private PerLengthImpedance createPerLengthImpedanceObject(CableConfiguration configuration, string acLineSegment_mrid) { PerLengthSequenceImpedance pli = new PerLengthSequenceImpedance(); if (!perLengthImpedanceContainer.ContainsKey(configuration.Name)) { if (configuration.Name != "xfm_1") { string pli_mrid = acLineSegment_mrid + "_PLI"; pli.ID = pli_mrid; pli.MRID = pli_mrid; pli.Name = configuration.Name; pli.Bch = (float)configuration.Susceptance; pli.B0ch = 0; pli.R = (float)configuration.Primar_value.Real_part; pli.R0 = 0; pli.X = (float)configuration.Primar_value.Imaginary_part; pli.X0 = 0; perLengthImpedanceContainer.Add(configuration.Name, pli); addComponentToGlobalDictionary(pli, pli.GetType()); } } else { pli = (PerLengthSequenceImpedance)perLengthImpedanceContainer[configuration.Name]; return(pli); } return(pli); }
public static void PopulatePerLengthSequenceImpedanceProperties(PerLengthSequenceImpedance cimPerLengthSequenceImpedance, ResourceDescription rd, ImportHelper importHelper, TransformAndLoadReport report) { if ((cimPerLengthSequenceImpedance != null) && (rd != null)) { PowerTransformerConverter.PopulatePerLengthImpedanceProperties(cimPerLengthSequenceImpedance, rd, importHelper, report); if (cimPerLengthSequenceImpedance.B0chHasValue) { rd.AddProperty(new Property(ModelCode.PERLNGTSEQIMPD_B0CH, cimPerLengthSequenceImpedance.B0ch)); } if (cimPerLengthSequenceImpedance.BchHasValue) { rd.AddProperty(new Property(ModelCode.PERLNGTSEQIMPD_BCH, cimPerLengthSequenceImpedance.Bch)); } if (cimPerLengthSequenceImpedance.G0chHasValue) { rd.AddProperty(new Property(ModelCode.PERLNGTSEQIMPD_G0CH, cimPerLengthSequenceImpedance.G0ch)); } if (cimPerLengthSequenceImpedance.GchHasValue) { rd.AddProperty(new Property(ModelCode.PERLNGTSEQIMPD_GCH, cimPerLengthSequenceImpedance.Gch)); } if (cimPerLengthSequenceImpedance.RHasValue) { rd.AddProperty(new Property(ModelCode.PERLNGTSEQIMPD_R, cimPerLengthSequenceImpedance.R)); } if (cimPerLengthSequenceImpedance.R0HasValue) { rd.AddProperty(new Property(ModelCode.PERLNGTSEQIMPD_R0, cimPerLengthSequenceImpedance.R0)); } if (cimPerLengthSequenceImpedance.XHasValue) { rd.AddProperty(new Property(ModelCode.PERLNGTSEQIMPD_X, cimPerLengthSequenceImpedance.X)); } if (cimPerLengthSequenceImpedance.X0HasValue) { rd.AddProperty(new Property(ModelCode.PERLNGTSEQIMPD_X0, cimPerLengthSequenceImpedance.X0)); } } }
private void addComponentToGlobalDictionary(IdentifiedObject component, Type type) { if (!globalComponentDictionary.ContainsKey(type)) { globalComponentDictionary.Add(type, new Dictionary <string, IdentifiedObject>()); } if (type.Equals(typeof(ACLineSegment))) { ACLineSegment acl = (ACLineSegment)component; globalComponentDictionary[type].Add(acl.MRID, acl); } else if (type.Equals(typeof(Terminal))) { Terminal tp = (Terminal)component; globalComponentDictionary[tp.GetType()].Add(tp.MRID, tp); } else if (type.Equals(typeof(Circuit))) { Circuit cr = (Circuit)component; globalComponentDictionary[cr.GetType()].Add(cr.MRID, cr); } else if (type.Equals(typeof(WireInfo))) { WireInfo wi = (WireInfo)component; globalComponentDictionary[wi.GetType()].Add(wi.MRID, wi); } else if (type.Equals(typeof(PerLengthSequenceImpedance))) { PerLengthSequenceImpedance pli = (PerLengthSequenceImpedance)component; globalComponentDictionary[pli.GetType()].Add(pli.MRID, pli); } else if (type.Equals(typeof(ConnectivityNode))) { ConnectivityNode cn = (ConnectivityNode)component; globalComponentDictionary[cn.GetType()].Add(cn.MRID, cn); } else if (type.Equals(typeof(PowerTransformer))) { PowerTransformer pt = (PowerTransformer)component; globalComponentDictionary[pt.GetType()].Add(pt.MRID, pt); } else if (type.Equals(typeof(PowerTransformerEnd))) { PowerTransformerEnd pt = (PowerTransformerEnd)component; globalComponentDictionary[pt.GetType()].Add(pt.MRID, pt); } else if (type.Equals(typeof(UsagePoint))) { UsagePoint us = (UsagePoint)component; globalComponentDictionary[us.GetType()].Add(us.MRID, us); } else if (type.Equals(typeof(PSRType))) { PSRType psr = (PSRType)component; globalComponentDictionary[psr.GetType()].Add(psr.Name, psr); } else if (type.Equals(typeof(SynchronousMachine))) { SynchronousMachine sm = (SynchronousMachine)component; globalComponentDictionary[sm.GetType()].Add(sm.Name, sm); } }