• InfoWorks WS Pro

Working with SQL

Use SQL in order to query model data and set properties of a network and control.


Tutorial resources

These downloadable resources will be used to complete this tutorial:


00:03

Structured query language.

00:05

Better known as SQL allows you to query model data like nodes and

00:09

links in a network and their associated control as well as simulation results.

00:14

If they are open.

00:16

And GIS background layers

00:19

SQL

00:19

queries can also help you set properties of a network and control.

00:24

You can use these queries to select objects in a GEO plan

00:28

display a table of results

00:29

or save results to a CSV.

00:33

They can also be used to aggregate time series data such as simulation results

00:39

in the model group window under session zero and four click and drag the

00:42

bridge net network into the workspace to open it in the GEO plan.

00:47

Next click and drag resize 63 bridge con into the GEO plan.

00:53

Expand selection lists then click and drag pipe selection into the GEO plan.

00:59

Notice that three pipes are now highlighted in red.

01:03

Next, expand the stored query group and double click pipe. Aggregate

01:09

the SQL pipe aggregate dialogue opens and shows

01:12

several options including dropdowns for object type field type

01:17

and field.

01:18

There is also a field with formulas that explain what actions the SQL will perform.

01:24

In this example, it will average the length diameter

01:28

flow

01:29

head loss and velocity of the three pipes highlighted in red in the GEO plan,

01:35

ensure that the box next to apply filter to current selection is checked.

01:41

Click test.

01:43

In this example, a notification tells you that the SQL has valid syntax.

01:49

Click OK. And then run

01:52

a grid appears showing the average length diameter flow

01:57

head loss and velocity of the three highlighted pipes

02:01

minimize the grid for now

02:04

in the workspace,

02:05

close the GEO plan and confirm that you want to close all windows associated with it.

02:11

You can try using SQL on other scenarios,

02:14

but keep in mind that you must give them a selection of objects to work with.

02:18

Otherwise it will not return any results.

Video transcript

00:03

Structured query language.

00:05

Better known as SQL allows you to query model data like nodes and

00:09

links in a network and their associated control as well as simulation results.

00:14

If they are open.

00:16

And GIS background layers

00:19

SQL

00:19

queries can also help you set properties of a network and control.

00:24

You can use these queries to select objects in a GEO plan

00:28

display a table of results

00:29

or save results to a CSV.

00:33

They can also be used to aggregate time series data such as simulation results

00:39

in the model group window under session zero and four click and drag the

00:42

bridge net network into the workspace to open it in the GEO plan.

00:47

Next click and drag resize 63 bridge con into the GEO plan.

00:53

Expand selection lists then click and drag pipe selection into the GEO plan.

00:59

Notice that three pipes are now highlighted in red.

01:03

Next, expand the stored query group and double click pipe. Aggregate

01:09

the SQL pipe aggregate dialogue opens and shows

01:12

several options including dropdowns for object type field type

01:17

and field.

01:18

There is also a field with formulas that explain what actions the SQL will perform.

01:24

In this example, it will average the length diameter

01:28

flow

01:29

head loss and velocity of the three pipes highlighted in red in the GEO plan,

01:35

ensure that the box next to apply filter to current selection is checked.

01:41

Click test.

01:43

In this example, a notification tells you that the SQL has valid syntax.

01:49

Click OK. And then run

01:52

a grid appears showing the average length diameter flow

01:57

head loss and velocity of the three highlighted pipes

02:01

minimize the grid for now

02:04

in the workspace,

02:05

close the GEO plan and confirm that you want to close all windows associated with it.

02:11

You can try using SQL on other scenarios,

02:14

but keep in mind that you must give them a selection of objects to work with.

02:18

Otherwise it will not return any results.

Step-by-step Guide

Structured Query Language, or SQL, allows you to query model data, like nodes and links in a network and control, simulation results that are open, and GIS background layers. SQL queries can also set properties of a network and control. You can use these queries to select objects in a GeoPlan, display a table of results, or save results to a CSV. They can also be used to aggregate timeseries data, such as simulation results.

  1. Open the appropriate data set.
  2. In the Model Group window, under Session 04, drag-and-drop the BridgeNet network into the workspace to open it in the GeoPlan.
  3. Drag-and-drop [Resize-63] BridgeCon into the GeoPlan.
  4. Expand Selection Lists.
  5. Drag-and-drop Pipe Selection into the GeoPlan.

Notice that three pipes are now highlighted in red.

In the InfoWater WS Pro interface, the Model Group window with the network, a run, and a selection list highlighted in red; and in the GeoPlan, three pipes highlighted in red.

  1. In the Model Group window, expand Stored Query Group.
  2. Double-click Pipe Aggregate.

The Model Group window with Stored Query Group expanded and Pipe Aggregate selected and called out.

  1. In the SQL: Pipe Aggregate dialog box, review the list of formulas that will calculate the length, diameter, flow, head loss, and velocity of the pipes selected in the GeoPlan.
  2. Enable Apply Filter to Current Selection.
  3. Click Test.
  4. In the notification dialog box, click OK.
  5. Click Run.

The SQL: Pipe Aggregate dialog box with a list of formulas that will calculate details, such as average diameter and flow, for the pipes selected in the GeoPlan.

  1. In the grid window, review the average length, diameter, flow, head loss, and velocity of the selected pipes.

The grid window with results from the query, such as length and average diameter of the selected pipes.

  1. Minimize the grid.
  2. In the workspace, Close the GeoPlan.
  3. Click Yes to confirm that you want to close all windows associated with the network.

Note: When using SQLs on other scenarios, remember, you must give them a selection of objects to work with, or it will not return any results.

Was this information helpful?