Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
Circuit Class Reference

#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

ElementaddElement (std::string name, double value, Node *pNode, Node *nNode, Element::ElementType et)
 
NodeaddNode (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 &currents)
 List of currents of voltage sources as a string.
 
std::vector< Element * > * getCurrentSources ()
 
ElementgetElement (std::string name)
 
int getLastId ()
 
NodegetNode (int id)
 
NodegetNode (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)
 
ElementgetVoltageSource (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)
 
ElementgetElement (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
 

Detailed Description

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.

Definition at line 62 of file Circuit.h.

Member Enumeration Documentation

◆ 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

Enumerator
ALPHA_NOT_APPLIED 

The scaling alpha is not applied (is one)

ALPHA_CURRENT_LIMITS 

The scaling alpha is applied (is not one) due to current limits.

ALPHA_VOLTAGE_LIMITS 

The scaling alpha is applied (is not one] due to voltage limits.

ALPHA_NOT_CONVERGING 

The Newton-Rhapson method has reached maximum iterations and no solution of circuit has been found with actual value of alpha.

Definition at line 96 of file Circuit.h.

Constructor & Destructor Documentation

◆ Circuit() [1/2]

Circuit::Circuit ( )

Definition at line 581 of file Circuit.cpp.

References circuitCurrentLimit, elements, iscleaned, lastId, nodes, and voltageSources.

◆ Circuit() [2/2]

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.

Member Function Documentation

◆ addElement()

Element * Circuit::addElement ( std::string  name,
double  value,
Node pNode,
Node nNode,
Element::ElementType  et 
)

◆ addNode()

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().

Here is the caller graph for this function:

◆ checkCircuit()

bool Circuit::checkCircuit ( std::string  substationId = "")

◆ cleanUpSP()

void Circuit::cleanUpSP ( )

Definition at line 889 of file Circuit.cpp.

References elements, iscleaned, Element::RESISTOR_traction_wire, and voltageSources.

◆ decreaseLastId()

void Circuit::decreaseLastId ( )
inline

Definition at line 245 of file Circuit.h.

References lastId.

Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), and replaceAndDeleteNode().

Here is the caller graph for this function:

◆ deployResults()

◆ detectRemovableNodes()

void Circuit::detectRemovableNodes ( std::vector< int > *  removable_ids)
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.

◆ eraseElement()

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().

Here is the caller graph for this function:

◆ eraseNode()

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().

Here is the caller graph for this function:

◆ getAlphaBest()

double Circuit::getAlphaBest ( )
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().

Here is the caller graph for this function:

◆ getAlphaReason()

alphaFlag Circuit::getAlphaReason ( )
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().

Here is the caller graph for this function:

◆ getCurrent()

double Circuit::getCurrent ( std::string  name)

Definition at line 68 of file Circuit.cpp.

References Element::getCurrent(), and getElement().

◆ getCurrentLimit()

double Circuit::getCurrentLimit ( )
inline

@ brief Get the electric current limit of this circuit.

Definition at line 256 of file Circuit.h.

References circuitCurrentLimit.

◆ getCurrentsOfCircuitSource()

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().

Here is the caller graph for this function:

◆ getCurrentSources()

std::vector< Element * > * Circuit::getCurrentSources ( )

Definition at line 178 of file Circuit.cpp.

References Element::CURRENT_SOURCE_traction_wire, and elements.

◆ getElement() [1/2]

Element * Circuit::getElement ( int  id)
private

Definition at line 130 of file Circuit.cpp.

References elements, and getVoltageSource().

◆ getElement() [2/2]

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().

Here is the caller graph for this function:

◆ getLastId()

int Circuit::getLastId ( )
inline

Definition at line 240 of file Circuit.h.

References lastId.

Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), and replaceAndDeleteNode().

Here is the caller graph for this function:

◆ getNode() [1/2]

Node * Circuit::getNode ( int  id)

Definition at line 107 of file Circuit.cpp.

References nodes.

◆ getNode() [2/2]

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().

Here is the caller graph for this function:

◆ getNumVoltageSources()

int Circuit::getNumVoltageSources ( )

Definition at line 979 of file Circuit.cpp.

References voltageSources.

Referenced by checkCircuit(), and MSTractionSubstation::writeTractionSubstationOutput().

Here is the caller graph for this function:

◆ getResistance()

double Circuit::getResistance ( std::string  name)

Definition at line 90 of file Circuit.cpp.

References getElement(), and Element::getResistance().

◆ getTotalCurrentOfCircuitSources()

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().

Here is the caller graph for this function:

◆ getTotalPowerOfCircuitSources()

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().

Here is the caller graph for this function:

◆ getVoltage()

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().

Here is the caller graph for this function:

◆ getVoltageSource()

Element * Circuit::getVoltageSource ( int  id)

Definition at line 139 of file Circuit.cpp.

References voltageSources.

Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), getElement(), and replaceAndDeleteNode().

Here is the caller graph for this function:

◆ lock()

void Circuit::lock ( )

Definition at line 189 of file Circuit.cpp.

References circuit_lock.

Referenced by GUIOverheadWire::drawGL().

Here is the caller graph for this function:

◆ replaceAndDeleteNode()

void Circuit::replaceAndDeleteNode ( Node unusedNode,
Node newNode 
)

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().

Here is the caller graph for this function:

◆ setCurrentLimit()

void Circuit::setCurrentLimit ( double  myCurrentLimit)
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.

◆ unlock()

void Circuit::unlock ( )

Definition at line 193 of file Circuit.cpp.

References circuit_lock.

Referenced by GUIOverheadWire::drawGL().

Here is the caller graph for this function:

Field Documentation

◆ alphaBest

double Circuit::alphaBest
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().

◆ alphaReason

alphaFlag Circuit::alphaReason
private

Definition at line 107 of file Circuit.h.

Referenced by getAlphaReason().

◆ circuitCurrentLimit

double Circuit::circuitCurrentLimit
private

The electric current limit of the voltage sources.

Definition at line 74 of file Circuit.h.

Referenced by Circuit(), Circuit(), getCurrentLimit(), and setCurrentLimit().

◆ elements

std::vector<Element*>* Circuit::elements
private

◆ iscleaned

bool Circuit::iscleaned
private

Definition at line 71 of file Circuit.h.

Referenced by Circuit(), Circuit(), and cleanUpSP().

◆ lastId

int Circuit::lastId
private

Definition at line 70 of file Circuit.h.

Referenced by addElement(), addNode(), Circuit(), Circuit(), decreaseLastId(), and getLastId().

◆ nodes

std::vector<Node*>* Circuit::nodes
private

◆ voltageSources


The documentation for this class was generated from the following files: