pyswmm / Stormwater-Management-Model

PySWMM Stormwater Management Model repository
Other
99 stars 77 forks source link

Address system routing and runoff stats bug (#354) #388

Closed karosc closed 1 year ago

karosc commented 1 year ago

These edits fix #354 and were cherry picked from @jennwuu's fork.

Changes to massbal_getFlowError

Essentially this adds a param (isFinalStorage) to massbal_getFlowError to flag whether or not we want end of simulation storage or not. This param gets passed down to massbal_getStorage, which already we parameterized with isFinalStorage.

If isFinalStorage=True, the stored volume in each node is added to the NodeOutflow array that is used compute the flow error for each node in the stats report. If isFinalStorage=False, the stored volume in each node is accumulated and returned only. If massbal_getFlowError called multiple times with isFinalStorage=True, the flow error reported in the rpt file would be incorrect.

This PR allows users to call massbal_getFlowError multiple times during a simulation by setting isFinalStorage=False.

Changes to massbal_getRoutingTotal

Changes to massbal_getRunoffError