Water Quality Analysis Functions¶
These functions are used to perform a water quality analysis.
Function | Description |
---|---|
solveQ |
Runs a complete water quality simulation with results at uniform reporting intervals written to the project's binary output file. |
openQ |
Opens a project's water quality solver. |
initQ |
Initializes a network prior to running a water quality analysis. |
runQ |
Makes hydraulic and water quality results at the start of the current time period available to a project's water quality solver. |
nextQ |
Advances a water quality simulation over the time until the next hydraulic event. |
stepQ |
Advances a water quality simulation by a single water quality time step. |
closeQ |
Closes the water quality solver, freeing all of its allocated memory. |
solveQ¶
Runs a complete water quality simulation with results at uniform reporting intervals written to the project's binary output file.
solveQ(): void;
A hydraulic analysis must have been run and saved to a hydraulics file before calling solveQ
. This function will not allow one to examine intermediate water quality results as they are generated. It can be followed by a call to report
to write all hydraulic and water quality results to a formatted report file.
One can instead use the openQ
- initQ
- runQ
- nextQ
- closeQ
sequence to gain access to water quality results at intermediate time periods.
openQ¶
Opens a project's water quality solver.
openQ(): void;
Call openQ
prior to running the first water quality analysis using an initQ
- runQ
- nextQ
(or stepQ
) sequence. Multiple water quality analyses can be made before calling closeQ
to close the water quality solver.
Do not call this function if a complete water quality analysis will be made using solveQ
.
initQ¶
Initializes a network prior to running a water quality analysis.
initQ(initFlag: InitHydOption.Save | InitHydOption.NoSave): void;
Parameters
Parameter | Type | Description |
---|---|---|
initFlag | InitHydOption.Save InitHydOption.NoSave |
set to InitHydOption.Save if results are to be saved to the project's binary output file, or to InitHydOption.NoSave if not. (see InitHydOption ) |
Call initQ
prior to running a water quality analysis using runQ
in conjunction with either nextQ
or stepQ
.
openQ
must have been called prior to calling initQ
.
Do not call initQ
if a complete water quality analysis will be made using solveQ
.
runQ¶
Makes hydraulic and water quality results at the start of the current time period available to a project's water quality solver.
runQ(): number;
Returns
Number
current simulation time in seconds.
Use runQ
along with nextQ
in a loop to access water quality results at the start of each hydraulic period in an extended period simulation. Or use it in a loop with stepQ
to access results at the start of each water quality time step.
initQ
must have been called prior to running an runQ
- nextQ
(or stepQ
) loop.
The current time of the simulation is determined from information saved with the hydraulic analysis that preceded the water quality analysis.
nextQ¶
Advances a water quality simulation over the time until the next hydraulic event.
nextQ(): number;
Returns
Number
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 runQ
to perform an extended period water quality analysis. It reacts and routes a project's water quality constituent over a time step determined by when the next hydraulic event occurs. Use stepQ
instead if you wish to generate results over each water quality time step.
The return is determined from information produced by the hydraulic analysis that preceded the water quality analysis.
stepQ¶
Advances a water quality simulation by a single water quality time step.
stepQ(): number;
Returns
Number
time left (in seconds) to the overall simulation duration.
This function is used in a loop with runQ
to perform an extended period water quality simulation. It allows one to generate water quality results at each water quality time step of the simulation, rather than over each hydraulic event period as with nextQ
.
Use the returned value to determine when no more calls to runQ
are needed because the end of the simulation period has been reached (i.e., when timeLeft = 0).
closeQ¶
Closes the water quality solver, freeing all of its allocated memory.
closeQ(): void;
Call closeQ
after all water quality analyses have been made using the initQ
- runQ
- nextQ
(or stepQ
) sequence of function calls.
Do not call this function if solveQ
is being used.