# Demand of each nodes in time 1

#1

Hi,
I want to have ِdemand of every node at time ‘1’,
I do not know exactly what command to use, but I used the following command and had an empty array.

d=epanet(‘2_BWSN_Network_1.inp’)
demand=d.getBinComputedNodeDemand;

What’s wrong ?

What command is more suitable , “getNodeDemandPatternIndex” Or “getBinComputedNodeDemand” ?

2_BWSN_Network_1.inp (44.0 KB)

Thanks

#2

Hi @linkhochon, check the following example code:
I have included three different options.

d = epanet(‘2_BWSN_Network_1.inp’);

% Retrieves the value of all node base demands
% initial
BaseDemands = d.getNodeBaseDemands;

%% Computed demands
% (1) Runs hydraulics Step-by-step
d.openHydraulicAnalysis;
d.initializeHydraulicAnalysis;
tstep=1; T=[]; D=[];
while (tstep>0)
t=d.runHydraulicAnalysis;
D=[D; d.getNodeActualDemand];
T=[T; t];
tstep=d.nextHydraulicAnalysisStep;
end
d.closeHydraulicAnalysis
D

% (2) Computed Hydraulic Time Series % row = time / col = nodes
Res = d.getComputedHydraulicTimeSeries; % Res.Demand(:, 1) % Res.Time

% (3) Computed Hydraulic # without events # row = time / col = nodes
Res2 = d.getComputedTimeSeries; % Res2.Demand(:, 1)

Regards,
Marios

#3

Can you tell me where “getBinComputedNodeDemand” command is used and how is it used?

Thanks

#4

The function `d.getBinComputedNodeDemand` it’s another option to compute node demands using the `epanet2d.exe` without load DLL library.

d = epanet(‘2_BWSN_Network_1.inp’, ‘bin’);
d.getBinComputedNodeDemand

#5

Hi,

When using the above commands , for some nodes the results are not correct.
For example, at the time of 1, real demand in node 17 is 30.9.
But in MATLAB, I have zero for all time.
How can I fix this problem?

Thanks

BWSN_Network_1.inp (43.4 KB)

#6

Please check the index of the node in Matlab. I think you confuse `index` with `ID`.

`index = d.getNodeIndex('JUNCTION-17')`

`Res.Demand(:,index )`

`plot(Res.Time/3600, Res.Demand(:,index ))`

#7

Hi @Mariosmsk , Thanks for your answer.you’re right,The indexes are not the same
But if we look at node 18 (infact 17), at the time of 1, the actual demand is not 30.4!
And we have a number of 40.1165.

#8

It’s ok with me.

Maybe you changed the time step and compare two different files or something similar?
Please make sure it is the same file.

Regards,

#9

Hi @Mariosmsk Thank you very much for the answer.
Is there a way to correct the indexes?
Because for another network I have, in matlab index 13 for node 83,and The same node has index 83 at epanet.
These differences are confusing. is there a command to change the index ?
Or is there any command to get demand by nameID of nodes?

Thankful