-
Notifications
You must be signed in to change notification settings - Fork 0
/
system.py
111 lines (98 loc) · 3.27 KB
/
system.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2014 Bryant E. McDonnell
#
# Licensed under the terms of the BSD2 License
# See LICENSE.txt for details
# -----------------------------------------------------------------------------
"""System module for the pythonic interface to SWMM5."""
# Local imports
from pyswmm.swmm5 import PYSWMMException
class SystemStats(object):
"""
System-Wide Flow and Runoff Routing Accumulation Volume Methods.
:param object model: Open Model Instance
Examples:
>>> from pyswmm import Simulation, SystemFlowRouting
>>>
>>> with Simulation('tests/data/TestModel1_weirSetting.inp') as sim:
... system_routing = SystemStats(sim)
...
... for step in simulation:
... print system_routing.routing_stats
... print system_routing.runoff_stats
"""
def __init__(self, model):
if not model._model.fileLoaded:
raise PYSWMMException("SWMM Model Not Open")
self._model = model._model
# --- Get Parameters
# -------------------------------------------------------------------------
@property
def routing_stats(self):
"""
Get rolling/cumulative routing stats. Follow Data are returned:
+--------------------+
| dry_weather_inflow |
+--------------------+
| wet_weather_inflow |
+--------------------+
| groundwater_inflow |
+--------------------+
| II_inflow |
+--------------------+
| external_inflow |
+--------------------+
| flooding |
+--------------------+
| outflow |
+--------------------+
| evaporation_loss |
+--------------------+
| seepage_loss |
+--------------------+
| reacted |
+--------------------+
| initial_storage |
+--------------------+
| final_storage |
+--------------------+
| routing_error |
+--------------------+
:return: Statistics
:rtype: dict
"""
return self._model.flow_routing_stats()
@property
def runoff_stats(self):
"""
Get rolling/cumulative runoff stats. Follow Data are returned:
+------------------+
| rainfall |
+------------------+
| evaporation |
+------------------+
| infiltration |
+------------------+
| runoff |
+------------------+
| drains |
+------------------+
| runon |
+------------------+
| init_storage |
+------------------+
| final_storage |
+------------------+
| init_snow_cover |
+------------------+
| final_snow_cover |
+------------------+
| snow_removed |
+------------------+
| routing_error |
+------------------+
:return: Statistics
:rtype: dict
"""
return self._model.runoff_routing_stats()