Tuesday, October 25, 2022

Combining Ruby with ICM SWMM Network


ICM InfoWorks by Autodesk Innovyze is a complicated program with many parts and a state-of-the-art 1D and 2D engine. One way to deal with the complexity is to automate complicated or repetitive tasks with SQL and Ruby. In this blog, we will use SQL and Ruby to automate the process of assigning Watershed outlet nodes for ICM SWMM Networks.

What are we hoping to achieve by Combining Ruby with ICM SWMM Networks?

  1. We want to find the outlet ID for the closest node to a Subcatchment in an ICM SWMM Network.
  2. Ruby will use the Geometry tools of ICM to find the closest node.
  3. What is an ICM SWMM Network? It is a Network in ICM that uses SWMM 5.1.015 data and most/many of the tools of the ICM GUI. ICM of course also has InfoWorks Networks.
  4. What am I showing in the Post header image? Autodesk has Subscription versions of ICM (Standard and Ultimate), but I am showing the Thales versions of ICM which are both 32bit and 64bit, and comingled ICM InfoWorks and ICM SWMM Networks. I also use InfoWater Pro (Arc GIS Pro) and InfoSWMM which uses Arc Map and has a direct import into an ICM SWMM Network.

ICM SWMM Network Data in the Autodesk Innvovyze ICM GUI
ICM SWMM Network Subcatchment Data

Why use Ruby for InfoWorks ICM SWMM Networks?

Why Ruby - it is part of ICM and easy to understand with a lot of Modeling features. It is part of Network Menu Commands. You can use a new Script or a past used script so it is easy to find.
No alt text provided for this image

What is an InfoWorks ICM SWMM Network?

ICM SWMM uses the SWMM 5.1.015 engine and has most of the UX features of ICM InfoWorks Networks including 2D. A different 1D network and solution of course.

What is an example of Ruby Scripts?

net=WSApplication.current_network
puts 'Running ruby for SWMM Networks'
nodes=Array.new
net.row_object_collection('sw_node').each do |n|
        if n.selected?
                temp=Array.new
                temp << n.id
                temp << n.x
                temp << n.y
                nodes << temp
        end
end
net.transaction_begin
net.row_object_collection('sw_subcatchment').each do |s|
        if s.selected?
                sx = s.x
                sy = s.y
                nearest_distance = 999999999.9
                (0...nodes.size).each do |i|
                        nx = nodes[i][1]
                        ny = nodes[i][2]
                        n_id = nodes[i][0]
                        distance=((sx-nx)*(sx-nx))+((sy-ny)*(sy-ny))
                        if distance < nearest_distance
                                nearest_distance=distance
                                s.outlet_id = n_id
                        end
                end
        else
        puts 'You forgot to select anything'
        end
        s.write
end
puts 'Ending ruby'
net.transaction_commit

Where can I find the Ruby Scripts?

Innovyze has a Github that you can use to copy or download dozens of Ruby and SQL scripts. If registered on our Portal, you can find Salesforce Knowledge Base articles and many other sources of help. at https://github.com/innovyze/Open-Source-Support. SQL and Ruby functionality exist to be used by users with knowledge of programming languages. We provide resources to assist customers in building their scripts through the existing self-help frameworks, including documentation on Ruby, help files, and more recently a wealth of GitHub examples - link above.

How do I use Ruby Scripts?

Easy - Go to the Network Menu and choose Run Ruby Scripts or Recent Ruby Scripts
No alt text provided for this image

Do I need to use SQL?

It helps if you have a simple global grid command and you do not want to edit the grid. Here is a simple SQL that sets the SWMM Network OUTLET_ID to blank. You can save the SQL on the project explorer window and click to activate the dialog.

No alt text provided for this image

What does each line of the Ruby Script represent and what does it perform for the ICM SWMM Network?

The annotated snippet below shows the steps used in the script. ICM SWMM Networks are sw_ whereas ICM InfoWorks Networks are hw_ (for reference)

