Save STATUS pipe step by step in .inp file by EPANET Matlab toolkit (EMT)


Hello all,
I run the below code. I want to save the result of new status pipe at a new .inp file.
I use the ‘saveBinInpFile’ and ‘saveInputFile’ function but didn’t work.


tstep=1; F=[];

Status = [0 0 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 1]’;

while (tstep>0)
d.setLinkStatus(index ,Status(i)); i=i+1;
F=[F; d.getLinkFlows];

Flows = F(:,index);
T = table(Flows,Status);

Alireza Moghaddam


Hi AliReza jan ,

Epanet inp dont save result status, you can get status and set EN_INITSTATUS ,

you Cannot set status for a check valve in setlinkvalue ;

for example in Net3.inp you must set this for pipe 330 :

ENsetlinkvalue(116, EN_INITSTATUS, 0); // to closed it
ENsetlinkvalue(116, EN_INITSTATUS, 1); // to open it
and then save it :slight_smile:

/*  */


Thanks for your reply,
But if I use EN_INITSTATUS, it change the initial status of a pipe (such as Open or Closed) for a full of extended period simulation (such as 24 hours).

I want to change the status of pipe step by step, for example the status pipe 330 Closed at time 8:00 and Open at time 22:00, while the initial status of this pipe is set on Open.

I should use Simple Controls at EPANET by EMT.


you can use Role and Control for it ,


Thanks Dear @milad-ghiami,
I want to apply the Controls in my .inp by EMT.