private ResourceDescription CreateTransformerWindingResourceDescription(Outage.TransformerWinding cimTransformerWinding)
        {
            ResourceDescription rd = null;

            if (cimTransformerWinding != null)
            {
                long gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.TRANSFORMERWINDING, importHelper.CheckOutIndexForDMSType(DMSType.TRANSFORMERWINDING));
                rd = new ResourceDescription(gid);
                importHelper.DefineIDMapping(cimTransformerWinding.ID, gid);

                OutageConverter.PopulateTransformerWindingProperties(cimTransformerWinding, rd, importHelper, report);
            }

            return(rd);
        }
Exemple #2
0
        public static void PopulateTransformerWindingProperties(Outage.TransformerWinding cimTransformerWinding, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report)
        {
            if ((cimTransformerWinding != null) && (rd != null))
            {
                OutageConverter.PopulateConductingEquipmentProperties(cimTransformerWinding, rd, importHelper, report);

                if (cimTransformerWinding.PowerTransformerHasValue)
                {
                    long gid = importHelper.GetMappedGID(cimTransformerWinding.PowerTransformer.ID);
                    if (gid < 0)
                    {
                        report.Report.Append("WARNING: Convert").Append(cimTransformerWinding.GetType().ToString()).Append(" rdfID: \"").Append(cimTransformerWinding.ID);
                        report.Report.Append("\" - Failed to set reference to PowerTransformer: rdfID\"").Append(cimTransformerWinding.PowerTransformer.ID).AppendLine(" \" is not mapped to GID!");
                    }
                    rd.AddProperty(new Property(ModelCode.TRANSFORMERWINDING_POWERTRANSFORMER, gid));
                }
            }
        }
        private void ImportTransformerWindings()
        {
            SortedDictionary <string, object> cimTransformerWindings = concreteModel.GetAllObjectsOfType("Outage.TransformerWinding");

            if (cimTransformerWindings != null)
            {
                foreach (KeyValuePair <string, object> cimTransformerWindingPair in cimTransformerWindings)
                {
                    Outage.TransformerWinding cimTransformerWinding = cimTransformerWindingPair.Value as Outage.TransformerWinding;
                    ResourceDescription       rd = CreateTransformerWindingResourceDescription(cimTransformerWinding);
                    if (rd != null)
                    {
                        string mrid = cimTransformerWinding.MRID;
                        CreateAndInsertDeltaOperation(mrid, rd);

                        report.Report.Append("TransformerWinding ID: ").Append(cimTransformerWinding.ID).Append(" SUCCESSFULLY converted to GID: ").AppendLine($"0x{rd.Id:X16}");
                    }
                    else
                    {
                        report.Report.Append("TransformerWinding ID: ").Append(cimTransformerWinding.ID).AppendLine(" FAILED to be converted");
                    }
                }
            }
        }