net=WSApplication.current_network

# Opens the current network on the ICM Geoplan

puts 'Running ruby for SWMM Networks'

# Tell the user some actions are being done by the script

nodes=Array.new

# Makes a new array - uses swmm nodes or sw_node

net.row_object_collection('sw_node').each do |n|
        if n.selected?
                temp=Array.new
                temp << n.id
                temp << n.x
                temp << n.y
                nodes << temp
        end
end
# Save the id, x coordinate, y coordinate to the nodes array of SELECTED Elements

net.transaction_begin

# start finding the nodes to set to the outlet of the subcatchment

net.row_object_collection('sw_subcatchment').each do |s|

# use swmm subcatchments or sw_subcatchment

        if s.selected?

# use the SELECTED Elements

                sx = s.x
                sy = s.y

# use the centroid of the subcatchment

                nearest_distance = 999999999.9
                (0...nodes.size).each do |i|
                        nx = nodes[i][1]
                        ny = nodes[i][2]
                        n_id = nodes[i][0]

# for each node find the x and y coordinates

                        distance=((sx-nx)*(sx-nx))+((sy-ny)*(sy-ny))

# compute the node to subcatchment distance
 
                       if distance < nearest_distance
                                nearest_distance=distance
                                s.outlet_id = n_id

# We have found the closed node and set the outlet ID to the node ID
                        end
                end
        else
        puts 'You forgot to select anything'

# message to remind ourself we forget to select any nodes or subcatchments

        end
        s.write
end
puts 'Ending ruby'
# Tell the user some actions were by the script

net.transaction_commit

# commit our new found ID to the current network (ICM SWMM Network)

I'm attaching a YouTube video that explains the previous stages. It is for ICM SWMM Networks, which utilizes SQL to remove or set the SWMM Subcatchment's OUTLET ID to Null and Ruby to determine the closest node to the Subcatchment's centroid and assign it as the OUTLET ID. I made a mistake and ran Ruby without using ICM to pick any items, which resulted in nothing being done, but at least I received a notice about not choosing any components.





