Using the Sync Out function to update source files using ModelBuilder

Product(s): Bentley WaterGEMS, WaterCAD, HAMMER, SewerGEMS, SewerCAD, CivilStorm, StormCAD
Version(s): V8i, Connect Edition
Area: Layout and Data Input

Overview

It is often a challenge to maintain the synchronization between the source file and the model. However, by using ModelBuilder, this can be done more efficiently. 

This TechNote is a continuation of the "Building and updating a model using ModelBuilder" TechNote, though it can be used independently. For example, you can use this methodology to transfer demand or loading data from a model file to an Excel spreadsheet, as mentioned in the following link: Can demand data be exported to an Excel file for use in another model?

Whether you are exporting demand data to a spreadsheet or updating your source file with up-to-date data from your water or storm-sewer model, you would use the Sync Out function in ModelBuilder. The steps below describe a more conventional usage of updating your source file information. The procedure uses a shapefile as the source file and WaterGEMS as the modeling software. However, these steps can generally be followed in any of the products listed above and with any source file type. 

Preview of Source File

The screenshot below shows the system as found in the source file.

However, the hydraulic system has been updated to remove four pipes found at the right end of the system. If the goal is to keep the source file and the hydraulic model in sync, you could manually adjust the source file. However, using the Sync Out function in ModelBuilder is a simple way to do this.

Updating Source File Using ModelBuilder

Now that the differences have been reviewed, the source file can be updated with the new information found in the WaterGEMS data. Before updating the source file directly it is recommended to make a back up copy of the source file. This way you will not lose any of the original data.

Select or create the ModelBuilder connection

Open ModelBuilder and you will see the ModelBuilder manager shown below:

If you built a model using the source file you want to modify, it will be listed in this table. To open that connection, simply double-click on it. If the model was built from a different computer, the connection may not be listed. If not, click the New button in the dialog shown above. Once you do that, the ModelBuilder wizard will open. You can also import an existing ModelBuilder connection by selecting the Import/Export button in the upper left.

Specify your Data Source

If you are using an existing ModelBuilder connection, the source file will already be selecting. However, these steps assume that they will need to be selected to assure that the process is understood.

The first step is to specify the source file. Select the Data Source type from the pulldown menu. This will be the source file type for the model. In this example it is the "ArcGIS Geodatabase Features" option, but if your source file is a different type, you will select that. Next, click the Browse button and browse to where the source file is saved.  

In this step, you can also applied a SQL query and preview the data in the source file. When "Show Preview" box is checked, only highlighted Table will be displayed. 

To continue, click Next.

Specify Spatial and Connectivity Options

The next screen lets you specify the units and connectivity options. This example uses feet as the coordinate unit. For metric models, the coordinate unit will likely be meters. You can choose the coordinate unit from the pull down menu at the top of the dialog.

Next, you will choose the connectivity options. The option "Create nodes if none found at pipe endpoint"will create a node at any pipe endpoint that doesn't have a connected node or is not within the specified tolerance of an existing node. To make this feel active, click the check box next to it. 

For the option "Establish connectivity using spatial data," this allows you to set a tolerance value for connectivity. If there is a node within the specified tolerance, pipes that are imported will be connected to that node. The unit associated with the tolerance is dictated by the coordinate unit you select.

Note: It is generally good practice to check both of the connectivity options, as shown above. If there is no junction within the specified tolerance and if no node is created if none is found at the end point, the pipe will not be imported at all. 

Once this is completed, click Next.

Specify Element Create/Remove/Update Options

Depending upon the requirement the selection of options may vary. For this particular example, following options are selected. These selections will prompt the program to add and update items, as as remove them if they are not present. This will allow the file to be fully up-to-date once the process is completed. In other words, if an item is no longer in the model, it will also be removed from the source file. 

Click Next.

Specify Additional Options

This allows the user to select the key field that will be used in field mapping. The options are Label or GIS-ID. Label is a common usage, particularly if there is a unique identifier in the source file. In this example, the unique identifier is the Label field in the source file. If there is a GIS-ID, that can be used as the key field as well. 

The main point of the Key Field is that it is unique. This allows for information to be properly mapped between the model and the source file. For instance, if the label for a pipe in a source is P-1, the the label P-1 must be present in the Hydraulic Model.

Click Next.

Specify Field mappings for each Table/Feature Class

If you used an existing connection at the start of the process, the items in the Specify Field Mappings section should be already be set. If a new button had been clicked then all the necessary elements and the fields need to be mapped. Follow the steps in the "Specify Field Mapping for each table/feature class" section from the Building and Updating a model using ModelBuilder TechNote for steps on doing this. 

Create Model Now?

 For the option "Would you like to build a model now?", select "No". If you say Yes to this, the hydraulic model will be updated, which is not necessary. The steps above were done to assure that the ModelBuilder connection was set up properly, so that the Sync Out function will be completed correctly. After select No, and click Finish.

Sync Out

Now it is time to sync out to the source file. In the ModelBuilder manager, select the connection that was just updated or used and click Sync Out.

  

This will sync the data in the hydraulic model with the source file. If you view the source file in its native platform again, you will see that that it was been updated. As shown in the screenshot below, the elements on the right side of the system have been removed. 

FAQ : What if you have used batch pipe split tool? 

While creating shapefiles you have to make sure to snap all pipes / lines to the end points, if you snap them to mid points so when Modelbuilder builds your network it will create a junction on the end point of a pipe that is attached to the mid-point of the other pipe, but the pipe won't be attached. When this occurs you'll have to use the batch pipe split tool. However when you split pipes using this tool, these split pipes will have common GIS ID, which can be a problem when you want to sync out the data to update your source file. 

E.g. when you want to sync details from one of these split pipe to one in GIS shapefile, Modelbuilder cant control which of the split pipes (with the same GIS-ID in the hydraulic model) values will be sync'd out (to the one pipe with that GIS-ID) in the GIS.

See Also

Building and updating a model using ModelBuilder

Preparing GIS data for use in the hydraulics and hydrology products 

Hydraulics and Hydrology Forum

Recommended
Related