16 Replies Latest reply on Jan 11, 2018 11:52 AM by Nick Apostolakis

    Spatial Analysis between Meters and Transformers

    Jim Kyle

      Hi,

       

      I am about to begin development of Geospatial tool that will look into our electric distribution network to try to determine which meters are connected to possibly the wrong transformer in our data.  Another part of this is possibly creating a little app to allow field personnel to change the Transformer to Meter relationship on these potentially incorrectly related features in the field and correct them during a field audit/visit.

       

      I am not exactly sure about how to go about this process - possibly start with identifying transformers that appear to be too far away to their related/connected meter and then possibly identifying/comparing between AMI data and GIS data.

       

      A quick internet search on this issue reveals that it kind of a common problem with electrical utility data so the point of this email is I am wondering if anybody out there has already gone through this process and could provide any insights on this topic? (and or if they have any geoprocessing script templates they would be willing to share).

       

      Thanks.

        • Re: Spatial Analysis between Meters and Transformers
          Mike Tulis

          I had similar question and here is the solution: How can I trace and record transformer information in meter attributes?  I hope this helps you.

           

          We are using Survalent's GIS Wizard to trace transformer <-> meter relationship instead. The tool uses linear connectivity rules (developed for GIS integration with SCADA and OMS). We then copy the results into GIS.

          • Re: Spatial Analysis between Meters and Transformers
            Mike Tulis

            How can I trace and record transformer information in meter attributes?

            This question has been Answered.

            Mike TulisNewbie

             

            Visibility: , Jim Kyle

            I would like to find a way to trace all meters to the transformer from which they are being fed. Then record the transformer ObjectID (e.g. 10959) in the related meter attributes. As shown in the pictures below the highlighted 11 meters are fed from single B phase 50 kV pole mounted transformer 3-305 (ObjectID 10959). Is there an existing ArcFM tool that would trace entire network and record transformer ObjectIDs to its related Meters attribute (TransformerObjectID).

            Meter Transformer Relationship.pngTransformer Meter Relationship2.png

            Your feedback is greatly appreciated. I am not sure where to start, but I am sure I am not the only person who would like to automate this process. Thank you. Mike.

             

            Francesco Giovinazzo
            Correct Answerby Francesco Giovinazzo on 08-Oct-2014 07:57

             

            Hello Mike,

             

            in this C# snippet I start from a switch in my system and trace all the downstream features, selecting them. The trace task will try to determine the flow from the starting junction, if it fails you should pass the EID of the element from which the flow is coming, aiding procedure.

             

            You can iterate through the results searching only for the features you need and perform updates, the functions at the bottom are ArcFM Samples I have found in the past.

             

            Let me know if you need further help

             

            Regards

             

            Fra

             

            List<IFeature> ListaBarriere = setup a list of barriers if you need them

            IFeature Interruttore = ... get your junction feature from where to start the trace

             

             

             

            INetworkClass pNetClass = (INetworkClass)Interruttore.Class;

            INetwork pNetwork = pNetClass.GeometricNetwork.Network;

            INetElements pNetEl = (INetElements)pNetwork;

            INetTopology pTopo = (INetTopology)pNetwork;

             

             

            int EID = pNetEl.GetEID(Interruttore.Class.ObjectClassID, Interruttore.OID, -1, esriElementType.esriETJunction);

             

             

             

            // create an instance of the Feeder Manager class

            // that performs electric tracing functions

            IMMElectricTracing elecTrace = new MMFeederTracerClass();

             

             

            IMMCurrentStatus cs = null;

             

             

             

            // the tracing results will be returned in these variables

            IMMTracedElements tracedJcts;

            IMMTracedElements tracedEdgs;

             

             

            int[] barrierJncts = new int[ListaBarriere.Count];

            int[] barrierEdges = new int[0];

             

             

             

            //setting the barriers with the appropriate EID

            int indice = 0;

            foreach (IFeature pBarriera in ListaBarriere)

            {

              int barriera_eid = pNetEl.GetEID(pBarriera.Class.ObjectClassID, pBarriera.OID, -1, esriElementType.esriETJunction);

              barrierJncts[indice] = barriera_eid;

              indice++;

            }

             

             

             

            //setting trace parameters

            IMMElectricTraceSettings pSettings = new MMElectricTraceSettingsClass();

            pSettings.RespectConductorPhasing = true;

            pSettings.RespectEnabledField = true;

            IMMElectricTraceSettingsEx pSettingEx = (IMMElectricTraceSettingsEx)pSettings;

            pSettingEx.UseFeederManagerCircuitSources = true;

             

             

             

            //executing the trace

            elecTrace.TraceDownstream(pNetClass.GeometricNetwork,

              pSettingEx,

              cs,

              EID,

              esriElementType.esriETJunction,

              SetOfPhases.abc,

              mmDirectionInfo.establishBySourceSearch,

              0,

              esriElementType.esriETJunction,

              barrierJncts,

              barrierEdges,

              true,

              out tracedJcts,

              out tracedEdgs);

             

             

             

            //results are here, you can enumerate the junctions searching only for the featureclasses you need

            IEnumNetEID TracedJunctions = ConvertTracedElementsCollectionToEnumNetEid(tracedJcts, pNetwork);

            IEnumNetEID TracedEdges = ConvertTracedElementsCollectionToEnumNetEid(tracedEdgs, pNetwork);

             

             

             

            //if needed, draw or select (maybe looping through IFeatureSelection is easier)

            DrawOrSelectTraceResults(TracedJunctions, TracedEdges, true);

             

             

            //...

             

             

             

             

             

            //function to convert from collection to enum net eid

            public IEnumNetEID ConvertTracedElementsCollectionToEnumNetEid(IMMTracedElements tracedElements, INetwork network)

            {

              // we have a feedpath, now we want to extract all the elements of one type and

              // put them in an esri enumneteid so we can display it on the map or other fun stuff

              IEnumNetEID resultEnum = null;

             

             

              IEnumNetEIDBuilder enumNetEIDBuilder = new EnumNetEIDArrayClass();

              enumNetEIDBuilder.Network = network;

              enumNetEIDBuilder.ElementType = (esriElementType)tracedElements.ElementType;

             

             

              INetElements netElements = network as INetElements;

             

             

              if ((netElements != null) && (esriElementType.esriETEdge == (esriElementType)tracedElements.ElementType))

              {

              tracedElements.Reset();

              IMMTracedElement tracedElement = tracedElements.Next();

              while (tracedElement != null)

              {

              IEnumNetEID tempEnumNetEID = netElements.GetEIDs(tracedElement.FCID, tracedElement.OID, esriElementType.esriETEdge);

              tempEnumNetEID.Reset();

              for (int eid = tempEnumNetEID.Next(); eid > 0; eid = tempEnumNetEID.Next())

              {

              enumNetEIDBuilder.Add(eid);

              }

              tracedElement = tracedElements.Next();

              }

              }

              else

              {

              tracedElements.Reset();

              IMMTracedElement tracedElement = tracedElements.Next();

              while (tracedElement != null)

              {

              enumNetEIDBuilder.Add(tracedElement.EID);

              tracedElement = tracedElements.Next();

              }

              }

              resultEnum = enumNetEIDBuilder as IEnumNetEID;

              return resultEnum;

            }

             

             

             

            //function to select or draw

            public void DrawOrSelectTraceResults(IEnumNetEID junctionList, IEnumNetEID edgeList, bool overrideSelectSetting)

            {

              //obtain a reference to the interface by querying the application for the Utility Network Analysis extension

              UID networkExtensionUID = new UIDClass();

              networkExtensionUID.Value = "esriEditorExt.UtilityNetworkAnalysisExt";

              INetworkAnalysisExt networkExtension = m_app.FindExtensionByCLSID(networkExtensionUID) as INetworkAnalysisExt;

             

             

              if (networkExtension != null)

              {

              INetworkAnalysisExtResults networkAnalysisResults = networkExtension as INetworkAnalysisExtResults;

              networkAnalysisResults.ClearResults();

             

             

              networkAnalysisResults.SetResults(junctionList, edgeList);

              //determine if results should be drawn

              if (networkAnalysisResults.ResultsAsSelection)

              {

              networkAnalysisResults.CreateSelection(junctionList, edgeList);

              }

              else if (overrideSelectSetting)

              {

              // temporarily toggle the user's setting

              networkAnalysisResults.ResultsAsSelection = true;

              networkAnalysisResults.CreateSelection(junctionList, edgeList);

              networkAnalysisResults.ResultsAsSelection = false;

              }

             

             

              networkAnalysisResults.ClearResults();

              networkAnalysisResults = null;

              }

             

             

              networkExtensionUID = null;

              networkExtension = null;

            }

            See the answer in context

             

            Average User Rating: No ratings (0 ratings)
            •  

              Re: How can I trace and record transformer information in meter attributes?
              Francesco GiovinazzoJourneymanHello Mike, I have used electric traces from C# code several times, if you need help I can provide a sample, the tracewill result in the EID of each junction or edge connected based on the trace you use, from the EID you can find the corresponding feature and if it's a transformer you can perform whatever operation you want. Regards Francesco

               

              •  

                Re: How can I trace and record transformer information in meter attributes?
                Mike TulisNewbieBuon Giorno Francesco, Thank you for your prompt reply. I would like to see the sample code and methodology how you accomplished this task. Please bear in mind that my programming skills are rusty and limited , but I am more than willing to try and learn . Mike

                 

                •  

                  Correct AnswerRe: How can I trace and record transformer information in meter attributes?
                  Francesco GiovinazzoJourneymanHello Mike, in this C# snippet I start from a switch in my system and trace all the downstream features, selecting them. The trace task will try to determine the flow from the starting junction, if it fails you should pass the EID of the element from which the flow is coming, aiding procedure. You can iterate through the results searching only for the features you need and perform updates, the functions at the bottom are ArcFM Samples I have found in the past. Let me know if you need further help Regards Fra
                  List<IFeature> ListaBarriere = setup a list of barriers if you need themIFeature Interruttore = ... get your junction feature from where to start the trace INetworkClass pNetClass = (INetworkClass)Interruttore.Class;INetwork pNetwork = pNetClass.GeometricNetwork.Network;INetElements pNetEl = (INetElements)pNetwork;INetTopology pTopo = (INetTopology)pNetwork; int EID = pNetEl.GetEID(Interruttore.Class.ObjectClassID, Interruttore.OID, -1, esriElementType.esriETJunction); // create an instance of the Feeder Manager class// that performs electric tracing functionsIMMElectricTracing elecTrace = new MMFeederTracerClass(); IMMCurrentStatus cs = null; // the tracing results will be returned in these variablesIMMTracedElements tracedJcts;IMMTracedElements tracedEdgs; int[] barrierJncts = new int[ListaBarriere.Count];int[] barrierEdges = new int[0]; //setting the barriers with the appropriate EIDint indice = 0;foreach (IFeature pBarriera in ListaBarriere){  int barriera_eid = pNetEl.GetEID(pBarriera.Class.ObjectClassID, pBarriera.OID, -1, esriElementType.esriETJunction);  barrierJncts[indice] = barriera_eid;  indice++;} //setting trace parametersIMMElectricTraceSettings pSettings = new MMElectricTraceSettingsClass();pSettings.RespectConductorPhasing = true;pSettings.RespectEnabledField = true;IMMElectricTraceSettingsEx pSettingEx = (IMMElectricTraceSettingsEx)pSettings;pSettingEx.UseFeederManagerCircuitSources = true; //executing the traceelecTrace.TraceDownstream(pNetClass.GeometricNetwork,  pSettingEx,  cs,  EID,  esriElementType.esriETJunction,  SetOfPhases.abc,  mmDirectionInfo.establishBySourceSearch,  0,  esriElementType.esriETJunction,  barrierJncts,  barrierEdges,  true,  out tracedJcts,  out tracedEdgs); //results are here, you can enumerate the junctions searching only for the featureclasses you needIEnumNetEID TracedJunctions = ConvertTracedElementsCollectionToEnumNetEid(tracedJcts, pNetwork);IEnumNetEID TracedEdges = ConvertTracedElementsCollectionToEnumNetEid(tracedEdgs, pNetwork); //if needed, draw or select (maybe looping through IFeatureSelection is easier)DrawOrSelectTraceResults(TracedJunctions, TracedEdges, true); //... //function to convert from collection to enum net eidpublic IEnumNetEID ConvertTracedElementsCollectionToEnumNetEid(IMMTracedElements tracedElements, INetwork network){  // we have a feedpath, now we want to extract all the elements of one type and  // put them in an esri enumneteid so we can display it on the map or other fun stuff  IEnumNetEID resultEnum = null;   IEnumNetEIDBuilder enumNetEIDBuilder = new EnumNetEIDArrayClass();  enumNetEIDBuilder.Network = network;  enumNetEIDBuilder.ElementType = (esriElementType)tracedElements.ElementType;   INetElements netElements = network as INetElements;   if ((netElements != null) && (esriElementType.esriETEdge == (esriElementType)tracedElements.ElementType))  {  tracedElements.Reset();  IMMTracedElement tracedElement = tracedElements.Next();  while (tracedElement != null)  {  IEnumNetEID tempEnumNetEID = netElements.GetEIDs(tracedElement.FCID, tracedElement.OID, esriElementType.esriETEdge);  tempEnumNetEID.Reset();  for (int eid = tempEnumNetEID.Next(); eid > 0; eid = tempEnumNetEID.Next())  {  enumNetEIDBuilder.Add(eid);  }  tracedElement = tracedElements.Next();  }  }  else  {  tracedElements.Reset();  IMMTracedElement tracedElement = tracedElements.Next();  while (tracedElement != null)  {  enumNetEIDBuilder.Add(tracedElement.EID);  tracedElement = tracedElements.Next();  }  }  resultEnum = enumNetEIDBuilder as IEnumNetEID;  return resultEnum;} //function to select or drawpublic void DrawOrSelectTraceResults(IEnumNetEID junctionList, IEnumNetEID edgeList, bool overrideSelectSetting){  //obtain a reference to the interface by querying the application for the Utility Network Analysis extension  UID networkExtensionUID = new UIDClass();  networkExtensionUID.Value = "esriEditorExt.UtilityNetworkAnalysisExt";  INetworkAnalysisExt networkExtension = m_app.FindExtensionByCLSID(networkExtensionUID) as INetworkAnalysisExt;   if (networkExtension != null)  {  INetworkAnalysisExtResults networkAnalysisResults = networkExtension as INetworkAnalysisExtResults;  networkAnalysisResults.ClearResults();   networkAnalysisResults.SetResults(junctionList, edgeList);  //determine if results should be drawn  if (networkAnalysisResults.ResultsAsSelection)  {  networkAnalysisResults.CreateSelection(junctionList, edgeList);  }  else if (overrideSelectSetting)  {  // temporarily toggle the user's setting  networkAnalysisResults.ResultsAsSelection = true;  networkAnalysisResults.CreateSelection(junctionList, edgeList);  networkAnalysisResults.ResultsAsSelection = false;  }   networkAnalysisResults.ClearResults();  networkAnalysisResults = null;  }   networkExtensionUID = null;  networkExtension = null;}

                   

            • Re: Spatial Analysis between Meters and Transformers
              Francesco Giovinazzo

              Hello,

               

              I am still here, if someone needs help, keep in mind that my snippet above is intended for Feeder Manager 1, we do not have anything on FM2 yet.

               

              Regards

               

              Francesco

                • Re: Spatial Analysis between Meters and Transformers
                  Darren Gilbertson

                  Francesco Giovinazzo,

                   

                  From Darren Gilbertson, Electric GIS & Asset Systems Analyst, City of Lethbridge (Alberta, Canada):

                  (Please reply to my email: darren.gilbertson@lethbridge.ca)

                   

                  We are in the process of building a downstream trace in code using the ArcFM SDK. For the trace algorithm (C#) we used the answer to "Spatial Analysis between Meters and Transformers" (a question asked by Mike Tulis from Medicine Hat Electric Utility) answered by you. The question that we have is whether we can get the results of the ArcFM Downstream Trace (IMMTracedElements - traced junctions and edges) in the network order (transformer connected to underground cable, underground cable connected to switch, switch connected to overhead wire, et-cetera). We are tracing downstream from our substation dynamic protective devices through all the network elements connected to feeder. We are particularly interested in the traced Junctions.

                   

                  //executing the trace

                  elecTrace.TraceDownstream(pNetClass.GeometricNetwork,

                    pSettingEx,

                    cs,

                    EID,

                    esriElementType.esriETJunction,

                    SetOfPhases.abc,

                    mmDirectionInfo.establishBySourceSearch,

                    0,

                    esriElementType.esriETJunction,

                    barrierJncts,

                    barrierEdges,

                    true,

                    out tracedJcts,

                    out tracedEdgs);

                   

                  Traced Junction results:

                       

                  FeatureClass ID ObjectID Element Trace Type EID FeatureClass Name
                  11638       esriETJunction13856 Dynamic Protective Device
                  129792       esriETJunction15502 Switch
                  13210455       esriETJunction15503 Electric Network Junction
                  129793       esriETJunction15505 Switch
                  13210456       esriETJunction15508 Electric Network Junction
                  129789       esriETJunction15512 Switch
                  13210460       esriETJunction15513 Electric Network Junction
                  1171967       esriETJunction15514 Fuse
                  13210489       esriETJunction15583 Electric Network Junction
                  1286790       esriETJunction15627 Streetlight
                  Et-cetera

                  The junctions start out in network order but soon loose that order.

                   

                  Thank you in advance for your reply.

                    • Re: Spatial Analysis between Meters and Transformers
                      Francesco Giovinazzo

                      Hello Darren,

                       

                      I don't think that's possible, a normal network (at least here around) is like a tree, with many branches departing from certain points, ending with leafs that are the service points; even if there is a way to retrieve junctions in order, once you reach a split in the line, that order will loose his value.

                       

                      We solved this problem using oracle, we add the results of the trace in a table, in the form of edges with from - to nodes, and then we used a select by prior to create the tree, then iterating the results.

                       

                      You could do this in memory using linq I guess, but when this algorithm was made we were in .NET 2.0 without it, so we used oracle and this thing is working pretty well since years, we use it to perform statistic electric calculations for transformer usages, cable thermal limits and stuff like that, also to model and test new service points.

                        • Re: Spatial Analysis between Meters and Transformers
                          Darren Gilbertson

                          Thanks for the quick reply Francesco!

                           

                          We are pursuing a strategy much like your solution (adding the results to Oracle database tables) however we are using the ArcObjects IForwardStar interface and performing a non-ArcFM geometric network trace. We are then using the results (junctions and edges) from the ArcFM downstream trace, as well as the feeder manager bits (MMElectricTraceWeight), to validate adjcent elements.

                           

                          I was hoping that maybe the trace results had a sequential (connectivity) structure, and therefore make our network walking easier to accomplish.

                           

                          Again, thanks for your help.

                          • Re: Spatial Analysis between Meters and Transformers
                            Darren Gilbertson

                            Thanks for the quick reply Francesco!

                             

                            We are pursuing a strategy much like your solution (adding the results to Oracle database tables) however we are using the ArcObjects IForwardStar interface and performing a non-ArcFM geometric network trace. We are then using the results (junctions and edges) from the ArcFM downstream trace, as well as the feeder manager bits (MMElectricTraceWeight), to validate adjcent elements.

                             

                            I was hoping that maybe the trace results had a sequential (connectivity) structure, and therefore make our network walking easier to accomplish.

                             

                            Again, thanks for your help.

                             

                            Darren Gilbertson

                            Electric GIS & Asset Systems Analyst

                            Lethbridge Electric Utility Administration

                            City of Lethbridge

                            910 - 4 Avenue South,

                            Lethbridge, AB.  T1J 0P6

                            Phone: 403.320.3138

                            This message, including any attachments, is intended only for the use of the individual(s) to which it is addressed and may contain information that is privileged/confidential.  Any other distribution, copying or disclosure is strictly prohibited.  If you are not the intended recipient or have received this message in error, please notify us immediately by reply e-mail and permanently delete this message including, any attachments without reading it or making a copy.  Thank you.

                      • Re: Spatial Analysis between Meters and Transformers
                        Nick Apostolakis

                        I had tried to build a relationship from transformers to service points (demarcation point per voltage, could be many meters) and then join by relationship, but we had a problem when trying to join several transformers to several service point at the same parcel (was a trailer park) so I had to abandon that Idea.

                        What I ended up doing is putting a transformer id field in service point, then I did a trace from the transformer level down and mass pushed the transformer number into that field in service point. We have about 60,000 customers so this may take some time to do if you have a large network. there maybe a way to automate that, Francesco is good at that. Now we are in the process of joining our service points to meters and by extension to the transformer. Our setup is quite detailed and is giving us many different combinations to join, but we are close to finishing.

                        So to recap we know what service point are being fed by which transformer because of the transformer id in service points.  Here is a look at the our layout.

                        Soon I will be able to trace from a transformer and get meter info and usage from AMI.

                         

                        This may not be the best solution but it works for us and may give others some ideas to solve their problems.