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 () |
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 |
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 581 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 590 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 787 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 42 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 902 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 889 of file Circuit.cpp.
References elements, iscleaned, Element::RESISTOR_traction_wire, and voltageSources.
|
inline |
Definition at line 245 of file Circuit.h.
References lastId.
Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), and replaceAndDeleteNode().
|
private |
Definition at line 488 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 761 of file Circuit.cpp.
References nodes, and Element::RESISTOR_traction_wire.
void Circuit::eraseElement | ( | Element * | element | ) |
Definition at line 831 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 62 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 127 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 132 of file Circuit.h.
References alphaReason.
Referenced by MSTractionSubstation::solveCircuit().
double Circuit::getCurrent | ( | std::string | name | ) |
Definition at line 68 of file Circuit.cpp.
References Element::getCurrent(), and getElement().
|
inline |
@ brief Get the electric current limit of this circuit.
Definition at line 256 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 165 of file Circuit.cpp.
References toString(), and voltageSources.
Referenced by MSTractionSubstation::addChargeValueForOutput().
std::vector< Element * > * Circuit::getCurrentSources | ( | ) |
Definition at line 178 of file Circuit.cpp.
References Element::CURRENT_SOURCE_traction_wire, and elements.
|
private |
Definition at line 130 of file Circuit.cpp.
References elements, and getVoltageSource().
Element * Circuit::getElement | ( | std::string | name | ) |
Definition at line 116 of file Circuit.cpp.
References elements, and voltageSources.
Referenced by addElement(), deployResults(), getCurrent(), getResistance(), getVoltage(), and MSDevice_ElecHybrid::notifyMove().
|
inline |
Definition at line 240 of file Circuit.h.
References lastId.
Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), and replaceAndDeleteNode().
Node * Circuit::getNode | ( | int | id | ) |
Definition at line 107 of file Circuit.cpp.
References nodes.
Node * Circuit::getNode | ( | std::string | name | ) |
Definition at line 98 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 979 of file Circuit.cpp.
References voltageSources.
Referenced by checkCircuit(), and MSTractionSubstation::writeTractionSubstationOutput().
double Circuit::getResistance | ( | std::string | name | ) |
Definition at line 90 of file Circuit.cpp.
References getElement(), and Element::getResistance().
double Circuit::getTotalCurrentOfCircuitSources | ( | ) |
The sum of voltage source currents in the circuit.
Definition at line 156 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 148 of file Circuit.cpp.
References Element::getPower(), and voltageSources.
Referenced by MSTractionSubstation::solveCircuit().
double Circuit::getVoltage | ( | std::string | name | ) |
Definition at line 76 of file Circuit.cpp.
References getElement(), getNode(), Element::getVoltage(), and Node::getVoltage().
Referenced by deployResults().
Element * Circuit::getVoltageSource | ( | int | id | ) |
Definition at line 139 of file Circuit.cpp.
References voltageSources.
Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), getElement(), and replaceAndDeleteNode().
void Circuit::lock | ( | ) |
Definition at line 189 of file Circuit.cpp.
References circuit_lock.
Referenced by GUIOverheadWire::drawGL().
Definition at line 839 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 251 of file Circuit.h.
References circuitCurrentLimit.
void Circuit::unlock | ( | ) |
Definition at line 193 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 86 of file Circuit.h.
Referenced by getAlphaBest().
|
private |
Definition at line 107 of file Circuit.h.
Referenced by getAlphaReason().
|
private |
The electric current limit of the voltage sources.
Definition at line 74 of file Circuit.h.
Referenced by Circuit(), Circuit(), getCurrentLimit(), and setCurrentLimit().
|
private |
Definition at line 67 of file Circuit.h.
Referenced by addElement(), checkCircuit(), Circuit(), Circuit(), cleanUpSP(), eraseElement(), getCurrentSources(), getElement(), getElement(), and replaceAndDeleteNode().
|
private |
Definition at line 71 of file Circuit.h.
Referenced by Circuit(), Circuit(), and cleanUpSP().
|
private |
Definition at line 70 of file Circuit.h.
Referenced by addElement(), addNode(), Circuit(), Circuit(), decreaseLastId(), and getLastId().
|
private |
Definition at line 66 of file Circuit.h.
Referenced by addNode(), checkCircuit(), Circuit(), Circuit(), deployResults(), detectRemovableNodes(), eraseNode(), getNode(), and getNode().
|
private |
Definition at line 68 of file Circuit.h.
Referenced by addElement(), checkCircuit(), Circuit(), Circuit(), cleanUpSP(), deployResults(), getCurrentsOfCircuitSource(), getElement(), getNumVoltageSources(), getTotalCurrentOfCircuitSources(), getTotalPowerOfCircuitSources(), getVoltageSource(), and replaceAndDeleteNode().