public static void PopulateProtectedSwitchProperties(ProtectedSwitch ps, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if (ps != null && rd != null) { PowerTransformerConverter.PopulateSwitchProperties(ps, rd, importHelper, report); } }
private ResourceDescription CreateProtectedSwitchResourceDescription(ProtectedSwitch s) { ResourceDescription rd = null; if (s != null) { long gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.PROTSWITCH, importHelper.CheckOutIndexForDMSType(DMSType.PROTSWITCH)); rd = new ResourceDescription(gid); importHelper.DefineIDMapping(s.ID, gid); PowerTransformerConverter.PopulateProtectedSwitchProperties(s, rd, importHelper, report); } return(rd); }
/// <summary> /// Creates entity for specified global inside the container. /// </summary> /// <param name="globalId">Global id of the entity for insert</param> /// <returns>Created entity (identified object).</returns> public IdentifiedObject CreateEntity(long globalId) { short type = ModelCodeHelper.ExtractTypeFromGlobalId(globalId); IdentifiedObject io = null; switch ((DMSType)type) { case DMSType.CURVE: io = new Curve(globalId); break; case DMSType.CURVEDATA: io = new CurveData(globalId); break; case DMSType.DISCONNECTOR: io = new Disconnector(globalId); break; case DMSType.IRREGULARTIMEPOINT: io = new IrregularTimePoint(globalId); break; case DMSType.OUTAGESCHEDULE: io = new OutageSchedule(globalId); break; case DMSType.PROTSWITCH: io = new ProtectedSwitch(globalId); break; case DMSType.REGULARTIMEPOINT: io = new RegularTimePoint(globalId); break; case DMSType.REGULARINTERVALSCHEDULE: io = new RegularIntervalSchedule(globalId); break; default: string message = String.Format("Failed to create entity because specified type ({0}) is not supported.", type); CommonTrace.WriteTrace(CommonTrace.TraceError, message); throw new Exception(message); } // Add entity to map this.AddEntity(io); return(io); }
private void ImportProtectedSwitch() { SortedDictionary <string, object> ps = concreteModel.GetAllObjectsOfType("FTN.ProtectedSwitch"); foreach (var v in ps) { ProtectedSwitch s = v.Value as ProtectedSwitch; ResourceDescription rd = CreateProtectedSwitchResourceDescription(s); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("PROTECTEDSWITCH ID = ").Append(s.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("PROTECTEDSWITCH ID = ").Append(s.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); }
void PopulateProtectedSwitchProperties(ProtectedSwitch x, ResourceDescription rd) { PopulateSwitchProperties(x, rd); }