Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The adapter consists of separate pre- and post adapters that can be used to import and export timeseries data to/from the SWMM model and control the simulation period. The FEWS general adapter is used to configure both the pre- and post adapter and execute the SWMM simulation using the SWMM5 command line executable. This model adapter is written in java. Note there is an open-source python based adapter available in development as well, developed by Matrix Solutions inc. More information about that adapter will be provided later on this page here

SWMM pre-adapter

The SWMM pre-adapter converts the pi-xml files from Delft-FEWS to model native input files.

...

Class name: nl.deltares.fews.swmm.SwmmPreAdapter

Properties

SWMM_input_file

(required)

Pathname of SWMM input file (*.inp) to update. This should be either an absolute path or a path relative to the workDir specified in the netcdf run file.

The input file will be updated to modify only the START_DATE, START_TIME, END_DATE, END_TIME, REPORT_START_DATE and REPORT_START_TIME fields, the rest of the file is not modified in any way.

Notes for users
  • For all files that are written by this adapter, if the file to be written already exists, then it will be overwritten.
  • This program can process timeseries input data per catchment, node or link model entity, and requires that each model entity has a unique ID, regardless of it's entity type.
  • This program assumes that the SWMM model configuration uses the same time zone as given in the PI XML run file.
  • The working directory (workDir) defined in the PI XML run file is the directory where the SWMM model will be run, the SWMM input files will be stored in this directory.
  • This program writes log messages to a log file called "swmm_pre_adapter_log.txt" in the workDir specified in the PI XML run file.
  • This program uses the information in the specified PI XML run file as input and uses this information to perform the following actions:
    1. Update the start and end time for the simulation.
      The SWMM input file (*.inp) file specified in the property "SWMM_input_file" will be updated to reflect the start and end date / time for the simulation as specified in the PI XML run file. The adapter will only modify the START_DATE, START_TIME, END_DATE, END_TIME, REPORT_START_DATE and REPORT_START_TIME fields where the report start date/time will be the same as the start of the simulation.
    2. Convert input PI XML timeseries files to SWMM itimeseries input file format files:
      For each of the input timeseries files listed in the PI XML run file, one or more SWMM compatible timeseries file will be written to the working directory as follows:
      - For each of the timeseries present in the PI XML input file, the location ID is looked up in the [TIMESERIES] section of the SWMM model input file (*.INP) to get the FILE name listed there.
      - A compatible timeseries file (see the SWMM5 user manual section 11.6) is written for each location in the working directory.

...

Code Block
titleruninfo.xml
<startUpActivities>
   <purgeActivity>
      <filter>%ROOT_DIR%/input/*.*</filter>
   </purgeActivity>
   <purgeActivity>
      <filter>%ROOT_DIR%/output/*.*</filter>
   </purgeActivity>
   <purgeActivity>
      <filter>%ROOT_DIR%/model/*.*</filter>
   </purgeActivity>
</startUpActivities>
<?xml version="1.0" encoding="UTF-8"?>
<Run xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.wldelft.nl/fews/PI" xsi:schemaLocation="http://www.wldelft.nl/fews/PI http://fews.wldelft.nl/schemas/version1.0/pi-schemas/pi_run.xsd" version="1.5">
    <timeZone>10.0</timeZone>
    <startDateTime date="2019-05-01" time="00:00:00"/>
    <endDateTime date="2020-05-01" time="00:00:00"/>
    <time0 date="2020-05-01" time="00:00:00"/>
    <lastObservationDateTime date="2020-05-01" time="00:00:00"/>
    <workDir>$WORKDIR$\model</workDir>
    <inputTimeSeriesFile>$WORKDIR$\input\rain.xml</inputTimeSeriesFile>
    <inputTimeSeriesFile>$WORKDIR$\input\evaporation.xml</inputTimeSeriesFile>
    <inputTimeSeriesFile>$WORKDIR$\input\level.xml</inputTimeSeriesFile>
    <inputTimeSeriesFile>$WORKDIR$\input\flow.xml</inputTimeSeriesFile>
    <outputDiagnosticFile>$WORKDIR$\piDiagnostic.xml</outputDiagnosticFile>
    <outputTimeSeriesFile>$WORKDIR$\output\outputswmm_links.xml</outputTimeSeriesFile>
    <outputTimeSeriesFile>$WORKDIR$\output\outputswmm_nodes.xml</outputTimeSeriesFile>
    <properties>
        <string key="swmm_input_file" value="$WORKDIR$/model/SWC.inp"/>
        <string key="swmm_report_file" value="$WORKDIR$/model/SWC.rpt"/>
    </properties>
</Run>


SWMM post-adapter

The SWMM post-adapter converts the native model output to  pi-xml files to be imported by Delft-FEWS.

...

Class name: nl.deltares.fews.swmm.SwmmPostAdapter

Properties

SWMM_report_file

(required)

Pathname of SWMM report file (*.rpt) to update. This should be either an absolute path or a path relative to the workDir specified in the netcdf run file.


Notes for users
  • For all files that are written by this adapter, if the file to be written already exists, then it will be overwritten.
  • This program can process timeseries output data per catchment, node or link model entity, and requires that each model entity has a unique ID, regardless of it's entity type.
  • The General adapter must be configured using the exportPlaceholderFile option, to provide a template file for each timeseries output file listed in the PI XML run file. These files will be overwrittten with actual model output after each model run. 
  • The SWMM output report must be properly configured to contain the required output time series (see the SWMM5 user manual section 8.2)
  • This program assumes that the SWMM model configuration uses the same time zone as given in the PI XML run file.
  • The working directory (workDir) defined in the PI XML run file is the directory where the SWMM model will be run, the SWMM report files is expected to be found in this directory.
  • This program writes log messages to a log file called "swmm_post_adapter_log.txt" in the workDir specified in the PI XML run file.
  • This program uses the information in the specified PI XML run file as input and uses this information to perform the following actions:
    1. Scan the report file for log messages (Error or Warning) and transfer these to the post-adapter log file in FEWS format.
    2. Convert output scalar time series per configured location and parameter as follows:
      For each of the timeseries headers in the configured 'placeholder' PI XML file listed in the run file, the location ID and parameter ID are used
      The report file is scanned to find the timeseries ouput for the requested location, and the column for the requested parameter to parse the timeserie output
      The 'template' PI XML file generated by the General adapter is overwritten by the timeseries output data.

...