GisWater Tutorial EPASWIMM

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 27

EPA SWMM / Giswater Tutorial

1: Installation
// under SWMM Giswater Water

This is the 1st episode in my tutorial on using EPA Storm Water


Management Model (EPA SWMM) and Giswater for rainfall-runoff
modeling for an urban drainage network system. This episode describes
the installation process.

The instructions in the Giswater documentation provided sufficient


information for installing this software. To install you must download the
installer package and execute it. Remember you can choose the Giswater
stand-alone install package or the all-in-one install package. The all-in-
one installer package is designed with a portable version of
PostgreSQL+PostGIS 2.1. Remember you need to have installed an
updated Java Runtime Environment (JRE) on your computer.

I took the easy road and used the all-in-one installer. Installation using the
installation wizard proved to be straight-forward. When the dust had
settled, the following had taken place:

1. Giswater had been placed in its standard installation path


(C:\Program Files\Giswater\, so apparently its a 64-bit
application) with the following sub-folders:

o epa - EPANET & EPA SWMM command line executables;

o gis - templates for gisproject export(?);

o images - images used in the Giswater graphical


user interface;

o inp - sqlite-databases used in the information exchange


between the database and the input / output files of the
simulation tools & templates for these files;

o legal - GPL v3 license;

o lib - java libraries used by the Giswater application;

o samples - SQL-scripts containing data for sample projects;

o sql - SQL-scripts containing database logic.


2. Some additional folders had been placed
in C:\Users\<username>\Giswater\:

o config - some general configuration files;

o log - logging directory for giswater application;

o portable - portable installation of postgresql + postgis


+ pgadmin3.

EPA SWWM
Since one of my objectives is to make a comparison between
using SWMM toghether with Giswater and a vanilla EPA SWMM setup, I
also need to have EPA SWMM 5.0.022 installed (the only version
supported by Giswater). However, this version is not available anymore
from the EPA website. After about 3 years of sleep, the EPASWMM model
is actively developed again. Usually this is good news, but when other
products depend on older versions that have been taken offline, it is bad
news as well

For this tutorial, it wont be a problem, since I already had version 5.0.022
installed on my computer. Yet, there is a bigger issue here: a lot of
functionality with regard to the visualization of the simulation results
(charts, profiles, animations, etc.) is not possible without
the EPA SWMM graphical user interface. Following could be done to
make this functionality also available to Giswater users (in order of
personal preference):

1. Giswater developers keep their software compatible with the most


recent version of EPA SWMM;

2. EPA also makes version 5.0.022 available for download, since this
has been the stable version for almost 3 years;

3. Giswater developers also supply a download for the full version


of EPA SWMM 5.0.022, not just the command line version.

Lets hope one of the parties involved reads this and takes action to solve
this issue .

EPA SWMM / Giswater Tutorial 2: Project Setup

// under SWMM Giswater Water


This is the 2nd episode in my tutorial on using EPA Storm Water
Management Model (EPA SWMM) and Giswater for rainfall-runoff
modeling for an urban drainage network system. This episode describes
how to create new project in EPA SWMM, how to create a project using
Giswater and the initial options that need to be set before we can start
creating our network.

EPA SWWM

Starting a new project in EPA SWMM is a simple as starting up the


program. A new project is opened and you can directly start drawing a
sewer network. A project can be saved as a SWMM-input file (INP-file).
Such an input-file contains both all objects in a projects network and all
options set by the user. Since a standard set of default values is provided,
we could start drawing the network without further preparation. Most
options deal with the look-and-feel of the program and the simulation
parameters. For these options, we will keep the default values for now.
Some options however do affect the drawing of the network and will need
to be set beforehand:

1. Specify whether the automatic computation of conduit lengths and


subcatchment areas is turned on or off.
2. Choose whether the positions of links above the invert of their
connecting nodes are expressed as a Depth above the node invert
or as the Elevation of the offset.

3. Select flow units that makes sense (i.e. change the default Cubic
Feet per Second to Cubic Metres per Second).

4. Change the map dimensions and extent to appropriate values


(available from the menu: View Dimensions).

5. On the ID Labels page of the defaults menu (Project Defaults),


