public static void PopulateSubstationProperties(DERMS.Substation cimSubstation, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimSubstation != null) && (rd != null)) { DERMSConveter.PopulateEquipmentContainerProperties(cimSubstation, rd, importHelper, report); if (cimSubstation.LatitudeHasValue) { rd.AddProperty(new Property(ModelCode.SUBSTATION_LATITUDE, cimSubstation.Latitude)); } if (cimSubstation.LongitudeHasValue) { rd.AddProperty(new Property(ModelCode.SUBSTATION_LONGITUDE, cimSubstation.Longitude)); } if (cimSubstation.RegionHasValue) { long gid = importHelper.GetMappedGID(cimSubstation.Region.ID); if (gid < 0) { report.Report.Append("WARNING: Convert ").Append(cimSubstation.GetType().ToString()).Append(" rdfID = \"").Append(cimSubstation.ID); report.Report.Append("\" - Failed to set reference to Equipment: rdfID \"").Append(cimSubstation.Region.ID).AppendLine(" \" is not mapped to GID!"); } rd.AddProperty(new Property(ModelCode.SUBSTATION_SUBREGION, gid)); } } }
private ResourceDescription CreateSubstationResourceDescription(DERMS.Substation cimSubstation) { ResourceDescription rd = null; if (cimSubstation != null) { long gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.SUBSTATION, importHelper.CheckOutIndexForDMSType(DMSType.SUBSTATION)); rd = new ResourceDescription(gid); importHelper.DefineIDMapping(cimSubstation.ID, gid); ////populate ResourceDescription DERMSConveter.PopulateSubstationProperties(cimSubstation, rd, importHelper, report); } return(rd); }
private void ImportSubstations() { SortedDictionary <string, object> cimSubstations = concreteModel.GetAllObjectsOfType("DERMS.Substation"); if (cimSubstations != null) { foreach (KeyValuePair <string, object> cimSubstationPair in cimSubstations) { DERMS.Substation cimSubstation = cimSubstationPair.Value as DERMS.Substation; ResourceDescription rd = CreateSubstationResourceDescription(cimSubstation); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("Substation ID = ").Append(cimSubstation.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("Substation ID = ").Append(cimSubstation.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }