private void ImportSubstation() { SortedDictionary <string, object> cimBaseVoltages = concreteModel.GetAllObjectsOfType("FTN.Substation"); if (cimBaseVoltages != null) { foreach (KeyValuePair <string, object> cimBaseVoltagePair in cimBaseVoltages) { FTN.Substation cimBaseVoltage = cimBaseVoltagePair.Value as FTN.Substation; ResourceDescription rd = CreateSubstationResourceDescription(cimBaseVoltage); if (rd != null) { if (ModelCodeHelper.ExtractEntityIdFromGlobalId(rd.Id) > 0) { delta.AddDeltaOperation(DeltaOpType.Update, rd, true); report.Report.Append("Substation ID = ").Append(cimBaseVoltage.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("Substation ID = ").Append(cimBaseVoltage.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } } else { report.Report.Append("Substation ID = ").Append(cimBaseVoltage.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }
public static void PopulateSubstationProperties(FTN.Substation cimIdentifiedObject, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimIdentifiedObject != null) && (rd != null)) { PowerTransformerConverter.PopulateEquipmentContainerProperties(cimIdentifiedObject, rd, importHelper, report); } }
public static void PopulateSubstationProperties(FTN.Substation cimSubstation, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimSubstation != null) && (rd != null)) { SCADAConverter.PopulateEquipmentContainerProperties(cimSubstation, rd, importHelper, report); if (cimSubstation.CapacityHasValue) { rd.AddProperty(new Property(ModelCode.SUBSTATION_CAPACITY, cimSubstation.Capacity)); } } }
private ResourceDescription CreateSubstationResourceDescription(FTN.Substation substation) { ResourceDescription rd = null; if (substation != null) { long gid = 0; int iteratorId = 0; int resourcesLeft = 0; int numberOfResources = 2; string message = string.Empty; bool contains = false; ModelCode modelCodeSubstation = ModelCode.SUBSTATION; List <ModelCode> properties = new List <ModelCode>(); ModelResourcesDesc modelResourcesDesc = new ModelResourcesDesc(); List <ResourceDescription> retList = new List <ResourceDescription>(); properties = modelResourcesDesc.GetAllPropertyIds(modelCodeSubstation); iteratorId = NetworkModelGDAProxy.Instance.GetExtentValues(modelCodeSubstation, properties); resourcesLeft = NetworkModelGDAProxy.Instance.IteratorResourcesLeft(iteratorId); while (resourcesLeft > 0) { List <ResourceDescription> rds = NetworkModelGDAProxy.Instance.IteratorNext(numberOfResources, iteratorId); retList.AddRange(rds); resourcesLeft = NetworkModelGDAProxy.Instance.IteratorResourcesLeft(iteratorId); } NetworkModelGDAProxy.Instance.IteratorClose(iteratorId); foreach (ResourceDescription res in retList) { foreach (Property pr in res.Properties) { if (pr.PropertyValue.StringValue.Equals(substation.MRID)) { contains = true; gid = res.Id; } } } if (!contains) { gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.SUBSTATION, importHelper.CheckOutIndexForDMSType(DMSType.SUBSTATION)); } rd = new ResourceDescription(gid); importHelper.DefineIDMapping(substation.ID, gid); PowerTransformerConverter.PopulateSubstationProperties(substation, rd, importHelper, report); } return(rd); }
public static void PopulateSubstationProperties(FTN.Substation cimSubstation, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimSubstation != null) && (rd != null)) { PowerTransformerConverter.PopulateEquipmentContainerProperties(cimSubstation, rd, importHelper, report); 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 SubGeograhicalRegion: rdfID \"").Append(cimSubstation.Region.ID).AppendLine(" \" is not mapped to GID!"); } rd.AddProperty(new Property(ModelCode.SUBSTATION_SUBGEOREG, gid)); } } }