set the ID Prefixes as follows (leave the others blank):

o Rain Gages: Gage

o Subcatchments: S

o Junctions: J

o Outfalls: Out

o Conduits: C

o ID Increment: 1

This will make EPA SWMM automatically label new objects with
consecutive numbers following the designated prefix.

GISWATER

Software configuration
The software configuration window can be opened from the menu
(Configuration Software configuration). The options that can be set
here determine how Giswater deals with inputfiles, outputfiles and the
database. For these options, we keep the default values. If you would use
your own database, this is the place where you can set up the location of
the database administration program (PGADMIN3).

Database connection
The software configuration window can be opened from the menu
(Configuration Database configuration). If I remember correctly, this
was all working correctly without alterations for the included portable
postgis database. If you would use your own database, this is the place
where you can set up the connection.
Creating a EPA SWMM project
The easiest way to start a project in Giswater is to load
the EPA SWMM DB Sample project. The corresponding option in the
project menu loads a sample project into the db using the sql files in the
installation directory. You can do this an play around for a while. The goal
for this episode in my tutorial is to create an empty project, so well take a
different track:

Open the EPA SWMM window (Software EPA SWMM):

Create a project and supply the following characteristics:

o Name of the project

o Title of the project

o Author of the project

o Date create

o SRID of the coordinate system to be used


Pressing the options button would open en windows in which we
can set a broad array of options. A few of the affect our system
have sensible defaults Options: sensible defaults, so we keep them
as is.

Creating a GIS-project
After we created the project, all necessary tables are present so
theoretically we could start filling these tables with information about our
system. However, these tables are not yet easy accessible for
the GIS superpowers yet. In order to facilitate this, Giswater contains a
function to create a GIS-project that can be opened and modified
using QGIS. During this process, a QGIS-project is created with
the EPA SWMM data (i.e. the objects in the system and input tables) and
simulation analysis in its table of contents.
Now I could should you our tutorial project in QGIS, yet that would look
somewhat empty in its current state. Therefore Ill provide a screenshot of
the GIS-project created based on the sample project:

CONCLUSIONS:

Starting a new project in Giswater is a little more work than in


vanilla EPA SWMM. This amount of work however is still very small.
Creating a GIS-project is trivial and gives us the opportunity to visualize
and edit our system in a proper GIS-environment with the possibility to
add our own data. background maps, web services etc. etc.

EPA SWMM / Giswater Tutorial 3: Creating Junctions

// under SWMM Giswater Water


This is the 3rd episode in my tutorial on using EPA Storm Water
Management Model (EPA SWMM) and Giswater for rainfall-runoff
modeling for an urban drainage network system. This episode describes
how to create junctions in EPA SWMM, using QGIS and
using SQL insert statements.

The wonderful EPA SWMM help provides us with the following


information on junctions:

Junctions are drainage system nodes where links join together.


Physically they can represent the confluence of natural surface
channels, manholes in a sewer system, or pipe connection fittings.
External inflows can enter the system at junctions. Excess water at a
junction can become partially pressurized while connecting conduits
are surcharged and can either be lost from the system or be allowed
to pond atop the junction and subsequently drain back into
the junction.

The principal input parameters for a junction are:

invert elevation;

height to ground surface: maximum depth at the junction (i.e.,


the distance from the invert to the ground surface) (feet or
meters). If zero, then the distance from the invert to the top of
the highest connecting link will be used;

ponded surface area when flooded (optional);

external inflow data (optional).

For now, we keep it as simple as possible and leave the two optional
attributes for later. However, there are some other attributes that may
seem trivial, yet still require attention:
Geometry;

X-coordinate;

Y-coordinate;

NodeID.

EPA SWMM

The graphical user interface of EPA SWMM provides two ways to create
a new node:

1. It is possible to draw a new node on the map, in which case the


location where you click the map is used to determine the X- and Y-
coordinate;

2. The other way around is to navigate to junctions in the tree view in


the tree view, select junctions by using the left mouse button,
followed by pressing the Add new button. Using this approach,
the location on the map where the junction is placed is determined
based on the values supplied for the X- and Y-coordinate.
In both cases, a NodeID is automatically generated using an
autoincrementor, with the prefixes and increment supplied in the project
defaults (see Episode 2: Project Setup). It is possible to replace this
automatically generated NodeID with your own value, yet each node
should have an unique ID. This constrained is enforced by the software.

Double-clicking on a node opens its attribute form in which the attributes


can be modified. The location of a junction can be changed by dragging
the junction to a new location, or by changing the X- and Y-attributes. A
selected node can be removed by pressing the Delete key on your
keyboard, or by using the Delete object button next to the Add
new button.

GISWATER: QGIS AS FRONTDOOR

The Giswater equivalent of drawing a junction in EPA SWMM directly,


would be to draw a new feature in in the junction layer of the
corresponding GIS-project. This approach offers the
following advantages:

Adding basemaps;1

Adding your own geo-spatial data as a reference, to snap new


objects on or to copy-paste the geometry into the SWMM layers;

Sophisticated drawing tools (cadtools, Autotrace, GPS) availabe


as plugins;

A field calculator to update attributes in bulk.

Sectors
Giswater introduces the concept of sectors. I havent found out yet
whether using sectors in your data is required or not. Ill ignore them for
now and come back to this either when Ill make an episode on the
functioning of sectors or when the calculation refuses to run .
Drawing new junctions

1. Make the Junctions layer


(EPA SWMM DATA Hydraulics Node Junctions ) active by
clicking on this layer in the content tree of the map;

2. Toggle editing (a);

3. Add new features (b);

4. In the attribute form, supply values for node_id, top_elev, ymax and
optionally for the other attributes (c);

5. Save layer edits (d).

Copy - Paste new junctions

1. Make the source layer for the junctions to be pasted active;

2. Toggle editing of this layer (a);

3. Select the features to be copied using the selection tools provided


by QGIS;

4. Click Copy features button (e);


5. Make the Junctions layer active;

6. Toggle editing (a);

7. Paste features (f);

8. If attributes with the same name were present in the source layer,
they will be transferred over. Otherwise, supply values for node_id,
top_elev, ymax and optionally for the other attributes (c);

9. Save layer edits (d).

Modify the location of a junction

1. Make the Junctions layer active;

2. Toggle editing (a);

3. Move features (g);

4. Drag junction to new location;

5. Save layer edits (d).

Modify the attributes of a junction

1. Make the Junctions layer active;

2. Toggle editing (a);

3. Open the attribute form using the Identify Features button (i) or
open the attribute table (j);

4. Fill in the new attribute values (c);

5. Save layer edits (d).

Delete a junction

1. Make the Junctions layer active;

2. Toggle editing (a);

3. Select features;

4. Delete selected using the Delete selected button (h) or pressing


the Delete key;
5. Save layer edits (d).

Important DONTs

Do NOT mess around in the nodes layer or in the results layers!!!


Drawing in these layers will not activate the required database
functions to create new objects correctly.

Make sure your Postgres server is running when starting


the QGIS project (i.e. do not close the command prompt window of
the portable Postgres). If the server stops with your GIS-project
open, QGIS will spit out a endless loop of pop-ups stating that it is
not able to reach the server. QGIS can now only be stopped
with violence.

GISWATER: SQL AS BACKDOOR

When you are drawing a drainage system from scratch, QGIS (or
other GIS software configured for editing the correct tables) would be the
way to go. However, in many cases information is already available from
other sources (CAD-drawings, geodatabases, Excel-files, etc.). In these
cases, you could also use scripting to interpret this information and insert
it into the database. These insert queries could directly be executed from
your code, yet I like to keep insight in what is happening. Therefore, my
approach was to use python scripts which write the insert queries to
a SQL-script.

If X- and Y-coordinates are available, the value to be inserted in the


geometry field can be generated using PPyGIS. Although in the
documentation is stated that PPyGIS is young and has several limitations,
it does this job really well. The following python code generates insert
statements for 4 junctions in a strictly random street somewhere in the
east of the Netherlands:

import ppygis
import psycopg2

SRID = 28992
schema = 'tutorial'
junction_view = 'v_inp_edit_junction'
junction_fields = '(node_id, top_elev, ymax, y0, ysur, apond,
sector_id, the_geom)'
junction_query = r'INSERT INTO "{0}"."{1}" {2} VALUES (%s, %s, %s, %s,
%s, %s, %s, %s);'.format(schema, junction_view, junction_fields)

