Using SQL to narrow 1D simulation results
Use result grid windows and create queries to narrow simulation results to your selected criteria.
Tutorial resources
These downloadable resources will be used to complete this tutorial:
Step-by-step guide
In InfoWorks ICM, all objects or a selection of objects can be viewed in a results grid window. SQL queries can also be used to create selections to narrow simulation results, or to generate custom tables containing specific object and results fields. For example, a query can select only the nodes that are flooding into a table with the ground level and maximum water level.
To use a results grid to tabulate all the result information for individual objects:
- Double-click the Design Run simulation to open it in a GeoPlan window.
- In the toolbar, from the Window menu, select Grid windows, and then select New node results window.
In the node results grid, the green column headings represent time-varying results for the current timestep, while black column headings represent the maximum results. The layout can be customized, sorted, and the results filtered by right-clicking in the grid.
- Right-click the Max Flood depth column header and select Sort Descending.
Now the nodes with the highest flood depths appear at the top of the grid.
It can be useful to narrow the results down to a custom selection. For example, to see a selection of only the nodes that are flooding, use an SQL query to make this selection with specific criteria:
- In the Database, right-click the 1D Sewer Model group and select New InfoWorks > Stored query.
- In the New Name popup, enter "Flooding Nodes".
- Click OK.
- In the Database, double-click Flooding Nodes to open the SQL window.
To set up a query to select only nodes that are flooding:
- On the SQL tab, in the Object Type drop-down, select All Nodes.
- Type the following query directly into the text box:
SELECT WHERE sim.max_floodvolume > 1 OR sim.max_flvol > 1;
This query identifies all nodes with a flood volume, stored or lost, greater than the tolerance of 1 m3.
- Enable Open Selection in Grid View.
- Click Test.
A notification appears to show if the query is valid and displays the number of items selected.
- Click OK.
- Click Save to save the query for later use, if needed.
- Click Run to run the query.
A grid appears, containing both the object properties and the simulation results based on the query.
- Scroll the grid to view the various properties for the selected nodes.
- Select all the rows in the grid.
- Switch to the model view to see the locations where flooding is occurring highlighted.
- Right-click anywhere in the GeoPlan and select Zoom to selection.
Further narrow the results with another query to select exactly what information appears in the grid. For this example, the query will select the nodes where the maximum flood depth is between 0 and -0.200m, and display only the node_id, ground_level, and max_flooddepth information.
- In the database, right-click the 1D Sewer Model group and select New InfoWorks > Stored query.
- In the New Name popup, enter the name "Risk of Flooding".
- Click OK.
- Double-click Risk of Flooding to open the SQL window.
- On the SQL tab, in the Object Type drop-down, select All Nodes.
- Use the Builder to help construct the query, or type the query directly into the text box:
SELECT node_id, ground_level, sim.max_flooddepth WHERE sim.max_flooddepth <= 0 AND sim.max_flooddepth >-0.200 ORDER BY sim.max_flooddepth DESC ;
- Enable Open Selection in Grid View.
- Click Test to validate the query.
- Click OK.
- Click Save.
- Click Run.
The grid appears with the results and displays only the columns built into the query.
- Select all the rows in the grid.
- Switch to the model view to see the locations where there is a risk of flooding highlighted.
- Right-click the GeoPlan and select Zoom to selection.