private void ImportGeographicalRegion() { SortedDictionary <string, object> cimBaseVoltages = concreteModel.GetAllObjectsOfType("FTN.GeographicalRegion"); if (cimBaseVoltages != null) { foreach (KeyValuePair <string, object> cimBaseVoltagePair in cimBaseVoltages) { FTN.GeographicalRegion cimBaseVoltage = cimBaseVoltagePair.Value as FTN.GeographicalRegion; ResourceDescription rd = CreateGeographicalRegionResourceDescription(cimBaseVoltage); if (rd != null) { if (ModelCodeHelper.ExtractEntityIdFromGlobalId(rd.Id) > 0) { delta.AddDeltaOperation(DeltaOpType.Update, rd, true); report.Report.Append("GeographicalRegion ID = ").Append(cimBaseVoltage.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("GeographicalRegion ID = ").Append(cimBaseVoltage.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } } else { report.Report.Append("GeographicalRegion ID = ").Append(cimBaseVoltage.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }
public static void PopulateGeographicalRegionProperties(FTN.GeographicalRegion cimIdentifiedObject, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimIdentifiedObject != null) && (rd != null)) { PowerTransformerConverter.PopulateIdentifiedObjectProperties(cimIdentifiedObject, rd); } }
private ResourceDescription CreateGeographicalRegionResourceDescription(FTN.GeographicalRegion geographical) { ResourceDescription rd = null; if (geographical != null) { long gid = 0; int iteratorId = 0; int resourcesLeft = 0; int numberOfResources = 2; string message = string.Empty; bool contains = false; ModelCode modelCodeGeo = ModelCode.GEOGRAFICAL_REGION; List <ModelCode> properties = new List <ModelCode>(); ModelResourcesDesc modelResourcesDesc = new ModelResourcesDesc(); List <ResourceDescription> retList = new List <ResourceDescription>(); properties = modelResourcesDesc.GetAllPropertyIds(modelCodeGeo); iteratorId = NetworkModelGDAProxy.Instance.GetExtentValues(modelCodeGeo, 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(geographical.MRID)) { contains = true; gid = res.Id; } } } if (!contains) { gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.GEOGRAFICAL_REGION, importHelper.CheckOutIndexForDMSType(DMSType.GEOGRAFICAL_REGION)); } rd = new ResourceDescription(gid); importHelper.DefineIDMapping(geographical.ID, gid); PowerTransformerConverter.PopulateGeographicalRegionProperties(geographical, rd, importHelper, report); } return(rd); }
public static void PopulateGeographicalRegionProperties(FTN.GeographicalRegion cimGeographicalRegion, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimGeographicalRegion != null) && (rd != null)) { PowerTransformerConverter.PopulateIdentifiedObjectProperties(cimGeographicalRegion, rd); if (cimGeographicalRegion.LongitudeHasValue) { rd.AddProperty(new Property(ModelCode.GEOGRAPHICALREGION_LONGITUDE, cimGeographicalRegion.Longitude)); } if (cimGeographicalRegion.LatitudeHasValue) { rd.AddProperty(new Property(ModelCode.GEOGRAPHICALREGION_LATITUDE, cimGeographicalRegion.Latitude)); } } }