class junction():
'''
This is a junction
'''
def __init__(self,NodeID,X,Y,Z):
'''
Constructor
'''
self.NodeID = NodeID
self.X = X
self.Y = Y
self.Z = Z
self.MaxDepth = 0 # take values from connected
reaches
self.InitDepth = 0 # 0 for now, to be examined later
self.SurchargeDepth = 0 # optional, to be examined later
self.PondingArea = 0 # optional, to be examined later
self.SectorID = None # ignore for now, to be examined
later
self.Geometry = ppygis.Point(self.X,self.Y,srid=SRID)

@property
def InsertValues(self):
return (self.NodeID, self.Z, self.MaxDepth, self.InitDepth, \
self.SurchargeDepth, self.PondingArea,
self.SectorID, \
self.Geometry.write_ewkb())

conn = psycopg2.connect('dbname=giswater_ddb user=postgres port=5431')


cur = conn.cursor()

# Here you can put the logic that reads out the files/databases
# that contain locations and/or attributes of your junctions
node_ids = ['J1', 'J2', 'J3', 'J4']
x = [255320.35, 255347.98, 255365.84, 255375.21]
y = [472276.25, 472302.63, 472319.22, 472328.19]
z = [33.11, 33.03, 32.76, 32.89]

for i in xrange(4):
example_junction = junction(node_ids[i], x[i], y[i], z[i])
junction_values = example_junction.InsertValues

# and write the resulting query to a file, not stdout


print cur.mogrify(junction_query, junction_values)

conn.close()
Which results in the following SQL-statement:

INSERT INTO "tutorial"."v_inp_edit_junction" VALUES ('J1', 33.11, 0,


0, 0, 0, None, '010100002040710000cdccccccc22a0f410000000051d31c41');
INSERT INTO "tutorial"."v_inp_edit_junction" VALUES ('J2', 33.03, 0,
0, 0, 0, None, '010100002040710000713d0ad79f2b0f4152b81e85bad31c41');
INSERT INTO "tutorial"."v_inp_edit_junction" VALUES ('J3', 32.76, 0,
0, 0, 0, None, '01010000204071000085eb51b82e2c0f4114ae47e1fcd31c41');
INSERT INTO "tutorial"."v_inp_edit_junction" VALUES ('J4', 32.89, 0,
0, 0, 0, None, '010100002040710000e17a14ae792c0f41295c8fc220d41c41');
As you can see, this insert query should also executed on the view that
contains the junctions, not directly on the node table. Update and delete
queries should also be performed on this view.

CONCLUSIONS:
QGIS provides much more powerful tools to draw and modify your objects
than using EPA SWMM directly. No incremental IDs are handed out
automatically, yet the field calculator provides a powerful tool ot generate
them in bulk. Data integrity is maintained by the database trigger and
constraints. This works works well, however you need to be really careful
to make your edits to the correct layer.

Open ends:

The description and TAG attributes of the junctions are not present
in Giswater. Within a GIS-environment, there is less need for this
functionality. However including the description attribute would be a
minor development effort. Supporting the use of tags might need
more effort;

Giswater introduces the concepts of sectors. It is not yet clear to


me what their function is and whether it is required to use them;

The initial depth does not seem to be explicitly mentioned in


the EPA SWMM help. This attribute will need to be
examined further.

1. It is possible to add a street map, utility map, topographic map, site


development plan, or any other relevant picture or drawing as a
backdrop image in EPA SWMM.This can be useful, yet to a
proper GIS-environment.

Go Top

EPA SWMM / Giswater Tutorial 4: Creating Conduits

// under SWMM Giswater Water


This is the 4th episode in my tutorial on using EPA Storm Water
Management Model (EPA SWMM) and Giswater for rainfall-runoff
modeling for an urban drainage network system. This episodes describes
how to create conduits in EPA SWMM, using QGIS and
using SQL insert statements.

The wonderful EPA SWMM help provides us with the following


information on conduits:

