public static void PopulateDiscreteProperties(FTN.Discrete cimDiscrete, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimDiscrete != null) && (rd != null)) { OMSConverter.PopulateMeasurmentProperties(cimDiscrete, rd, importHelper, report); if (cimDiscrete.MinValueHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_MINVAL, cimDiscrete.MinValue)); } if (cimDiscrete.MaxValueHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_MAXVAL, cimDiscrete.MaxValue)); } if (cimDiscrete.NormalValueHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_NORMVAL, cimDiscrete.NormalValue)); } if (cimDiscrete.ValidCommandsHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_VALIDCOMMANDS, GetDMSCommand(cimDiscrete.ValidCommands))); } if (cimDiscrete.ValidStatesHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_VALIDSTATES, GetDMSStates(cimDiscrete.ValidStates))); } } }
private void ImportDiscrete() { SortedDictionary <string, object> cimBaseVoltages = concreteModel.GetAllObjectsOfType("FTN.Discrete"); if (cimBaseVoltages != null) { foreach (KeyValuePair <string, object> cimBaseVoltagePair in cimBaseVoltages) { FTN.Discrete cimBaseVoltage = cimBaseVoltagePair.Value as FTN.Discrete; ResourceDescription rd = CreateDiscreteResourceDescription(cimBaseVoltage); if (rd != null) { if (ModelCodeHelper.ExtractEntityIdFromGlobalId(rd.Id) > 0) { delta.AddDeltaOperation(DeltaOpType.Update, rd, true); report.Report.Append("EnergyConsumer ID = ").Append(cimBaseVoltage.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("Discrete ID = ").Append(cimBaseVoltage.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } } else { report.Report.Append("Discrete ID = ").Append(cimBaseVoltage.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }
public static void PopulateDiscreteProperties(FTN.Discrete cimDiscrete, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimDiscrete != null) && (rd != null)) { PowerTransformerConverter.PopulateMeasurementProperties(cimDiscrete, rd, importHelper, report); if (cimDiscrete.MaxValueHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_MAX_VALUE, cimDiscrete.MaxValue)); } if (cimDiscrete.MinValueHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_MIN_VALUE, cimDiscrete.MinValue)); } if (cimDiscrete.NormalValueHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_NORMAL_VALUE, cimDiscrete.NormalValue)); } if (cimDiscrete.PowerSystemResourceHasValue) { long gid = importHelper.GetMappedGID(cimDiscrete.PowerSystemResource.ID); if (gid < 0) { report.Report.Append("WARNING: Convert ").Append(cimDiscrete.GetType().ToString()).Append(" rdfID = \"").Append(cimDiscrete.ID); report.Report.Append("\" - Failed to set reference to PowerSystemResource: rdfID \"").Append(cimDiscrete.PowerSystemResource.ID).AppendLine(" \" is not mapped to GID!"); } rd.AddProperty(new Property(ModelCode.MEASUREMENT_PSR, gid)); } } }
private ResourceDescription CreateDiscreteResourceDescription(FTN.Discrete discrete) { ResourceDescription rd = null; if (discrete != null) { long gid = 0; int iteratorId = 0; int resourcesLeft = 0; int numberOfResources = 2; string message = string.Empty; bool contains = false; ModelCode modelCodeDiscrete = ModelCode.DISCRETE; List <ModelCode> properties = new List <ModelCode>(); ModelResourcesDesc modelResourcesDesc = new ModelResourcesDesc(); List <ResourceDescription> retList = new List <ResourceDescription>(); properties = modelResourcesDesc.GetAllPropertyIds(modelCodeDiscrete); iteratorId = NetworkModelGDAProxy.Instance.GetExtentValues(modelCodeDiscrete, 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(discrete.MRID)) { contains = true; gid = res.Id; } } } if (!contains) { gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.DISCRETE, importHelper.CheckOutIndexForDMSType(DMSType.DISCRETE)); } rd = new ResourceDescription(gid); importHelper.DefineIDMapping(discrete.ID, gid); PowerTransformerConverter.PopulateDiscreteProperties(discrete, rd, importHelper, report); } return(rd); }
private ResourceDescription CreateDiscreteResourceDescription(FTN.Discrete cimDiscrete) { ResourceDescription rd = null; if (cimDiscrete != null) { long gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.DISCRETE, importHelper.CheckOutIndexForDMSType(DMSType.DISCRETE)); rd = new ResourceDescription(gid); importHelper.DefineIDMapping(cimDiscrete.ID, gid); ////populate ResourceDescription OMSConverter.PopulateDiscreteProperties(cimDiscrete, rd, importHelper, report); } return(rd); }
public static void PopulateDiscreteProperties(FTN.Discrete cimDiscrete, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimDiscrete != null) && (rd != null)) { SCADAConverter.PopulateMeasurementProperties(cimDiscrete, rd, importHelper, report); if (cimDiscrete.MaxValueHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_MAXVALUE, cimDiscrete.MaxValue)); } if (cimDiscrete.MinValueHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_MINVALUE, cimDiscrete.MinValue)); } if (cimDiscrete.NormalValueHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_NORMALVALUE, cimDiscrete.NormalValue)); } } }
public static void PopulateDiscreteProperties(FTN.Discrete cimIdentifiedObject, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimIdentifiedObject != null) && (rd != null)) { PowerTransformerConverter.PopulateMeasurementProperties(cimIdentifiedObject, rd, importHelper, report); if (cimIdentifiedObject.MaxValueHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_MAX_VALUE, cimIdentifiedObject.MaxValue)); } if (cimIdentifiedObject.MinValueHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_MIN_VALUE, cimIdentifiedObject.MinValue)); } if (cimIdentifiedObject.NormalValueHasValue) { rd.AddProperty(new Property(ModelCode.DISCRETE_NORMAL_VALUE, cimIdentifiedObject.NormalValue)); } } }
private void ImportDiscrete() { SortedDictionary <string, object> cimDiscrete = concreteModel.GetAllObjectsOfType("FTN.Discrete"); if (cimDiscrete != null) { foreach (KeyValuePair <string, object> cimDiscretePair in cimDiscrete) { FTN.Discrete cimDisc = cimDiscretePair.Value as FTN.Discrete; ResourceDescription rd = CreateDiscreteResourceDescription(cimDisc); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("Discrete ID = ").Append(cimDisc.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("Discrete ID = ").Append(cimDisc.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }