Skip to content

Nodal Demand Functions

These functions are used for managing nodal demands.

FunctionDescription
addDemandappends a new demand to a junction node demands list.
deleteDemanddeletes a demand from a junction node.
getBaseDemandGets the base demand for one of a node’s demand categories.
getDemandIndexRetrieves the index of a node’s named demand category.
getDemandModelRetrieves the type of demand model in use and its parameters.
getDemandNameRetrieves the name of a node’s demand category.
getDemandPatternRetrieves the index of a time pattern assigned to one of a node’s demand categories.
getNumberOfDemandsRetrieves the number of demand categories for a junction node.
setBaseDemandSets the base demand for one of a node’s demand categories.
setDemandModelSets the type of demand model to use and its parameters.
setDemandNameAssigns a name to a node’s demand category.
setDemandPatternSets the index of a time pattern used for one of a node’s demand categories.

appends a new demand to a junction node demands list.

addDemand(nodeIndex: number, baseDemand: number, demandPattern: string, demandName: string): void;

Parameters

ParameterTypeDescription
nodeIndexnumberthe index of a node (starting from 1).
baseDemandnumberthe demand’s base value.
demandPatternstringthe name of a time pattern used by the demand
demandNamestringthe 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.


Deletes a demand from a junction node.

deleteDemand(nodeIndex: number, demandIndex: number): void;

Parameters

ParameterTypeDescription
nodeIndex the index of a node (starting from 1).
demandIndex the position of the demand in the node’s demands list (starting from 1).

Gets the base demand for one of a node’s demand categories.

getBaseDemand(nodeIndex: number, demandIndex: number): number;

Parameters

ParameterTypeDescription
nodeIndexnumbera node’s index (starting from 1).
demandIndexnumberthe index of a demand category for the node (starting from 1).

Returns

Number the category’s base demand.


Retrieves the index of a node’s named demand category.

getDemandIndex(nodeIndex: number, demandName: string): number;

Parameters

ParameterTypeDescription
nodeIndexnumberthe index of a node (starting from 1)
demandNamestringthe name of a demand category for the node

Returns

Number the index of the demand being sought


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;
}
PropertyTypeDescription
typeDemandModelType of demand model (see DemandModel).
pminnumberPressure below which there is no demand.
preqnumberPressure required to deliver full demand.
pexpnumberPressure exponent in demand function.

Parameters pmin, preq, and pexp are only used when the demand model is DemandModel.PDA.


Retrieves the name of a node’s demand category.

getDemandName(nodeIndex: number, demandIndex: number): string;

Parameters

ParameterTypeDescription
nodeIndexnumbera node’s index (starting from 1).
demandIndexnumberthe index of one of the node’s demand categories (starting from 1).

Returns

String The name of the selected category.


Retrieves the index of a time pattern assigned to one of a node’s demand categories.

getDemandPattern(nodeIndex: number, demandIndex: number): number;

Parameters

ParameterTypeDescription
nodeIndexnumberthe node’s index (starting from 1).
demandIndexnumberthe 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.


Retrieves the number of demand categories for a junction node.

getNumberOfDemands(nodeIndex: number): number;

Parameters

ParameterTypeDescription
nodeIndexnumberthe index of a node (starting from 1).

Returns

Number the number of demand categories assigned to the node.


Sets the base demand for one of a node’s demand categories.

setBaseDemand(nodeIndex: number, demandIndex: number, baseDemand: number): void;

Parameters

ParameterTypeDescription
nodeIndexnumbera node’s index (starting from 1).
demandIndexnumberthe index of a demand category for the node (starting from 1).
baseDemandnumberthe new base demand for the category.

Sets the type of demand model to use and its parameters.

setDemandModel(type: DemandModel, pmin: number, preq: number, pexp: number): void;

Parameters

ParameterTypeDescription
typeDemandModelType of demand model (see DemandModel).
pminnumberPressure below which there is no demand.
preqnumberPressure required to deliver full demand.
pexpnumberPressure 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.


Assigns a name to a node’s demand category.

setDemandName(nodeIndex: number, demandIdx: number, demandName: string): void;

Parameters

ParameterTypeDescription
nodeIndexnumbera node’s index (starting from 1).
demandIdxnumberthe index of one of the node’s demand categories (starting from 1).
demandNamestringthe new name assigned to the category.

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

ParameterTypeDescription
nodeIndexnumbera node’s index (starting from 1).
demandIndexnumberthe index of one of the node’s demand categories (starting from 1).
patIndexnumberthe 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.