Conduits are pipes or channels that move water from one node to
another in the conveyance system. Their cross-sectional shapes can be
selected from a variety of standard open and closed geometries.
Irregular natural cross-section shapes are also supported, as are
user-defined closed shapes.

The principal input parameters for conduits are:

Names of the inlet and outlet nodes;

Offset depth or elevation of the conduit above the inlet and


outlet node inverts;

Conduit length;

Mannings roughness;

Cross-sectional geometry (profile describing parameters and


the number of barrels);

Loss coefficients (headloss coefficients for the entrance, exit and


average along the length of the conduit);

Presence of a flap gate to prevent reverse flow;

Inlet geometry code number if conduit acts as a culvert.

Conduits designated as culverts are checked continuously during


dynamic wave flow routing to see if they operate under Inlet Control
as defined in the Federal Highway Administrations publication
Hydraulic Design of Highway Culverts (Publication No. FHWA-NHI-
01-020, May 2005).

Attributes that can be supplied, yet not mentioned as principal input


parameters are:

Initial flow in the conduit at the start of the simulation;

Maximum flow allowed in the conduit (use 0 or leave blank if


not applicable);

Maximum depth of the conduits cross section;

Culvert code number of inlet geometry if conduit is a culvert subject


to possible inlet flow control (leave blank otherwise).
Similar to the junctions, there are some other attributes that may seem
trivial, yet still require attention:

Geometry;

ArcID.

ARC-NODE TOPOLOGY

EPA SWMM is modelling the drainage system using an Arc-Node


Topological Model. Such a topology exerts some rules of the objects in
order to maintain network integrity.

1. A node is an intersection point where two or more arcs meet.


Can also occur at the end of a dangling arc (i.e. an arc that is
not connected to another arc);

2. An arc is defined as a line vector that start and end at a node.


Arcs can either be straight line vectors between two nodes or
consist of multiple segments that together form the connection
between two nodes. The (optional) points along an arc that
define its shape are called Vertices;

3. Every Arc has a direction (which may or may not be the same
as the hydraulic direction).

The rules described above, result in the following behavior of the objects:

A new arc can only be constructed as a connection between 2


separate existing nodes;

If an arc is deleted, nodes that were previously connected are


not affected;

If a node is deleted, arcs that were previously connected are


deleted as well;

If the geometry of an arc is modified, the new geometry should also


connect two separate existing nodes.

If a node is moved to a new position, geometry of the connected


arcs is updated accordingly.

EPA SWMM
The graphical user interface of EPA SWMM provides two ways to create
a new conduit:

1. It is possible to draw a new conduit on the map. In this case the


inlet node, outlet node and direction on how the conduit is drawn.
These conduits can either be straight lines or contain
additional vertices.

2. The other way around is to usting the Add new button. Using this
approach, a conduit is drawn as a straight line between the last two
junctions that have been drawn.

In both cases, an ArcID is automatically generated using an


autoincrementor, with the prefixes and increment supplied in the project
defaults (see Episode 2: Project Setup). It is possible to replace this
automatically generated ArcID with your own value, yet each node should
have an unique ID. This constrained is enforced by the software.

Double-clicking on a conduit opens its attribute form in which the


attributes can be modified. elected reaches can be removed by pressing
the Delete key on your keyboard, or by using the Delete object button
next to the Add new button. Pressing the right mouse button on a
conduit, opens a context menu with the following options:

Copy / paste: transfer attributes from one conduit to another;

Delete: delete the conduit;

Reverse: reverse the direction of the conduit (i.e. exchange inlet


node and outlet node properties);

Convert to: convert the object type to one of the other object types
that can form an arc (pump, orifice, weir & outlet);

Vertices: start editing the vertices of the conduit;

Properties: open the attribute form for the conduit.


The inlet node and outlet node of a conduit can only be changed using
the attribute form. If one of these values is changed, the geometry of the
conduit is updated accordingly. If the inlet node is changed, the segment
that connects the original inlet node with the second vertex (second-to-
last for the outlet node) is replaced with a straight segment from this
vertex to the new inlet node.

GISWATER: QGIS AS FRONTDOOR

The Giswater equivalent of drawing a conduit in EPA SWMM directly,


would be to draw a new feature in in the conduit layer of the
corresponding GIS-project. However, whereas in EPA SWMM the cross-
sectional geometry and roughness coefficient are attributes of each
reach, GISWATER uses a different approach. GISWATER is using lookup
tables for the profile definitions and materials (with their manning
roughness coefficient as an attribute). The profile definition and material
are not mandatory attributes of a conduit, yet conduits without a cross-
section geometry do not make sense. Therefore, we need at least one
profile definition and material definition to choose before we can create
a conduit.

Material & pipe profile definitions


Material and profile definitions could be created and modified by editing
the administrative tables in QGIS or by executing SQL-statements. The
developers of GISWATER have been so kind to provide a functionality for
managing material (Data Materials catalog) and profile definitions
(Data Arc catalog).

Using these catalogs to manage material definitions is straight-forward1.


Only thing to only thing is one has to realize that n is the Mannings
roughness coefficient. For profile definitions however, we have an issue:
how do we know the meaning of the editable fields? When a shape is
selected in th cross-section editor of EPA SWMM, an appropriate set of
edit fields appears for describing the dimensions of that shape. However,
with GISWATER, only the field names of the underlying database fields
are visible as labels. With names like Geom1, Geom2,
Geom3 & Geom4, this does not provide much help. Only way I
managed to create correct profiles is to create the profiles in
the EPA SWMM interface and reverse engineer the meaning of the
parameters for the different shapes from the resulting INP-file.

Drawing conduits
The drawing process for the conduits is very similar to the process
described for junctions.
Notable differences are:

The conduits are directional lines. An arrow is showing the direction


on the map;

Material definitions and profile definitions have to be created in the


corresponding lookup tables;

Whereas junctions can be located freely, conduits should always


connect two separate existing nodes. If this requirement is not met,
trying to save the conduit will result in a commit error.
GISWATER: SQL AS BACKDOOR

The same recipe as used for the junctions, will also work for the conduits.
The following python code generates insert statements for 3 conduits that
connect the junctions that were placed in a strictly random street
somewhere in the east of the Netherlands during Episode 3: Creating
Junctions:

import ppygis
import psycopg2

SRID = 28992
schema = 'tutorial'
junction_view = 'v_inp_edit_junction'
junction_fields = '(node_id, top_elev, ymax, y0, ysur, apond,
sector_id, the_geom)'
junction_query = r'INSERT INTO "{0}"."{1}" {2} VALUES (%s, %s, %s, %s,
%s, %s, %s, %s);'.format(schema, junction_view, junction_fields)
conduit_view = 'v_inp_edit_conduit'
conduit_fields = '(arc_id, z1, z2, arccat_id, matcat_id, barrels,
culvert, kentry, kexit, kavg, flap, q0, qmax, sector_id, the_geom)'
conduit_query = r'INSERT INTO "{0}"."{1}" {2} VALUES (%s, %s, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s);'.format(schema,
conduit_view, conduit_fields)
class Junction():
'''
This is a junction
'''
def __init__(self,NodeID,X,Y,Z):
'''
Constructor
'''
self.NodeID = NodeID
self.X = X
self.Y = Y
self.Z = Z
self.MaxDepth = 0 # take values from connected
reaches
self.InitDepth = 0 # 0 for now, to be examined later
self.SurchargeDepth = 0 # optional, to be examined later
self.PondingArea = 0 # optional, to be examined later
self.SectorID = None # ignore for now, to be examined
later
self.Geometry = ppygis.Point(self.X,self.Y,srid=SRID)

@property
def InsertValues(self):
return (self.NodeID, self.Z, self.MaxDepth, self.InitDepth, \
self.SurchargeDepth, self.PondingArea,
self.SectorID, \
self.Geometry.write_ewkb())

class Conduit():
'''
This is a conduit
'''
def
__init__(self,ArcID,StartNode,EndNode,InletOffset,OutletOffset):
'''
Constructor
'''
self.ArcID = ArcID
self.InletOffset = InletOffset
self.OutletOffset = OutletOffset
self.ArcCat_ID = "ROUND500" # Profile definition created
previously
self.MatCat_ID = "CONCRETE" # Material created previously
self.Barrels = 1 # 1 for now, to be examined
later
self.Culvert = None # ignore for now, to be
examined later
self.Kentry = 0 # 0 for now, to be examined
later
self.Kexit = 0 # 0 for now, to be examined
later
self.Kavg = 0 # 0 for now, to be examined
later
self.Flap = 'NO' # NO for now, to be examined
later
self.Q0 = 0 # 0 for now, to be examined
later
self.Qmax = 0 # 0 for now, to be examined
later
self.SectorID = None # ignore for now, to be
examined later
self.StartNode = StartNode
self.EndNode = EndNode
self.Geometry = ppygis.LineString((self.StartNode.Geometry, \
self.EndNode.Geometry,),
srid=SRID)

@property
def InsertValues(self):
return (self.ArcID, self.InletOffset, self.OutletOffset, \
self.ArcCat_ID, self.MatCat_ID, self.Barrels, \
self.Culvert, self.Kentry, self.Kexit, self.Kavg, \
self.Flap, self.Q0, self.Qmax, self.SectorID, \
self.Geometry.write_ewkb())

conn = psycopg2.connect('dbname=giswater_ddb user=postgres port=5431')


cur = conn.cursor()

# Here you can put the logic that reads out the files/databases
# that contain locations and/or attributes of your objects
node_ids = ['J1', 'J2', 'J3', 'J4']
x = [255320.35, 255347.98, 255365.84, 255375.21]
y = [472276.25, 472302.63, 472319.22, 472328.19]
z = [33.11, 33.03, 32.76, 32.89]
arc_ids = ['C1','C2','C3']
junction_list = []

# insert queries for the junctions


for i in xrange(4):
example_junction = Junction(node_ids[i], x[i], y[i], z[i])
junction_values = example_junction.InsertValues

# and write the resulting query to a file, not stdout


print cur.mogrify(junction_query, junction_values)
junction_list.append(example_junction)

# insert queries for the conduits


for i in xrange(3):
start_node = junction_list[i]
end_node = junction_list[i+1]
inlet_offset = 0.5
outlet_offset = 0.5
example_conduit = Conduit(arc_ids[i], start_node, end_node, \
inlet_offset, outlet_offset)
conduit_values = example_conduit.InsertValues

# and write the resulting query to a file, not stdout


print cur.mogrify(conduit_query, conduit_values)

conn.close()
Which results in the following SQL-statement with some very long lines:

INSERT INTO "tutorial"."v_inp_edit_junction" VALUES ('J1', 33.11, 0,


0, 0, 0, None, '010100002040710000cdccccccc22a0f410000000051d31c41');
INSERT INTO "tutorial"."v_inp_edit_junction" VALUES ('J2', 33.03, 0,
0, 0, 0, None, '010100002040710000713d0ad79f2b0f4152b81e85bad31c41');
INSERT INTO "tutorial"."v_inp_edit_junction" VALUES ('J3', 32.76, 0,
0, 0, 0, None, '01010000204071000085eb51b82e2c0f4114ae47e1fcd31c41');
INSERT INTO "tutorial"."v_inp_edit_junction" VALUES ('J4', 32.89, 0,
0, 0, 0, None, '010100002040710000e17a14ae792c0f41295c8fc220d41c41');

INSERT INTO "tutorial"."v_inp_edit_conduit" (arc_id, z1, z2,


arccat_id, matcat_id, barrels, culvert, kentry, kexit, kavg, flap, q0,
qmax, sector_id, the_geom) VALUES ('C1', 0.5, 0.5, 'ROUND500',
'CONCRETE', 1, NULL, 0, 0, 0, 'NO', 0,0, NULL,
'01020000204071000002000000cdccccccc22a0f410000000051d31c41713d0ad79f2
b0f4152b81e85bad31c41');
INSERT INTO "tutorial"."v_inp_edit_conduit" (arc_id, z1, z2,
arccat_id, matcat_id, barrels, culvert, kentry, kexit, kavg, flap, q0,
qmax, sector_id, the_geom) VALUES ('C2', 0.5, 0.5, 'ROUND500',
'CONCRETE', 1, NULL, 0, 0, 0, 'NO', 0,0, NULL,
'01020000204071000002000000713d0ad79f2b0f4152b81e85bad31c4185eb51b82e2
c0f4114ae47e1fcd31c41');
INSERT INTO "tutorial"."v_inp_edit_conduit" (arc_id, z1, z2,
arccat_id, matcat_id, barrels, culvert, kentry, kexit, kavg, flap, q0,
qmax, sector_id, the_geom) VALUES ('C3', 0.5, 0.5, 'ROUND500',
'CONCRETE', 1, NULL, 0, 0, 0, 'NO', 0,0, NULL,
'0102000020407100000200000085eb51b82e2c0f4114ae47e1fcd31c41e17a14ae792
c0f41295c8fc220d41c41');

CONCLUSIONS:

Although it took a while to grasp the behavior that was going on, the use
of Arc-Node topology makes sense for an urban drainage network and
does a good job maintaining network integrity. GISWATER mimics the
network behavior of plain SWMM really well. The addition of directional
arrows communicates that the objects form a network and provide insight
in the direction of the arcs. However, without proper instruction, this may
result in confusion when users are under the impression that the arrows
are showing hydraulic direction.

GISWATER introduces a system of material definitions and profile


definitions for the reaches. This approach appeals to me conceptually.
However, in its current form, the profile catalog is far from user-friendly:
the meaning of the input parameters is unclear for the various shapes.

1. Although there seems to be a little bug in the version


of GISWATER Im running (v1,0.186), since trying to save a
material resulted in the following message: The column name
roughness was not found in this ResultSet. Adding records to the
material definition table from QGIS worked correctly.

EPA SWMM / Giswater Tutorial 5: Outfalls


// under SWMM Giswater Water
This is the 5th episode in my tutorial on using EPA Storm Water
Management Model (EPA SWMM) and Giswater for rainfall-runoff
modeling for an urban drainage network system.

Outfalls are terminal nodes of the drainage system used to define


final downstream boundaries under Dynamic Wave flow routing. For
other types of flow routing they behave as a junction. Only a single
link can be connected to an outfall node.

The boundary conditions at an outfall can be described by any one of


the following stage relationships: * the critical or normal flow depth
in the connecting conduit

a fixed stage elevation

a tidal stage described in a table of tide height versus hour of


the day

a user-defined time series of stage versus time.

The principal input parameters for outfalls include:

invert elevation

boundary condition type and stage description

presence of a flap gate to prevent backflow through the outfall.

Name User-assigned outfall name.

X-Coordinate Horizontal location of the outfall on the Study Area Map. If


left blank then the outfall will not appear on the map.

Y-Coordinate Vertical location of the outfall on the Study Area Map. If left
blank then the outfall will not appear on the map.

Description Click the ellipsis button (or press Enter) to edit an optional
description of the outfall.

Tag Optional label used to categorize or classify the outfall.

Inflows Click the ellipsis button (or press Enter) to assign external direct,
dry weather or RDII inflows to the outfall.
Treatment Click the ellipsis button (or press Enter) to edit a set of
treatment functions for pollutants entering the node.

Invert El. Invert elevation of the outfall (feet or meters).

Tide Gate YES - tide gate present to prevent backflow NO - no tide


gate present

Type Type of outfall boundary condition: FREE: outfall stage determined


by minimum of critical flow depth and normal flow depth in the connecting
conduit NORMAL: outfall stage based on normal flow depth in the
connecting conduit FIXED: outfall stage set to a fixed value TIDAL: outfall
stage given by a table of tide elevation versus time of day TIMESERIES:
outfall stage supplied from a time series of elevations

Fixed Stage Water elevation for a FIXED type of outfall (feet or meters).

Tidal Curve Name Name of the Tidal Curve relating water elevation to
hour of the day for a TIDAL outfall (double-click to edit the curve).

Time Series Name Name of time series containing time history of outfall
stage for a TIMESERIES outfall (double-click to edit the series).

Only thing required before running the model is possible is to create


an outfall.

Create outfall Run EPA SWMM (not that the results make any sense
without inflows)

GISWATER: run not possilbe

CONCLUSIONS:

Convert - absent in GISWATER

Sectors are relevant :)

You might also like