private void ImportBaseVoltages() { SortedDictionary <string, object> cimBaseVoltages = concreteModel.GetAllObjectsOfType("FTN.BaseVoltage"); if (cimBaseVoltages != null) { foreach (KeyValuePair <string, object> cimBaseVoltagePair in cimBaseVoltages) { FTN.BaseVoltage cimBaseVoltage = cimBaseVoltagePair.Value as FTN.BaseVoltage; ResourceDescription rd = CreateBaseVoltageResourceDecription(cimBaseVoltage); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("BaseVoltage ID = ").Append(cimBaseVoltage.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("BaseVoltage ID = ").Append(cimBaseVoltage.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }
/// <summary> /// Generic method to import cim objects based on DMSType /// </summary> /// <typeparam name="T"></typeparam> /// <param name="dmsType"></param> /// <param name="typeName"></param> private void Import <T>(DMSType dmsType, string typeName) where T : IdentifiedObject { SortedDictionary <string, object> cimObjects = concreteModel.GetAllObjectsOfType(typeof(T).FullName); if (cimObjects == null) { return; } foreach (var kvp in cimObjects) { T cimObj = (T)kvp.Value; var rd = CreateResourceDescription(cimObj, dmsType); if (rd == null) { report.Report.Append($"{typeof(T).Name} ID = ").Append(cimObj.ID).AppendLine(" FAILED to be converted"); continue; } else { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append($"{typeof(T).Name} ID = ").Append(cimObj.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } report.Report.AppendLine(); } }
public Delta CreateNMSDelta(ConcreteModel concreteModel) { if (concreteModel == null || concreteModel.ModelMap == null) { return(null); } Delta delta = new Delta(); foreach (DMSType type in ModelResourcesDesc.TypeIdsInInsertOrder) { SortedDictionary <string, object> cimObjects = concreteModel.GetAllObjectsOfType("FTN." + ModelCodeHelper.DMSTypeToName(type)); if (cimObjects == null) { continue; } foreach (KeyValuePair <string, object> cimObjectPair in cimObjects) { IDClass idc = cimObjectPair.Value as IDClass; long gid = ModelCodeHelper.CreateGID(0, type, --counters[type]); ResourceDescription rd = new ResourceDescription(gid); idMapping[idc.ID] = gid; PopulateProperties(idc, rd); delta.InsertOperations.Add(rd); } } return(delta); }
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(); } }
private void ImportGeographicalRegions() { SortedDictionary <string, object> cimRegions = concreteModel.GetAllObjectsOfType("DERMS.GeographicalRegion"); if (cimRegions != null) { foreach (KeyValuePair <string, object> cimRegionPair in cimRegions) { DERMS.GeographicalRegion cimRegion = cimRegionPair.Value as DERMS.GeographicalRegion; ResourceDescription rd = CreateGeographicalRegionResourceDescription(cimRegion); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("GeographicalRegion ID = ").Append(cimRegion.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("GeographicalRegion ID = ").Append(cimRegion.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }
private void ImportConnectNodeCount() { SortedDictionary <string, object> cimConnNodeCont = concreteModel.GetAllObjectsOfType("FTN.ConnectivityNodeContainer"); if (cimConnNodeCont != null) { foreach (KeyValuePair <string, object> cimConnNodeContPair in cimConnNodeCont) { FTN.ConnectivityNodeContainer cimCNC = cimConnNodeContPair.Value as FTN.ConnectivityNodeContainer; ResourceDescription rd = CreateConnNodeContResourceDescription(cimCNC); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("ConnectivityNodeContainer ID = ").Append(cimCNC.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("ConnectivityNodeContainer ID = ").Append(cimCNC.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }
private void ImportRegularIntervalSchedule() { SortedDictionary <string, object> ps = concreteModel.GetAllObjectsOfType("FTN.RegularIntervalSchedule"); foreach (var v in ps) { RegularIntervalSchedule s = v.Value as RegularIntervalSchedule; ResourceDescription rd = CreateRegularIntervalScheduleResourceDescription(s); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("REGULARINTERVALSCHEDULE ID = ").Append(s.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("REGULARINTERVALSCHEDULE ID = ").Append(s.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); }
private void ImportAsset() { SortedDictionary <string, object> cimAssets = concreteModel.GetAllObjectsOfType("FTN.Asset"); if (cimAssets != null) { foreach (KeyValuePair <string, object> cimAssetsPairs in cimAssets) { FTN.Asset cimAssset = cimAssetsPairs.Value as FTN.Asset; ResourceDescription rd = CreateAssetResourceDescription(cimAssset); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("Asset ID = ").Append(cimAssset.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("Asset ID = ").Append(cimAssset.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }
private void ImportRegulatingControls() { SortedDictionary <string, object> cimRegulatingControls = concreteModel.GetAllObjectsOfType("FTN.RegulatingControl"); if (cimRegulatingControls != null) { foreach (KeyValuePair <string, object> RegulatingControlPair in cimRegulatingControls) { FTN.RegulatingControl cimRegulatingControl = RegulatingControlPair.Value as FTN.RegulatingControl; ResourceDescription rd = CreateRegulatingControlResourceDescription(cimRegulatingControl); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("RegulatingControl ID = ").Append(cimRegulatingControl.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("RegulatingControl ID = ").Append(cimRegulatingControl.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }
private void ImportPhaseImpedanceDatas() { SortedDictionary <string, object> cimPhaseImpedanceDatas = concreteModel.GetAllObjectsOfType("FTN.PhaseImpedanceData"); if (cimPhaseImpedanceDatas != null) { foreach (KeyValuePair <string, object> cimPhaseImpedanceDataPair in cimPhaseImpedanceDatas) { FTN.PhaseImpedanceData cimPhaseImpedanceData = cimPhaseImpedanceDataPair.Value as FTN.PhaseImpedanceData; ResourceDescription rd = CreatePhaseImpedanceDataResourceDescription(cimPhaseImpedanceData); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("PhaseImpedanceData ID = ").Append(cimPhaseImpedanceData.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("PhaseImpedanceData ID = ").Append(cimPhaseImpedanceData.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }
private void ImportSeriesCompensators() { SortedDictionary <string, object> cimSeriesCompensators = concreteModel.GetAllObjectsOfType("FTN.SeriesCompensator"); if (cimSeriesCompensators != null) { foreach (KeyValuePair <string, object> cimSeriesCompensatorPair in cimSeriesCompensators) { FTN.SeriesCompensator cimSeriesCompensator = cimSeriesCompensatorPair.Value as FTN.SeriesCompensator; ResourceDescription rd = CreateSeriesCompensatorResourceDescription(cimSeriesCompensator); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("SeriesCompensator ID = ").Append(cimSeriesCompensator.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("SeriesCompensator ID = ").Append(cimSeriesCompensator.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }
private void ImportBay() { SortedDictionary <string, object> bays = concreteModel.GetAllObjectsOfType("FTN.Bay"); if (bays != null) { foreach (KeyValuePair <string, object> baysPair in bays) { FTN.Bay bay = baysPair.Value as FTN.Bay; ResourceDescription rd = CreateBaysResourceDescription(bay); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("Bay ID = ").Append(bay.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("Bay ID = ").Append(bay.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }
private void ImportPowerTransformers() { SortedDictionary <string, object> cimPowerTransformers = concreteModel.GetAllObjectsOfType("Outage.PowerTransformer"); if (cimPowerTransformers != null) { foreach (KeyValuePair <string, object> cimPowerTransformerPair in cimPowerTransformers) { Outage.PowerTransformer cimPowerTransformer = cimPowerTransformerPair.Value as Outage.PowerTransformer; ResourceDescription rd = CreatePowerTransformerResourceDescription(cimPowerTransformer); if (rd != null) { string mrid = cimPowerTransformer.MRID; CreateAndInsertDeltaOperation(mrid, rd); report.Report.Append("PowerTransformer ID: ").Append(cimPowerTransformer.ID).Append(" SUCCESSFULLY converted to GID: ").AppendLine($"0x{rd.Id:X16}"); } else { report.Report.Append("PowerTransformer ID: ").Append(cimPowerTransformer.ID).AppendLine(" FAILED to be converted"); } } } }