ENnextH: determine the next hydraulic step

View source: R/hydraulics.r

ENnextHR Documentation

determine the next hydraulic step

Description

ENnextH determines the length of time until the next hydraulic event occurs in an extended period simulation.

Usage

ENnextH()

Details

This function is used in conjunction with ENrunH to perform an extended period hydraulic analysis (see example below).

The return value is automatically computed as the smaller of:

  • the time interval until the next hydraulic time step begins

  • the time interval until the next reporting time step begins

  • the time interval until the next change in demands occurs

  • the time interval until a tank becomes full or empty

  • the time interval until a control or rule fires

Value

An integer, the time (in seconds) until next hydraulic event occurs or 0 if at the end of the simulation period.

See Also

ENopenH, ENinitH, ENrunH, ENcloseH, ENsettimeparam

Examples

# path to Net1.inp example file included with this package
inp <- file.path( find.package("epanet2toolkit"), "extdata","Net1.inp")  
ENopen( inp, "Net1.rpt")
  # store simulation times
  t = NULL
  ENopenH()
  ENinitH(11)
  repeat {
    t <- c(t, ENrunH())
    tstep <- ENnextH()
    if (tstep == 0) {
      break
    }
  }
  ENcloseH()
  ENclose()
# clean-up the created files
file.remove("Net1.rpt") 
  

epanet2toolkit documentation built on Nov. 6, 2023, 9:06 a.m.