This code is a function called "runhyd" that solves the network hydraulics for a single time period in a project.
It takes in two parameters, a pointer to a "Project" struct (pr) and a pointer to a long int (t) which will hold the current time in seconds. The function returns an error code.
It first finds new demands and control actions by calling the "demands" and "controls" functions. Then it solves the network hydraulic equations by calling the "hydsolve" function and passing it the pointer to the "Project" struct, the iteration count, and the solution accuracy. If there is no error code, it then checks for system unbalance and activates the "Haltflag" if the error is too high. Finally, it reports any warning conditions by calling the "writehydwarn" function.
The function uses the following variables:
Variable | Purpose |
---|---|
hyd | pointer to the "Hydraul" struct in the "Project" struct |
time | pointer to the "Times" struct in the "Project" struct |
rpt | pointer to the "Report" struct in the "Project" struct |
iter | iteration count |
errcode | error code |
relerr | solution accuracy |
No comments:
Post a Comment