hello

swmmjs

A detailed description of .out data

Take a Virtual Trip Through Your .out

Before you start this tour, you should load up a .out file using one of the buttons above. I recommend using the 'Load Default' button if this is your first time here. That will load up the data necessary to run the displays. The data being used in this tour is manufactured using EPA-SWMM, a phenomenal program for environmental systems. If you are here on a cellphone or tablet, try out the landscape mode and enjoy using the pinch and finger-drag effects, but definitely check out the mouseover and super-zoom wheel effect on desktops.

The units used in each of the displays is called a byte, and this number is helpful if you wish to understand how to access those values for display and analysis. This tour will take you through the addresses in each of the 7 major sections of a swmm .out file. The sections are as follows:

  • Opening Records
  • Object ID Names
  • Object Properties
  • Reporting Variables
  • Reporting Interval
  • Computed Results
  • Closing Records

Each section starts with a button that will zoom your display to the section at hand, then a localized display of the binary section, a short description of the section, and finally a clickable 'Documentation' that contains the EPA-SWMM documentation for the section.

I hope you enjoy this as much as I do.

Opening Records

The first section describes a lot about how the file should be parsed and treated. This section includes the EPA-SWMM version number, the count of each reportable object, the units that data is reported in, and a special code to help with the basic assumption that the file you are working with is indeed an EPA-SWMM .out file.

Documentation

The following basic information is written at the beginning of the binary output file produced by a SWMM 5 simulation:

  • an identifying number equal to 516114522
  • version number of the engine
  • a code number for the flow units that are in effect where 0 = CFS, 1 = GPM, 2 = MGD, 3 = CMS, 4 = LPS, and 5 = LPD
  • the number of subcatchments in the project reported on
  • the number of nodes in the project reported on
  • the number of links in the project reported on
  • the number of pollutants in the project

Each of these values is written to the file as a 4-byte integer.

Object ID Names

The Object ID Names section is helpful when presenting data in a user-friendly format. This section contains literally all of the strings used to describe the major objects of a model. While each of these object types is far more complex than needs to be detailed here, I've included a simple description of each object type for those following along:

  • subcatchment: A plot of land.
  • node: An intersection point, like a creek branch/delta or a manhole.
  • link: A connection object for two nodes, such as a pipe.
  • pollutant: Nasty stuff, usually.
  • pollutant concentration units codes: The units that the pollutant results are reported in. See the 'Documentation' section below for details.
Documentation

Following the Opening Records section of SWMM 5's binary output file comes a section containing the ID names of each subcatchment, node, link, and pollutant defined in the SWMM 5 input file whose results are being reported. Pollutant concentration codes are also contained in this section of the file.

Each ID name consists of two records written to the output file:

  • the number of characters in the name (expressed as a 4-byte integer)
  • the string of characters that comprise the name (each character is 1 byte).

The names are written first for each reported subcatchment, then for each reported node, then for each reported link, and finally for each pollutant. Within each category of object the names are written in the same order in which the object appeared in the input file. This same order is maintained when computed results are written to the file in the Computed Results section.

Following the listing of pollutant names, the code numbers that represent the concentration units of each pollutant are written to the file as 4-byte integers. These codes are: 0 for mg/L, 1 for ug/L, and 2 for counts/L.

To summarize, the overall layout of this section of the file is:

  • subcatchment ID names
  • node ID names
  • link ID names
  • pollutant names
  • pollutant concentration units codes

Object Properties

In the Object Properties section, you'll find a lot of information that describes the input to the model. This section is really helpful for independent display systems and set analysis. The input and output can be easily associated within this file when using this section.

Input to a swmm model is very easy to understand, with the subcatchments (plots of land) receiving an area, nodes being given elevations and depths, and links are recorded using lengths, depths, and elevation changes (offsets).

Documentation

The Object Properties section of the binary output file produced by the SWMM 5 engine contains a limited collection of input properties associated with each object (not the entire set of properties). The format of this section is as follows:

Item Type Description
Number of subcatchment properties saved INT4 Currently equal to 1
Code number of each subcatchment property saved INT4 Currently equal to 1 for subcatchment area
Value of each property for each subcatchment REAL4 Subcatchment area (ac or ha) for each subcatchment
Number of node properties saved INT4 Currently equal to 3
Code number of each node property saved INT4 Currently equal to:
  • 0: node type code
  • 2: node invert elevation
  • 3: node max. depth
Value of each property for each node REAL4 Node type code, invert elevation (ft or m), and max. depth (ft. or m) for each node
Number of link properties saved INT4 Currently equal to 5
Code number of each link property saved INT4 Currently equal to:
  • 0: link type code
  • 4: upstream invert offset
  • 4: downstream invert offset
  • 3: link max. depth
  • 5: link length
Value of each property for each link REAL4 Link type code, upstream invert offset (ft or m), downstream invert offset (ft or m), max. depth (ft or m), and length (ft or m) for each link.

Reporting Variables

This section, Reporting Variables, assigns to each of the output values an integer for all of the reported output. This includes variables such as snow depth, total inflow, and flooding volume. This section is just ever so slightly more interesting to a parser than it is to a person, but if you take a look at the 'Documentation' section, you'll see all the types of useful output data you can read from a .out file.

Documentation