InfoSewer Run Manager and Video showing the Accuracy Parameter

 Innovyze InfoSewer Run Manager

  • Flow Unit - Units of flow measurement (cfs, gpm, mgd, imgd, afd, L/s, L/m, MLd, m3/h, and m3/d).

  • Default Diurnal Pattern - Determines which diurnal pattern will be applied to an EPS simulation when a unique pattern has not been assigned to an individual manhole(s).

  • Global Loading Multiplier - Used to assign a multiplier in which global loadings are to be multiplied.  For example, a MAXDAY EPS model scenario may have a global loading multiplier of 2.5.

  • Accuracy -  Convergence criterion used to signal that a solution has been found to the nonlinear equations that govern network hydraulics.  Trials end when the relative change in pipe flow rates between two successive iterations is less than this number.  The suggested value is 0.001.

  • Diurnal Pattern Usage - Select whether the pattern will linearly interpolate intermediate values (continuous) or evaluate patterns in a stepwise fashion. Click here to learn more about pattern representation options.

  • Default Manhole Sealing Method - Use this to specify the default Manhole cover type for Normal Manholes. Choose Locked to contain flow inside the manhole structure when the water level rises above the rim elevation and choose Unlocked if flow is not contained inside the structure and spills over when the water level rises above the rim elevation. The maximum head possible in the second case is thus the manhole rim elevation

  • Maximum number of segments - The maximum number of segments specifies the maximum number of segments a pipe can be divided into during a flow routing and quality analyses. The default value is 100 segments per pipe. The maximum number of segments affects the speed and accuracy of the hydraulic analysis. The smaller the value the faster the computational speed.

  • Minimum Travel Distance - Minimum Travel Distance is the smallest length that a pipe segment could assume. Pipes shorter than this value will have only one segment. The default value is 100 ft.

  • Minimum Travel Time - Minimum Travel Time establishes the smallest time of travel through a pipe recognized by InfoSewer Travel times smaller than this number are set equal to it (travel times through pumps are instantaneous and are not affected by this limit). The default minimum travel time is 1 second.InfoSewer determines the travel time based on pipe and flow properties, and uses this computed time step for hydraulic calculations during an EPS. The user can assign a desired minimum travel time, and this value is used when calculated travel times are less than the minimum travel time. The maximum allowable value for the minimum travel time is equal to the smaller value of report time step and pattern time step. The minimum travel time affects the speed and accuracy of the water quality analysis (i.e. time of concentration and source tracing). The larger this value is the faster the computational speed.

  • Pumped Flow Conservation - Check this option to set the gravity main flow downstream of a pump equal to  the pump flow thereby forcing it to be an unpeakable load.  If this option is not checked then the gravity main flow downstream of a pump is set equal to the flow entering the wet well. This option can be used only  for steady-state analysis and design.

  • Flow Attenuation - Check this option to include flow/hydrograph attenuation in the EPS simulation. If this option is not checked then flow attenuation will not be considered in the analysis. Flow attenuation in a sewer collection system is the process of reducing the peak flow rate by redistributing the same volume of flow over a longer period of time as a result of friction (resistance), internal storage and diffusion along the sewer pipes.InfoSewer uses a distributed Muskingum-Cunge flow routing method based on diffusion analogy, which is capable of accurately predicting hydrograph attenuation or peak flow damping effects (peak subsidence). This option can only be used for extended period simulation.

  • Unit Hydrograph Adjustment Threshold(%) - The option provides the flexibility whether to adjust ordinates of synthetic unit hydrograph such as Tri-triangular, NRCS Dimensionless, NRCS Triangular and CUHP. Theoretically, volume under a UH has to be drainage area * an inch of rainfall. That may not happen while synthesizing UHs. In case the difference in volume under the synthesized UH and the theoretical volume exceeds the threshold assigned by the user, the model will adjust the UH volume to "match" the theoretical volume.

  • Advanced Forcemain Network Support - The checkbox for Advanced Forcemain Network Support allows the simulation of two or more upstream force mains to one or more downstream force main(s) through a junction chamber.  The link flows and node depths are solved iteratively to maintain the mass balance and the energy balance of the incoming and outgoing flows.  The new network solver is used to calculate the flows in the forcemain pipes and the heads at the junction chambers associated with the force main(s). See Advanced Force Main Network Solution for additional information.

  • If the checkbox flag  is turned on (checked) then the new Advanced Forcemain Network Support will be used during the simulation.

  • If the checkbox flag is turned off (unchecked) then the default force main solution will be used. You will get an error message if there is more than one force main connected to the same junction chamber.

In the example shown below, the upstream force mains are links 947 and FM51, the merging junction chamber is node 52 and the downstream force main is link 53.  As you can see in the graph from the Output Report Manager the flow in link 53 is the sum of the flows in links 947 and FM51.  This example will only work with the new Advanced Forcemain Network Support feature




Sunday, November 1, 2020

HOW TO USE GIS GATEWAY IN INFOSWMM TO CREATE BOTH DATA AND MODEL RESULTS SHAPEFILES

 

GIS Gateway – Create Shapefile

The Create Shapefile tool available from the GIS Gateway, allows you to create a new ESRI® Shapefile directly from InfoSWMM data. Any data associated with each data type can be used to populate the new Shapefile attribute table. The tool can be applied to a Domain or to the Active Network as needed.

The dialog box looks like this:

A description of the features:

Feature/ButtonDescription
Data TypeChoose the modeling data type that the new Shapefile will be based on
Fields to ExportDepending on which Data Type was chosen, a list of available information fields will be shown. Use click, ctrl-click or shift-click to select all fields you wish to include in the new Shapefile’s Attribute Table.
Apply on DomainIf this option is chosen, only features contained in the current Domain (if one is defined) will be exported to the new Shapefile.
Apply on Active NetworkIf this option is chosen, only features in the Active Network will be exported.
ShapefileThis box contains the filepath and filename of the new Shapefile
Use the Browse button to choose a filepath and filename for the new Shapefile
CreateWhen all parameters are selected, click this button to export the Shapefile
CloseClose the dialog box without exporting the Shapefile

Wednesday, September 23, 2020

InfoSWMM Version Numbers and the version of Arc Map they use and which EPA SWMM5 Engine is used for Each InfoSWMM Version

 InfoSWMM Version Numbers 

InfoSWMM Version 14.7  Update 2 for Arc Map 10 to 10.7 and Windows 7/8/8.1/10 - EPA SWMM 5.1.013  11/16/2019  

InfoSWMM Version 14.7  Update 1 for Arc Map 10 to 10.7 and Windows 7/8/8.1/10 - EPA SWMM 5.1.013  04/12/2019    

InfoSWMM Version 14.7  for Arc Map 10 to 10.6 and Windows 7/8/8.1/10 - EPA SWMM 5.1.013  12/30/2018   

InfoSWMM Version 14.6 Update 2 for Arc Map 10.6 and Windows 7/8/8.1/10 - EPA SWMM 5.1.012  8/30/2018   

InfoSWMM Version 14.6 Update 1 for Arc Map 10.6 and Windows 7/8/8.1/10 - EPA SWMM 5.1.012  6/30/2018   

InfoSWMM Version 14.6 for Arc Map 10.6 and Windows 7/8/8.1/10 - EPA SWMM 5.1.012  11/30/2017 

InfoSWMM Version 14.5 Update 10 for Arc Map 10.5 and Windows 7/8/8.1/10 - EPA SWMM 5.1.012  10/7/2017

InfoSWMM Version 14.5 Update 9 for Arc Map 10.5 and Windows 7/8/8.1/10 - EPA SWMM 5.1.012  5/15/2017

InfoSWMM Version 14.5 Update 8 for Arc Map 10.5 and Windows 7/8/8.1/10 - EPA SWMM 5.1.012  4/17/2017

InfoSWMM Version 14.5 Update 7 for Arc Map 10.5 and Windows 7/8/8.1/10 - EPA SWMM 5.1.011  3/29/2017 SH

InfoSWMM Version 14.5 Update 6 for Arc Map 10.5 and Windows 7/8/8.1/10 - EPA SWMM 5.1.011  3/9/2017 SH

InfoSWMM Version 14.5 Update 5 for Arc Map 10.5 and Windows 7/8/8.1/10 - EPA SWMM 5.1.011  12/27/2016 SH

InfoSWMM Version 14.5 Update 4 for Arc Map 10.4 and Windows 7/8/8.1/10  - EPA SWMM 5.1.010  10/07/2016  MC1  SH

InfoSWMM Version 14.5 Update 3 for Arc Map 10.4 and Windows 7/8/8.1/10  - EPA SWMM 5.1.010  9/14/2016 MC1 SH

InfoSWMM Version 14.5 Update 2 for Arc Map 10.4 and Windows 7/8/8.1/10 - EPA SWMM 5.1.010  08/12/2016 MC1

InfoSWMM Version 14.5 Update 1 for Arc Map 10.4 and Windows 7/8/8.1/10  - EPA SWMM 5.1.010  08/05/2016 MC1

InfoSWMM Version 14.5  for Arc Map 10.4 and Windows 7/8/8.1/10   - EPA SWMM 5.1.010  06/07/2016 MC1

InfoSWMM Version 14 SP1 Update 8/9 for Arc Map 10.4  and Windows 7/8/8.1/10 - EPA SWMM 5.1.010  04/25/2016 MC1

InfoSWMM Version 14 SP1 Update 7 for Arc Map 10.4  and Windows 7/8/8.1/10 - EPA SWMM 5.1.010  03/25/2016 MC1

InfoSWMM Version 14 SP1 Update 6 for Arc Map 10.3 and Windows 7/8/8.1/10  - EPA SWMM 5.1.010   03/18/2016 MC1

InfoSWMM Version 14 SP1 for Arc Map 10.3  and Windows 7/8/8.1/10 - EPA SWMM 5.1.010   11/25/2015 MC1

InfoSWMM Version 14 Update 1 for Arc Map 10.3 and Windows 7/8/8.1/10  - EPA SWMM 5.1.009    9/25/2015 MC1

InfoSWMM Version 14 for Arc Map 10.3 and Windows 7/8/8.1/10 - EPA SWMM 5.1.009    8/11/2015

InfoSWMM Version 13 SP1 for Arc Map 10.3  - EPA SWMM 5.1.007     1/10/2015

InfoSWMM Version 13 Update 5 for Arc Map 10.2 - EPA SWMM 5.1.007     10/9/2014

InfoSWMM Version 13 for Arc GIS 10.2- EPA SWMM 5.1.006     09/22/2014

InfoSWMM Version 12 SP1  Update 5 - EPA SWMM 5.0.022     06/12/2014

InfoSWMM Version 12 SP1 for Arc GIS 10.1  - EPA SWMM 5.0.022     10/25/2013

InfoSWMM Version 12    - EPA SWMM 5.0.022      04/21/2011

InfoSWMM Version 11    - EPA SWMM 5.0.022      04/21/2011

InfoSWMM Version 10    - EPA SWMM 5.0.022      10/13/2010

InfoSWMM Version 9.0 for Arc GIS 10.0  - EPA SWMM 5.0.019      08/20/2010

InfoSWMM Version 8.5    - EPA SWMM 5.0.018     11/19/2009

InfoSWMM Version 8 .0 for Arc GIS 9.3-  EPA SWMM 5.0.016      10/19/2009

InfoSWMM Version 7 .0 -  EPA SWMM 5.0.013      03/10/2008

InfoSWMM Version 6 .0 -  EPA SWMM 5.0.010    05/04/2007

InfoSWMM Version 5 .0 -  EPA SWMM 5.0.006      10/10/2005

 InfoSWMM Version 4 .0 -  EPA SWMM 5.0.005      08/17/2005

 InfoSWMM Version 3 .0 -  EPA SWMM 5.0.004      11/30/2004

 InfoSWMM Version 2 .0 -  EPA SWMM 5.0.004      11/30/2004

 InfoSWMM Version 1 .0 -  EPA SWMM 5.0.001      10/26/2004

Thursday, August 13, 2020

Low Impact Development Control Editor in InfoSWMM based on SWMM5

Low Impact Development Control Editor

The LID Control Editor is used to define a low impact development control that can be deployed throughout a study area to store, infiltrate, and evaporate Subcatchment runoff. The design of the control is made on a per-unit-area basis so that it can be placed in any number of Subcatchments at different sizes or number of replicates.

 

The editor contains the following data entry fields:

Control Name

A name used to identify the particular LID control.

LID Type

The generic type of LID being defined (bio-retention cell, porous pavement, infiltration trench, rain barrel, or vegetative swale).

Process Layers

These are a tabbed set of pages containing data entry fields for the vertical layers and underdrain that comprise an LID control. They include some combination of the following, depending on the type of LID selected:

<![if !supportLists]>·        <![endif]>Surface Layer

<![if !supportLists]>·        <![endif]>Pavement Layer

<![if !supportLists]>·        <![endif]>Soil Layer

<![if !supportLists]>·        <![endif]>Storage Layer

<![if !supportLists]>·        <![endif]>UnderDrain System

<![if !supportLists]>·        <![endif]>Pollutant Removals

 

 

 

Privileged and Confidential Communication: This electronic mail communication and any documents included hereto may contain confidential and privileged material for the sole use of the intended recipient(s) named above. If you are not the intended recipient (or authorized to receive for the recipient) of this message, any review, use, distribution or disclosure by you or others is strictly prohibited. Please contact the sender by reply email and delete and/or destroy the accompanying message.

Saturday, July 4, 2020

Hidden features of the 1D St Venant solution for SWMM5, InfoSWMM, and ICM SWMM Networks


🌍 Deep Dive into InfoSWMM SA & Its Nuances 🌊

1/ 🚀 ArcEngine InfoSWMM SA: This variant of InfoSWMM, known as InfoSWMM SA, reveals some fascinating, often overlooked features of the 1D St Venant solution. This extends to software like SWMM5, InfoSWMM, and ICM SWMM Networks. Dive into SA's capabilities with these intriguing output graphs and reports! 🖼️ [Image]

2/ 💾 Software Compatibility: ArcEngine InfoSWMM SA 3.0 is built on ESRI's 10.7 version, while InfoSWMM is more adaptable, running on ArcMap versions ranging from 10.3 to 10.8. 🖼️ [Image]

3/ 🌐 ArcGIS ESRI Software Family: For those curious about how ArcMap fits into the broader ArcGIS ESRI suite, here's a tidbit: ArcMap specializes in 2D spatial data visualization and editing. For a deeper dive, check out ArcGIS Wikipedia. 🖼️ [Image]

4/ 💡 Flow Insights in SWMM5: The SWMM5 engine calculates the flow at the link's midpoint, relying on upstream and downstream hydraulic data. Outputs in this context span Flow, Depth, Capacity, and the Froude Number. 🖼️ [Image]

5/ 📊 Capacity Analysis: In SWMM5, while the flow is gauged at the link's midpoint, associated data like depth and capacity follow suit. Here, "Capacity" is derived from the middle cross-sectional area divided by the full flow area. 🖼️ [Image]

6/ 📈 Velocity in SWMM5: The velocity, a derived output in SWMM5, is calculated using the link's midpoint flow and the depth-related cross-sectional area. 🖼️ [Image]

7/ 🚦 Capacity vs. Surcharge d/D: While SWMM5 displays the capacity (area/full area), InfoSWMM further offers insights into the Surcharged d/D – essentially the average of upstream & downstream depths. A point to note: Capacity ranges between 0 and 1, but Surcharge d/D might exceed 1. 🖼️ [Image]

8/ 🌪 Flow Volume & Froude Number: Both are computed outputs in SWMM5. Notably, the Froude Number works in tandem with the Keep, Dampen, and Ignore parameters, influencing the non-linear term's inclusion/exclusion in the St Venant Equation solution. 🖼️ [Image]

9/ 🌊 Velocity Outputs in SWMM5: Besides the central flow output, SWMM5 provides computed outputs for upstream and downstream velocity, derived from the link's flow and the respective cross-sectional areas. 🖼️ [Image]

10/ 📜 Area in 1D St Venant Solution: This solution leverages upstream and downstream cross-sectional areas, extracted from the respective depths. These play a pivotal role in the solution's non-linear term. 🖼️ [Image]

11/ 📐 Upstream & Downstream Depths in SWMM5: These depths, pivotal in SWMM5, are based on node area rules and the corresponding node depths. Depth essentially is the node depth, but can differ if there are offsets, normal depth, or critical depth. 🖼️ [Image]

Stay curious, and keep exploring these water systems' intricacies! 💧🔍📘🎉

Challenges of modeling stormwater transients in developing countries by Daniel Allasia et al

Challenges of modeling stormwater transients in developing countries by Daniel Allasia, Robson Pachaly, Rutineia Tassi, Jose Goes Vasconcelos, Ben R. Hodges, and Robert E. Dickinson iahr.org/index/detail/1

GitHub code and Markdown (MD) files Leveraging

 To better achieve your goal of leveraging your GitHub code and Markdown (MD) files for your WordPress blog or LinkedIn articles, consider t...