Why my EPANET model always retrieve the same simulated pressure no matter what demand multiplier I put in the model

Hello,
I am using genetic algorithm to calibrate demand multiplier.
Here, there are 20 individuals in the population.
When I put each individuals representing a vector of residential and commercial multiplier in the model and run the EPANET model, why it always retrieved the same model-simulated pressure no matter which individual was put in the model?

Thank you very much.

Hi,
I suggest using the get function for the demand multiplier to be sure your population is set in the model.
Good Luck.
Alireza

Hello,
Thank you for your reply.
Did you mean use the function of ‘getpatternvalue’ to see if each indvidual is set in the model?
ZIyuan Cai

Yes. Check it after set.

Hello,
I am a little bit confused about the function that I should use. My goal is to calibrate demand multipliers( residential and commercial customers). If I want to put the vector of demand multipliers in the model, which functions (setpatternvalue, or setdemandpattern) should I use. Thank you very much.

Hello,
Can I ask one more question? After checking, I found that the population was successfully set in the mode. And assuming that there are 50 timesteps. At first 30 timesteps, different vectors of demand multipliers correspond to different pressure values. However, starting from 31st timestep, the same model-simulated pressure no matter which individual was put in the model. Are there any other porblem leading to this problem?
Thank you very much!

Hi
You can use addPattern or setPatternValue functions. For addPattern function you can use this example:

Hello ,
I think is related to difference of time duration of hydraulic model or pattern time step.
If you can sent your model I’ll consider it.
Regards.

First, I got the path of the input file of network.

  1. import epanet.toolkit as en
  2. epanet_proj = en.createproject()
  3. en.open(ph=epanet_proj, inpFile=“D:/L-Town/Battledim-project/L-Town_50.inp”, rptFile=“D:/L-Town/Battledim-project/L-Town_50.rpt”,outFile="")

There are two patterns (resdential and commercial)
The indices of resdential and commercial patterns are 1 and 2 respectively.

Then I create a population with 20 indivdiuals. Each indivdiual is like a vector of residential and commercial multipliers.
I used the code ‘ENgetpatternlen’ to retrieve the number of time periods in those two pattern.
The number of time period is 50.

I started to put each individual in the model

  1. for timestep in range(0,50):
  2.    num_of_individual = 20
    
  3.           for i in range(num_of_individual ):
    
  4.                  for l in range(len(2)):
    
  5.                       if l == 0:
    
  6.                            multiplier_r = en.setpatternvalue(epanet_proj,l+1,timestep+1,population[i][l])
    
  7.                       if l == 1:
    
  8.                           multiplier_c = en.setpatternvalue(epanet_proj,l+1,timestep+1,population[i][l])
    

There are 50 timesteps totally. At first 30 timesteps, each indivdiual could lead to different corresponding pressures, but starting from 31st timestep, it always retrieved the same model-simulated pressure no matter which individual was put in the model.

Please have a look.
Thank you very much.

I suggest use below function:

for t=1:length(pattern_demand_new)

d.setPatternValue(PatternIndex(1),t,pattern_demand_new(t));               

end

which pattern_demand_new is the vector of new value for demand pattern same to population vector in your code.
PatternIndex(1) is also the first index of your pattern such as residential pattern.

Hello,
Thanks for you reply.
What I did was smiliar with what you wanne me do.
The problem is that I applied the function ‘setpatternvalue’ and ‘getpatternvalue’ to make sure each vector was put in the model. At the first 30 timesteps, different vector corresponded to different simulated pressures, but starting from 31st timestep, each vector resulted in the same simulated pressures. I am sure that each vector was successfully set in the model.
I did other experiment setting different sets of emitters to nodes. I found that different sets of emitters corresonded to different pressures at each timestep. So different vector theorically leads to different pressures even if at 31-50th timestep. But the reality is that starting at 31st timestep, no matter which vector was put in the model, they both led to the same pressures that is the same as the simualted pressures under the condition of model with the default value. But I am sure that each vector was successfully set in the model.

Hi
If you like, email your Matlab code to me. I’ll check it more exactly.

Hello,
I have emailed the code to you.
Could you please have a look when you are available?
Thank you very much1

Hello,
I am so sorry to bother you.
Could you please have a look at my code that I messaged to you?
I thought about the problem for many days, but unfortunately, no solutions were developed.