internal TransmissionUnit(Terminal linkPoint, TransmissionUnit powerSource) { I = new Complex[] { 0, 0, 0 }; UpstreamUnit = powerSource; DownstreamUnits = new HashSet<TransmissionUnit>(); powerSource.DownstreamUnits.Add(this); var tryT = linkPoint.ParentEquipment as PowerTransformer.TransformerEnd; var tryLine = linkPoint.ParentEquipment as ACLineSegment; //For now assume that Ends[0] is always the upstream TransformerEnd if (tryT != null) { typeOfBranch = "TransformerEnd"; tbranch = tryT; upstreamTerm = tryT.ParentTransformer.Ends[1].Terminal1; Node = upstreamTerm.ConnectionPoint.DynamicTopoNode; BaseKV = UpstreamUnit.BaseKV * (tryT.ParentTransformer.Ends[1].BaseKV / tryT.ParentTransformer.Ends[0].BaseKV); } if (tryLine != null) { typeOfBranch = "Conductor"; lineBranch = tryLine; BaseKV = UpstreamUnit.BaseKV; if (ReferenceEquals(tryLine.Terminal1, linkPoint)) { Node = tryLine.Terminal2.ConnectionPoint.DynamicTopoNode; upstreamTerm = tryLine.Terminal2; } if (ReferenceEquals(tryLine.Terminal2, linkPoint)) { Node = tryLine.Terminal1.ConnectionPoint.DynamicTopoNode; upstreamTerm = tryLine.Terminal1; } } V = new Complex[]{BaseKV,BaseKV,BaseKV}; }
protected override void constructAndConnect(Dictionary<string, DataTable> typesToBuild) { var terms = new Dictionary<string, Terminal>(); lineObject = modelObject as Line; if (typesToBuild["PowerTransformer"] != null) { foreach (DataRow row in typesToBuild["PowerTransformer"].Rows) { var tranName = (string)row["Name"]; lineObject[tranName] = new PowerTransformer(row); } foreach (DataRow row in typesToBuild["PowerTransformerEnd"].Rows) { var endName = (string)row["Name"]; var parent = (PowerTransformer)lineObject[(string)row["PowerTransformer"]]; var end = new PowerTransformer.TransformerEnd(row, parent); lineObject[endName] = end; parent.Ends.Add(end); } } foreach (DataRow row in typesToBuild["Switch"].Rows) { var switchName = (string)row["Name"]; lineObject[switchName] = ConductingEquipment.newConductingEquipment(row); } foreach (DataRow row in typesToBuild["ACLineSegment"].Rows) { var linesegName = (string)row["Name"]; lineObject[linesegName] = ConductingEquipment.newConductingEquipment(row); } foreach (DataRow row in typesToBuild["EnergyConsumer"].Rows) { var loadName = (string)row["Name"]; lineObject[loadName] = ConductingEquipment.newConductingEquipment(row); } foreach (DataRow row in typesToBuild["Terminal"].Rows) { var termName = (string)row["Name"]; var parentName = (string)row["ParentEquipment"]; terms.Add(termName,new Terminal(row,(ConductingEquipment)lineObject[parentName],lineObject.serviceArea)); } //instantiate and connect conducting equipment classes makeBranches(terms); makeShunts(terms); makeStaticTopology(lineObject); }