private ResourceDescription CreateWindingTestResourceDescription(FTN.WindingTest cimWindingTest) { ResourceDescription rd = null; if (cimWindingTest != null) { long gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.WINDINGTEST, importHelper.CheckOutIndexForDMSType(DMSType.WINDINGTEST)); rd = new ResourceDescription(gid); importHelper.DefineIDMapping(cimWindingTest.ID, gid); ////populate ResourceDescription PowerTransformerConverter.PopulateWindingTestProperties(cimWindingTest, rd, importHelper); } return(rd); }
public static void PopulateWindingTestProperties(FTN.WindingTest cimWindingTest, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimWindingTest != null) && (rd != null)) { PowerTransformerConverter.PopulateIdentifiedObjectProperties(cimWindingTest, rd); if (cimWindingTest.LeakageImpedanceHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_LEAKIMPDN, cimWindingTest.LeakageImpedance)); } if (cimWindingTest.LoadLossHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_LOADLOSS, cimWindingTest.LoadLoss)); } if (cimWindingTest.NoLoadLossHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_NOLOADLOSS, cimWindingTest.NoLoadLoss)); } if (cimWindingTest.PhaseShiftHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_PHASESHIFT, cimWindingTest.PhaseShift)); } if (cimWindingTest.LeakageImpedance0PercentHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_LEAKIMPDN0PERCENT, cimWindingTest.LeakageImpedance0Percent)); } if (cimWindingTest.LeakageImpedanceMaxPercentHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_LEAKIMPDNMAXPERCENT, cimWindingTest.LeakageImpedanceMaxPercent)); } if (cimWindingTest.LeakageImpedanceMinPercentHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_LEAKIMPDNMINPERCENT, cimWindingTest.LeakageImpedanceMinPercent)); } if (cimWindingTest.From_TransformerWindingHasValue) { long gid = importHelper.GetMappedGID(cimWindingTest.From_TransformerWinding.ID); if (gid < 0) { report.Report.Append("WARNING: Convert ").Append(cimWindingTest.GetType().ToString()).Append(" rdfID = \"").Append(cimWindingTest.ID); report.Report.Append("\" - Failed to set reference to TransformerWinding: rdfID \"").Append(cimWindingTest.From_TransformerWinding.ID).AppendLine(" \" is not mapped to GID!"); } rd.AddProperty(new Property(ModelCode.WINDINGTEST_POWERTRWINDING, gid)); } } }
public static void PopulateWindingTestProperties(FTN.WindingTest cimWindingTest, ResourceDescription rd, ImportHelper importHelper) { if ((cimWindingTest != null) && (rd != null)) { PowerTransformerConverter.PopulateIdentifiedObjectProperties(cimWindingTest, rd); if (cimWindingTest.LeakageImpedanceHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_LEAKIMPDN, cimWindingTest.LeakageImpedance)); } if (cimWindingTest.LoadLossHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_LOADLOSS, cimWindingTest.LoadLoss)); } if (cimWindingTest.NoLoadLossHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_NOLOADLOSS, cimWindingTest.NoLoadLoss)); } if (cimWindingTest.PhaseShiftHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_PHASESHIFT, cimWindingTest.PhaseShift)); } if (cimWindingTest.LeakageImpedance0PercentHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_LEAKIMPDN0PERCENT, cimWindingTest.LeakageImpedance0Percent)); } if (cimWindingTest.LeakageImpedanceMaxPercentHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_LEAKIMPDNMAXPERCENT, cimWindingTest.LeakageImpedanceMaxPercent)); } if (cimWindingTest.LeakageImpedanceMinPercentHasValue) { rd.AddProperty(new Property(ModelCode.WINDINGTEST_LEAKIMPDNMINPERCENT, cimWindingTest.LeakageImpedanceMinPercent)); } if (cimWindingTest.From_TransformerWindingHasValue) { long gid = importHelper.GetMappedGID(cimWindingTest.From_TransformerWinding.ID); rd.AddProperty(new Property(ModelCode.WINDINGTEST_POWERTRWINDING, gid)); } } }
private void ImportWindingTests() { SortedDictionary <string, object> cimWindingTests = concreteModel.GetAllObjectsOfType("FTN.WindingTest"); if (cimWindingTests != null) { foreach (KeyValuePair <string, object> cimWindingTestPair in cimWindingTests) { FTN.WindingTest cimWindingTest = cimWindingTestPair.Value as FTN.WindingTest; ResourceDescription rd = CreateWindingTestResourceDescription(cimWindingTest); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("WindingTest ID = ").Append(cimWindingTest.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("WindingTest ID = ").Append(cimWindingTest.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }