Configure subnetwork trace

View inAndroidFormsUWPWPFWinUIiOSView on GitHub

Get a server-defined trace configuration for a given tier and modify its traversability scope, add new condition barriers and control what is included in the subnetwork trace result.

Image of configure subnetwork trace

Use case

While some traces are built from an ad-hoc group of parameters, many are based on a variation of the trace configuration taken from the subnetwork definition. For example, an electrical trace will be based on the trace configuration of the subnetwork, but may add additional clauses to constrain the trace along a single phase. Similarly, a trace in a gas or electric design application may include features with a status of "In Design" that are normally excluded from trace results.

How to use the sample

The sample loads with a server-defined trace configuration from a tier. Check or uncheck which options to include in the trace - such as containers or barriers. Use the selection boxes to define a new condition network attribute comparison, and then use 'Add' to add the it to the trace configuration. Tap 'Trace' to run a subnetwork trace with this modified configuration from a default starting location.

Example barrier conditions for the default dataset:

  • 'Transformer Load' Equal '15'
  • 'Phases Current' DoesNotIncludeTheValues 'A'
  • 'Generation KW' LessThan '50'

How it works

  1. Create and load a UtilityNetwork with a feature service URL, then get an asset type and a tier by their names.
  2. Populate the choice list for the comparison source with the non-system defined Definition.NetworkAttributes. Populate the choice list for the comparison operator with the enum values from UtilityAttributeComparisonOperator.
  3. Create a UtilityElement from this asset type to use as the starting location for the trace.
  4. Update the selected barrier expression and the checked options in the UI using this tier's TraceConfiguration.
  5. When 'Network Attribute' is selected, if its Domain is a CodedValueDomain, populate the choice list for the comparison value with its CodedValues. Otherwise, display a free-form textbox for entering an attribute value.
  6. When 'Add' is clicked, create a new UtilityNetworkAttributeComparison using the selected comparison source, operator, and selected or typed value. Use the selected source's NetworkAttribute.DataType to convert the comparison value to the correct data type.
  7. If the Traversability's list of Barriers is not empty, create a UtilityTraceOrCondition with the existing Barriers and the new comparison from Step 6.
  8. When 'Trace' is clicked, create UtilityTraceParameters passing in UtilityTraceType.Subnetwork and the default starting location. Set its TraceConfiguration with the modified options, selections, and expression; then run a UtilityNetwork.TraceAsync.
  9. When Reset is clicked, set the trace configurations expression back to its original value.
  10. Display the count of returned UtilityElementTraceResult.Elements.

Relevant API

  • CodedValueDomain
  • UtilityAssetType
  • UtilityAttributeComparisonOperator
  • UtilityCategory
  • UtilityCategoryComparison
  • UtilityCategoryComparisonOperator
  • UtilityDomainNetwork
  • UtilityElement
  • UtilityElementTraceResult
  • UtilityNetwork
  • UtilityNetworkAttribute
  • UtilityNetworkAttributeComparison
  • UtilityNetworkDefinition
  • UtilityTerminal
  • UtilityTier
  • UtilityTraceAndCondition
  • UtilityTraceConfiguration
  • UtilityTraceOrCondition
  • UtilityTraceParameters
  • UtilityTraceResult
  • UtilityTraceType
  • UtilityTraversability

About the data

The Naperville electrical network feature service, hosted on ArcGIS Online, contains a utility network used to run the subnetwork-based trace shown in this sample.

Additional information

Using utility network on ArcGIS Enterprise 10.8 requires an ArcGIS Enterprise member account licensed with the Utility Network user type extension. Please refer to the utility network services documentation.

Tags

category comparison, condition barriers, network analysis, network attribute comparison, subnetwork trace, trace configuration, traversability, utility network, validate consistency

Sample Code

ConfigureSubnetworkTrace.xamlConfigureSubnetworkTrace.xamlConfigureSubnetworkTrace.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<ContentPage x:Class="ArcGISRuntimeXamarin.Samples.ConfigureSubnetworkTrace.ConfigureSubnetworkTrace"
             xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
    <Grid>
        <TableView x:Name="ConfigureTable"
                   HasUnevenRows="True"
                   Intent="Settings">
            <TableRoot>
                <TableSection Title="Trace options">
                    <SwitchCell On="True"
                                OnChanged="IncludeBarriersChanged"
                                Text="Include barriers" />
                    <SwitchCell On="True"
                                OnChanged="IncludContainersChanged"
                                Text="Include containers" />
                    <!--  NOTE that There are also: IncludeContent, IncludeStructures, IgnoreBarriersAtStartingPoints, ValidateConsistency  -->
                </TableSection>
                <TableSection>
                    <ViewCell>
                        <Label FontSize="Medium" Text="Example barrier condition for this data: 'Transformer Load' Equal '15'" />
                    </ViewCell>
                </TableSection>
                <TableSection Title="Define new condition">
                    <ViewCell>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                            </Grid.RowDefinitions>
                            <Picker x:Name="Attributes"
                                    Grid.Row="0"
                                    ItemDisplayBinding="{Binding Name}"
                                    SelectedIndexChanged="OnAttributeChanged"
                                    VerticalOptions="CenterAndExpand" />
                            <Picker x:Name="Operators"
                                    Grid.Row="1"
                                    VerticalOptions="CenterAndExpand" />
                            <Picker x:Name="ValueSelection"
                                    Grid.Row="2"
                                    ItemDisplayBinding="{Binding Name}"
                                    VerticalOptions="CenterAndExpand" />
                            <Entry x:Name="ValueEntry"
                                   Grid.Row="2"
                                   IsVisible="False" />
                            <Button Grid.Row="3"
                                    Clicked="OnAddCondition"
                                    Text="Add condition" />
                        </Grid>
                    </ViewCell>
                </TableSection>
                <TableSection Title="Barrier conditions">
                    <ViewCell>
                        <ScrollView HeightRequest="150">
                            <Label x:Name="ConditionBarrierExpression"
                                   Grid.Row="0"
                                   FontAttributes="Bold"
                                   Text="" />
                        </ScrollView>
                    </ViewCell>
                </TableSection>
                <TableSection>
                    <ViewCell>
                        <Button Clicked="OnTrace" Text="Trace" />
                    </ViewCell>
                    <ViewCell>
                        <Button Clicked="OnReset" Text="Reset" />
                    </ViewCell>
                </TableSection>
            </TableRoot>
        </TableView>
    </Grid>
</ContentPage>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.