Reporting Functions¶
These functions are used to report simulation results.
Function | Description |
---|---|
writeLine |
Writes a line of text to a project's report file. |
report |
Writes simulation results in a tabular format to a project's report file. |
copyReport |
Copies the current contents of a project's report file to another file. |
clearReport |
Clears the contents of a project's report file. |
resetReport |
Resets a project's report options to their default values. |
setReport |
Processes a reporting format command. |
setStatusReport |
Sets the level of hydraulic status reporting. |
getStatistic |
Retrieves a particular simulation statistic. |
getResultIndex |
Retrieves the order in which a node or link appears in anĀ output file. |
writeLine¶
Writes a line of text to a project's report file.
writeLine(line: string): void;
Parameters
Parameter | Type | Description |
---|---|---|
line | String |
a text string to write. |
report¶
Writes simulation results in a tabular format to a project's report file.
report(): void;
Either a full hydraulic analysis or full hydraulic and water quality analysis must have been run, with results saved to file, before report
is called. In the former case, saveH
must also be called first to transfer results from the project's intermediate hydraulics file to its output file.
The format of the report is controlled by commands issued with setreport
.
copyReport¶
Copies the current contents of a project's report file to another file.
copyReport(filename: string): void;
Parameters
Parameter | Type | Description |
---|---|---|
filename | String |
the full path name of the destination file. |
This function allows toolkit clients to retrieve the contents of a project's report file while the project is still open.
clearReport¶
Clears the contents of a project's report file.
clearReport(): void;
resetReport¶
Resets a project's report options to their default values.
resetReport(): void;
After calling this function the default reporting options are in effect. These are:
- no status report
- no energy report
- no nodes reported on
- no links reported on
- node variables reported to 2 decimal places
- link variables reported to 2 decimal places (3 for friction factor)
- node variables reported are elevation, head, pressure, and quality
- link variables reported are flow, velocity, and head loss.
setReport¶
Processes a reporting format command.
setReport(format: string): void;
Parameters
Parameter | Type | Description |
---|---|---|
format | String |
a report formatting command. |
Acceptable report formatting commands are described in the [REPORT] section of the Input File topic.
Formatted results of a simulation can be written to a project's report file using the report
function.
setStatusReport¶
Sets the level of hydraulic status reporting.
setStatusReport(level: StatusReport): void;
Parameters
Parameter | Type | Description |
---|---|---|
level | StatusReport |
a status reporting level code (see StatusReport ). |
Status reporting writes changes in the hydraulics status of network elements to a project's report file as a hydraulic simulation unfolds. There are three levels of reporting: StatusReport.NoReport
(no status reporting), StatusReport.NormalReport
(normal reporting) StatusReport.FullReport
(full status reporting).
The full status report contains information at each trial of the solution to the system hydraulic equations at each time step of a simulation. It is useful mainly for debugging purposes.
If many hydraulic analyses will be run in the application it is recommended that status reporting be turned off (level = StatusReport.NoReport
).
getStatistic¶
Retrieves a particular simulation statistic.
getStatistic(type: AnalysisStatistic): number;
Parameters
Parameter | Type | Description |
---|---|---|
type | AnalysisStatistic |
the type of statistic to retrieve (see AnalysisStatistic ). |
Returns
Number
the value of the statistic.
getResultIndex¶
Retrieves the order in which a node or link appears in an output file.
getResultIndex(type: ObjectType.Node | ObjectType.Link, index: number): number;
Parameters
Parameter | Type | Description |
---|---|---|
type | ObjectType.Node ObjectType.Link |
a type of element (either ObjectType.Node or ObjectType.Link ). |
index | Number |
the element's current index (starting from 1). |
Returns
Number
the order in which the element's results were written to file.
If the element does not appear in the file then its result index is 0.
This function can be used to correctly retrieve results from an EPANET binary output file after the order of nodes or links in a network's database has been changed due to editing operations.