Difference between revisions of "XPSWMM to TUFLOW-SWMM"

From Tuflow
Jump to navigation Jump to search
 
(245 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
= Introduction =
 
= Introduction =
This Wiki page outlines recommended steps for conversion of an XPSWMM model to TUFLOW. <br>
+
This Wiki page outlines recommended steps for the conversion of an XPSWMM model to TUFLOW. <br>
 
 
XPSWMM is a flood and urban stormwater drainage modeling software developed by Autodesk (previously Innovyze and XP Solutions). The XPSWMM solution uses EPA SWMM for its 1D calculations, dynamically linked to TUFLOW for its 2D calculations. The software functions within a custom build Graphical User interface (GUI). During simulation, XPSWMM calls a TUFLOW dynamic library for the 2D calculations. As XPSWMM uses TUFLOW for its 2D engine, XPSWMM and TUFLOW use the same 2D solution and will achieve identical results if configured in a like-for-like way.
 
 
 
Common user feedback suggests the XPSWMM GUI is useful for simple modeling projects; however, it can become cumbersome and inefficient in workflow when dealing with larger datasets and/or a large volume of different scenario and event simulations. In response to requests from USA XPSWMM users who want to convert XPSWMM models into a native TUFLOW format, TUFLOW linkage with 1D EPA Storm Water Management Model (SWMM) was added as a supported feature in TUFLOW 2023-03-AD release. The modeling workflow in TUFLOW differs from XPSWMM, as TUFLOW modeling is integrated with QGIS (Geographical Information System) GIS software. This GIS integration is well-suited for working with larger datasets. Additionally, the structural design associated with TUFLOW modeling makes its general workflow extremely efficient, particularly for the automated management of multiple scenarios and events.
 
  
 +
XPSWMM is a flood and urban stormwater drainage modeling software developed by Autodesk (previously Innovyze and XP Solutions). The XPSWMM solution uses EPA SWMM for its 1D calculations, dynamically linked to TUFLOW for its 2D calculations. The software functions within a custom build Graphical User Interface (GUI). Unknown to many XPSWMM modelers, during simulation, XPSWMM processes its inputs into TUFLOW files and also calls TUFLOW for the 2D calculations. As XPSWMM uses TUFLOW for its 2D engine, like-for-like results can be achieved using this software. The modeling workflow in TUFLOW differs from XPSWMM, as TUFLOW modeling is integrated with QGIS (Geographical Information System) GIS software instead of embedded within a software specific Graphical User Interface.
  
 
If you are building a TUFLOW SWMM model from scratch, not from XPSWMM, please refer to the <u>[[TUFLOW_SWMM_Tutorial_Introduction | TUFLOW SWMM Tutorials]]</u>. Tutorials are provided for the following topics:
 
If you are building a TUFLOW SWMM model from scratch, not from XPSWMM, please refer to the <u>[[TUFLOW_SWMM_Tutorial_Introduction | TUFLOW SWMM Tutorials]]</u>. Tutorials are provided for the following topics:
Line 12: Line 9:
 
* <u>[[TUFLOW SWMM Tutorial M03 | TUFLOW SWMM Module 3]]</u> - 1D SWMM Pipe Network / 1D SWMM Urban Hydrology
 
* <u>[[TUFLOW SWMM Tutorial M03 | TUFLOW SWMM Module 3]]</u> - 1D SWMM Pipe Network / 1D SWMM Urban Hydrology
 
* <u>[[TUFLOW SWMM Tutorial M04 | TUFLOW SWMM Module 4]]</u> - 1D SWMM Pipe Network / 1D SWMM Urban Hydrology: Executing multiple different event simulations from a single model control file.
 
* <u>[[TUFLOW SWMM Tutorial M04 | TUFLOW SWMM Module 4]]</u> - 1D SWMM Pipe Network / 1D SWMM Urban Hydrology: Executing multiple different event simulations from a single model control file.
<br>
 
  
== TUFLOW Licensing / XPSWMM Discount ==
+
== Dataset Download ==
If you are an existing / or past XPSWMM perpetual license owner who would like to purchase a TUFLOW license, please contact <u>[mailto::sales@tuflow.com sales@tuflow.com]</u>. You may be eligible for an XPSWMM / TUFLOW discount in recognition of past royalties Autodesk paid TUFLOW when you purchased an XPSWMM perpetual license. <br>
+
The dataset used for this model conversion demonstration is available for download here: <u>[https://downloads.tuflow.com/SWMM/XPSWMM_XPX_to_TUFLOW_Conversion.zip XPSWMM XPX to TUFLOW Conversion Dataset]</u>. <br>
<br>
+
This dataset contains the XPSWMM model and the resulting TUFLOW model that is created. These can be found in the '''XPSWMM''' and '''Complete_Conversion''' folders respectively. <br>
  
= XPSWMM to TUFLOW Model Conversion=
+
'''If you are using this example conversion dataset, please rerun the XPSWMM model in the location where you save the dataset before beginning your own TUFLOW model conversion.''' Rerunning the model is necessary because XPSWMM will write TUFLOW files during its preprocessing, subsequently defining the correct file path information (for the location where you saved your files) in the newly written TUFLOW files. We also recommend creating your own TUFLOW model in a different folder from the provided TUFLOW dataset so you can easily compare your model against it.<br>
== Two Dimensional (2D) Model Elements ==
 
XPSWMM writes TUFLOW model files when it pre-processes the model inputs defined in its GUI (prior to the hydraulic calculations). Using default settings, XPSWMM typically writes the TUFLOW files to the '''2D\Data''' folder.<br>  
 
  
The following sections explain how 2D data can be exported from XPSWMM and/or reconfigured into a format that is more standard of a TUFLOW model. The conversion has been summarized into three steps:
+
If you do not have access to a XPSWMM license and the XPSWMM Application, please refer to the <u>[[XPSWMM_to_TUFLOW-SWMM_Troubleshooting#Model_Conversion_Without_a_XPSWMM_License |XPSWMM to TUFLOW SWMM Troubleshooting]]</u> page. <br>
<ol>
 
<li> Obtain Digital Terrain Model (DTM) dataset for TUFLOW model.
 
<li> Use TUFLOW's Processing Tool to configure the XPSWMM written TUFLOW files into a standard TUFLOW folder structure and GIS database format.
 
<li> Manual optional changes to the TUFLOW control files.
 
</ol>
 
<br>
 
  
=== Digital Terrain Model (DTM) Data ===
+
= XPSWMM to TUFLOW Model Conversion =
 +
== Export Data From XPSWMM Model ==
 +
'''Digital Terrain Model (DTM) Data'''<br>
 
XPSWMM reads its 2D DTM data in one of two ways:
 
XPSWMM reads its 2D DTM data in one of two ways:
 
* The DTM data can be directly specified in the '2D Model Settings', or  
 
* The DTM data can be directly specified in the '2D Model Settings', or  
 
* The DTM data can be internally processed by XPSWMM using its terrain tools and DTM builder.  
 
* The DTM data can be internally processed by XPSWMM using its terrain tools and DTM builder.  
Depending which method is applied to your XPSWMM model, the steps required to convert the model to TUFLOW will vary.  
+
Depending on which method is applied to your XPSWMM model, the steps required to will vary. Review which method is used:
 
 
Let's review what method is used:
 
 
<ol>
 
<ol>
 
<li> Open your existing model in XPSWMM.
 
<li> Open your existing model in XPSWMM.
<li> In the top dropdown menu options, navigate to Configuration >> Job control >> 2D Model Settings. This will open a dialog.  
+
<li> In the top dropdown menu options, go to Configuration > Job Control > 2D Model Settings. This will open a dialog.  
 
<li> Under '2D Hydraulics Job Control', select 'Surface & Sampling'.  
 
<li> Under '2D Hydraulics Job Control', select 'Surface & Sampling'.  
 
<li> Review the options in the 'Surface' section:
 
<li> Review the options in the 'Surface' section:
:* If 'Use DTM' is selected: Continue to the section below (<u>[[#XPSWMM_DTM_Preprocessing | XPSWMM DTM Preprocessing]]</u>) and complete the steps.
+
:* If 'Use DTM' is selected: Continue to the section below (<u>[[XPSWMM_to_TUFLOW-SWMM#Export_DTM_Data_from_XPSWMM |Export DTM Data from XPSWMM]]</u>) and complete the steps.
:* If 'Use Grid File for Topography' is selected and a 'Grid file' is specified: Go to the <u>[[#Convert_XPSWMM_Model_to_Recommended_TUFLOW_Structure | Convert XPSWMM Model to Recommended TUFLOW Structure]]</u> section. The steps outlined in the 'XPSWMM DTM Preprocessing' section can be skipped.
+
:* If 'Use Grid File for Topography' is selected and a 'Grid file' is specified, the steps outlined in the 'Export DTM Data From XPSWMM' section can be skipped. Go to the <u>[[XPSWMM_to_TUFLOW-SWMM#Export_XPX_Data_From_XPSWMM|Export XPX Data From XPSWMM]]</u> section.
<br>
+
'''Note:''' If you have a .tif elevation file, you can continue to the <u>[[XPSWMM_to_TUFLOW-SWMM#Export_XPX_Data_From_XPSWMM|Export XPX Data From XPSWMM]]</u> section. The conversion process will be identical however, once converted, you will have to create the '''TUFLOW\model\grid''' folder manually and copy the .tif file into it.  
'''<font color="red">Video</font>'''
+
<br><br>
 +
{{Video|name=Animation_XPtoTUFLOW_Export_Data_01b.mp4|width=1350}}
 
<br>
 
<br>
 
</ol>
 
</ol>
<br>
 
 
====XPSWMM DTM Preprocessing====
 
If 'Use DTM' was selected, XPSWMM pre-processes its Digital Terrain Model (DTM) into a binary XPTIN elevation dataset for inclusion in the TUFLOW model. XPTIN is a propriety format that can't readily be used in GIS software. For this reason, the following section outlines how to obtain a DTM dataset in a GIS friendly form. <br>
 
 
:'''Note:''' If 'Use DTM' was selected, follow the steps below. Otherwise, <u>do not</u> complete these steps; continue to the <u>[[#Convert_XPSWMM_Model_to_Recommended_TUFLOW_Structure | Convert XPSWMM Model to Recommended TUFLOW Structure]]</u> section.
 
 
  
XPSWMM provides two options for preprocessing the DTM to be used in the TUFLOW model, both options are outlined below. As 'Option 1' is straightforward and 'Option 2' is more involved, 'Option 2' is demonstrated in the video below.
+
=== Export DTM Data From XPSWMM ===
<br>
+
If 'Use DTM' was selected, XPSWMM preprocesses its Digital Terrain Model (DTM) into a binary XPTIN elevation dataset for inclusion in the TUFLOW model. XPTIN is a binary format that can't readily be used in GIS software. For this reason, the following steps outline how to obtain a DTM dataset in a GIS friendly form.
:'''Option 1 (recommended)''' - Use Original Source Elevation Data Imported to XPSWMM:
 
<ol>
 
<li> Locate the original 'Grid' file (.asc or .flt/.hdr format). Save it to the folder where XPSWMM writes the .tcf during its simulation preprocessing. By default, this is the '''2D\Data''' folder. <br>
 
If this folder does not exist, either:
 
:* The XPSWMM model has not run, so the TUFLOW control files have not been created by XPSWMM. Run the XPSWMM model (go to Analyze >> Solve... in top dropdown menu options).
 
:* Non-default output settings have been specified in XPSWMM. To determine the output location, in the top dropdown menu options, go to Configuration >> Job Control >> 2D Model Settings >> Folder Options. Ensure the following 'Folder Locations' are selected:
 
::[[File: XPSWMM_to_TUFLOW_2DJobControl_FolderOptions_Dialog_01c.png]]<br>
 
<br>
 
<li> In the top dropdown menu options, navigate to Configuration >> Job control >> 2D Model Settings. This will open a dialog, under '2D Hydraulics Job Control', select 'Surface & Sampling'.
 
<li> Tick on 'Use grid file for topography' and select '...' to navigate to the Grid file saved in the '''2D\Data''' folder. This file will be read directly into TUFLOW.  
 
<li> Click 'OK' to save the settings.  
 
<li> If these steps worked as expected, skip 'Option 2' and continue to the next section. Otherwise, proceed to 'Option 2'.  
 
</ol>
 
<br>
 
 
 
:'''Option 2''' - Export DTM Data from XPSWMM:
 
 
<ol>
 
<ol>
 
<li> In the XPSWMM Layers panel, under 'Topography', right click on '''DTM''' and select 'Export DTM Data'.  
 
<li> In the XPSWMM Layers panel, under 'Topography', right click on '''DTM''' and select 'Export DTM Data'.  
 
:* Input TIN File: Select the relevant XPSWMM Input TIN file.  
 
:* Input TIN File: Select the relevant XPSWMM Input TIN file.  
 
:* Output File Format: 'ASCII Grid File Format'.
 
:* Output File Format: 'ASCII Grid File Format'.
:* Cell Size Value: Choose a suitable DTM resolution. This resolution should be finer than the hydraulic model resolution. Typically, a DTM resolution is 1/10th (or smaller) of the hydraulic model 2D cell size.  
+
:* Cell Size Value: Choose a suitable DTM resolution. This resolution should be finer than the hydraulic model resolution. Typically, a DTM resolution is 1/5th to 1/10th of the hydraulic model 2D cell size is common (1 in the example dataset).
 +
''Note: XPSWMM requires an integer cell size value for this export step. For example, Cell Size Values of 1, 2, 3, 4, 5 ... are suitable. The XPSWMM export will not function if you specify a decimal cell size value (eg. 0.5, 2.5, etc.).'' 
 
<li> Click 'Export'.
 
<li> Click 'Export'.
<li> Save the file to the folder where XPSWMM writes the .tcf during its simulation preprocessing. By default, this is the '''2D\Data''' folder. <br>
+
<li> Save the file under an appropriate name (e.g. '''1D2D_Urban_Grid.asc''') to the folder where XPSWMM writes the .tcf during its simulation preprocessing. By default, this is the '''2D\Data''' folder. <br>
 
If this folder does not exist, either:
 
If this folder does not exist, either:
:* The XPSWMM model has not run, so the TUFLOW control files have not been created by XPSWMM. Run the XPSWMM model (go to Analyze >> Solve... in top dropdown menu options).
+
:* The XPSWMM model has not run, so the TUFLOW control files have not been created by XPSWMM. Run the XPSWMM model (go to Analyze > Solve... in top dropdown menu options).
:* Non-default output settings have been specified in XPSWMM. To determine the output location, in the top dropdown menu options, go to Configuration >> Job Control >> 2D Model Settings >> Folder Options. Ensure the 'Folder Locations' shown in the image above are selected.
+
:* Non-default output settings have been specified in XPSWMM. To determine the output location, in the top dropdown menu options, go to Configuration > Job Control > 2D Model Settings > Folder Options. Ensure the following 'Folder Locations' are selected.
<li> In the top dropdown menu options, navigate to  Configuration >> Job Control >> 2D Model Settings. This will open a dialog, under '2D Hydraulics Job Control', select 'Surface & Sampling'.
+
::[[File: XPSWMM_to_TUFLOW_2DJobControl_FolderOptions_Dialog_01e.png]]<br><br>
 +
 
 +
<li> In the top dropdown menu options, navigate to  Configuration > Job Control > 2D Model Settings. This will open a dialog, under '2D Hydraulics Job Control', select 'Surface & Sampling'.
 
<li> Tick on 'Use grid file for topography' and select '...' to navigate to the Grid file saved in the '''2D\Data''' folder. This file will be read directly into TUFLOW.  
 
<li> Tick on 'Use grid file for topography' and select '...' to navigate to the Grid file saved in the '''2D\Data''' folder. This file will be read directly into TUFLOW.  
 
<li> Click 'OK' to save the settings.  
 
<li> Click 'OK' to save the settings.  
 +
<li> Run the XPSWMM model to rewrite the TUFLOW files (including the new linkage to the DTM dataset) to the Data folder (go to Analyze > Solve... in top dropdown menu options).
 
<br><br>
 
<br><br>
<font color="red">'''Video'''</font>
+
{{Video|name=Animation_XPtoTUFLOW_Export_Data_02b.mp4|width=1350}}
 
<br>
 
<br>
 
</ol>
 
</ol>
 +
 +
=== Export XPX Data From XPSWMM ===
 +
A XPX file is a simple command line file that contains the information needed to create link and node objects. To export this data from the XPSWMM model:
 +
<ol>
 +
<li> In XPSWMM, in the top dropdown menu options, navigate to File > Import/Export Data > Export XPX Data. This will open a dialog. Leave all options as default and click 'Export'.
 +
<li> When prompted, save the file under an appropriate name (eg '''1D2D_Urban_001.xpx''') to the folder where the XPSWMM model is located.
 +
<br><br>
 +
{{Video|name=Animation_XPtoTUFLOW_Export_Data_03b.mp4|width=1350}}
 
<br>
 
<br>
 +
</ol>
  
=== Convert XPSWMM Model to Recommended TUFLOW Structure ===
+
== Convert XPSWMM Model to TUFLOW SWMM ==
When XPSWMM writes its TUFLOW files, it consolidates all the information into a single folder (typically the '''2D\Data''' folder). This is not a standard TUFLOW structure. The standard structure used by the majority of TUFLOW modelers globally includes the following subfolders:
+
Ensure you have QGIS and have the QGIS TUFLOW Plugin installed:
 +
*Install QGIS 3.34 or later: <u>[https://www.qgis.org/en/site/forusers/download.html Latest 64-bit version of QGIS]</u>.
 +
*Install the QGIS TUFLOW Plugin by following the instructions, <u>[[TUFLOW_QGIS_Plugin | QGIS TUFLOW Plugin Installation]]</u>.
  
{| class="wikitable" width="80%" style="text-align:center"
+
The following steps outline the process of converting a XPSWMM model to TUFLOW SWMM using the '<u>[[QGIS_SWMM_Convert_XPSWMM_Model_From_XPX|Convert - XPSWMM model from XPX]]</u>' processing tool.
!style="background-color:#005581; font-weight:bold; color:white;"| Folder
 
!style="background-color:#005581; font-weight:bold; color:white;"| Folder
 
!style="background-color:#005581; font-weight:bold; color:white;"| Folder Purpose
 
 
 
|-
 
|rowspan="10"|[[File:TUFLOW_Folder_Structure.JPG | 150px]]
 
|-
 
|colspan="2"|'''Folders typically saved to the network within a folder titled TUFLOW'''
 
|-
 
| runs || TUFLOW Control File(s) (.tcf), the primary file(s) used to run TUFLOW simulations, are saved here.
 
|-
 
| runs\log || TUFLOW simulation log and error/warning message files are written here during a model simulation.
 
|-
 
| bc_dbase || Input boundary condition database(s) and time-series data for 1D and 2D domains are saved here.
 
|-
 
| model || TUFLOW's second level control files (.tgc, .tbc, .tscf, .ecf) are saved here.
 
|-
 
| model\gis <br> model\grid <br> model\mi <br> model\swmm || GIS layers defining the input spatial datasets are saved here.
 
|-
 
|colspan="2"|'''Folders typically saved to a computers local drive in a Project folder'''
 
|-
 
| results || TUFLOW simulation results are written here during a model simulation.
 
|-
 
| check || TUFLOW simulation check files are written here during a model simulation.
 
|}
 
 
 
<br>
 
To simplify the process of converting the XPSWMM model to the recommended TUFLOW SWMM folder structure, we have created a processing tool. This tool converts the GIS format of the XPSWMM model, creates the recommended TUFLOW folder structure and saves the converted model files to their correct locations. For more information on the processing tool, see <u>[[Convert_TUFLOW_Model_GIS_Format | Convert TUFLOW Model GIS Format]]</u>.
 
  
 
<ol>
 
<ol>
<li> Open QGIS. If you do not have QGIS installed:
+
<li> Open QGIS and go to Processing > Toolbox from the top dropdown menu options to open the Processing Toolbox.
:*Install QGIS 3.34 or later: <u>[https://www.qgis.org/en/site/forusers/download.html Latest 64-bit version of QGIS]</u>.
+
<li> Go to TUFLOW >> SWMM in the processing tool list and select '<u>[[QGIS_SWMM_Convert_XPSWMM_Model_From_XPX|Convert - XPSWMM model from XPX]]</u>'. This opens the dialog shown below.
:*Install the QGIS TUFLOW Plugin by following the instructions, <u>[[TUFLOW_QGIS_Plugin | QGIS TUFLOW Plugin Installation]]</u>.
+
:* XPSWMM Exported XPX File: Click '...' and navigate to the exported XPX data (e.g. '''1D2D_Urban_001.xpx'''). This should be located in the same folder as the XPSWMM model.
<li> In QGIS, go to Processing > Toolbox from the top dropdown menu options to open the Processing Toolbox.
+
:* TUFLOW TCF Filename: Click '...' and navigate to the XPSWMM .tcf. This should be located in the '''2D\Data''' folder (e.g. '''2D\Data >> 1D2D_Urban_001.tcf''').
<li> Go to 'TUFLOW' in the processing tool list and select '<u>[[Convert_TUFLOW_Model_GIS_Format |Convert TUFLOW Model GIS Format]]</u>'. This opens the dialog shown below.
+
:* SWMM File Prefix: Choose an appropriate prefix for the SWMM files (e.g. '''1D2D_Urban_swmm''').
:* TCF: Click '...' and navigate to the XPSWMM .tcf.  
+
:* Output Solution Scheme: 'HPC'
 +
:* Output Hardware Specification: 'GPU' (if GPU is not available, select 'CPU')
 
:* Output Vector Format: 'GPKG'
 
:* Output Vector Format: 'GPKG'
 
:* Output Raster Format: 'GTIFF'
 
:* Output Raster Format: 'GTIFF'
:* Output Profile: Any option can be used. 'ALL IN ONE' is used in this example for model design consistency with the <u>[[Tutorial_Introduction | TUFLOW SWMM Tutorials]]</u>.  
+
:* Output Profile: Any option can be used. 'ALL IN ONE' is used in this example for model design consistency with the <u>[[Tutorial_Introduction | TUFLOW SWMM Tutorials]]</u>.
:* Output Folder: Click '...' and navigate to an appropriate location to save your TUFLOW model. In this location, create a new folder called '''TUFLOW''' and select it.  
+
:* Event name if no global storms: Choose an appropriate event name if applicable (100yr in the example dataset).
:* Advanced Parameters:
+
:* BC width for created 1D/2D connections (HX/SX): This value should be approximately 2 times the width of the hydraulic model 2D cell size (10 in the example dataset).
::* Tick on 'Write empty files'.
+
:* BC offset distance for created 1D/2D connections (HX/SX): Distance from the channel endpoint to the midpoint of the BC line (2 in the example dataset).
::* Output CRS: Select an appropriate Coordinate Reference System (CRS) for the model.
+
:* Output Folder: Click '...' and navigate to an appropriate location to save your TUFLOW model. In this location, create a new folder called '''TUFLOW''' and select it.
::* Tick on 'Force TUFLOW Directory Structure'.
+
:* Output CRS: Select an appropriate Coordinate Reference System (CRS) for the model. For the demonstration model, the CRS is 'EPSG:32760 - WGS 84 / UTM zone 60S'.
<li> Click 'Run'.
+
<li> Click 'Run'. Once the tool is finished, click 'Close'.
 +
<br><br>
 +
{{Video|name=Animation_XPtoTUFLOW_Convert_01c.mp4|width=1350}}
 +
<br>
 
</ol>
 
</ol>
'''<font color="red">Note: Update text further here after Ellis updates Plugin
 
* TUFLOw Folder
 
* SWMM Folder</font>'''
 
 
'''<font color="red">Video</font>'''
 
 
<br><br>
 
 
=== Clean TUFLOW Control File ===
 
In the process of converting a model, the <u>[[Convert_TUFLOW_Model_GIS_Format |Convert TUFLOW Model GIS Format]]</u> tool adds commands to control files. While these control files will allow the converted model to run, they have not been structured neatly. To maintain an easy to read and effective model, it is recommended to 'clean up' the TUFLOW control files. This can be done by:
 
:* Including a title at the beginning of each control file. For example, <font color="green"><tt>! TUFLOW CONTROL FILE (.TCF) defines the model simulation parameters and directs input from other data sources</tt></font>.
 
:* Adding headings to sections of the control file. For example, <font color="green"><tt>! MODEL INITIALIZATION</tt></font> could be used as a header for the commands required to initialize the TUFLOW SWMM model.
 
:* Using comments to explain the purpose of commands. For example, <font color="blue"><tt>Spatial Database </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> ..\model\gis\1D2D_Urban_001.gpkg </tt></font> <font color="green"><tt> ! Specify the location of the GeoPackage Spatial Database</tt></font>.<br>
 
:* Using relative file paths to specify the location of various files and layers in the model.
 
 
The example below demonstrates how to clean up a TCF.
 
 
<font color="red"><tt>Emilie, I haven't worked on the text below. You're welcome to write something here if you feel confident doing it </tt></font>
 
 
 
 
<br><br>
 
  
=== Load TUFLOW Model in QGIS ===
+
Inspect the output of the '<u>[[QGIS_SWMM_Convert_XPSWMM_Model_From_XPX|Convert - XPSWMM model from XPX]]</u>' processing tool and load the TUFLOW model into QGIS:
Load and style the TUFLOW model in QGIS:
 
 
<ol>
 
<ol>
<li> Click on the ‘Load TUFLOW Layers from TCF’ symbol from the TUFLOW Plugin toolbar.
+
<li> In Windows File Explorer, inspect the files output by the processing tool. In particular:
 +
* The '''TUFLOW\bc_dbase''' folder contains the BC Database which will contain any curves used in BC conditions, for easy extending to other events.
 +
* The '''TUFLOW\model''' folder contains the TUFLOW SWMM Control File (TSCF) which holds all commands specific to SWMM, including links to the converted SWMM INP file.
 +
* The '''TUFLOW\model\swmm''' folder contains a GeoPackage database ('''*_convert_messages.gpkg'''). This GeoPackage contains locations and descriptions of any errors or warnings that occurred during the conversion process.
 +
: '''Note:''' Conversion messages are addressed in further detail here <u>[[XPSWMM_to_TUFLOW-SWMM_Troubleshooting#Common_Conversion_Issues |XPSWMM to TUFLOW SWMM Troubleshooting]]</u>.
 +
* The '''TUFLOW\runs''' folder contains the TCF. If event(s) are specified, the TCF filename with have event placeholder(s), i.e. '_~e1~_~e2~_' (e.g. '''1D2D_Urban_001_~e1~.tcf'''). Again, if event(s) are used, this folder also contains the TUFLOW Event File (TEF) with the event(s) specified. <br>
 +
{{Video|name=Animation_XPtoTUFLOW_Convert_02b.mp4|width=800}}
 +
<br>
 +
<li> Open QGIS, and click on the ‘Load TUFLOW Layers from TCF’ symbol from the QGIS TUFLOW Plugin toolbar.
 
<br>
 
<br>
 
[[File: Tuflow_plugin_load_tcf_layers.png]]<br>
 
[[File: Tuflow_plugin_load_tcf_layers.png]]<br>
 
<br>
 
<br>
<li> Go to the location of the TUFLOW model and navigate to the '''TUFLOW\runs''' folder. Select the TCF.
+
<li> Navigate to the location of the TUFLOW model and go to the '''TUFLOW\runs''' folder. Select the TCF.
 
<li> In the Load Layers window, select:
 
<li> In the Load Layers window, select:
 
* Ordering Options: Alphabetical
 
* Ordering Options: Alphabetical
Line 179: Line 121:
 
* Raster Load Options: Load Normally  
 
* Raster Load Options: Load Normally  
 
<li> Click ‘Open’ and ‘OK’.
 
<li> Click ‘Open’ and ‘OK’.
</ol>
+
<li> Change the symbology of the DTM dataset:
<br>
+
* In the QGIS Layers panel, right click on the DTM Grid file and select 'Properties'.
 
+
* In the Symbology tab, under 'Band Rendering', set the 'Render type' to 'Hillshade' and the 'Z Factor' to 3.
Style the layers however you desire. Common steps to do this are:
+
<li> Inspect the output GIS layers.
<ol>
 
<li>Click on the ‘Apply TUFLOW Styles to Open Layers’ symbol from the TUFLOW Plugin toolbar.
 
<br>
 
[[File:tuflow_plugin_styles_open_layers.png]]<br>
 
<br>
 
<li>Change the symbology of the DEM:
 
*Right click on the '''DEM''' file in the QGIS Layers Panel and select 'Properties'.
 
*From the Symbology tab, under 'Band Rendering' select the following options:
 
:*Render type: Singleband pseudocolor
 
:*Color ramp: Spectral
 
:*Color ramp: Invert Color Ramp
 
:*Mode: Equal Interval
 
*From the Transparency tab, set the Global Opacity to 75%.
 
*Click 'Apply' and 'OK'.
 
<br>
 
<font color="red">Video</font> <br>
 
<li>Create a hillshade of the DEM:
 
*Right click on the '''DEM''' file in the QGIS Layers Panel and select 'Duplicate Layer'.
 
*Right click on the '''DEM_copy''' and select 'Rename Layer'. Rename the layer to '''DEM_Hillshade'''.
 
*Right click on the '''DEM_Hillshade''' and select 'Properties'.
 
*From the Symbology tab, under 'Band Rendering' select the following options:
 
:*Render type: Hillshade
 
:*Z Factor: 3
 
*Click 'Apply' and 'OK'.
 
<br>
 
<font color="red">Video</font> <br>
 
</ol>
 
 
 
<font color="red"><tt>Emilie, I haven't worked on the text below. You're welcome to write something here if you feel confident doing it </tt></font>
 
 
 
 
 
Tell the user to load the model, style the file and inspect the data.
 
 
 
 
<br><br>
 
<br><br>
 
+
{{Video|name=Animation_XPtoTUFLOW_Convert_03b.mp4|width=1350}}
== One Dimensional (1D) SWMM Model Elements ==
 
 
 
=== Export 1D EPA SWMM Pipe Network Data from XPSWMM ===
 
Convert 1D XPSWMM hydraulics features into a EPA SWMM 5 INP file format for TUFLOW:
 
<ol>
 
<li> In XPSWMM, select 'Hydraulics Mode' from the toolbar.
 
<br><br>
 
[[File: XPSWMM_to_TUFLOW_toolbar_hydraulics_mode_01a.png|700px]]
 
 
<br>
 
<br>
<li> From the XPSWMM top dropmenu select File >> Import/Export Data >> Export to EPASWMM5. The exported INP file will be saved to the same folder as the .xp project file.
 
<li> When prompted to save changes, select 'Yes'.
 
<li> Rename the exported INP file by adding 'HDR' to the file name. For example, '''1D2D_Urban_001.inp''' > '''1D2D_Urban_HDR_001.inp'''. Copy the renamed INP file into the '''TUFLOW\model\swmm''' folder.
 
<li> In Windows File Explorer, navigate to the '''TUFLOW\model\swmm''' folder. Drag and drop the .inp file into QGIS. This will open the <u>[[QGIS_SWMM_GeoPackage_Create_from_SWMM_inp |GeoPackage - Create from SWMM inp ]]</u> tool from the QGIS Processing Toolbox.
 
:* SWMM Input File (inp): Pre-populated
 
:* CRS for GeoPackage: Select and appropriate Coordinate Reference System (CRS) for the model.
 
:* GeoPackage output filename: Prepopulated to save the output GeoPackage file in the same folder location and with the same name as the SWMM input file.
 
<li> Click 'Run'. Once the tool is finished, click 'Close'.
 
<li> A dialog will appear. Select 'Add Layers' to open all vectors within the newly created SWMM GeoPackage file. By default, all items in the available list should have been selected.
 
<li> In the QGIS Layers panel, move the SWMM GeoPackage file to the top of the list. This will ensure the data within this database file is displayed above all other layers in the project.
 
<li> Inspect the attributes associated with the various objects in the GeoPackage to familiarize yourself with the data.
 
<br><br>
 
'''<font color="red">Video</font>'''
 
 
</ol>
 
</ol>
  
 +
== Recommended Additional Conversion Steps ==
 +
While the bulk of the XPSWMM to TUFLOW SWMM model conversion is automated by the '<u>[[QGIS_SWMM_Convert_XPSWMM_Model_From_XPX|Convert - XPSWMM model from XPX]]</u>' processing tool, some required or recommended conventions must be implemented/updated manually. Therefore, it is highly recommended to complete the additional conversion steps: <u>[[XPSWMM_to_TUFLOW-SWMM_Recommended_Additional_Conversion_Steps|Recommended Additional Conversion Steps]]</u>. <br>
 +
These steps can help improve model stability and they may also be helpful to address any messages that occurred when using the conversion tool.
 
<br>
 
<br>
  
===Correct SWMM Nodes--Junction/Outfall Model Design===
+
== TUFLOW Simulation Execution ==
XPSWMM used a modified version of the EPA SWMM engine. Unlike traditional EPA SWMM networks that require '''Nodes--Junctions''' at the upstream end of culverts and '''Nodes--Outfalls''' at the outlets, XPSWMM uses '''Nodes--Junctions''' in all locations. TUFLOW's implementation of SWMM has retained the traditional EPA SWMM structure. Due to this fundamental difference in approach, some manipulation of the XPSWMM '''Nodes--Junctions''' information is necessary.
+
Set up a simple batch file (.bat) to run TUFLOW. This approach calls the TUFLOW executable file (.exe) and runs the TCF file.
 
 
<ol>
 
<li> In the QGIS Layers panel, select (left click) '''Nodes--Junctions''' to make it the active dataset.
 
<li> Go to Processing > Toolbox from the top dropdown menu options to open the Processing Toolbox.
 
<li> Go to TUFLOW >> SWMM in the processing tool list and select '<u>[[QGIS_SWMM_Junctions_Downstream_Junctions_to_Outfalls |Junctions - Downstream junctions to outfalls]]</u>'. This opens the dialog shown below.
 
:* Input Junctions: '''Nodes--Junctions''' (this is prepopulated as '''Nodes--Junctions''' is the active dataset).
 
:* Input Conduits: Click '...' and tick on '''Links--Conduits'''
 
:* Modified Junctions Layer: Leave this field blank so the tool writes the data to a temporary file. It will not be used.
 
:* Modified Outfalls Layer:
 
<ol>
 
::<li> Click '...', select 'Save to GeoPackage...'.
 
::<li> Navigate to the '''TUFLOW\model\swmm''' folder and select the GeoPackage file created in the <u>[[#Convert_XPSWMM_Model_to_Recommended_TUFLOW_Structure | Convert XPSWMM Model to Recommended TUFLOW Structure]]</u> section. Click 'Save'.
 
::<li> A dialog will open. In the 'Layer Name' field, write '''Nodes--Outfalls'''. It is important that this layer is named correctly so it is recognized by the other TUFLOW SWMM processing tools.
 
::<li> Click 'OK'.
 
</ol>
 
<li> Click 'Run'. Once the tool is finished, click 'Close'.
 
<li> The temporary junctions layer, '''Modified junctions layer''', and the new outfalls layer, '''Nodes--Outfalls''', will appear in the QGIS Layers panel.  
 
<li> In the QGIS Layers panel, right click '''Modified junctions layer''', and select 'Remove Layer..'.
 
<li> In the QGIS Layers panel, select (left click) '''Nodes--Outfalls''' and toggle off editing.
 
<br><br>
 
<font color="red> Video</font>
 
<br>
 
</ol>
 
<br>
 
 
 
To complete the update process, it is necessary to remove the junction nodes from '''Nodes--Junctions''' that coincide with the nodes created in '''Nodes-Outfalls'''. While this can be done manually, the steps below illustrate an automated process using a processing tool.
 
 
<ol>
 
<ol>
<li> In the QGIS Layers panel, select (left click) '''Nodes--Junctions''' and toggle on editing.
+
<li>Create a new text file in the '''TUFLOW\runs''' folder and save as '''_run_HPC.bat'''.  
<li> Use the 'Select Features' tool to select all nodes included in the '''Nodes--Junctions''' layer. This will change their color to bright yellow.
+
<li>Open the '''_run_HPC.bat''' in a text editor and include a file path to the TUFLOW executable and the TCF name: <br>
<li> In the Processing Toolbox, go to 'Vector Selection' and select 'Select within distance'. This opens the dialog shown below.
+
<font color="blue"><tt>set </font>exe<font color="red">=</font>"..\..\exe\2023-03-AD\TUFLOW_iSP_w64.exe"<br>
:* Select features from: '''Nodes--Junctions''' (this is prepopulated as '''Nodes--Junctions''' is the active dataset).
+
<font color="blue"><tt>set </font>run<font color="red">=</font>start "TUFLOW" /wait <font color="orange">%exe%</font> -b<br>
:* By comparing to the features from: Click the drop down menu and select '''Nodes--Outfalls'''.
+
<font color="orange">%run%</font> -e1 100yr 1D2D_Urban_001_~e1~.tcf</tt></font></tt> <br>
:* Where the features are within: '0.1 meters'
 
:* Modify current selection by: 'selecting within current selection'
 
<li> Click 'Run'. Once the tool is finished, click 'Close'.
 
<li> In the QGIS Layers panel, right click '''Nodes--Junctions''' and select 'Open Attribute Table'.
 
<li> In the attributes table, only some of the junction nodes will be selected. Select 'Delete selected features' to delete these nodes. Close the attribute table.
 
<li> Toggle the editing off to save the edits.
 
<br><br>
 
<font color="red"> Video</font>
 
 
<br>
 
<br>
 +
'''Note:''' A relative path is used for the executable and the TCF, full file path can also be used.
 +
<li>Save the batch file and double click it in Windows File Explorer to run the simulation. This will open the TUFLOW DOS Console Window and the simulation should be executed.
 
</ol>
 
</ol>
<br>
 
  
=== 1D/2D Pipe Network Pit (Inlet Usage) Connections ===
+
TUFLOW simulations can be executed via numerous ways. A comprehensive summary of the most commonly used approaches is documented in the <u>[[Running_TUFLOW | Running TUFLOW]]</u> Wiki page.
⁠ Inlet usage connections define the 1D/2D linkages between the ground surface, defined in 2D, and the 1D SWMM pipe network. Physically these features come in many forms and dimensions, though are typically referred to as kerb inlets with or without associated grates. An example is shown in the image below. <br>
 
[[File: XPSWMM_Kerb_Inlet.JPG | 300px ]] <br>
 
Transfer of inlet usage connection information from XPSWMM to TUFLOW requires a three step process:
 
* Export of data from XPSWMM.
 
* Conversion of the exported data into a TUFLOW SWMM compatible format.
 
* Minor edits are required to correct for snapping deficiencies in the XPSWMM export tools.
 
The following sections provide step by step instructions for these three tasks.
 
<br><br>
 
  
==== Export Data from XPSWMM====
+
=== Troubleshooting ===
<ol>
+
Did your TUFLOW SWMM model fail to run successfully? If so, here is a link to a troubleshooting guide: <u>[[TUFLOW_SWMM_Troubleshooting | TUFLOW SWMM Troubleshooting]]</u>.<br>
<li> Select the Hydraulics mode in XPSWMM: [[File: XPSWMM_Hyd_Icon_002.png | 30px]].
 
<li> Right click '''Nodes''' in the layers panel and select '''''Export to GIS File...'''''
 
:* Enter an appropriate filename in the '''GIS File''' field. A common name for this temporary file is, "XPSWMM_Node_Export.shp"
 
:* Set the file path to the '''TUFLOW\model\swmm''' folder.
 
:* Save as type: ESRI (*.shp)
 
  
 +
= TUFLOW SWMM Result Viewing =
 +
Are you familiar with loading and viewing TUFLOW results in QGIS? If not, we strongly recommend self-registering and completing our free eLearning:
 +
<u>[https://www.tuflow.com/training/training-catalogue/tt001e-introduction-to-qgis-for-tuflow-elearning/ Introduction to QGIS for TUFLOW]</u>. <br>
 +
Our <u>[[TUFLOW_SWMM_Tutorial_Introduction | TUFLOW SWMM Tutorials]]</u> also demonstrate working with TUFLOW SWMM results.
  
 +
= Recommended Further Reading =
 +
For users who wish to get a better understanding of either 2D TUFLOW or 1D EPA SWMM, the following resources may be of use:<br>
 +
'''TUFLOW''': <u>[https://www.tuflow.com www.tuflow.com]</u>
 +
*<u>[https://www.tuflow.com/downloads/#tuflow TUFLOW User Manual]</u>
 +
*<u>[https://docs.tuflow.com/classic-hpc/release/2023-03-AD/ TUFLOW 2023-03-AD release notes]</u>
 +
*<u>[[Tutorial_Introduction#Tutorial_Modules | TUFLOW Tutorial Models]]</u>
  
<li> Expand the selection tree to display: '''Node data and Results >> Hydraulics Node >> HDR Node Data'''.
 
<li> In HDR Node Data select the following items by either double clicking the item, of selecting the entry then clicking the right arrow button [[File: XPSWMM_Right_Arrow_Icon_002.png | 30px]]:
 
:* Node 2D Inflow Capture Flag
 
:* Ground Elevation (Spill Crest)
 
:* 2D Inflow Capture Coefficient
 
:* 2D Inflow Capture Exponent
 
 
<li> The items should now be listed in the righthand box. In the '''''Custom Names''''' column shorten the text entries to less than 10 characters. Common abbreviations are ''NodeIn'', ''Ground'', ''Coeff'', ''Exponent''.
 
:
 
 
<li> Click 'Export'. A Pop-up message will appear reporting how many nodes were exported.<br><br>
 
</ol>
 
'''<font color="red">Video</font>'''
 
 
<br>
 
<br>
 +
'''EPA SWMM''': <u>[https://www.epa.gov/water-research/storm-water-management-model-swmm www.epa.gov]</u>
 +
*<u>[https://downloads.tuflow.com/SWMM/SWMM5_Reference_Manual_Volume1_Hydrology_P100NYRA.pdf SWMM5 Reference Manual - Volume 1 (Hydrology)]</u>
 +
*<u>[https://downloads.tuflow.com/SWMM/SWMM5_Reference_Manual_Volume2_Hydaulics_P100S9AS.pdf SWMM5 Reference Manual - Volume 2 (Hydraulics) ]</u>
 +
*<u>[https://downloads.tuflow.com/SWMM/SWMM5_Reference_Manual_Volume2_Hydraulics_Addendum-20220210mas2wr.pdf  SWMM5 Reference Manual - Volume 2 (Hydraulics Addendum) ]</u>
 +
*<u>[https://downloads.tuflow.com/SWMM/SWMM5_Reference_Manual_Volume3_Water_Quality_P100P2NY.pdf  SWMM5 Reference Manual - Volume 3 (Water Quality) ]</u>
 +
*<u>[https://downloads.tuflow.com/SWMM/SWMM5_User%27s_Manual.pdf EPA SWMM5 User's Manual]</u>
  
==== Convert Exported Data into TUFLOW SWMM Format ====
+
=Feedback / Suggestions=
<ol>
+
We hope you have found this model conversion page helpful. If you have any feedback or suggestions, please email <u>[mailto::support@tuflow.com support@tuflow.com]</u>.
<li> Open QGIS and load '''XPSWMM_Node_Export.shp'''
 
<li> Left click '''XPSWMM_Node_Export''' in the Layers panel to make it the active dataset.  
 
<li> If you closed the Processing Toolbox after the previous model conversion steps, select '''Processing > Toolbox''' from the top dropdown menu options.
 
<li> Select '''TUFLOW >> SWMM >> <u>[[QGIS_SWMM_Convert_XPSWMM_GIS_Inlet_Layers_to_SWMM | Convert - XPSWMM GIS Inlet Layers to SWMM]]</u>''' in the processing tool list.
 
<li> Select the following in the dialog box.
 
:*GIS Layer with inlet information: XPSWMM_Node_Export  (this entry should already be populated if you left clicked the layer before selecting the tool)
 
:*Inlet Field Name: Node Name
 
:*Inlet Elevation Field: '''Ground'''
 
:*Inlet 2D capture flag: '''NodeIn'''
 
:*Inlet discharge coeffecient field: '''Coeff'''
 
:*Inlet discharge exponent field: '''Exponent'''
 
:*Inlet connection width: '''This defines the number of 2D cells associated with the 1D/2D connect. Typically, it is set to match your 2D cell size.'''
 
:*CRS: '''Choose your model's Coordinate Reference System'''
 
:*SWMM inp file (for inlet definition and curves):
 
::*'''Save to File...'''
 
::*Save within the '''TUFLOW/model/swmm''' folder
 
::*Choose an appropriate '''inp''' file name (for example: swmm_inlet_curves_XP_001.inp).
 
:*Geo-Package file for inlet usage (for inlet placement):
 
::*'''Save to File...'''
 
::*Save within the '''TUFLOW/model/swmm''' folder
 
::*Choose an appropriate '''gpkg '''file name (for example:swmm_iu_XP_001.gpkg)
 
<li> Select 'Run'.
 
<li>Open '''swmm_iu_XP_001.gpkg''' and '''swmm_inlet_curves_XP_001.gpkg''' in QGIS. Inspect the attributes associated with the objects in both layers.
 
</ol>
 
 
 
'''<font color="red">Video</font>'''
 
 
 
====Edit TUFLOW SWMM Data====
 
Unfortunately the snapping tolerance set by XPSWMM for its Node GIS Data Export function is greater than the underlying model information it is associated with. This can offset the data by a small distance. We need to correct this error. There is an automated tool to assist (reducing manual effort) for this task.
 
<ol>
 
<li> In the QGIS Layers Panel, select (left click) the '''swmm_iu_XP_001''' layer.
 
<li> Make the '''swmm_iu_XP_001''' layer editable by clicking the 'Toggle Editing' symbol [[File:toggle_editing_icon.png|27x27px]].
 
<li> Go to '''Processing > Toolbox''' from the top dropdown menu options to open the Processing Toolbox.
 
<li>In the Processing Toolbox, select the '''Edit Features In-Place''' tool [[File:edit_features_in_place_icon.png]]. This allows the editing of an existing layer, instead of the creation of a new layer.
 
<li>Choose '''Vector geometry >> Snap geometries to layer''' and enter the following inputs to the dialog box:
 
:*Reference Layer (this is the layer we wish to snap to): '''Nodes--Junctions'''
 
:*Tolerance: '''0.1''' (units = metres)
 
:*Behaviour: '''Prefer aligning nodes, insert extra vertices where needed.'''
 
 
 
<li>Select: Modify All Features
 
<li>Toggle the editing off for '''swmm_iu_XP_001''' to save the edits.<br>
 
</ol>
 
 
 
'''<font color="red">Video</font>'''
 
 
<br>
 
<br>
  
===Create 1D/2D Culvert Connections===
 
In addition to the pipe network inlet usage 1D/2D connections, we also need to connect our 1D culvert inlet/outlets to the 2D. Physically these features are often associated with either culverts under raised road or rail embankment, outlets from pipe networks into creeks, streams or river, or open pipe network inlets and outlets associated with major stormwater drainage infrastructure (modifying historically above ground streamflows to an underground stormwater network). An example is shown in the image below. <br>
 
[[File: XPSWMM_Culvert_Inlet.JPG | 350px]]<br>   
 
To link a 1D SWMM culvert to the TUFLOW 2D, TUFLOW SWMM requires 1D/2D HX connection lines for the upstream (inlet) end of a culvert and 1D/2D SX connection lines at the downstream (outlet) end. This model schematization is different to TUFLOW ESTRY and also XPSWMM (which require 1D/2D SX connections upstream and downstream), though matches the traditional requirements of EPA SWMM. <br>
 
<ol>
 
<li>In the QGIS Layers Panel, select (left click) '''Links--Conduits'''.
 
<li> Use the 'Select Features' tool to select the culvert and pipe objects in '''Links--Conduits''' layer that will have a clear opening (typically under an embankment or from a pipe network to/from a waterway, such as a creek). In XPSWMM, this type of feature is typically represented by '''Links''' snapped to '''Nodes''' with "Link invert to 2D" selected.
 
<li>In the Processing Toolbox, go to TUFLOW >> SWMM and select '<u>[[QGIS_SWMM_BC_Create_Channel_Endpoint_1D/2D_Connections |BC - Create channel endpoint 1D/2D connections]]</u>'. This opens the dialog shown below. 
 
:*Input Conduits Layer: '''Links--Conduits'''
 
:*Create connections at: 'Both ends'.
 
:*Offset Distance: 2
 
:*Length of BC lines: 10
 
:*Tick on 'Set 2D cell elevation to 1D culvert invert at 1D/2D connection cells if needed'.
 
:*Output Layer:
 
<ol>
 
::<li>Click the ... and select 'Save to GeoPackage'.
 
::<li>Navigate to the '''TUFLOW\model\gis''' folder and select the HDR GPKG you exported from the XPSWMM model during the <u>[[#Convert_XPSWMM_Model_to_Recommended_TUFLOW_Structure | Convert XPSWMM Model to Recommended TUFLOW Structure]]</u> step. It should be saved to the TUFLOW/model/swmm folder. Click Save.
 
::<li>A dialog will open. In the Layer name field, write '''2d_bc_SWMM_Culvert_Connections_001_L'''.
 
::<li>Click 'OK'.
 
</ol>
 
 
<li>Click 'Run'.
 
<li>Once the tool is finished, click 'Close'.
 
<li>The '''2d_bc_SWMM_Culvert_Connections_001_L''' appears in the QGIS Layers Panel. Select 'Apply TUFLOW Styles to Current Layer'.
 
<li> Make the '''2d_bc_SWMM_Culvert_Connections_001_L''' layer editable by clicking the 'Toggle Editing' symbol [[File:toggle_editing_icon.png|27x27px]].
 
<li> Review the '''2d_bc_SWMM_Culvert_Connections_001_L''' data. Make corrections by deleting objects in locations where a 1D/2D connection was only needed at one end of the conduit , instead of both ends.
 
<li> Toggle editing off for '''2d_bc_SWMM_Culvert_Connections_001_L''' to save the edits
 
</ol>
 
 
'''<font color="red">Video</font>'''
 
 
=== SWMM Hydrology ===
 
If your XPSWMM model includes EPA SWMM hydrology, the hydrology components can be brought across into TUFLOW SWMM.
 
<ol>
 
<li> Open the XPSWMM model.
 
<li> Check whether the SWMM Hydrology runoff method has been used in your XPSWMM model by reviewing the selection from the following model settings: '''Configure >> Mode Properties >> Solver Mode >> Methods'''<br>
 
[[File:XPSWMM_Hydrology_Methods.JPG |800px]]
 
<li> Select the Hydraulics mode: [[File: XPSWMM_Rnf_Icon_002.png | 30px]].
 
<li> Convert 1D XPSWMM hydraulics features into a EPA SWMM 5 INP file format for TUFLOW:
 
<li> From the XPSWMM top drop menu select '''File > Import/Export Data > Export to EPASWMM5'''
 
<li> When prompted if you wish to save changes, select '''Yes'''.
 
<li> The exported INP file will be saved to the same folder and .XP project file.
 
<li> In QGIS in the Processing Toolbox, go to TUFLOW >> SWMM and select <u>[[QGIS_SWMM_GeoPackage_Create_from_SWMM_inp |GeoPackage Create from SWMM inp]]</u>. Enter the field below into the dialog box:
 
:* SWMM Input File (inp): Select the recently exported INP file in the .XP project file.
 
:* CRS for GeoPackage: Select an appropriate Coordinate Reference System for your model.
 
:* GeoPackage output filename: Save the file to the '''TUFLOW\model\swmm''' folder, add "RNF" to the XP exported filename to distinguish this file from the HDR GeoPackage.
 
:* Select 'Run'.
 
<li>Before Opening the RNF GeoPackage file in QGIS we have to delete the Nodes--Junctions Layer within it. It is a duplicate of the Nodes--Junctions Layer contained in the HDR GeoPackage file.
 
<li> From the QGIS drop menus, Select '''View > Panels'''. Tick '''Browser Panel'''.
 
<li> In the Browser Panel view the Layer tree associated with RNF GeoPackage file. Right click '''Nodes--Junctions''' Select '''Manage > Remove Layer'''
 
<li> After making the above change, open the RNF GeoPackage file in QGIS and review the attribute data.
 
''Note: For hydrology, TUFLOW has more advanced, workflow efficient "Event Scenario Management" options than XPSMM. If your project requires the simulation of multiple hydrology events, please complete <u>[[TUFLOW_SWMM_Tutorial_M04 | TUFLOW SWMM Module 4 (1D SWMM Pipe Network / 1D SWMM Urban Hydrology: Executing multiple different event simulations from a single model control file)]]</u>. and use the model design concepts in it to upgrade the configuration of your TUFLOW model to accommodate for the simulation of multiple events from a single model. ''
 
 
</ol>
 
'''<font color="red">Video</font>'''
 
<br>
 
 
===Update SWMM Nodes--Junction Attributes===
 
The final GIS feature update that is necessary to finalise the SWMM portion of the TUFLOW model relates to the Nodes---Junctions attributes. This is typically the final model bulid step because the recommended Junctions attributes varies depending on whether the Junction is associated with inlet usage connections, 1D/2D culvert connections and SWMM hydrology sub-catchments.
 
<ol>
 
<li>In the QGIS Layers Panel, select (left click) '''Nodes--Junctions''' and toggle on editing.
 
<li>In the Processing Toolbox, select the 'Edit Features In-Place' tool. This allows the editing of an existing layer, instead of the creation of a new layer.
 
<li>Go to TUFLOW >> SWMM in the processing tool list and select '<u>[[QGIS_SWMM_Junctions_Set_Attributes |Junctions - Set attributes ]]</u>' processing tool. This opens the dialog shown below.
 
 
{| class="wikitable" width="80%" style="text-align:center"
 
!style="background-color:#005581; font-weight:bold; color:white;"| Dialog
 
!style="background-color:#005581; font-weight:bold; color:white;"| Recommended Parameter Value
 
!style="background-color:#005581; font-weight:bold; color:white;"| Comment
 
|-
 
| Input Subcatchments: || '''Hydrology--Subcatchments''' || Input is optional - only use if Hydrology Subcatchment Layers exist
 
|-
 
| Input Inlet Usage Layers: || '''swmm_iu_TS02_001''' || Input is optional - only use if Inlet Usage Layers exist
 
|-
 
|Input BC Connection Layers || '''2d_bc_SWMM_Culvert_Connections_001_L''' || Input is optional - only use if BC Connection Layers exist
 
|-
 
| '''General Options'''||colspan="3"|
 
|-
 
|Maximum Depth Option (Ymax) || '''Set to 0.0''' || -
 
|-
 
|Nodes receiving subcatchment flows option <br>(if connected to 2D): ||'''Set Apond = 0.0; Ksur = 0.0 <br>(overwrites options below)''' || -
 
|-
 
|rowspan="2"|Nodes connected to 2D without Inlets: || '''Ysur: 0''' || -
 
|-
 
|'''Area of ponding: 50''' || This value should match the 2D cell area associated with 1D/2D culvert connections.
 
|-
 
|rowspan="3"|Nodes connected to the 2D with Inlets: ||'''Maximum depth: 'Use global option'''' || -
 
|-
 
| '''Ysur: 0''' || -
 
|-
 
| '''Area of ponding: 9''' || This value should match the 2D cell area associated with the Inlet Usage connections
 
|-
 
|rowspan="2"|  Nodes without a 2D connection: || '''Surcharge Depth: 99''' || This entry should equal a value higher than any expected water level in the model
 
|-
 
| '''Area of ponding: 1''' || -
 
|}
 
<br>
 
<li>Select 'Modify All Features'.
 
<li>Once the tool has finished, click 'Close'.
 
<li>Turn off editing to save the edits.
 
<li>View the attributes associated within '''Nodes--Junctions''' to verify the data processing has been completed correctly. <br>
 
For a summary of the attributes associated with the '''Nodes--Junctions''' layer, refer to <u>[https://docs.tuflow.com/classic-hpc/release/2023-03-AD/SWMM-Input-Detailed-1.html#tab:tab-SWMM-Input-Junctions TUFLOW 2023-03-AD Release Notes (Table A.30)]</u> and the <u>[https://downloads.tuflow.com/SWMM/SWMM5_Reference_Manual_Volume2_Hydaulics_P100S9AS.pdf SWMM Reference Manual - Volume 2 (Hydraulics)]</u>.
 
<br><br>
 
</ol>
 
 
'''<font color="red">Video</font>'''
 
 
===Export INP Files===
 
<font color="red"><tt>Emilie, I haven't worked on the text below. All the INP file need to be exported before they are useed- you're welcome to write something here if you feel confident doing it </tt></font>
 
 
= Link 1D SWMM and 2D TUFLOW Model =
 
<font color="red"><tt>Emilie, I haven't worked on the text below (it was Pavlina's notes)- you're welcome to if you feel confident doing it </tt></font>
 
 
 
 
The linking is specified in the TUFLOW control files. Further commands can be added in or removed based on the modeling task.
 
<ol>
 
<li>Create TUFLOW SWMM Control File (TSCF):
 
<ol><font color="blue"><tt>Read SWMM </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\swmm\original_model.inp </tt></font></ol>
 
<ol><font color="blue"><tt>Read SWMM </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\swmm\inlet_definition.inp.inp </tt></font></ol>
 
<ol><font color="blue"><tt>Read SWMM </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\swmm\subcatchments.inp </tt></font></ol>
 
<ol><font color="blue"><tt>Read SWMM Inlet Usage</tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\swmm\inlet_usage_information.gpkg </tt></font></ol>
 
 
'''<<Video>>'''<br>
 
<br>
 
 
<li>Update TUFLOW Boundary Control file (TBC):
 
:* Add non-inlet 1D/2D links:
 
<ol><font color="blue"><tt>Read GIS BC </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\gis\2d_bc_1d2d_links.gpkg </tt></font></ol>
 
'''<<Video>>'''<br>
 
<br>
 
 
<li>Update main TUFLOW control file (TCF):
 
:* Add below commands if applicable:
 
<ol><font color="blue"><tt>Solution Scheme </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>HPC </tt></font></ol>
 
<ol><font color="blue"><tt>Hardware </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>GPU </tt></font></ol>
 
<ol><font color="blue"><tt>GIS Format </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>GPKG </tt></font></ol>
 
:* Add TSCF command to read the 1D SWMM features:
 
<ol><font color="blue"><tt>SWMM Control File </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>..\swmm\SWMM.tscf </tt></font></ol>
 
:* Add time control comands:
 
<ol><font color="blue"><tt>Start Time</tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt><<start_time>> </tt></font></ol>
 
<ol><font color="blue"><tt>End Time </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt><<end_time>> </tt></font></ol>
 
:* Rarely used options to consider removing from the TCF:
 
<ol><font color="blue"><tt>SX ZC Check </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>OFF </tt></font></ol>
 
<ol><font color="blue"><tt>HX ZC Check </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>OFF </tt></font></ol>
 
<ol><font color="blue"><tt>Mass Balance Corrector </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>OFF </tt></font></ol>
 
:* Remove XPSWMM references:
 
<ol><font color="blue"><tt>Read GIS XP Nodes </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt></tt></font></ol>
 
<ol><font color="blue"><tt>Read GIS XP WLL </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt></tt></font></ol>
 
<ol><font color="blue"><tt>Read GIS XP NETWORK </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt></tt></font></ol>
 
:* Add scenarios/events if applicable
 
'''<<Video>>'''<br>
 
</ol>
 
<br>
 
 
=Feedback / Suggestions=
 
If you have any suggestions to be included in these pages, please email <u>[mailto::support@tuflow.com support@tuflow.com]</u>.
 
  
  
 
{{Tips Navigation
 
{{Tips Navigation
|uplink=[[Main_Page| Back to Main Page]]
+
|uplink=[[Main_Page| Back to Wiki Main Page]]
 
}}
 
}}

Latest revision as of 10:16, 6 September 2024

Introduction

This Wiki page outlines recommended steps for the conversion of an XPSWMM model to TUFLOW.

XPSWMM is a flood and urban stormwater drainage modeling software developed by Autodesk (previously Innovyze and XP Solutions). The XPSWMM solution uses EPA SWMM for its 1D calculations, dynamically linked to TUFLOW for its 2D calculations. The software functions within a custom build Graphical User Interface (GUI). Unknown to many XPSWMM modelers, during simulation, XPSWMM processes its inputs into TUFLOW files and also calls TUFLOW for the 2D calculations. As XPSWMM uses TUFLOW for its 2D engine, like-for-like results can be achieved using this software. The modeling workflow in TUFLOW differs from XPSWMM, as TUFLOW modeling is integrated with QGIS (Geographical Information System) GIS software instead of embedded within a software specific Graphical User Interface.

If you are building a TUFLOW SWMM model from scratch, not from XPSWMM, please refer to the TUFLOW SWMM Tutorials. Tutorials are provided for the following topics:

Dataset Download

The dataset used for this model conversion demonstration is available for download here: XPSWMM XPX to TUFLOW Conversion Dataset.
This dataset contains the XPSWMM model and the resulting TUFLOW model that is created. These can be found in the XPSWMM and Complete_Conversion folders respectively.

If you are using this example conversion dataset, please rerun the XPSWMM model in the location where you save the dataset before beginning your own TUFLOW model conversion. Rerunning the model is necessary because XPSWMM will write TUFLOW files during its preprocessing, subsequently defining the correct file path information (for the location where you saved your files) in the newly written TUFLOW files. We also recommend creating your own TUFLOW model in a different folder from the provided TUFLOW dataset so you can easily compare your model against it.

If you do not have access to a XPSWMM license and the XPSWMM Application, please refer to the XPSWMM to TUFLOW SWMM Troubleshooting page.

XPSWMM to TUFLOW Model Conversion

Export Data From XPSWMM Model

Digital Terrain Model (DTM) Data
XPSWMM reads its 2D DTM data in one of two ways:

  • The DTM data can be directly specified in the '2D Model Settings', or
  • The DTM data can be internally processed by XPSWMM using its terrain tools and DTM builder.

Depending on which method is applied to your XPSWMM model, the steps required to will vary. Review which method is used:

  1. Open your existing model in XPSWMM.
  2. In the top dropdown menu options, go to Configuration > Job Control > 2D Model Settings. This will open a dialog.
  3. Under '2D Hydraulics Job Control', select 'Surface & Sampling'.
  4. Review the options in the 'Surface' section:
    • If 'Use DTM' is selected: Continue to the section below (Export DTM Data from XPSWMM) and complete the steps.
    • If 'Use Grid File for Topography' is selected and a 'Grid file' is specified, the steps outlined in the 'Export DTM Data From XPSWMM' section can be skipped. Go to the Export XPX Data From XPSWMM section.
    Note: If you have a .tif elevation file, you can continue to the Export XPX Data From XPSWMM section. The conversion process will be identical however, once converted, you will have to create the TUFLOW\model\grid folder manually and copy the .tif file into it.


Export DTM Data From XPSWMM

If 'Use DTM' was selected, XPSWMM preprocesses its Digital Terrain Model (DTM) into a binary XPTIN elevation dataset for inclusion in the TUFLOW model. XPTIN is a binary format that can't readily be used in GIS software. For this reason, the following steps outline how to obtain a DTM dataset in a GIS friendly form.

  1. In the XPSWMM Layers panel, under 'Topography', right click on DTM and select 'Export DTM Data'.
    • Input TIN File: Select the relevant XPSWMM Input TIN file.
    • Output File Format: 'ASCII Grid File Format'.
    • Cell Size Value: Choose a suitable DTM resolution. This resolution should be finer than the hydraulic model resolution. Typically, a DTM resolution is 1/5th to 1/10th of the hydraulic model 2D cell size is common (1 in the example dataset).
    Note: XPSWMM requires an integer cell size value for this export step. For example, Cell Size Values of 1, 2, 3, 4, 5 ... are suitable. The XPSWMM export will not function if you specify a decimal cell size value (eg. 0.5, 2.5, etc.).
  2. Click 'Export'.
  3. Save the file under an appropriate name (e.g. 1D2D_Urban_Grid.asc) to the folder where XPSWMM writes the .tcf during its simulation preprocessing. By default, this is the 2D\Data folder.
    If this folder does not exist, either:
    • The XPSWMM model has not run, so the TUFLOW control files have not been created by XPSWMM. Run the XPSWMM model (go to Analyze > Solve... in top dropdown menu options).
    • Non-default output settings have been specified in XPSWMM. To determine the output location, in the top dropdown menu options, go to Configuration > Job Control > 2D Model Settings > Folder Options. Ensure the following 'Folder Locations' are selected.
    XPSWMM to TUFLOW 2DJobControl FolderOptions Dialog 01e.png

  4. In the top dropdown menu options, navigate to Configuration > Job Control > 2D Model Settings. This will open a dialog, under '2D Hydraulics Job Control', select 'Surface & Sampling'.
  5. Tick on 'Use grid file for topography' and select '...' to navigate to the Grid file saved in the 2D\Data folder. This file will be read directly into TUFLOW.
  6. Click 'OK' to save the settings.
  7. Run the XPSWMM model to rewrite the TUFLOW files (including the new linkage to the DTM dataset) to the Data folder (go to Analyze > Solve... in top dropdown menu options).


Export XPX Data From XPSWMM

A XPX file is a simple command line file that contains the information needed to create link and node objects. To export this data from the XPSWMM model:

  1. In XPSWMM, in the top dropdown menu options, navigate to File > Import/Export Data > Export XPX Data. This will open a dialog. Leave all options as default and click 'Export'.
  2. When prompted, save the file under an appropriate name (eg 1D2D_Urban_001.xpx) to the folder where the XPSWMM model is located.


Convert XPSWMM Model to TUFLOW SWMM

Ensure you have QGIS and have the QGIS TUFLOW Plugin installed:

The following steps outline the process of converting a XPSWMM model to TUFLOW SWMM using the 'Convert - XPSWMM model from XPX' processing tool.

  1. Open QGIS and go to Processing > Toolbox from the top dropdown menu options to open the Processing Toolbox.
  2. Go to TUFLOW >> SWMM in the processing tool list and select 'Convert - XPSWMM model from XPX'. This opens the dialog shown below.
    • XPSWMM Exported XPX File: Click '...' and navigate to the exported XPX data (e.g. 1D2D_Urban_001.xpx). This should be located in the same folder as the XPSWMM model.
    • TUFLOW TCF Filename: Click '...' and navigate to the XPSWMM .tcf. This should be located in the 2D\Data folder (e.g. 2D\Data >> 1D2D_Urban_001.tcf).
    • SWMM File Prefix: Choose an appropriate prefix for the SWMM files (e.g. 1D2D_Urban_swmm).
    • Output Solution Scheme: 'HPC'
    • Output Hardware Specification: 'GPU' (if GPU is not available, select 'CPU')
    • Output Vector Format: 'GPKG'
    • Output Raster Format: 'GTIFF'
    • Output Profile: Any option can be used. 'ALL IN ONE' is used in this example for model design consistency with the TUFLOW SWMM Tutorials.
    • Event name if no global storms: Choose an appropriate event name if applicable (100yr in the example dataset).
    • BC width for created 1D/2D connections (HX/SX): This value should be approximately 2 times the width of the hydraulic model 2D cell size (10 in the example dataset).
    • BC offset distance for created 1D/2D connections (HX/SX): Distance from the channel endpoint to the midpoint of the BC line (2 in the example dataset).
    • Output Folder: Click '...' and navigate to an appropriate location to save your TUFLOW model. In this location, create a new folder called TUFLOW and select it.
    • Output CRS: Select an appropriate Coordinate Reference System (CRS) for the model. For the demonstration model, the CRS is 'EPSG:32760 - WGS 84 / UTM zone 60S'.
  3. Click 'Run'. Once the tool is finished, click 'Close'.


Inspect the output of the 'Convert - XPSWMM model from XPX' processing tool and load the TUFLOW model into QGIS:

  1. In Windows File Explorer, inspect the files output by the processing tool. In particular:
    • The TUFLOW\bc_dbase folder contains the BC Database which will contain any curves used in BC conditions, for easy extending to other events.
    • The TUFLOW\model folder contains the TUFLOW SWMM Control File (TSCF) which holds all commands specific to SWMM, including links to the converted SWMM INP file.
    • The TUFLOW\model\swmm folder contains a GeoPackage database (*_convert_messages.gpkg). This GeoPackage contains locations and descriptions of any errors or warnings that occurred during the conversion process.
    Note: Conversion messages are addressed in further detail here XPSWMM to TUFLOW SWMM Troubleshooting.
    • The TUFLOW\runs folder contains the TCF. If event(s) are specified, the TCF filename with have event placeholder(s), i.e. '_~e1~_~e2~_' (e.g. 1D2D_Urban_001_~e1~.tcf). Again, if event(s) are used, this folder also contains the TUFLOW Event File (TEF) with the event(s) specified.


  2. Open QGIS, and click on the ‘Load TUFLOW Layers from TCF’ symbol from the QGIS TUFLOW Plugin toolbar.
    Tuflow plugin load tcf layers.png

  3. Navigate to the location of the TUFLOW model and go to the TUFLOW\runs folder. Select the TCF.
  4. In the Load Layers window, select:
    • Ordering Options: Alphabetical
    • Grouping Options: Group by control file
    • Raster Load Options: Load Normally
  5. Click ‘Open’ and ‘OK’.
  6. Change the symbology of the DTM dataset:
    • In the QGIS Layers panel, right click on the DTM Grid file and select 'Properties'.
    • In the Symbology tab, under 'Band Rendering', set the 'Render type' to 'Hillshade' and the 'Z Factor' to 3.
  7. Inspect the output GIS layers.


Recommended Additional Conversion Steps

While the bulk of the XPSWMM to TUFLOW SWMM model conversion is automated by the 'Convert - XPSWMM model from XPX' processing tool, some required or recommended conventions must be implemented/updated manually. Therefore, it is highly recommended to complete the additional conversion steps: Recommended Additional Conversion Steps.
These steps can help improve model stability and they may also be helpful to address any messages that occurred when using the conversion tool.

TUFLOW Simulation Execution

Set up a simple batch file (.bat) to run TUFLOW. This approach calls the TUFLOW executable file (.exe) and runs the TCF file.

  1. Create a new text file in the TUFLOW\runs folder and save as _run_HPC.bat.
  2. Open the _run_HPC.bat in a text editor and include a file path to the TUFLOW executable and the TCF name:
    set exe="..\..\exe\2023-03-AD\TUFLOW_iSP_w64.exe"
    set run=start "TUFLOW" /wait %exe% -b
    %run% -e1 100yr 1D2D_Urban_001_~e1~.tcf


    Note: A relative path is used for the executable and the TCF, full file path can also be used.
  3. Save the batch file and double click it in Windows File Explorer to run the simulation. This will open the TUFLOW DOS Console Window and the simulation should be executed.

TUFLOW simulations can be executed via numerous ways. A comprehensive summary of the most commonly used approaches is documented in the Running TUFLOW Wiki page.

Troubleshooting

Did your TUFLOW SWMM model fail to run successfully? If so, here is a link to a troubleshooting guide: TUFLOW SWMM Troubleshooting.

TUFLOW SWMM Result Viewing

Are you familiar with loading and viewing TUFLOW results in QGIS? If not, we strongly recommend self-registering and completing our free eLearning: Introduction to QGIS for TUFLOW.
Our TUFLOW SWMM Tutorials also demonstrate working with TUFLOW SWMM results.

Recommended Further Reading

For users who wish to get a better understanding of either 2D TUFLOW or 1D EPA SWMM, the following resources may be of use:
TUFLOW: www.tuflow.com


EPA SWMM: www.epa.gov

Feedback / Suggestions

We hope you have found this model conversion page helpful. If you have any feedback or suggestions, please email support@tuflow.com.


Up
Go-up.png Back to Wiki Main Page