Verify the results of EPANET-MSX by EMT


#1

Hi everybody,

I have written the following MATLAB code for running the example.msx in the EPANET-MSX manual 2011 (page 21). This example describes AS Oxidation/ Adsorption.I get report for node D and C, but results are different with presented ones in the manual (page 25) for example in node C.

My code is below: Is it wrong?


%% Load EPANET Network and MSX
G = epanet(‘example.inp’); % Load EPANET Input file
G.loadMSXFile(‘example.msx’); % Load MSX file

sensor_id = {‘C’, ‘D’};
sensor_index = G.getNodeIndex(sensor_id);
node_id = G.getNodeNameID;

%% Run

Q = G.getMSXComputedQualityNode(sensor_index); % Solve hydraulics and MSX quality dynamics

% The result of node C

j=1;
for i=1:length (Q.Time)
if mod(Q.Time(i),7200)==0
time(j)=Q.Time(i)/3600; quality(1,j)=time(j);
AS3(j)=Q.Quality{1,1}(i,1); quality(2,j)=AS3(j);
AS5 (j)=Q.Quality{1,1}(i,2); quality(3,j)=AS5 (j);
Astot(j)=Q.Quality{1,1}(i,3); quality(4,j)= Astot(j);
AS5s(j)=Q.Quality{1,1}(i,4); quality(5,j)=AS5s(j);
NH2CL(j)=Q.Quality{1,1}(i,5); quality(6,j)=NH2CL(j);
j=j+1;
end
end
quality=quality’;


My result, manual result and the example.msx is attached. The difference of results is highlighted.

The link of EPANET-MSX user manual is at below:
https://cfpub.epa.gov/si/si_public_record_report.cfm?Lab=NHSRC&direntryid=218488

Thanks for any advice.


#2

Hi @alireza2032,

I have made some changes in your code.

clear; clc;
start_toolkit;

% Load EPANET Network and MSX
G = epanet('example.inp'); % Load EPANET Input file
G.loadMSXFile('example.msx'); % Load MSX file

sensor_id = {'C'};
sensor_index = G.getNodeIndex(sensor_id);
node_id = G.getNodeNameID;

%% Run
Q = G.getMSXComputedQualityNode(sensor_index); % Solve hydraulics and MSX quality dynamics

% The result of node C
clear quality
j = 1;
for i=1:length(Q.Time)
    if mod(Q.Time(i), 7200)==0
        
        quality(j, 1) = Q.Time(i)/3600;
        
        for s=1:G.getMSXSpeciesCount
            quality(j, s+1) = Q.Quality{1}(i, s); 
        end
        j = j + 1;
        
    end
end

quality

Please try again. It’s ok with me.

Regards,
Marios


#3

Dear @Mariosmsk,

Many thanks as always. That’s correct.


#4

Dear @Mariosmsk,

I prepare an MSX file for Net1.inp. The MSX file is modified based on example.msx in the manual. I want to inject 5 mg/L NH2Cl and 40 mg/L AS3+ at the nodes 9 and 11, respectively with the pattern ID CL2PAT and AS3PAT.

Once I run my MATLAB program I get the below error:
Error 514 - could not solve reaction equilibrium expressions.

What is your advice to solve my problem? I know the problem is related to Tank but I don’t know how to fix it. I attached Net1.inp and Net1.msx.
Net1.inp (7.7 KB)
https://www.dropbox.com/s/39gxlx5kmu00aou/Net1.msx?dl=0

Thanks,
Alireza


#5

@alireza2032, I have tested your files with the code above and it’s working for me.


#6

@Mariosmsk, I get the below message when run the
Q = G.getMSXComputedQualityNode(sensor_index)

Error 514 - could not solve reaction equilibrium expressions.