Versions Compared

Key

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

...

  • 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.

SWMM post-adapter

Model post-adapter for running SWMM (Storm Water Management Model) model (version 5) from Delft-FEWS.
For information about the SWMM model see https://www.epa.gov/water-research/storm-water-management-model-swmm

Usage: SWMMPostAdapter <PI XML run file pathname relative to current working directory>

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.

PI XMl run file example

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>


SWMM post-adapter

Model post-adapter for running SWMM (Storm Water Management Model) model (version 5) from Delft-FEWS.
For information about the SWMM model see https://www.epa.gov/water-research/storm-water-management-model-swmm

Usage: SWMMPostAdapter <PI XML run file pathname relative to current working directory>

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

...

  • 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.

...

Code Block
xml
xml
titleexportActivities
<exportActivities>
	<exportTimeSeriesActivity>
	   <exportFile>rain.xml</exportFile>
	   <timeSeriesSets>
	      <timeSeriesSet>
	         <moduleInstanceId>$SWMM_MODEL$SWMMProcess</moduleInstanceId>
	         <valueType>scalar</valueType>
	         <parameterId>P.obs</parameterId>
	         <locationSetId>stations.P.$MINE$</locationSetId>
	         <timeSeriesType>simulated historical</timeSeriesType>
	         <timeStep id="day_AEST"/>
	         <relativeViewPeriod unit="day" start="-366" end="0" startOverrulable="true"/>
	         <readWriteMode>add originals</readWriteMode>
	      </timeSeriesSet>
	   </timeSeriesSets>
	</exportTimeSeriesActivity>
	<exportTimeSeriesActivity>
	   <exportFile>evaporation.xml</exportFile>
	   <timeSeriesSets>
	      <timeSeriesSet>
	         <moduleInstanceId>$SWMM_MODEL$SWMMProcess</moduleInstanceId>
	         <valueType>scalar</valueType>
	         <parameterId>E.pot</parameterId>
	         <locationSetId>stations.P.$MINE$</locationSetId>
	         <timeSeriesType>simulated historical</timeSeriesType>
	         <timeStep id="day_AEST"/>
	         <relativeViewPeriod unit="day" start="-366" end="0" startOverrulable="true"/>
	         <readWriteMode>add originals</readWriteMode>
	      </timeSeriesSet>
	   </timeSeriesSets>
	</exportTimeSeriesActivity>
	<exportTimeSeriesActivity>
	   <exportFile>level.xml</exportFile>
	   <timeSeriesSets>
	      <timeSeriesSet>
	         <moduleInstanceId>$SWMM_MODEL$SWMMProcess</moduleInstanceId>
	         <valueType>scalar</valueType>
	         <parameterId>H.obs</parameterId>
	         <locationSetId>stations.ml.$MINE$.H</locationSetId>
	         <timeSeriesType>simulated historical</timeSeriesType>
	         <timeStep id="month_AEST"/>
	         <relativeViewPeriod unit="day" start="-366" end="0" startOverrulable="true"/>
	 <exportActivities>
	<exportTimeSeriesActivity>
	   <exportFile>rain.xml</exportFile>
	   <timeSeriesSets>
	      <timeSeriesSet>
	        <readWriteMode>add <moduleInstanceId>$SWMM_MODEL$SWMMProcess<originals</moduleInstanceId>readWriteMode>
	      </timeSeriesSet>
	   <valueType>scalar</valueType></timeSeriesSets>
	</exportTimeSeriesActivity>
	<exportTimeSeriesActivity>
	         <parameterId>P.obs</parameterId><exportFile>flow.xml</exportFile>
	   <timeSeriesSets>
	      <locationSetId>stations.P.$MINE$</locationSetId><timeSeriesSet>
	         <timeSeriesType>simulated historical</timeSeriesType><moduleInstanceId>$SWMM_MODEL$SWMMProcess</moduleInstanceId>
	         <timeStep id="day_AEST"/><valueType>scalar</valueType>
	         <relativeViewPeriod unit="day" start="-366" end="0" startOverrulable="true"/><parameterId>Q.ml</parameterId>
	         <readWriteMode>add originals</readWriteMode><locationSetId>stations.ml.$MINE$.Q</locationSetId>
	       </timeSeriesSet>
	  <timeSeriesType>simulated <historical</timeSeriesSets>timeSeriesType>
	</exportTimeSeriesActivity>
	<exportTimeSeriesActivity>
	   <exportFile>evaporation.xml</exportFile>
	   <timeSeriesSets>
	      <timeSeriesSet>
	     <timeStep id="day_AEST"/>
	    <moduleInstanceId>$SWMM_MODEL$SWMMProcess</moduleInstanceId>
	     <relativeViewPeriod unit="day" start="-366"  <valueType>scalar</valueType>end="0" startOverrulable="true"/>
	         <readWriteMode>add <parameterId>E.pot<originals</parameterId>readWriteMode>
	      </timeSeriesSet>
	   <locationSetId>stations.P.$MINE$</locationSetId></timeSeriesSets>
	</exportTimeSeriesActivity>
	<exportDataSetActivity>
	         <timeSeriesType>simulated historical</timeSeriesType><moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
	</exportDataSetActivity>
	<exportRunFileActivity>
	         <timeStep id="day_AEST"/><exportFile>runinfo.xml</exportFile>
	    <properties>
	     <relativeViewPeriod unit="day" start="-366" end="0" startOverrulable="true <string key="swmm_input_file" value="%ROOT_DIR%/model/$SWMM_INP_FILE$"/>
	      <string   <readWriteMode>add originals</readWriteMode>
	      </timeSeriesSet>key="swmm_report_file" value="%ROOT_DIR%/model/$SWMM_RPT_FILE$"/>
	   </timeSeriesSets>properties>
	</exportTimeSeriesActivity>
	<exportTimeSeriesActivity>
	   <exportFile>level.xml</exportFile>
	   <timeSeriesSets>
	      <timeSeriesSet>
	         <moduleInstanceId>$SWMM_MODEL$SWMMProcess</moduleInstanceId>exportRunFileActivity>
