Calculate each pollutant's concentration with Output module #395
-
I define 3 pollutants in SWMM inp file and execute it successfully. Then I want to extract the results of each pollutant's concentration of certain nodes with Pyswmm Output module. I check swmm.toolkit.shared_enum.py and find a relevant parameter named NodeAttribute.POLLUT_CONC_0, which is defined as concentration of each pollutant, but with the codes below only one sequence can be extracted, which looks alike the CODR result I get directly from SWMM using the same output file. So I wonder is it possilble to extract the results of all the pollutants I define with current version of Pyswmm? BTW my SWMM version is 5.1.14 and Pyswmm version is 1.4.0, if it helps.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
@Karakurko, I agree that this might be a bug. Let me have a look at the accessors and see if we overlooked something. That being said, if you want to extract info and it’s not a super long simulation, you can get the WQ data while pyswmm is running for all your polluts |
Beta Was this translation helpful? Give feedback.
-
@Karakurko, ok i have a very simple work around for you! You'll need to make a very simple modification to swmm.toolkit python code. Depending if you are using a VENV or just have pyswmm/swmm-toolkit globally navigate to:
Then add these following lines: class NodeAttribute(Enum, start = 0):
"""Node Attribute enum class.
.. rubric:: Enum Members
========================= ===============================
:attr:`~INVERT_DEPTH` water depth above invert
:attr:`~HYDRAULIC_HEAD` hydraulic head
:attr:`~PONDED_VOLUME` volume stored and ponded
:attr:`~LATERAL_INFLOW` lateral inflow rate
:attr:`~TOTAL_INFLOW` total inflow rate
:attr:`~FLOODING_LOSSES` overflow rate
:attr:`~POLLUT_CONC_0` concentration of each pollutant
========================= ===============================
"""
INVERT_DEPTH = 0
HYDRAULIC_HEAD = 1
PONDED_VOLUME = 2
LATERAL_INFLOW = 3
TOTAL_INFLOW = 4
FLOODING_LOSSES = 5
POLLUT_CONC_0 = 6
POLLUT_CONC_1 = 7
POLLUT_CONC_2 = 8 Finally, let's use those enums with Output('test.out') as out:
S1_pollution = list(out.node_series('J1', NodeAttribute.POLLUT_CONC_0).values())
S2_pollution = list(out.node_series('J1', NodeAttribute.POLLUT_CONC_1).values())
S3_pollution = list(out.node_series('J1', NodeAttribute.POLLUT_CONC_2).values())
time_stamps = out.times creates: |
Beta Was this translation helpful? Give feedback.
@Karakurko, ok i have a very simple work around for you!
You'll need to make a very simple modification to swmm.toolkit python code. Depending if you are using a VENV or just have pyswmm/swmm-toolkit globally navigate to:
... /site-packages/swmm/toolkit/shared_enum.py
Then add these following lines: