Trying to set prv setting

hi
I want to set prv setting in matlab but i cant and when i run ‘getLinkSettings’ it shows 0 that means my prvs sets to 0 and i cant change it.please help:confused:

Hi @peiman,

The function d.getLinkSettings you can be called with step-by-step hydraulic analysis. Also, you can use d.setLinkSettings(valveIndex/linkindex, 10) in step-by-step. Maybe you want the initial setting d.getLinkInitialSetting, d.getLinkInitialSetting(linkindex) and set d.setLinkInitialSetting(linkindex, 100) %index, value

e.g.

start_toolkit;

d = epanet(‘BWSN_Network_1.inp’);

valveIndex = d.getLinkValveIndex;
valveIndex = valveIndex(1);

% Run step by step hydraulic analysis
d.openHydraulicAnalysis;
d.initializeHydraulicAnalysis;
tstep=1;LinkSettings=[];T_H=[];P=[];
while (tstep>0)
t=d.runHydraulicAnalysis;
P=[P; d.getNodePressure];
LinkSettings=[LinkSettings; d.getLinkSettings];
d.setLinkSettings(valveIndex, randi(100))
T_H=[T_H; t];
tstep=d.nextHydraulicAnalysisStep;
end
d.closeHydraulicAnalysis;
d.unload;
LinkSettings
valveIndex

1 Like

Thank you for reply
Its work

@peiman
salam agha peiman lotfan y rahe ertebati begin soalati azaton dashtam kheyli mamnonam
09356072638 in shomarame
ahmad.ravanbakhsh64@gmail.com inam emailam
kheyli baram moheme lotfan hatman javab bedin mamnoon

Salam ahmad jan vala man khodam taze kar ba toolkit ro shuru kardam va taze dar hale yadgiri hastam vase payan namam vali ba in hal khoshhal misham age betoonam komak konam.

lotfan y shomare tamas bem bede mamnoon