Nodal Demand Functions
These functions are used for managing nodal demands.
| Function | Versions | Description |
|---|---|---|
addDemand | 2.2+ | Appends a new demand to a junction node demands list. |
deleteDemand | 2.2+ | Deletes a demand from a junction node. |
getBaseDemand | 2.2+ | Gets the base demand for one of a node’s demand categories. |
getDemandIndex | 2.2+ | Retrieves the index of a node’s named demand category. |
getDemandModel | 2.2+ | Retrieves the type of demand model in use and its parameters. |
getDemandName | 2.2+ | Retrieves the name of a node’s demand category. |
getDemandPattern | 2.2+ | Retrieves the index of a time pattern assigned to one of a node’s demand categories. |
getNumberOfDemands | 2.2+ | Retrieves the number of demand categories for a junction node. |
setBaseDemand | 2.2+ | Sets the base demand for one of a node’s demand categories. |
setDemandModel | 2.2+ | Sets the type of demand model to use and its parameters. |
setDemandName | 2.2+ | Assigns a name to a node’s demand category. |
setDemandPattern | 2.2+ | Sets the index of a time pattern used for one of a node’s demand categories. |
addDemand 2.2+
Section titled “addDemand ”Appends a new demand to a junction node demands list.
addDemand(nodeIndex: number, baseDemand: number, demandPattern: string, demandName: string): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| nodeIndex | number | the index of a node (starting from 1). |
| baseDemand | number | the demand’s base value. |
| demandPattern | string | the name of a time pattern used by the demand |
| demandName | string | the name of the demand’s category |
A NULL or blank string can be used for demandPattern and for demandName to indicate that no time pattern or category name is associated with the demand.
deleteDemand 2.2+
Section titled “deleteDemand ”Deletes a demand from a junction node.
deleteDemand(nodeIndex: number, demandIndex: number): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| nodeIndex | number | the index of a node (starting from 1). |
| demandIndex | number | the position of the demand in the node’s demands list (starting from 1). |
getBaseDemand 2.2+
Section titled “getBaseDemand ”Gets the base demand for one of a node’s demand categories.
getBaseDemand(nodeIndex: number, demandIndex: number): number;Parameters
| Parameter | Type | Description |
|---|---|---|
| nodeIndex | number | a node’s index (starting from 1). |
| demandIndex | number | the index of a demand category for the node (starting from 1). |
Returns
Number
the category’s base demand.
getDemandIndex 2.2+
Section titled “getDemandIndex ”Retrieves the index of a node’s named demand category.
getDemandIndex(nodeIndex: number, demandName: string): number;Parameters
| Parameter | Type | Description |
|---|---|---|
| nodeIndex | number | the index of a node (starting from 1) |
| demandName | string | the name of a demand category for the node |
Returns
Number
the index of the demand being sought
getDemandModel 2.2+
Section titled “getDemandModel ”Retrieves the type of demand model in use and its parameters.
getDemandModel(): { type: DemandModel; pmin: number; preq: number; pexp: number;};Returns
Object
{ type: DemandModel; pmin: number; preq: number; pexp: number;}| Property | Type | Description |
|---|---|---|
| type | DemandModel | Type of demand model (see DemandModel). |
| pmin | number | Pressure below which there is no demand. |
| preq | number | Pressure required to deliver full demand. |
| pexp | number | Pressure exponent in demand function. |
Parameters pmin, preq, and pexp are only used when the demand model is DemandModel.PDA.
getDemandName 2.2+
Section titled “getDemandName ”Retrieves the name of a node’s demand category.
getDemandName(nodeIndex: number, demandIndex: number): string;Parameters
| Parameter | Type | Description |
|---|---|---|
| nodeIndex | number | a node’s index (starting from 1). |
| demandIndex | number | the index of one of the node’s demand categories (starting from 1). |
Returns
String
The name of the selected category.
getDemandPattern 2.2+
Section titled “getDemandPattern ”Retrieves the index of a time pattern assigned to one of a node’s demand categories.
getDemandPattern(nodeIndex: number, demandIndex: number): number;Parameters
| Parameter | Type | Description |
|---|---|---|
| nodeIndex | number | the node’s index (starting from 1). |
| demandIndex | number | the index of a demand category for the node (starting from 1). |
Returns
Number
the index of the category’s time pattern.
A returned pattern index of 0 indicates that no time pattern has been assigned to the demand category.
getNumberOfDemands 2.2+
Section titled “getNumberOfDemands ”Retrieves the number of demand categories for a junction node.
getNumberOfDemands(nodeIndex: number): number;Parameters
| Parameter | Type | Description |
|---|---|---|
| nodeIndex | number | the index of a node (starting from 1). |
Returns
Number
the number of demand categories assigned to the node.
setBaseDemand 2.2+
Section titled “setBaseDemand ”Sets the base demand for one of a node’s demand categories.
setBaseDemand(nodeIndex: number, demandIndex: number, baseDemand: number): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| nodeIndex | number | a node’s index (starting from 1). |
| demandIndex | number | the index of a demand category for the node (starting from 1). |
| baseDemand | number | the new base demand for the category. |
setDemandModel 2.2+
Section titled “setDemandModel ”Sets the type of demand model to use and its parameters.
setDemandModel(type: DemandModel, pmin: number, preq: number, pexp: number): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| type | DemandModel | Type of demand model (see DemandModel). |
| pmin | number | Pressure below which there is no demand. |
| preq | number | Pressure required to deliver full demand. |
| pexp | number | Pressure exponent in demand function. |
Set type to EN_DDA for a traditional demand driven analysis (in which case the remaining three parameter values are ignored) or to EN_PDA for a pressure driven analysis. In the latter case a node’s demand is computed as:
Dfull * [ (P - pmin) / (preq - pmin) ] ^ pexp
where Dfull is the full demand and P is the current pressure.
Setting preq equal to pmin will result in a solution with the smallest amount of demand reductions needed to insure that no node delivers positive demand at a pressure below pmin.
setDemandName 2.2+
Section titled “setDemandName ”Assigns a name to a node’s demand category.
setDemandName(nodeIndex: number, demandIdx: number, demandName: string): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| nodeIndex | number | a node’s index (starting from 1). |
| demandIdx | number | the index of one of the node’s demand categories (starting from 1). |
| demandName | string | the new name assigned to the category. |
setDemandPattern 2.2+
Section titled “setDemandPattern ”Sets the index of a time pattern used for one of a node’s demand categories.
setDemandPattern(nodeIndex: number, demandIndex: number, patIndex: number): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| nodeIndex | number | a node’s index (starting from 1). |
| demandIndex | number | the index of one of the node’s demand categories (starting from 1). |
| patIndex | number | the index of the time pattern assigned to the category. |
Specifying a pattern index of 0 indicates that no time pattern is assigned to the demand category.