The Reporting Variables section of the SWMM 5 binary output file contains the number and codes of each variable reported on. The items written to this section, all as 4-byte integers, are as follows:

  • Number of subcatchment variables (currently 8 + number of pollutants).
  • Code number of each subcatchment variable:
    • 0: rainfall (in/hr or mm/hr)
    • 1: snow depth (in or mm)
    • 2: evaporation loss (in/day or mm/day)
    • 3: infiltration losses (in/hr or mm/hr)
    • 4: runoff rate (flow units)
    • 5: groundwater outflow rate (flow units)
    • 6: groundwater water table elevation (ft or m)
    • 7: unsaturated zone moisture content (fraction)
    • 7+N: runoff concentration of Nth pollutant
  • Number of node variables (currently 6 + number of pollutants).
  • Code number of each node variable:
    • 0: depth of water above invert (ft or m)
    • 1: hydraulic head (ft or m)
    • 2: volume of stored + ponded water (ft3 or m3)
    • 3: lateral inflow (flow units)
    • 4: total inflow (lateral + upstream) (flow units)
    • 5: flow lost to flooding (flow units)
    • 5 + N: concentration of Nth pollutant
  • Number of link variables (currently 5 + number of pollutants).
  • Code number of each link variable:
    • 0: flow rate (flow units)
    • 1: flow depth (ft or m)
    • 2: flow velocity (ft/s or m/s)
    • 3: flow volume (ft3 or m3)
    • 4: fraction of conduit's area filled or setting for non-conduits
    • 4 + N: concentration of Nth pollutant
  • Code number of each system-wide variable:
    • 0: air temperature (deg. F or deg. C)
    • 1: rainfall (in/hr or mm/hr)
    • 2: snow depth (in or mm),
    • 3: evaporation + infiltration loss rate (in/hr or mm/hr),
    • 4: runoff flow (flow units)
    • 5: dry weather inflow (flow units)
    • 6: groundwater inflow (flow units)
    • 7: RDII inflow (flow units)
    • 8: user supplied direct inflow (flow units)
    • 9: total lateral inflow (sum of variables 4 to 8) (flow units)
    • 10: flow lost to flooding (flow units)
    • 11: flow leaving through outfalls (flow units)
    • 12: volume of stored water (ft3 or m3)
    • 13: actual evaporation rate (in/day or mm/day)
    • 14: potential evaporation rate (PET) (in/day or mm/day

Reporting Interval

This section is incredibly small, and just describes the start date of the model, and the amount of time between reporting intervals. You will notice day 0 is December 30. This is due to the fact that not every great idea makes sense.

Documentation

The Reporting Interval portion of the SWMM 5 binary output file consists of only two records:

  • The start date and time of the simulation, expressed as an 8-byte double precision number representing the number of decimal days since 12:00 am of December 30, 1899.
  • The time interval between reporting periods in seconds, expressed as a 4-byte integer number.

Computed Results

This is the real meat of the file. In the 'Computed Results' section, you'll find the data data. This section contains a repeating pattern that starts with an 8-byte DateTime of the current timestep, followed by the output for each major object in the model. Each model object is identified by its array position in the objectIDs section, and each reported value is associated with its array position in the 'Reporting Variables' section.

Zooming in and out on this section is probably something I'll never get tired of.

Documentation

The Computed Results portion of the SWMM 5 binary output file is where the computed values for each subcatchment, node, link and system reporting variable are stored for each reporting period of the simulation. The number and type of each reporting variable was supplied in the Reporting Variables portion of the file. The following information is written to the binary file for each reporting period, starting from the first period (the initial conditions at time 0 of the simulation do not appear in the file):

  • the date and time of the reporting period, expressed as an 8-byte double precision number representing the number of decimal days since 12/30/1899
  • the value of each subcatchment variable for each subcatchment, as 4-byte floats
  • the value of each node variable for each node, as 4-byte floats
  • the value of each link variable for each link, as 4-byte floats
  • the value of each system-wide variable, as 4-byte floats

Note that the layout of these data is as follows:

  • Date/time value
  • Variable 1, Variable 2, etc. for first subcatchment
  • ...
  • Variable 1, Variable 2, etc. for last subcatchment
  • Variable 1, Variable 2, etc. for first node
  • ...
  • Variable 1, Variable 2, etc. for last node
  • Variable 1, Variable 2, etc. for first link
  • ...
  • Variable 1, Variable 2, etc. for last link
  • First system-wide variable, ...., last system-wide variable

The order in which each variable is written for a specific object follows the order in which the variables were listed in the Reporting Variables section of the file. The order in which each subcatchment, node, and link appear follows the same order in which they appear in the Object ID Names section of the file, and is the same order they appear in the SWMM 5 input file. Again remember that only a subset of all subcatchments, nodes, and links may be reported on, depending on the options that were specified in the [REPORT] section of the project's input file.

This collection of data is repeated for each reporting period. The actual number of reporting periods can be read from the Closing Records portion of the file.

Closing Records

The end of the file, 'Closing Records', wraps up the file with a tidy index, error code, and file verification number.

Documentation

The following records are written to the SWMM 5 binary results file following the data that appear in the Computed Results section of the file:

  • the byte position where the Object ID Names section of the file begins (4-byte integer)
  • byte position where the Object Properties section of the file begins (4-byte integer)
  • byte position where the Computed Results section of the file begins (4-byte integer)
  • total number of reporting periods contained in the Computed Results section of the file (4-byte integer)
  • error code status of the simulation, where 0 indicates no errors (4-byte integer)
  • the same identifying number, 516114522, that appears as the very first record in the file (4-byte integer).

Note that byte positions are expressed as offsets from the beginning of the file, whose byte position is 0.

Summary

Thanks so much for taking this quick tour of swmm binary .out files. The visualizations are made using d3, Bootstrap, and swmmjs. This webpage is hosted on AWS and utilizes a lightweight instance. If you had trouble loading the page, please give me a heads up and I'll see what I can do to help. I hope you've learned something, or at least had a little fun. Definitely find your way back again or contact me for more info.

If you are looking for a text file of the contents of the .out file, you can click the button below. Be aware, this will translate the entire contents of the .out binary into text, and probably be too much for a smaller computer to handle.