|
= XPSWMM to TUFLOW Model Conversion=
== 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. follow these steps to extract and format the XPSWMM / TUFLOW 2D model features.<br>
<ol>
<li> <u>[[XPSWMM_Conversion_DTM | Digital Terrain Model (DTM) Data Processing]]</u>
<li> <u>[[XPSWMM_Conversion_TUFLOW_Structure | Convert XPSWMM Model to Recommended TUFLOW Structure]]</u>
<li>* <u>[[XPSWMM_Conversion_Load_TUFLOW_Model | Load Model in QGIS]]</u>
</ol>
=== Convert XPSWMM Model to Recommended TUFLOW Structure ===
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:
{| class="wikitable" width="80%" style="text-align:center"
!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>
<li> Open QGIS. If you do not have QGIS 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>.
<li> In QGIS, go to Processing > Toolbox from the top dropdown menu options to open the Processing Toolbox.
<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.
:* TCF: Click '...' and navigate to the XPSWMM .tcf. This should be located in the '''2D\Data''' folder.
:* 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 <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.
:* Advanced Parameters:
::* Tick on 'Write empty files'.
::* Output CRS: Select an appropriate Coordinate Reference System (CRS) for the model.
::* Tick on 'Force TUFLOW Directory Structure'.
::* TUFLOW Directory Structure Settings: Click '...'. Under 'Folder Structure', click the plus button to add a folder. Set 'Key' to '''swmm''', and 'Path' to '''./model/swmm'''.
<li> Click 'Run'.
<br><br>
{{Video|name=Animation_XPtoTUFLOW_2D_model_03a.mp4|width=1350}}
<br>
<li> Inspect the tool output to familiarize yourself with the TUFLOW model structure.
<br><br>
{{Video|name=|width=1350}}
<br>
</ol>
<br>
=== Load and Style the TUFLOW Model in QGIS ===
|