Professional Documents
Culture Documents
GisWater Tutorial EPASWIMM
GisWater Tutorial EPASWIMM
GisWater Tutorial EPASWIMM
1: Installation
// under SWMM Giswater Water
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:
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):
2. EPA also makes version 5.0.022 available for download, since this
has been the stable version for almost 3 years;
Lets hope one of the parties involved reads this and takes action to solve
this issue .
EPA SWWM
3. Select flow units that makes sense (i.e. change the default Cubic
Feet per Second to Cubic Metres per Second).
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:
o Date create
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:
invert elevation;
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:
Adding basemaps;1
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
4. In the attribute form, supply values for node_id, top_elev, ymax and
optionally for the other attributes (c);
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);
3. Open the attribute form using the Identify Features button (i) or
open the attribute table (j);
Delete a junction
3. Select features;
Important DONTs
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.
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())
# 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
conn.close()
Which results in the following SQL-statement:
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;
Go Top
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.
Conduit length;
Mannings roughness;
Geometry;
ArcID.
ARC-NODE TOPOLOGY
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:
EPA SWMM
The graphical user interface of EPA SWMM provides two ways to create
a new conduit:
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.
Convert to: convert the object type to one of the other object types
that can form an arc (pump, orifice, weir & outlet);
Drawing conduits
The drawing process for the conduits is very similar to the process
described for junctions.
Notable differences are:
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())
# 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 = []
conn.close()
Which results in the following SQL-statement with some very long lines:
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.
invert elevation
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.
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.
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).
Create outfall Run EPA SWMM (not that the results make any sense
without inflows)
CONCLUSIONS: