Is it possible to save the changes made by MATLAB on EPANET?


#1

Hi,
If a code runs 100 times ,And assume that each time the program is executed, the EPANET file changes (change in consumption patterns and roughness coefficients, etc.)
Can I save changed EPANET files? Can I save 100 different EPANET files?

for i = 1:100

% Randomize hydraulics
r_p = -u_p + 2*u_p.*rand(size(demand_pattern,1),size(demand_pattern,2));
new_demand_pattern = demand_pattern + demand_pattern.*r_p;
G.setPatternMatrix(new_demand_pattern); % Set new patterns
r_r = -u_r + 2*u_r.*rand(size(roughness_coeff,1),size(roughness_coeff,2));
new_roughness_coeff = roughness_coeff + roughness_coeff.*r_r;
G.setLinkRoughnessCoeff(new_roughness_coeff); % Set new roughness coefficients
% Randomize injection
G.setMSXSources(node_id(inj_sc(i,1)), 'AsIII', 'Setpoint', inj_sc(i,2), 'AS3PAT'); % Specify Arsenite injection source

Thanks


#2

@linkhochon, yes, you can use for example: G.saveInputFile(['Net1_Scenario_',num2str(i),'.inp'])


#3

Hi @Mariosmsk Many thanks :tada: