Creating MSX file with EMT

Hi all,

Can a MSX file be created with EPANET-MATLAB Toolkit?

Is there any way I can generate multiple MSX files?



Hi @ken,

Try this example

But first, replace your epanet.m with


Is EPANET_MSX to be installed for using EX15_write_msx_file.m?
or need not to be installed EPANET_MSX and can we only work with EMT?


Does the EMT- support the program EPANET 2.2 ?

Hi @amin_msb , you can use

1 Like

Hi @Mariosmsk
Thank you very much for your response and support.
I’ll try it.

Hi dear @Mariosmsk
I intend to perform multi-species analysis (MSX) of arsenic oxidation in the Net1.inp example network using DDA and PDA methods. The code written in MATLAB cannot solve the MSX equations for the Net1.inp model with the default GPM (US Customary Units) of EPANET 2.2 software, and eventually reports “Error 514 - could not solve reaction equilibrium expressions”.
On the other hand, when the units are changed to SI Metric Units in the MATLAB environment, the program runs but provides incorrect answers.
Could you help me what should I do?

Hi @amin_msb, I have tested now with some examples, and looks good. Could you provide more information about the issue? Some example of code? You can send it by email if you want. (


Hi @Mariosmsk
thank you for your attention, I’ll send you my code to your email.

Hi @amin_msb,

Please try to call the function d.loadEPANETFile(d.TempInpFile) (line 90 of your code)

%% Multi-Species Analysis with EPANET-MSX (Step 2):
> d.loadEPANETFile(d.TempInpFile)

1 Like

Hi dear @Mariosmsk
OK, many thanks for your time and consideration. I’ll try it.

Hi @Mariosmsk
I want to randomly change the degradation coefficients of a species such as chlorine in the msx file and actually perform the uncertainty analysis on this parameter. Executing the “d.setMSXConstantsValue (2)” command for the second parameter of the problem, kb, does not change its values and results.

1 Like

I’m having the same issue.
I noticed that after changing the value using d.MSXConstantsValue(1) = X, if I save the MSX file (d.saveMSXFile) I still get the original value, even though in the Matlab variable viewer the value is equal to the updated value