swmm5 module#
Python extensions for the SWMM5 Programmers toolkit.
- exception SWMMException(error_code, error_message)[source]#
Bases:
Exception
Custom exception class for SWMM errors.
- exception PYSWMMException(error_message)[source]#
Bases:
Exception
Custom exception class for PySWMM errors.
- class PySWMM(inpfile='', rptfile=None, binfile=None, swmm_lib_path=None)[source]#
Bases:
object
Wrapper class to lead SWMM DLL object.
This allow performing operations on the SWMM object that is created when the file is being loaded.
PySWMM can be run in two different modes:
Mode 1: Execute simulation without any intervention
Open the Input file using swmm_open()
Execute the simlation without intervening swmmExec()
then close calling swmm_close()
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmmExec() >>> swmm_model.swmm_close()
—or—
Mode 2: Step through the entire simulation manually by (This mode allows the user to invervene and stream simulation data as well as set parameters and use outside controls approaches)
swmm_open()
swmm_start()
swmm_step() or swmm_stride() until it returns 0
swmm_end()
swmm_report()
swmm_close()
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_step() # or swmm_stride() ... if (time <= 0.0): break >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
Initialize the PySWMM object class.
User can specified SWMM library path. Uses default lib if not provided.
- Parameters:
- swmmExec(inpfile=None, rptfile=None, binfile=None)[source]#
Open an input file, run SWMM, then close the file.
- Parameters:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmmExec() >>> swmm_model.swmm_close()
- swmm_open(inpfile=None, rptfile=None, binfile=None)[source]#
Opens SWMM input file & reads in network data.
- Parameters:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_close()
- swmm_start(SaveOut2rpt=False)[source]#
Prepares to Start SWMM Simulation.
- Parameters:
SaveOut2rpt (bool) – Save timeseries results to rpt file (default is False).
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_step() ... if (time <= 0.0): break >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- swmm_end()[source]#
Ends SWMM Simulation.
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_step() ... if (time <= 0.0): break >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- swmm_step()[source]#
Advances SWMM Simulation by a single routing step.
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_step() ... if (time <= 0.0): break >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- swmm_stride(advanceSeconds)[source]#
This function allows for user defined stride length to advance the model simulation by a defined time. This is useful when control rules are managed externally by PySWMM. Instead of evaluating rules every routing step, instead the simulation can be advanced further in time before the PySWMM can intervene. When a 0 is returned, the simulation period has reached the end.
- Parameters:
advanceSeconds (int) – Number seconds to advance the simulation forward.
- Returns:
Current simulation time after a stride in decimal days (float)
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_stride(600) ... if (time <= 0.0): break >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- swmm_report()[source]#
Copies Time Series results from .out to .rpt file.
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_step() ... if (time <= 0.0): break >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- swmm_close()[source]#
Closes model and supporting files and cleans up memory.
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_step() ... if (time <= 0.0): break >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- swmm_save_hotstart(hotstart_filename)[source]#
Save the current state of the model to a hotstart file.
This can be run at any point during the simultion.
- Parameters:
hotstart_filename (str) – Name of hotstart file to save to.
- swmm_use_hotstart(hotstart_filename)[source]#
Use a hotstart file to initialize the model.
This must be run before swmm_start() and after swmm_open().
- Parameters:
hotstart_filename (str) – Name of hotstart file to load from.
- swmm_getVersion()[source]#
Retrieves version number of current SWMM engine.
The format used is xyzzz where x = major version number, y = minor version number, and zzz = build number.
- Returns:
version number of the DLL source code
- Return type:
- swmm_getMassBalErr()[source]#
Get Mass Balance Errors.
- Returns:
Runoff Error, Flow Routing Error, Quality Error
- Return type:
- getSimulationDateTime(timeType)[source]#
Get Simulation Time Data (Based on SimulationTime options).
- Parameters:
timeType (int) – (toolkitapi.SimulationTime member variable)
- Returns:
datetime
- Return type:
datetime
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getSimulationDateTime(SimulationTime.StartDateTime) 2015-11-01 14:00:00 >>> swmm_model.getSimulationDateTime(SimulationTime.EndDateTime) 2015-11-04 00:00:00 >>> swmm_model.getSimulationDateTime(SimulationTime.ReportStart) 2015-11-01 14:00:00 >>> >>> swmm_model.swmm_close()
- setSimulationDateTime(timeType, newDateTime)[source]#
Set Simulation Time Data (Based on SimulationTime options).
- Parameters:
timeType (int) – (toolkitapi.SimulationTime member variable)
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.setSimulationDateTime(SimulationTime.StartDateTime, datetime(2009, 10, 1, 12,30)) >>>
- getSimUnit(unit_type)[source]#
Get Simulation Units.
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getSimUnit(SimulationUnits.FlowUnits) CFS >>> swmm_model.swmm_close()
- getSimOptionSetting(setting_type)[source]#
Get Simulation Option Settings.
- Parameters:
settingtype (int) – Analysis Option Setting
- Returns:
Simulation Analysis option setting
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getSimAnalysisSetting(SimAnalysisSettings.AllowPonding) False >>> swmm_model.swmm_close()
- getSimAnalysisSetting(param_type)[source]#
Get Simulation Configuration Parameter.
- Parameters:
paramtype (int) – Simulation Parameter Type
- Returns:
Simulation Analysis Parameter Value
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getSimAnalysisSetting(SimulationParameters.RouteStep) 300 >>> swmm_model.swmm_close()
- getProjectSize(object_type)[source]#
Get Project Size: Number of Objects.
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getProjectSize(ObjectType.NODE) 10 >>> swmm_model.swmm_close()
- getObjectId(objecttype, index)[source]#
Get Object ID name.
- Parameters:
objecttype (int) – (member variable)
index – ID Index
- Returns:
Object ID
- Return type:
string
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getObjectId(ObjectType.NODE,35) "example_id_name" >>> >>> swmm_model.swmm_close()
- getObjectIDList(objecttype)[source]#
Get Object ID list.
- Parameters:
objecttype (int) – (member variable)
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getObjectIDList(ObjectType.LINK) ['C1:C2', 'C2', 'C3'] >>> >>> swmm_model.swmm_close() >>>
- ObjectIDexist(objecttype, ID)[source]#
Check if Object ID Exists. Mostly used as an internal function.
- getNodeType(ID)[source]#
Get Node Type (e.g. Junction, Outfall, Storage, Divider).
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getNodeType('J1') 0 >>> >>> swmm_model.getNodeType('J1') is NodeType.junction True >>> >>> swmm_model.swmm_close()
- getLinkType(ID)[source]#
Get Link Type (e.g. Conduit, Pump, Orifice, Weir, Outlet).
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getLinkType('C1') 3 >>> >>> swmm_model.getLinkType('C1') is LinkType.weir True >>> >>> swmm_model.swmm_close()
- getLinkConnections(ID)[source]#
Get Link Connections (Upstream and Downstream Nodes).
Interestingly, if the dynamic wave solver is used, when the input file is parsed and added to the SWMM5 data model, any negatively sloped conduits are reversed automatically. The swmm_getLinkConnections function always calls the _swmm_getLinkDirection function to ensure the user-assigned upstream ID and downstream IDs are in the correct order. This way, the function provides support for directed graphs automatically.
- Parameters:
index (str) – ID
- Returns:
(Upstream Node Index, Downstream Node Index)
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getLinkConnections('C1') ('NodeUSID','NodeDSID') >>> >>> swmm_model.swmm_close()
- getNodeParam(ID, parameter)[source]#
Get Node Parameter.
- Parameters:
- Returns:
Parameter Value
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getNodeParam('J2',NodeParams.invertElev ) 13.392 >>> >>> swmm_model.swmm_close()
- setNodeParam(ID, parameter, value)[source]#
Set Node Parameter.
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getNodeParam('J2',NodeParams.invertElev, 19 ) >>> >>> swmm_model.swmm_close()
- getLinkParam(ID, parameter)[source]#
Get Link Parameter.
- Parameters:
- Returns:
Parameter Value
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getLinkParam('C1:C2',LinkParams.offset1 ) 0.0 >>> >>> swmm_model.swmm_close()
- setLinkParam(ID, parameter, value)[source]#
Set Link Parameter.
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.setLinkParam('C1:C2',LinkParams.offset1, 2 ) >>> >>> swmm_model.swmm_close()
- getLidCOverflow(ID)[source]#
Get Lid Control Parameter.
- Parameters:
ID (str) – Lid Control ID
- Return type:
Bool
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getLidCOverflow('J2') True >>> >>> swmm_model.swmm_close()
- getLidCParam(ID, layer, parameter)[source]#
Get LidControl Parameter.
- Parameters:
- Returns:
Parameter Value
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getLidCParam('J2', LidLayer.surface, LidLayersProperty.thickness) >>> >>> swmm_model.swmm_close()
- setLidCParam(ID, layer, parameter, value)[source]#
Set Lid Control Parameter Before/During Model Simulation.
- Parameters:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.setLidCParam('J2', LidLayer.surface, LidLayersProperty.thickness, 110) >>> >>> swmm_model.swmm_close()
- getLidUCount(ID)[source]#
Get Number of Lid Units Defined for Subcatchment.
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getLidUCount('J2') 2 >>> >>> swmm_model.swmm_close()
- getLidUParam(subcatchID, lid_index, parameter)[source]#
Get LidUnit Parameter
- Parameters:
- Returns:
paramater Value
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getLidUParam('S2', 0, LidUParams.unitarea) 1000 >>> >>> swmm_model.swmm_close()
- setLidUParam(subcatchID, lid_index, parameter, value)[source]#
Set LidUnit Parameter
- Parameters:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.setLidUParam('S2', 0, LidUParams.unitarea, 10) >>> >>> swmm_model.swmm_close()
- getLidUOption(subcatchID, lid_index, parameter)[source]#
Get LidUnit Option
- Parameters:
- Returns:
paramater Value
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getLidUOption('S2', 0, LidUParams.index) 1000 >>> >>> swmm_model.swmm_close()
- setLidUOption(subcatchID, lid_index, parameter, value)[source]#
Set LidUnit Option
- Parameters:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.setLidUOption('S2', 0, LidUParams.index, 0) >>> >>> swmm_model.swmm_close()
- getSubcatchParam(ID, parameter)[source]#
Get Subcatchment Parameter
- Parameters:
- Returns:
Parameter Value
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getLinkParam('S2',SubcParams.area ) 43561.596096880996 >>> >>> swmm_model.swmm_close()
- setSubcatchParam(ID, parameter, value)[source]#
Set Subcatchment Parameter.
- Parameters:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.setLinkParam('S2',SubcParams.area, 100 ) >>> >>> swmm_model.swmm_close()
- getSubcatchOutConnection(ID)[source]#
Get Subcatchment Outlet Connection.
This function return the type of loading surface and the ID. The two load to objects are nodes and other subcatchments.
Nodes are ObjectType.NODE Subcatchments are ObjectType.SUBCATCH
- Parameters:
- Returns:
(Loading Surface Type, ID)
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getSubcatchOutConnection('S2',SubcParams.area ) (2, 'J2') >>> >>> subout = swmm_model.getSubcatchOutConnection('S2',SubcParams.area ) >>> subout[0] == ObjectType.NODE True >>> >>> swmm_model.swmm_close()
- getGagePrecip(ID, parameter)[source]#
Get precipitation from gage
This function returns the rainfall, show and total precipitation associated with the gage
- Parameters:
- Returns:
value
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.getGagePrecip('Gage1', ) 0.0 >>> swmm_model.swmm_close()
- getCurrentSimulationTime()[source]#
Get Current Simulation DateTime in Python Format.
- Returns:
Python Datetime
- Return type:
datetime
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_step() ... print(swmm_model.getCurrentSimualationTime()) ... if (time <= 0.0): break 2015-11-03 10:10:12 2015-11-03 10:20:12 2015-11-03 10:30:12 2015-11-03 10:40:12 >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- getLidUFluxRates(subcatchID, lidIndex, layerIndex)[source]#
Get Lid Unit Layer Flux Rates Result.
- Parameters:
- Returns:
Parameter Value
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_step() ... print(swmm_model.getLidUFluxRates('J1', 0, LidLayers.surface)) ... if (time <= 0.0): break 1.2 1.5 1.9 1.2 >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- getLidUResult(subcatchID, lidIndex, resultType)[source]#
Get Lid Result.
- Parameters:
- Returns:
Parameter Value
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_step() ... print(swmm_model.getLidUResult('J1', 0, LidUResults.inflow)) ... if (time <= 0.0): break 1.2 1.5 1.9 1.2 >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- getLidGResult(subcatchID, resultType)[source]#
Get Lid Group Result.
- Parameters:
- Returns:
Parameter Value
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_step() ... print(swmm_model.getLidGResult('J1', LidUResults.flowToPerv)) ... if (time <= 0.0): break 1.2 1.5 1.9 1.2 >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- getNodeResult(ID, result_type)[source]#
Get Node Result.
- Parameters:
- Returns:
value
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_step() ... print(swmm_model.getNodeResult('J1', NodeResults.newDepth)) ... if (time <= 0.0): break 1.2 1.5 1.9 1.2 >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- getLinkResult(ID, result_type)[source]#
Get Link Result.
- Parameters:
- Returns:
parameter value
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_step() ... print(swmm_model.getLinkResult('J1', LinkResults.newFlow)) ... if (time <= 0.0): break 1.2 1.5 1.9 1.2 >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- getSubcatchResult(ID, result_type)[source]#
Get Subcatchment Result
- Parameters:
- Returns:
paramater Value
- Return type:
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> while(True): ... time = swmm_model.swmm_step() ... print(swmm_model.getSubcatchResult('S3', SubcResults.newRunoff)) ... if (time <= 0.0): break 0.01 0.05 0.09 0.08 >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- flow_routing_stats()[source]#
Get Flow Routing System stats.
- Returns:
Dictionary of Flow Routing Stats.
- Return type:
- runoff_routing_stats()[source]#
Get Runoff Routing System stats.
- Returns:
Dictionary of Runoff Routing Stats.
- Return type:
- setLinkSetting(ID, target_setting)[source]#
Set Link Setting (Pumps, Orifices, Weirs).
at the start of the next routing step.
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> i = 0 >>> while(True): ... time = swmm_model.swmm_step() ... i+=1 ... if i == 80: ... swmm_model.setLinkSetting('C3',0.5) ... if (time <= 0.0): break ... >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- setNodeInflow(ID, flow_rate)[source]#
Set Node Inflow rate.
The flow rate should be in the user defined units. The value is held constant in the model until it is redefined by the toolkit API.
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> i = 0 >>> while(True): ... if i == 80: ... swmm_model.setNodeInflow('J1',4) ... time = swmm_model.swmm_step() ... i+=1 ... if (time <= 0.0): break ... >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- setOutfallStage(ID, stage)[source]#
Set Outfall Stage (head).
The level should be in the user defined units. The value is held constant in the model until it is redefined by the toolkit API.
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.swmm_start(True) >>> i = 0 >>> while(True): ... if i == 80: ... swmm_model.setOutfallStage('J1',4) ... time = swmm_model.swmm_step() ... i+=1 ... if (time <= 0.0): break ... >>> >>> swmm_model.swmm_end() >>> swmm_model.swmm_report() >>> swmm_model.swmm_close()
- setGagePrecip(ID, value)[source]#
Set precipitation to gage
This function sets the rainfall intensity to the gage
Examples:
>>> swmm_model = PySWMM(r'\.inp',r'\.rpt',r'\.out') >>> swmm_model.swmm_open() >>> swmm_model.setGagePrecip('Gage1', 10.0) >>> swmm_model.swmm_close()