Hydraulic Analysis Functions¶
These functions are used to perform a hydraulic analysis.
| Function | Description |
|---|---|
solveH |
Runs a complete hydraulic simulation with results for all time periods written to a temporary hydraulics file. |
useHydFile |
Uses a previously saved binary hydraulics file to supply a project's hydraulics. |
openH |
Opens a project's hydraulic solver. |
initH |
Initializes a network prior to running a hydraulic analysis. |
runH |
Computes a hydraulic solution for the current point in time. |
nextH |
Determines the length of time until the next hydraulic event occurs in an extended period simulation. |
saveH |
Transfers a project's hydraulics results from its temporary hydraulics file to its binary output file, where results are only reported at uniform reporting intervals. |
saveHydFile |
Saves a project's temporary hydraulics file to disk. |
closeH |
Closes the hydraulic solver freeing all of its allocated memory. |
solveH¶
Runs a complete hydraulic simulation with results for all time periods written to a temporary hydraulics file.
solveH(): void
Use solveH to generate a complete hydraulic solution which can stand alone or be used as input to a water quality analysis. This function will not allow one to examine intermediate hydraulic results as they are generated. It can also be followed by calls to saveH and report to write hydraulic results to the report file.
The sequence openH - initH - runH - nextH - closeH can be used instead to gain access to results at intermediate time periods and directly adjust link status and control settings as a simulation proceeds.
useHydFile¶
Uses a previously saved binary hydraulics file to supply a project's hydraulics.
useHydFile(filename: string): void
Parameters
| Parameter | Type | Description |
|---|---|---|
| filename | String |
the name of the binary file containing hydraulic results. |
Call this function to re-use a set of hydraulic analysis results saved previously. This can save computational time if water quality analyses are being made under the same set of hydraulic conditions.
Do not call this function while the hydraulics solver is open.
openH¶
Opens a project's hydraulic solver.
openH(): void
Call openH prior to running the first hydraulic analysis using the initH - runH - nextH sequence. Multiple analyses can be made before calling closeH to close the hydraulic solver.
Do not call this function if solveH is being used to run a complete hydraulic analysis or if hydraulics are being supplied by a previously saved hydraulics file using useHydFile.
initH¶
Initializes a network prior to running a hydraulic analysis.
initH(initFlag: InitHydOption): void
Parameters
| Parameter | Type | Description |
|---|---|---|
| initFlag | InitHydOption |
a 2-digit initialization flag (see InitHydOption). |
This function initializes storage tank levels, link status and settings, and the simulation time clock prior to running a hydraulic analysis.
The initialization flag is a two digit number where the 1st (left) digit indicates if link flows should be re-initialized (1) or not (0), and the 2nd digit indicates if hydraulic results should be saved to a temporary binary hydraulics file (1) or not (0).
Be sure to call initH prior to running a hydraulic analysis using a runH - nextH loop.
Choose to save hydraulics results if you will be:
- making a subsequent water quality run,
- using
reportto generate a report - using
saveHydFileto save the binary hydraulics file.
There is no need to save hydraulics if you will be writing custom code to process hydraulic results as they are generated using the functions getNodeValue and getLinkValue.
runH¶
Computes a hydraulic solution for the current point in time.
runH(): Number
Returns
Number
The current simulation time in seconds.
This function is used in a loop with nextH to run an extended period hydraulic simulation.
initH must have been called prior to running the runH - nextH loop.
nextH¶
Determines the length of time until the next hydraulic event occurs in an extended period simulation.
nextH(): Number
Returns
Number
The time (in seconds) until the next hydraulic event or 0 if at the end of the full simulation duration.
This function is used in a loop with runH to run an extended period hydraulic simulation.
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.
saveH¶
Transfers a project's hydraulics results from its temporary hydraulics file to its binary output file, where results are only reported at uniform reporting intervals.
saveH(): void
saveH is used when only a hydraulic analysis is run and results at uniform reporting intervals need to be transferred to a project's binary output file. Such would be the case when results are to be written in formatted fashion to the project's report file using report.
saveHydFile¶
Saves a project's temporary hydraulics file to disk.
saveHydFile( filename: String): void
Parameters
| Parameter | Type | Description |
|---|---|---|
| filename | String |
the name of the file to be created. |
Use this function to save the current set of hydraulics results to a file, either for post-processing or to be used at a later time by calling the useHydFile function.
The hydraulics file contains nodal demands and heads and link flows, status, and settings for all hydraulic time steps, even intermediate ones.
Before calling this function hydraulic results must have been generated and saved by having called solveH or the initH - runH - nextH sequence with the initflag argument of initH set to InitHydOption.Save or InitHydOption.SaveAndInit.
closeH¶
Closes the hydraulic solver freeing all of its allocated memory.
closeH(): void
Call closeH after all hydraulics analyses have been made using initH - runH - nextH. Do not call this function if solveH is being used.