Hope to repeat hydraulic simultion many times.
lookforhan opened this issue · 1 comments
lookforhan commented
Is your feature request related to a problem? Please describe.
I need to use Monte Carlo Method with epanet. I would like to use epanet open an inp file and run hydraulic simulation. And repeat these processes many times.
When I open an inp file, I always need to load and unload the epanet2.dll which are really time-consuming.
Maybe we can make the processes of load and unload the epanet2.dll independent with opening inp file.
Describe the solution you'd like
Maybe we can
t = epanet() % load epanet2.dll
for i = 1:10
t.open(inpfile{i}) % open an inp file
t.writeReport()
t,closeNetwork
end
t.unload %unload epanet2.dll
Mariosmsk commented
You can use this example for the same network
clear; close('all'); clc;
start_toolkit;
d=epanet('Net1.inp');
for i = 1:3
d.loadEPANETFile(d.TempInpFile)
% Set new values for parameters
d.setNodeElevations(rand(1, d.getNodeCount)*100)
% create reports
d.solveCompleteHydraulics;
d.solveCompleteQuality;
d.setReportFormatReset;
d.setReport(['FILE report', num2str(i), '.txt']);
d.setReport('NODES ALL');
d.setReport('LINKS ALL');
d.writeReport;
end
d.unload;
and this example for different networks:
clear; close('all'); clc;
start_toolkit;
for i = 1:3
d = epanet(['Net',num2str(i),'.inp'], 'loadfile');
% Set new values for parameters
d.setNodeElevations(rand(1, d.getNodeCount)*100)
% create reports
d.solveCompleteHydraulics;
d.solveCompleteQuality;
d.setReportFormatReset;
d.setReport(['FILE report', num2str(i), '.txt']);
d.setReport('NODES ALL');
d.setReport('LINKS ALL');
d.writeReport;
end