UtilityNetwork

Summary

The UtilityNetwork class provides access to methods that support managing subnetwork controllers and associations between network features. You can also create or delete connectivity, containment, and structural attachment associations between specified features, or enable or disable the subnetwork controller assignment from specified features.

Syntax

UtilityNetwork (utilityNetworkPath)
ParameterExplanationData Type
utilityNetworkPath

The input utility network.

String

Method Overview

MethodExplanation
AddConnectivityAssociation (association_type, from_table, from_global_id, from_terminal_name, to_table, to_global_id, to_terminal_name, percent_along)

The AddConnectivityAssociation method creates a connectivity association between two noncoincident features to model connectivity.

For example, you can define connectivity associations for point feature classes and junction object tables in the domain network and structure network as long as network rules exist to support the association. Two point features, such as a transformer and a fuse, that are not coincident can be offset from each other by x and y, or z while connectivity is maintained through a connectivity association. Junction-junction connectivity associations also support connectivity between terminals on features.

There are several types of connectivity associations: Junction-junction connectivity, Junction-edge from connectivity, Junction-edge midspan connectivity, and Junction-edge to connectivity.

AddContainmentAssociation (container_table, container_global_id, content_table, content_global_id, is_content_visible)

The AddContainmentAssociation method creates a containment association to model a dense collection of features in a network.

Containment associations allow a dense collection of features to be represented by a single feature. For example, devices, wires, and conductors can be placed inside features such as substations, switch gears, trenches, and ducts. Content features can be shown or hidden in the map view to improve visibility and reduce map clutter. Features that contain other features are known as containers and the features being contained are known as content.

A utility network supports nested containment as well as a one-to-many relationship between content and containers. With nested containment, a container feature can contain another container feature, which in turn contains other content. For example, a substation can contain a junction box, and the junction box can contain electrical devices. In a one-to-many relationship, a single content feature is contained in more than one container, for example, a single underground line spanning many duct banks.

AddStructuralAttachmentAssociation (structure_table, structure_global_id, attachment_table, attachment_global_id)

The AddStructuralAttachmentAssociation method creates a structural attachment association to allow the modeling of supporting structures and attachments that convey resources in the network.

Structural attachments logically associate structure features with other features in a utility network. These associations allow modeling the relationship between structures that support equipment and associated assets that are attached. For example, a pole can serve as the structure, with a transformer as the attachment.

Learn more about how to create a structural attachment association

DeleteConnectivityAssociation (association_type, association_global_id)

The DeleteConnectivityAssociation method removes the connectivity association between two features.

Learn more about how to delete a connectivity association

DeleteContainmentAssociation (association_global_id)

The DeleteContainmentAssociation method removes the containment association between a container feature and its content.

Learn more about how to delete a containment association

DeleteStructualAttachmentAssociation (association_global_id)

The DeleteStructualAttachmentAssociation method removes the structural attachment association between a structure feature and an attachment feature.

Learn more about how to delete a structural attachment association

DisableSubnetworkController (table, global_id, terminal_name)

The DisableSubnetworkController method removes the subnetwork controller assignment from a terminal on a device or junction object.

Learn more about how to remove a subnetwork controller

EnableSubnetworkController (table, global_id, terminal_name, subnetwork_controller_name, subnetwork_name, tier_name, description, notes)

The EnableSubnetworkController method enables a subnetwork controller.

Subnetwork controllers are set on the terminal of a device or junction object to represent the origin of a subnetwork.

Learn more about how to set a subnetwork controller

HasValidNetworkTopology ()

The HasValidNetworkTopology method checks whether the network topology is enabled.

Ensuring that the utility network's topology is enabled is helpful before creating associations and modifying subnetwork controllers.

Methods

AddConnectivityAssociation (association_type, from_table, from_global_id, from_terminal_name, to_table, to_global_id, to_terminal_name, percent_along)
ParameterExplanationData Type
association_type

An integer value representing the type of connectivity association that will be created.

  • 1—Junction-Junction Connectivity association
  • 4—Junction-Edge From Connectivity association
  • 5—Junction-Edge Midspan Connectivity association
  • 6—Junction-Edge To Connectivity association
Integer
from_table

The table name of the from object.

String
from_global_id

The global ID of the from object.

String
from_terminal_name

The terminal name of the from object.

String
to_table

The table name of the to object.

String
to_global_id

The global ID of the to object.

String
to_terminal_name

The terminal name of the to object.

String
percent_along

The percentage along the edge where the connection occurs. This is only used for midspan connectivity..

Float
Return Value
Data TypeExplanation
Integer

The object ID of the new connectivity association.

import arcpy

editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")

# Pass in the utility network layer
myUtilityNetwork = arcpy.un.UtilityNetwork(
    r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork") 

if not editor.isEditing:
    editor.startEditing()
    editor.startOperation()

object_id = myUtilityNetwork.AddConnectivityAssociation(
    1, "WaterDevice","{41D5BFC0-BFED-40A1-AB1A-02B0D69FB835}",
    "High Pressure In", "WaterDevice",
    "{D8F5535D-36B1-485E-97D3-E92E453CC11E}", "Port One", 0)

if editor.isEditing:
    editor.stopOperation()
    editor.stopEditing(True)
AddContainmentAssociation (container_table, container_global_id, content_table, content_global_id, is_content_visible)
ParameterExplanationData Type
container_table

The table name of the container object.

String
container_global_id

The global ID of the container object.

String
content_table

The table name of the content object.

String
content_global_id

The global ID of the content object.

String
is_content_visible

Specifies whether the content will be visible.

Boolean
import arcpy

editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase") 

# Pass in the utility network layer
myUtilityNetwork = arcpy.un.UtilityNetwork(
    r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork")

if not editor.isEditing:
    editor.startEditing()
    editor.startOperation()

myUtilityNetwork.AddContainmentAssociation(
    "StructureBoundary", "{A498A20B-C086-48C9-993D-F71231037806}",
    "WaterDevice", "{90483407-0BBF-48FF-A7B8-D3D26313A7CB}", True)

if editor.isEditing:
    editor.stopOperation()
    editor.stopEditing(True)
AddStructuralAttachmentAssociation (structure_table, structure_global_id, attachment_table, attachment_global_id)
ParameterExplanationData Type
structure_table

The table name of the structure object.

String
structure_global_id

The global ID of the structure object.

String
attachment_table

The table name of the attachment object.

String
attachment_global_id

The global ID of the attachment object.

String
Return Value
Data TypeExplanation
Integer

The object ID of the new attachment association.

import arcpy

editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")

myUtilityNetwork = arcpy.un.UtilityNetwork(
    r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork")

if not editor.isEditing:
    editor.startEditing()
    editor.startOperation()

object_id = myUtilityNetwork.AddStructuralAttachmentAssociation(
    "StructureJunction", "{529DE843-659D-499B-AF2A-FA8E47E89CAD}",
    "ElecDistDevice", "{505C79BC-1019-4A71-85B5-F4D38F6E0C6E}")

if editor.isEditing:
    editor.stopOperation()
    editor.stopEditing(True)
DeleteConnectivityAssociation (association_type, association_global_id)
ParameterExplanationData Type
association_type

An integer value representing the type of connectivity association that will be deleted.

  • 1—Junction-Junction Connectivity association
  • 4—Junction-Edge From Connectivity association
  • 5—Junction-Edge Midspan Connectivity association
  • 6—Junction-Edge To Connectivity association
Integer
association_global_id

The global ID of the association that will be deleted.

String
import arcpy

editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")

myUtilityNetwork = arcpy.un.UtilityNetwork(
    r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork")

if not editor.isEditing:
    editor.startEditing()
    editor.startOperation()

myUtilityNetwork.DeleteConnectivityAssociation(
    1, "{0356CDD1-C44A-4273-8EE7-73A27EFEF116}")

if editor.isEditing:
    editor.stopOperation()
    editor.stopEditing(True)
DeleteContainmentAssociation (association_global_id)
ParameterExplanationData Type
association_global_id

The global ID for the specified containment association in the utility network.

String
import arcpy

editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")

myUtilityNetwork = arcpy.un.UtilityNetwork(
    r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork")

if not editor.isEditing:
    editor.startEditing()
    editor.startOperation()

myUtilityNetwork.DeleteContainmentAssociation(
    "{8513D6CE-0416-4967-BBCC-591A1C34CF4A}")

if editor.isEditing:
    editor.stopOperation()
    editor.stopEditing(True)
DeleteStructualAttachmentAssociation (association_global_id)
ParameterExplanationData Type
association_global_id

The global ID of the specified structural attachment association in the utility network.

String
import arcpy

editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")

# Pass in the utility network layer
myUtilityNetwork = arcpy.un.UtilityNetwork(
    r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork") 

if not editor.isEditing:
    editor.startEditing()
    editor.startOperation()

myUtilityNetwork.DeleteStructuralAttachmentAssociation(
    "{549DE843-659D-499B-AF2A-FA8E47E89CAD}")

if editor.isEditing:
    editor.stopOperation()
    editor.stopEditing(True)
DisableSubnetworkController (table, global_id, terminal_name)
ParameterExplanationData Type
table

The table name to which the subnetwork controller is assigned.

String
global_id

The global ID for the feature to which the subnetwork controller is assigned.

String
terminal_name

The name of the terminal to which the subnetwork controller is assigned.

String
import arcpy

editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase")

myUtilityNetwork = arcpy.un.UtilityNetwork(
    r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork")

if not editor.isEditing:
    editor.startEditing()
    editor.startOperation()

myUtilityNetwork.DisableSubnetworkController(
    "ElecDistDevice", "{A6BFF336-92F9-45F0-8ACE-AAD6137E5E2B}", "Side1")

if editor.isEditing:
    editor.stopOperation()
    editor.stopEditing(True)
EnableSubnetworkController (table, global_id, terminal_name, subnetwork_controller_name, subnetwork_name, tier_name, description, notes)
ParameterExplanationData Type
table

The table name to which the new subnetwork controller will be assigned.

String
global_id

The global ID for the feature to which the new subnetwork controller will be assigned.

String
terminal_name

The name of the terminal on which the new subnetwork controller will be assigned.

String
subnetwork_controller_name

The name of the new subnetwork controller.

String
subnetwork_name

The name of the subnetwork on which the subnetwork controller participates.

String
tier_name

The name of the tier to which the subnetwork controller belongs.

String
description

A description of the new subnetwork controller.

String
notes

Notes for the new subnetwork controller.

String
Return Value
Data TypeExplanation
Integer

The object ID of the new row in the subnetworks table.

import arcpy

editor = arcpy.da.Editor(r"C:\testData\SDK_UtilityNetwork.geodatabase") 

# Pass in the utility network layer
myUtilityNetwork = arcpy.un.UtilityNetwork(
    r"C:\testData\SDK_UtilityNetwork.geodatabase\main.TestNetwork\main.TestNetwork") 

if not editor.isEditing:
    editor.startEditing()
    editor.startOperation()

object_id = myUtilityNetwork.EnableSubnetworkController(
    "PipelineDevice", "{560FCA60-62B4-4B40-8CD9-9986AD63FA10}", "Terminal One",
    "#2-213 - Batchelder HP T1", "213 - Batchelder HP", "Cathodic Read Location", 
    "Some Description", "No Notes")

if editor.isEditing:
    editor.stopOperation()
    editor.stopEditing(True)
HasValidNetworkTopology ()
Return Value
Data TypeExplanation
Boolean

A return Boolean value of True indicates that the topology for the utility network is enabled.

import arcpy
 
myUtilityNetwork = arcpy.un.UtilityNetwork(
    r"C:\path\to\data\testdata1.sde\ELEC.TestNetwork\ELEC.TestNetwork")

is_valid = myUtilityNetwork.HasValidNetworkTopology()