Can you trust these results?


#1

Hi,

I used the following code to check 6 different statuses for each node.

close all; clear;  rng(1)

%% Load EPANET Network 
G = epanet('BWSN_Network_1.inp'); % Load EPANET Input file

G.setQualityType('chem','mg/L');
G.setTimeReportingStep(300);	
% Sensor locations

sensor_id = G.getNodeNameID 
sensor_index = G.getNodeIndex(sensor_id);

%% Simulation Setup

t_d = 2; % days
G.setTimeSimulationDuration(t_d*24*60*60); % Set simulation duration of 2 days

%% Get Network data
demand_pattern = G.getPattern;
roughness_coeff = G.getLinkRoughnessCoeff;
node_id = G.getNodeNameID;

%% Scenarios
Ns = G.NodeCount; % Number of scenarios to simulate
u_p = 0.20; % pattern uncertainty
u_r = 0.20; % roughness coefficient uncertainty
max_inj_conc=2;
inj_duration =[2,8,6,3,4,3]; % maximum duration 

inj_starts_time =[0,5,8,13,18,20]; % (DT=1h)

magnitude=[1,1.2,1.15,1.25,1.5,1.75];%different magnitudes for different starting time
row=1;

for node=1:double(G.NodeCount)
    for startTime=1:length(inj_starts_time)
      
       %Injection location, magnitude, start time, duration 
       inj_sc(row,:)=[node , magnitude(startTime) , inj_starts_time(startTime) , inj_duration(startTime)]; 
         row=row+1;
    end
end

%% Run epochs
% Randomize hydraulics
row=row-1;
%zeroNodes=zeros(1,G.getNodeCount);
zeroNodes=zeros(1,row);
for i = 1:row
    tic
    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;
    PAT_INDEX = G.addPattern('new_PAT', 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
    disp(['Iteration ', int2str(i)])

    tmp_values = zeroNodes;
    % Randomize injection
    G.setNodeSourceType(inj_sc(i,1),'SETPOINT')
    tmp_values(inj_sc(i,1)) = 479167 
    G.setNodeSourceQuality(tmp_values)
    tmp_values_pat_ind = zeroNodes;
    tmp_values_pat_ind(inj_sc(i,1)) = PAT_INDEX;
    G.setNodeSourcePatternIndex(tmp_values_pat_ind)

    Q{i} = G.getComputedQualityTimeSeries('quality', sensor_index).NodeQuality; % Solve hydraulics and quality dynamics
   %figure;
    %plot(Q{i})
end
toc
Q

But in the results, all 6 values are the same!
Why do we get the same results in each of the six (iteration)?

image

Are these results correct? Is this possible?

My Network
BWSN_Network_1.inp (43.4 KB)

Am I wrong?

Thanks