public static void PopulateIrregularTimePointProperties(IrregularTimePoint point, ResourceDescription rd, ImportHelper i, TransformAndLoadReport report) { if (point != null && rd != null) { PowerTransformerConverter.PopulateIdentifiedObjectProperties(point, rd); if (point.TimeHasValue) { rd.AddProperty(new Property(ModelCode.IRREGULARTIMEPOINT_TIME, point.Time)); } if (point.Value1HasValue) { rd.AddProperty(new Property(ModelCode.IRREGULARTIMEPOINT_VALUE1, point.Value1)); } if (point.Value2HasValue) { rd.AddProperty(new Property(ModelCode.IRREGULARTIMEPOINT_VALUE2, point.Value2)); } if (point.IntervalScheduleHasValue) { long gid = i.GetMappedGID(point.IntervalSchedule.ID); if (gid < 0) { report.Report.Append("WARNING: Convert ").Append(point.GetType().ToString()).Append(" rdfID = \"").Append(point.ID); report.Report.Append("\" - Failed to set reference to IntervalSchedule: rdfID \"").Append(point.IntervalSchedule.ID).AppendLine(" \" is not mapped to GID!"); } else { rd.AddProperty(new Property(ModelCode.IRREGULARTIMEPOINT_INTERVALSCHEDULE, gid)); } } } }
private ResourceDescription CreateIrregularTimePointResourceDescription(IrregularTimePoint s) { ResourceDescription rd = null; if (s != null) { long gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.IRREGULARTIMEPOINT, importHelper.CheckOutIndexForDMSType(DMSType.IRREGULARTIMEPOINT)); rd = new ResourceDescription(gid); importHelper.DefineIDMapping(s.ID, gid); PowerTransformerConverter.PopulateIrregularTimePointProperties(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 ImportIrregularTimePoint() { SortedDictionary <string, object> ps = concreteModel.GetAllObjectsOfType("FTN.IrregularTimePoint"); foreach (var v in ps) { IrregularTimePoint s = v.Value as IrregularTimePoint; ResourceDescription rd = CreateIrregularTimePointResourceDescription(s); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("IRREGULARTIMEPOINT ID = ").Append(s.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("IRREGULARTIEPOINT ID = ").Append(s.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); }