![]() |
Eclipse SUMO - Simulation of Urban MObility
|
#include <Circuit.h>
Public Types | |
| enum | alphaFlag { ALPHA_NOT_APPLIED = 0 , ALPHA_CURRENT_LIMITS , ALPHA_VOLTAGE_LIMITS , ALPHA_NOT_CONVERGING } |
| Flag of alpha scaling parameter. More... | |
Public Member Functions | |
| Element * | addElement (std::string name, double value, Node *pNode, Node *nNode, Element::ElementType et) |
| Node * | addNode (std::string name) |
| bool | checkCircuit (std::string substationId="") |
| Circuit () | |
| Circuit (double currentLimit) | |
| Constructor with user-specified current limit parameter. | |
| void | cleanUpSP () |
| void | decreaseLastId () |
| void | eraseElement (Element *element) |
| void | eraseNode (Node *node) |
| double | getAlphaBest () |
| return alphaBest variable, the best alpha scaling value | |
| alphaFlag | getAlphaReason () |
return the reason why alpha scaling value has been used | |
| double | getCurrent (std::string name) |
| double | getCurrentLimit () |
| @ brief Get the electric current limit of this circuit. | |
| std::string & | getCurrentsOfCircuitSource (std::string ¤ts) |
| List of currents of voltage sources as a string. | |
| std::vector< Element * > * | getCurrentSources () |
| Element * | getElement (std::string name) |
| int | getLastId () |
| Node * | getNode (int id) |
| Node * | getNode (std::string name) |
| int | getNumVoltageSources () |
| double | getResistance (std::string name) |
| double | getTotalCurrentOfCircuitSources () |
| The sum of voltage source currents in the circuit. | |
| double | getTotalPowerOfCircuitSources () |
| The sum of voltage source powers in the circuit. | |
| double | getVoltage (std::string name) |
| Element * | getVoltageSource (int id) |
| void | lock () |
| void | replaceAndDeleteNode (Node *unusedNode, Node *newNode) |
| void | setCurrentLimit (double myCurrentLimit) |
| Set the electric current limit of this circuit. | |
| void | unlock () |
Static Public Member Functions | |
| static void | enforceCurrentLimits (const bool val) |
| whether per-substation overhead-wire current limits should be enforced | |
Private Member Functions | |
| void | deployResults (double *vals, std::vector< int > *removable_ids) |
| void | detectRemovableNodes (std::vector< int > *removable_ids) |
| Element * | getElement (int id) |
Private Attributes | |
| double | alphaBest |
| Best alpha scaling value. | |
| alphaFlag | alphaReason |
| double | circuitCurrentLimit |
| The electric current limit of the voltage sources. | |
| std::vector< Element * > * | elements |
| bool | iscleaned |
| int | lastId |
| std::vector< Node * > * | nodes |
| std::vector< Element * > * | voltageSources |
Static Private Attributes | |
| static bool | myCurrentLimits = false |
| whether per-substation overhead-wire current limits should be enforced | |
All interactions will be through this class, the user will know nothing about the other classes, and will interact only through the names of the elements/nodes.
| enum Circuit::alphaFlag |
Flag of alpha scaling parameter.
returns ALPHA_NOT_APPLIED => alpha should be 1 returns ALPHA_CURRENT_LIMITS => alpha is lower than one due to electric current limits of the substation returns ALPHA_VOLTAGE_LIMITS => alpha is not one due to inability of network to transfer requested power due to overhead wire resistance returns ALPHA_NOT_CONVERGING => number of allowed iterations exceeded
| Circuit::Circuit | ( | ) |
Definition at line 582 of file Circuit.cpp.
References circuitCurrentLimit, elements, iscleaned, lastId, nodes, and voltageSources.
| Circuit::Circuit | ( | double | currentLimit | ) |
Constructor with user-specified current limit parameter.
Definition at line 591 of file Circuit.cpp.
References circuitCurrentLimit, elements, iscleaned, lastId, nodes, and voltageSources.
| Element * Circuit::addElement | ( | std::string | name, |
| double | value, | ||
| Node * | pNode, | ||
| Node * | nNode, | ||
| Element::ElementType | et | ||
| ) |
Definition at line 786 of file Circuit.cpp.
References Node::addElement(), circuit_lock, elements, getElement(), Element::getType(), lastId, Element::RESISTOR_traction_wire, Element::setId(), Element::setNegNode(), Element::setPosNode(), TL, Element::VOLTAGE_SOURCE_traction_wire, voltageSources, WRITE_ERROR, and WRITE_WARNING.
Referenced by MSTractionSubstation::addOverheadWireClampToCircuit(), MSTractionSubstation::addOverheadWireInnerSegmentToCircuit(), MSTractionSubstation::addOverheadWireSegmentToCircuit(), and MSDevice_ElecHybrid::notifyMove().
| Node * Circuit::addNode | ( | std::string | name | ) |
Definition at line 43 of file Circuit.cpp.
References circuit_lock, getNode(), lastId, nodes, Node::setGround(), TL, and WRITE_ERRORF.
Referenced by MSTractionSubstation::addOverheadWireInnerSegmentToCircuit(), MSTractionSubstation::addOverheadWireSegmentToCircuit(), and MSDevice_ElecHybrid::notifyMove().
| bool Circuit::checkCircuit | ( | std::string | substationId = "" | ) |
there used to be == 1 which was probably a typo ... check!
Definition at line 901 of file Circuit.cpp.
References elements, Node::getElements(), Node::getId(), getNode(), getNumVoltageSources(), Node::isGround(), nodes, Element::RESISTOR_traction_wire, TL, toString(), Element::VOLTAGE_SOURCE_traction_wire, voltageSources, WRITE_ERRORF, and WRITE_WARNINGF.
| void Circuit::cleanUpSP | ( | ) |
Definition at line 888 of file Circuit.cpp.
References elements, iscleaned, Element::RESISTOR_traction_wire, and voltageSources.
|
inline |
Definition at line 254 of file Circuit.h.
References lastId.
Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), and replaceAndDeleteNode().
|
private |
Definition at line 489 of file Circuit.cpp.
References Node::getAnOtherElement(), getElement(), getNode(), Element::getResistance(), Element::getTheOtherNode(), Node::getVoltage(), getVoltage(), Node::isRemovable(), nodes, Node::setVoltage(), TL, Element::VOLTAGE_SOURCE_traction_wire, voltageSources, WRITE_ERROR, and WRITE_WARNING.
|
private |
Select removable nodes, i.e. nodes that are NOT the ground of the circuit and that have exactly two resistor elements connected. Ids of those removable nodes are added into the internal vector removable_ids.
Definition at line 760 of file Circuit.cpp.
References nodes, and Element::RESISTOR_traction_wire.
|
inlinestatic |
whether per-substation overhead-wire current limits should be enforced
Definition at line 66 of file Circuit.h.
References myCurrentLimits.
Referenced by MSFrame::setMSGlobals().
| void Circuit::eraseElement | ( | Element * | element | ) |
Definition at line 830 of file Circuit.cpp.
References circuit_lock, elements, Node::eraseElement(), Element::getNegNode(), and Element::getPosNode().
Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), and MSOverheadWire::~MSOverheadWire().
| void Circuit::eraseNode | ( | Node * | node | ) |
Definition at line 63 of file Circuit.cpp.
References circuit_lock, and nodes.
Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), replaceAndDeleteNode(), and MSOverheadWire::~MSOverheadWire().
|
inline |
return alphaBest variable, the best alpha scaling value
Definition at line 136 of file Circuit.h.
References alphaBest.
Referenced by MSDevice_ElecHybrid::getCircuitAlpha(), and MSTractionSubstation::solveCircuit().
|
inline |
return the reason why alpha scaling value has been used
Definition at line 141 of file Circuit.h.
References alphaReason.
Referenced by MSTractionSubstation::solveCircuit().
| double Circuit::getCurrent | ( | std::string | name | ) |
Definition at line 69 of file Circuit.cpp.
References Element::getCurrent(), and getElement().
|
inline |
@ brief Get the electric current limit of this circuit.
Definition at line 265 of file Circuit.h.
References circuitCurrentLimit.
| std::string & Circuit::getCurrentsOfCircuitSource | ( | std::string & | currents | ) |
List of currents of voltage sources as a string.
Definition at line 166 of file Circuit.cpp.
References toString(), and voltageSources.
Referenced by MSTractionSubstation::addChargeValueForOutput().
| std::vector< Element * > * Circuit::getCurrentSources | ( | ) |
Definition at line 179 of file Circuit.cpp.
References Element::CURRENT_SOURCE_traction_wire, and elements.
|
private |
Definition at line 131 of file Circuit.cpp.
References elements, and getVoltageSource().
| Element * Circuit::getElement | ( | std::string | name | ) |
Definition at line 117 of file Circuit.cpp.
References elements, and voltageSources.
Referenced by addElement(), deployResults(), getCurrent(), getResistance(), getVoltage(), and MSDevice_ElecHybrid::notifyMove().
|
inline |
Definition at line 249 of file Circuit.h.
References lastId.
Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), and replaceAndDeleteNode().
| Node * Circuit::getNode | ( | int | id | ) |
Definition at line 108 of file Circuit.cpp.
References nodes.
| Node * Circuit::getNode | ( | std::string | name | ) |
Definition at line 99 of file Circuit.cpp.
References nodes.
Referenced by addNode(), MSTractionSubstation::addOverheadWireSegmentToCircuit(), checkCircuit(), MSDevice_ElecHybrid::deleteVehicleFromCircuit(), deployResults(), GUIOverheadWire::drawGL(), getVoltage(), MSDevice_ElecHybrid::notifyMove(), and replaceAndDeleteNode().
| int Circuit::getNumVoltageSources | ( | ) |
Definition at line 978 of file Circuit.cpp.
References voltageSources.
Referenced by checkCircuit(), and MSTractionSubstation::writeTractionSubstationOutput().
| double Circuit::getResistance | ( | std::string | name | ) |
Definition at line 91 of file Circuit.cpp.
References getElement(), and Element::getResistance().
| double Circuit::getTotalCurrentOfCircuitSources | ( | ) |
The sum of voltage source currents in the circuit.
Definition at line 157 of file Circuit.cpp.
References voltageSources.
Referenced by MSTractionSubstation::solveCircuit().
| double Circuit::getTotalPowerOfCircuitSources | ( | ) |
The sum of voltage source powers in the circuit.
Definition at line 149 of file Circuit.cpp.
References Element::getPower(), and voltageSources.
Referenced by MSTractionSubstation::solveCircuit().
| double Circuit::getVoltage | ( | std::string | name | ) |
Definition at line 77 of file Circuit.cpp.
References getElement(), getNode(), Element::getVoltage(), and Node::getVoltage().
Referenced by deployResults().
| Element * Circuit::getVoltageSource | ( | int | id | ) |
Definition at line 140 of file Circuit.cpp.
References voltageSources.
Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), getElement(), and replaceAndDeleteNode().
| void Circuit::lock | ( | ) |
Definition at line 190 of file Circuit.cpp.
References circuit_lock.
Referenced by GUIOverheadWire::drawGL().
Definition at line 838 of file Circuit.cpp.
References Node::addElement(), decreaseLastId(), elements, Node::eraseElement(), eraseNode(), Node::getId(), getLastId(), getNode(), getVoltageSource(), Element::setId(), Node::setId(), TL, voltageSources, and WRITE_ERROR.
Referenced by MSTractionSubstation::addOverheadWireSegmentToCircuit().
|
inline |
Set the electric current limit of this circuit.
RICE_CHECK: Is this identical to the current limit of a traction substation?
Definition at line 260 of file Circuit.h.
References circuitCurrentLimit.
| void Circuit::unlock | ( | ) |
Definition at line 194 of file Circuit.cpp.
References circuit_lock.
Referenced by GUIOverheadWire::drawGL().
|
private |
Best alpha scaling value.
This parameter is used to scale down the power demands of current sources (vehicles that draw power from the circuit) so that a solution of the system can be found. Note: the system is nonlinear (quadratic), hence in some cases (typically too high power demands) a solution cannot be found. In that moment we decrease all power requirements by alpha and try to solve again, until we find alpha that ensures stable solution. This is then reported as alphaBest.
Definition at line 92 of file Circuit.h.
Referenced by getAlphaBest().
|
private |
Definition at line 116 of file Circuit.h.
Referenced by getAlphaReason().
|
private |
The electric current limit of the voltage sources.
Definition at line 80 of file Circuit.h.
Referenced by Circuit(), Circuit(), getCurrentLimit(), and setCurrentLimit().
|
private |
Definition at line 73 of file Circuit.h.
Referenced by addElement(), checkCircuit(), Circuit(), Circuit(), cleanUpSP(), eraseElement(), getCurrentSources(), getElement(), getElement(), and replaceAndDeleteNode().
|
private |
Definition at line 77 of file Circuit.h.
Referenced by Circuit(), Circuit(), and cleanUpSP().
|
private |
Definition at line 76 of file Circuit.h.
Referenced by addElement(), addNode(), Circuit(), Circuit(), decreaseLastId(), and getLastId().
|
staticprivate |
whether per-substation overhead-wire current limits should be enforced
Definition at line 95 of file Circuit.h.
Referenced by enforceCurrentLimits().
|
private |
Definition at line 72 of file Circuit.h.
Referenced by addNode(), checkCircuit(), Circuit(), Circuit(), deployResults(), detectRemovableNodes(), eraseNode(), getNode(), and getNode().
|
private |
Definition at line 74 of file Circuit.h.
Referenced by addElement(), checkCircuit(), Circuit(), Circuit(), cleanUpSP(), deployResults(), getCurrentsOfCircuitSource(), getElement(), getNumVoltageSources(), getTotalCurrentOfCircuitSources(), getTotalPowerOfCircuitSources(), getVoltageSource(), and replaceAndDeleteNode().