public static void PopulateRegularTimePointProperties(RegularTimePoint r, ResourceDescription rd, ImportHelper i, TransformAndLoadReport report) { if (r != null && rd != null) { PowerTransformerConverter.PopulateIdentifiedObjectProperties(r, rd); if (r.SequenceNumberHasValue) { rd.AddProperty(new Property(ModelCode.REGULARTIMEPOINT_SEQUENCENO, r.SequenceNumber)); } if (r.Value1HasValue) { rd.AddProperty(new Property(ModelCode.REGULARTIMEPOINT_VALUE1, r.Value1)); } if (r.Value2HasValue) { rd.AddProperty(new Property(ModelCode.REGULARTIMEPOINT_VALUE2, r.Value2)); } if (r.IntervalScheduleHasValue) { long gid = i.GetMappedGID(r.IntervalSchedule.ID); if (gid < 0) { report.Report.Append("WARNING: Convert ").Append(r.GetType().ToString()).Append(" rdfID = \"").Append(r.ID); report.Report.Append("\" - Failed to set reference to IntervalSchedule: rdfID \"").Append(r.IntervalSchedule.ID).AppendLine(" \" is not mapped to GID!"); } else { rd.AddProperty(new Property(ModelCode.REGULARTIMEPOINT_INTERVALSCHEDULE, gid)); } } } }
private ResourceDescription CreateRegularTimePointResourceDescription(RegularTimePoint s) { ResourceDescription rd = null; if (s != null) { long gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.REGULARTIMEPOINT, importHelper.CheckOutIndexForDMSType(DMSType.REGULARTIMEPOINT)); rd = new ResourceDescription(gid); importHelper.DefineIDMapping(s.ID, gid); PowerTransformerConverter.PopulateRegularTimePointProperties(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 ImportRegularTimePoint() { SortedDictionary <string, object> ps = concreteModel.GetAllObjectsOfType("FTN.RegularTimePoint"); foreach (var v in ps) { RegularTimePoint s = v.Value as RegularTimePoint; ResourceDescription rd = CreateRegularTimePointResourceDescription(s); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("REGULARTIMEPOINT ID = ").Append(s.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("REGULARTIEPOINT ID = ").Append(s.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); }