///<summary>Finds length of next time step & updates tank levels and rule-based contol actions.</summary> protected virtual long NextHyd() { long hydstep = 0; if (_simulationOutput != null) { AwareStep.Write(_simulationOutput, this, Htime); } if (Htime < net.Duration) { hydstep = TimeStep(); } if (net.Duration == 0) { SimulationPump.StepEnergy(net, _epat, _pumps, Htime, 0); } else if (Htime < net.Duration) { SimulationPump.StepEnergy(net, _epat, _pumps, Htime, hydstep); } if (Htime < net.Duration) { Htime += hydstep; if (Htime >= Rtime) { Rtime += net.RStep; } } return(hydstep); }
public long SimulateSingleStep() { if (!_running) { _running = true; } if (!RunHyd()) { _running = false; return(0); } long hydstep = 0; if (Htime < net.Duration) { hydstep = TimeStep(); } if (net.Duration == 0) { SimulationPump.StepEnergy(net, _epat, _pumps, Htime, 0); } else if (Htime < net.Duration) { SimulationPump.StepEnergy(net, _epat, _pumps, Htime, hydstep); } if (Htime < net.Duration) { Htime += hydstep; if (Htime >= Rtime) { Rtime += net.RStep; } } long tstep = hydstep; if (!_running && tstep > 0) { _running = false; return(0); } if (_running && tstep > 0) { return(tstep); } else { _running = false; return(0); } }