</exportActivities>
Execute activities

This section calls the SWMM pre and post-adapters as well as the SWMM executable. Note: the run file must be passed as an argument to the SWMM pre and post-adapters.

Code Block
xml
xml
titleexecuteActivities
<executeActivities>
	<executeActivitys>
	         <valueType>scalar</valueType>
	         <parameterId>H.obs</parameterId><description>Run SWMM pre</description>
	   <command>
	      <locationSetId>stations<className>nl.deltares.mlfews.$MINE$swmm.H<SwmmPreAdapter</locationSetId>className>
	      <binDir>$SWMM_BIN$</binDir>
	   <timeSeriesType>simulated   historical<<moduleDataSetName>UpdateSoftwareSWMM</timeSeriesType>moduleDataSetName>
	   </command>
	   <arguments>
	   <timeStep id="month_AEST"/>   <argument>%ROOT_DIR%/input/runinfo.xml</argument>
	   </arguments>
	   <logFile>
	   <relativeViewPeriod unit="day" start="-366" end="0" startOverrulable="true"/> <file>%ROOT_DIR%/input/swmm_pre_adapter_log.txt</file>
	      <infoLinePattern>*   <readWriteMode>add originals</readWriteMode>INFO *</infoLinePattern>
	      <warningLinePattern>* WARNING *</timeSeriesSet>warningLinePattern>
	      <errorLinePattern>* ERROR *</timeSeriesSets>
	</exportTimeSeriesActivity>errorLinePattern>
	<exportTimeSeriesActivity>
	   <exportFile>flow.xml<</exportFile>logFile>
	   <timeSeriesSets><timeOut>3600000</timeOut>
	      <timeSeriesSet>
	         <moduleInstanceId>$SWMM_MODEL$SWMMProcess</moduleInstanceId>
	   <ignoreDiagnostics>true</ignoreDiagnostics>
	</executeActivity>
	<executeActivity>
	   <description>Run   <valueType>scalar<SWMM</valueType>description>
	   <command>
	      <parameterId>Q.ml</parameterId><executable>$SWMM_BIN$/swmm5.exe</executable>
	         <locationSetId>stations.ml.$MINE$.Q</locationSetId></command>
	   <arguments>
	      <timeSeriesType>simulated historical</timeSeriesType>
	   <argument>%ROOT_DIR%/model/$SWMM_INP_FILE$</argument>
	      <timeStep id="day_AEST"/><argument>%ROOT_DIR%/model/$SWMM_RPT_FILE$</argument>
	   </arguments>
	   <timeOut>3600000</timeOut>
	   <relativeViewPeriod unit="day" start="-366" end="0" startOverrulable="true"/><ignoreDiagnostics>true</ignoreDiagnostics>
	</executeActivity>
	<executeActivity>
	   <description>Run SWMM post</description>
	   <command>
	      <readWriteMode>add originals</readWriteMode><className>nl.deltares.fews.swmm.SwmmPostAdapter</className>
	      <<binDir>$SWMM_BIN$</timeSeriesSet>binDir>
	   </timeSeriesSets>command>
	</exportTimeSeriesActivity>
	<exportDataSetActivity>
   <arguments>
    	   <moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
	</exportDataSetActivity>
	<exportRunFileActivity>
	   <exportFile>runinfo.xml</exportFile>
	   <properties><argument>%ROOT_DIR%/input/runinfo.xml</argument>
	   </arguments>
	   <logFile>
	      <file>%ROOT_DIR%/input/swmm_post_adapter_log.txt</file>
	      <infoLinePattern>* INFO *</infoLinePattern>
	      <string key="swmm_input_file" value="%ROOT_DIR%/model/$SWMM_INP_FILE$"/><warningLinePattern>* WARNING *</warningLinePattern>
	      <string key="swmm_report_file" value="%ROOT_DIR%/model/$SWMM_RPT_FILE$"/><errorLinePattern>* ERROR *</errorLinePattern>
	   </logFile>
	   <timeOut>3600000</timeOut>
	   <<ignoreDiagnostics>true</properties>ignoreDiagnostics>
	</exportRunFileActivity>executeActivity>
</exportActivities>executeActivities>

...

Import activities

This In this section calls the SWMM pre and post-adapters as well as the SWMM executable. Note: the run file must be passed as an argument to the SWMM pre and post-adapters.the data to be imported into FEWS as output from the module is specified. Data to import from SWMM generally includes:

  • Output timeseries data (water levels, flows)

Code Block
xml
xml
titleexecuteActivitiesimportActivities
<executeActivities><importActivities>
	<executeActivitys>
	   <description>Run SWMM pre</description><importTimeSeriesActivity>
	   <command>
	      <className>nl.deltares.fews.swmm.SwmmPreAdapter</className>
	<exportPlaceholderFile>true</exportPlaceholderFile>
      <binDir>$SWMM<importFile>outputswmm_BIN$</binDir>
	   links.xml</importFile>
   <moduleDataSetName>UpdateSoftwareSWMM</moduleDataSetName>
	   </command><timeSeriesSets>
	   <arguments>
	      <argument>%ROOT_DIR%/input/runinfo.xml</argument>
	<timeSeriesSet>
   </arguments>
	   <logFile>
	      <file>%ROOT_DIR%/input/swmm_pre_adapter_log.txt</file>
	      <infoLinePattern>* INFO *</infoLinePattern>
	<moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
          <warningLinePattern>* WARNING *<<valueType>scalar</warningLinePattern>valueType>
	       <errorLinePattern>* ERROR *</errorLinePattern>
	   <<parameterId>Q.gw</logFile>parameterId>
	     <timeOut>3600000</timeOut>
	   <ignoreDiagnostics>true</ignoreDiagnostics>
	</executeActivity>
	<executeActivity>
	   <description>Run SWMM</description>
	 <locationSetId>stations.ml.$MINE$.H</locationSetId>
    <command>
	      <executable>$SWMM_BIN$/swmm5.exe</executable>
	  <timeSeriesType>simulated <historical</command>timeSeriesType>
	   <arguments>
	      <argument>%ROOT_DIR%/model/$SWMM_INP_FILE$</argument>
	      <argument>%ROOT_DIR%/model/$SWMM_RPT_FILE$</argument>
	   </arguments>
	   <timeOut>3600000</timeOut>
	   <ignoreDiagnostics>true</ignoreDiagnostics>
	</executeActivity>
	<executeActivity>
	   <description>Run SWMM post</description>
	   <command>
	<timeStep id="day_AEST"/>
            <readWriteMode>add originals</readWriteMode>
         <className>nl.deltares.fews.swmm.SwmmPostAdapter</className>
	      <binDir>$SWMM_BIN$</binDir>
	</timeSeriesSet>
      </command>timeSeriesSets>
	   <arguments>
    	  <argument>%ROOT_DIR%/input/runinfo.xml</argument>
	   </arguments>
	   <logFile>
	      <file>%ROOT_DIR%/input/swmm_post_adapter_log.txt</file>
	      <infoLinePattern>* INFO *</infoLinePattern>
	      <warningLinePattern>* WARNING *</warningLinePattern>
	      <errorLinePattern>* ERROR *</errorLinePattern>
	   </logFile>
	   <timeOut>3600000</timeOut>
	   <ignoreDiagnostics>true</ignoreDiagnostics>
	</executeActivity>
</executeActivities>
Import activities

In this section the data to be imported into FEWS as output from the module is specified. Data to import from SWMM generally includes:

...

</importTimeSeriesActivity>
</importActivities>

PI XML Run file example

Typically, the genaral adapter exports one PI XML runfile for use by both adapters, as in the below example.

Code Block
titleruninfo.xml
<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>D:\FEWS\REGIONHOME\Modules\swmm\model</workDir>
    <inputTimeSeriesFile>D:\FEWS\REGIONHOME\Modules\swmm\input\rain.xml</inputTimeSeriesFile>
    <inputTimeSeriesFile>D:\FEWS\REGIONHOME\Modules\swmm\input\evaporation.xml</inputTimeSeriesFile>
    <inputTimeSeriesFile>D:\FEWS\REGIONHOME\Modules\swmm\input\level.xml</inputTimeSeriesFile>
    <inputTimeSeriesFile>D:\FEWS\REGIONHOME\Modules\swmm\input\flow.xml</inputTimeSeriesFile>
    <outputDiagnosticFile>D:\FEWS\REGIONHOME\Modules\swmm\piDiagnostic.xml</outputDiagnosticFile>
    <outputTimeSeriesFile>D:\FEWS\REGIONHOME\Modules\swmm\output\outputswmm_links.xml</outputTimeSeriesFile>
    <properties>
Code Block
xmlxml
titleimportActivities
<importActivities>
   <importTimeSeriesActivity>
	  <exportPlaceholderFile>true</exportPlaceholderFile>
      <importFile>outputswmm_links.xml</importFile>
      <timeSeriesSets>
         <timeSeriesSet>
            <moduleInstanceId>$MODULE_INSTANCE_ID$</moduleInstanceId>
            <valueType>scalar</valueType>
            <parameterId>Q.gw</parameterId>
            <locationSetId>stations.ml.$MINE$.H</locationSetId>
            <timeSeriesType>simulated historical</timeSeriesType>
        <string    <timeStep id="day_AEST"/>
            <readWriteMode>add originals</readWriteMode>
key="swmm_input_file" value="$WORKDIR$/model/SWC.inp"/>
        <string  </timeSeriesSet>
 key="swmm_report_file" value="$WORKDIR$/model/SWC.rpt"/>
     </timeSeriesSets>properties>
   </Run></importTimeSeriesActivity>
</importActivities>startUpActivities>

Please note that the <outputDiagnosticFile> element is required, even though it is not actually used in this configuration.