![]() |
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. More... | |
void | cleanUpSP () |
void | descreaseLastId () |
void | eraseElement (Element *element) |
void | eraseNode (Node *node) |
double | getAlphaBest () |
return alphaBest variable, the best alpha scaling value More... | |
alphaFlag | getAlphaReason () |
return the reason why alpha scaling value has been used More... | |
double | getCurrent (std::string name) |
double | getCurrentLimit () |
@ brief Get the electric current limit of this circuit. More... | |
std::string & | getCurrentsOfCircuitSource (std::string ¤ts) |
List of currents of voltage sources as a string. More... | |
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. More... | |
double | getTotalPowerOfCircuitSources () |
The sum of voltage source powers in the circuit. More... | |
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. More... | |
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. More... | |
alphaFlag | alphaReason |
double | circuitCurrentLimit |
The electric current limit of the voltage sources. More... | |
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 shoud 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 597 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 606 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 803 of file Circuit.cpp.
References Node::addElement(), circuit_lock, elements, getElement(), Element::getType(), lastId, Element::setId(), Element::setNegNode(), Element::setPosNode(), 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 55 of file Circuit.cpp.
References circuit_lock, getNode(), lastId, nodes, Node::setGround(), and WRITE_ERROR.
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 918 of file Circuit.cpp.
References elements, Node::getElements(), Node::getId(), getNode(), getNumVoltageSources(), Node::isGround(), nodes, toString(), voltageSources, WRITE_ERROR, and WRITE_WARNING.
void Circuit::cleanUpSP | ( | ) |
Definition at line 905 of file Circuit.cpp.
References elements, iscleaned, and voltageSources.
|
private |
Definition at line 504 of file Circuit.cpp.
References Node::getAnOtherElement(), getElement(), Node::getElements(), getNode(), Element::getPosNode(), Element::getResistance(), Element::getTheOtherNode(), Node::getVoltage(), getVoltage(), Node::isRemovable(), nodes, Node::setVoltage(), voltageSources, WRITE_ERROR, and WRITE_WARNING.
|
inline |
Definition at line 244 of file Circuit.h.
References lastId.
Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), and replaceAndDeleteNode().
|
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 777 of file Circuit.cpp.
References nodes.
void Circuit::eraseElement | ( | Element * | element | ) |
Definition at line 847 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 75 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 126 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 131 of file Circuit.h.
References alphaReason.
Referenced by MSTractionSubstation::solveCircuit().
double Circuit::getCurrent | ( | std::string | name | ) |
Definition at line 81 of file Circuit.cpp.
References Element::getCurrent(), and getElement().
|
inline |
@ brief Get the electric current limit of this circuit.
Definition at line 255 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 178 of file Circuit.cpp.
References toString(), and voltageSources.
Referenced by MSTractionSubstation::addChargeValueForOutput().
std::vector< Element * > * Circuit::getCurrentSources | ( | ) |
Definition at line 191 of file Circuit.cpp.
References elements.
|
private |
Definition at line 143 of file Circuit.cpp.
References elements, and getVoltageSource().
Element * Circuit::getElement | ( | std::string | name | ) |
Definition at line 129 of file Circuit.cpp.
References elements, and voltageSources.
Referenced by addElement(), deployResults(), getCurrent(), getResistance(), getVoltage(), and MSDevice_ElecHybrid::notifyMove().
|
inline |
Definition at line 239 of file Circuit.h.
References lastId.
Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), and replaceAndDeleteNode().
Node * Circuit::getNode | ( | int | id | ) |
Definition at line 120 of file Circuit.cpp.
References nodes.
Node * Circuit::getNode | ( | std::string | name | ) |
Definition at line 111 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 995 of file Circuit.cpp.
References voltageSources.
Referenced by checkCircuit(), and MSTractionSubstation::writeTractionSubstationOutput().
double Circuit::getResistance | ( | std::string | name | ) |
Definition at line 103 of file Circuit.cpp.
References getElement(), and Element::getResistance().
double Circuit::getTotalCurrentOfCircuitSources | ( | ) |
The sum of voltage source currents in the circuit.
Definition at line 169 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 161 of file Circuit.cpp.
References voltageSources.
Referenced by MSTractionSubstation::solveCircuit().
double Circuit::getVoltage | ( | std::string | name | ) |
Definition at line 89 of file Circuit.cpp.
References getElement(), getNode(), Element::getVoltage(), and Node::getVoltage().
Referenced by deployResults().
Element * Circuit::getVoltageSource | ( | int | id | ) |
Definition at line 152 of file Circuit.cpp.
References voltageSources.
Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), getElement(), and replaceAndDeleteNode().
void Circuit::lock | ( | ) |
Definition at line 202 of file Circuit.cpp.
References circuit_lock.
Referenced by GUIOverheadWire::drawGL().
Definition at line 855 of file Circuit.cpp.
References Node::addElement(), descreaseLastId(), elements, Node::eraseElement(), eraseNode(), Node::getId(), getLastId(), getNode(), getVoltageSource(), Element::setId(), Node::setId(), 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 250 of file Circuit.h.
References circuitCurrentLimit.
void Circuit::unlock | ( | ) |
Definition at line 206 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 85 of file Circuit.h.
Referenced by getAlphaBest().
|
private |
Definition at line 106 of file Circuit.h.
Referenced by getAlphaReason().
|
private |
The electric current limit of the voltage sources.
Definition at line 73 of file Circuit.h.
Referenced by Circuit(), getCurrentLimit(), and setCurrentLimit().
|
private |
Definition at line 66 of file Circuit.h.
Referenced by addElement(), checkCircuit(), Circuit(), cleanUpSP(), eraseElement(), getCurrentSources(), getElement(), and replaceAndDeleteNode().
|
private |
Definition at line 70 of file Circuit.h.
Referenced by Circuit(), and cleanUpSP().
|
private |
Definition at line 69 of file Circuit.h.
Referenced by addElement(), addNode(), Circuit(), descreaseLastId(), and getLastId().
|
private |
Definition at line 65 of file Circuit.h.
Referenced by addNode(), checkCircuit(), Circuit(), deployResults(), detectRemovableNodes(), eraseNode(), and getNode().
|
private |
Definition at line 67 of file Circuit.h.
Referenced by addElement(), checkCircuit(), Circuit(), cleanUpSP(), deployResults(), getCurrentsOfCircuitSource(), getElement(), getNumVoltageSources(), getTotalCurrentOfCircuitSources(), getTotalPowerOfCircuitSources(), getVoltageSource(), and replaceAndDeleteNode().