ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Data.UtilityNetwork Namespace / SubnetworkManager Class / EnableController Method
The Tier to which the Subnetwork is created.
Corresponds to the feature to be enabled as a SubnetworkController. This Element must specify a terminal, and this terminal must be specified as a Controller Terminal in the terminal definition.
Name of the subnetwork.
Name of the subnetwork controller.
A description for the subnetwork controller.
Additional notes for the subnetwork controller.
Example

In This Topic
    EnableController Method
    In This Topic
    Enables a feature corresponding to device to be a SubnetworkController and adds it to an existing Subnetwork corresponding to subnetworkName. If the specified subnetwork does not exist, a new one will be created. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function EnableController( _
       ByVal tier As Tier, _
       ByVal device As Element, _
       ByVal subnetworkName As String, _
       ByVal controllerName As String, _
       ByVal description As String, _
       ByVal notes As String _
    ) As Subnetwork

    Parameters

    tier
    The Tier to which the Subnetwork is created.
    device
    Corresponds to the feature to be enabled as a SubnetworkController. This Element must specify a terminal, and this terminal must be specified as a Controller Terminal in the terminal definition.
    subnetworkName
    Name of the subnetwork.
    controllerName
    Name of the subnetwork controller.
    description
    A description for the subnetwork controller.
    notes
    Additional notes for the subnetwork controller.

    Return Value

    The newly-created or modified subnetwork.
    Exceptions
    ExceptionDescription
    If the Terminal in device is null and the associated TerminalConfiguration has multiple terminals.
    A geodatabase-related exception has occurred.
    This method or property must be called within the lambda passed to QueuedTask.Run
    Remarks
    • This routine generates its own editing transaction and therefore cannot be wrapped inside a separate transaction.
    • When writing an ArcGIS Pro add-in, the extension method UtilityNetworkExtensions.EnableControllerInEditOperation should be used instead. This extension method will create an edit operation on the Pro undo/redo stack and redraw any affected layers.
    Example
    Life cycle for a mesh subnetwork with multiple controllers
    // Create a subnetwork named "Mesh1" from three controllers
    // elementM1, elementM2, and elementM3 represent the devices that serve as subnetwork controllers (e.g., network protectors)
    subnetworkManager.EnableController(lowVoltageMeshTier, elementM1, "Mesh1", "M1", "my description", "my notes");
    subnetworkManager.EnableController(lowVoltageMeshTier, elementM2, "Mesh1", "M2", "my description", "my notes");
    Subnetwork subnetworkMesh1 = subnetworkManager.EnableController(lowVoltageMeshTier, elementM3, "Mesh1", "M3", "my description", "my notes");
    subnetworkMesh1.Update();
    MapView.Active.Redraw(true);
    
    // ...
    
    // When deleting the subnetwork, each controller must be disabled before the subnetwork itself is deleted
    subnetworkManager.DisableControllerInEditOperation(elementM1);
    subnetworkManager.DisableControllerInEditOperation(elementM2);
    subnetworkManager.DisableControllerInEditOperation(elementM3);
    
    // After the subnetwork is deleted, all of the rows that have been labeled with the subnetwork ID need to be updated
    subnetworkMesh1.Update();
    MapView.Active.Redraw(true);
    
    // The final step is to notify external systems (if any) by exporting the subnetwork
    SubnetworkExportOptions subnetworkExportOptions = new SubnetworkExportOptions()
    {
      SetAcknowledged = true,
      IncludeDomainDescriptions = true,
      IncludeGeometry = true,
      ServiceSynchronizationType = ServiceSynchronizationType.Asynchronous,
    
      SubnetworkExportResultTypes = new List<SubnetworkExportResultType>()
      {
        SubnetworkExportResultType.Features
      }
      
      // Set networks attributes and attribute fields to export
      //ResultNetworkAttributes = new List<NetworkAttribute>(networkAttributes),
    
      //ResultFieldsByNetworkSourceID = new Dictionary<int, List<string>>()
      //  { { electricDevice.ID, new List<string>() { "AssetID" } } }
    
    };
    subnetworkMesh1.Export(new Uri($"{Path.GetTempPath()}SubnetworkExportResult.json"), subnetworkExportOptions);
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also