Eclipse SUMO - Simulation of Urban MObility
Circuit Class Reference

#include <Circuit.h>

Public Member Functions

ElementaddElement (string name, double value, Node *pNode, Node *nNode, Element::ElementType et)
 
NodeaddNode (string name)
 
bool checkCircuit (std::string substationId="")
 
 Circuit ()
 
void cleanUpSP ()
 
void descreaseLastId ()
 
void eraseElement (Element *element)
 
void eraseNode (Node *node)
 
double getCurrent (string name)
 
vector< Element * > * getCurrentSources ()
 
ElementgetElement (string name)
 
int getLastId ()
 
NodegetNode (int id)
 
NodegetNode (string name)
 
int getNumVoltageSources ()
 
double getResistance (string name)
 
double getVoltage (string name)
 
ElementgetVoltageSource (int id)
 
void lock ()
 
void replaceAndDeleteNode (Node *unusedNode, Node *newNode)
 
void unlock ()
 

Data Fields

double alphaBest
 Best alpha scaling value. More...
 

Private Member Functions

void deployResults (double *vals, std::vector< int > *removable_ids)
 
void detectRemovableNodes (std::vector< int > *removable_ids)
 
ElementgetElement (int id)
 

Private Attributes

vector< Element * > * elements
 
bool iscleaned
 
int lastId
 
vector< Node * > * nodes
 
vector< Element * > * voltageSources
 

Detailed Description

Note
based on work 2017 Ahmad Khaled, Ahmad Essam, Omnia Zakaria, Mary Nader 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 38 of file Circuit.h.

Constructor & Destructor Documentation

◆ Circuit()

Circuit::Circuit ( )

Definition at line 492 of file Circuit.cpp.

Member Function Documentation

◆ addElement()

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

Definition at line 659 of file Circuit.cpp.

References Node::addElement(), circuit_lock, Element::getType(), Element::setId(), Element::setNegNode(), and Element::setPosNode().

Referenced by MSTractionSubstation::addOverheadWireClampToCircuit(), MSTractionSubstation::addOverheadWireInnerSegmentToCircuit(), MSTractionSubstation::addOverheadWireSegmentToCircuit(), and MSDevice_ElecHybrid::notifyMove().

Here is the caller graph for this function:

◆ addNode()

Node * Circuit::addNode ( string  name)

Definition at line 41 of file Circuit.cpp.

References circuit_lock, and Node::setGround().

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 = "")

there used to be == 1 which was probably a typo ... check!

Definition at line 764 of file Circuit.cpp.

References Node::getElements(), Node::getId(), Node::isGround(), toString(), WRITE_ERROR, and WRITE_WARNING.

◆ cleanUpSP()

void Circuit::cleanUpSP ( )

Definition at line 751 of file Circuit.cpp.

◆ deployResults()

void Circuit::deployResults ( double *  vals,
std::vector< int > *  removable_ids 
)
private

◆ descreaseLastId()

void Circuit::descreaseLastId ( )
inline

Definition at line 178 of file Circuit.h.

References lastId.

Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit().

Here is the caller graph for this function:

◆ detectRemovableNodes()

void Circuit::detectRemovableNodes ( std::vector< int > *  removable_ids)
private

Definition at line 638 of file Circuit.cpp.

◆ eraseElement()

void Circuit::eraseElement ( Element element)

Definition at line 693 of file Circuit.cpp.

References circuit_lock.

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.

Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit(), and MSOverheadWire::~MSOverheadWire().

Here is the caller graph for this function:

◆ getCurrent()

double Circuit::getCurrent ( string  name)

Definition at line 68 of file Circuit.cpp.

References Element::getCurrent().

◆ getCurrentSources()

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

Definition at line 154 of file Circuit.cpp.

Referenced by MSTractionSubstation::solveCircuit().

Here is the caller graph for this function:

◆ getElement() [1/2]

Element * Circuit::getElement ( int  id)
private

Definition at line 131 of file Circuit.cpp.

◆ getElement() [2/2]

Element * Circuit::getElement ( string  name)

Definition at line 117 of file Circuit.cpp.

Referenced by MSDevice_ElecHybrid::notifyMove().

Here is the caller graph for this function:

◆ getLastId()

int Circuit::getLastId ( )
inline

Definition at line 173 of file Circuit.h.

References lastId.

Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit().

Here is the caller graph for this function:

◆ getNode() [1/2]

Node * Circuit::getNode ( int  id)

Definition at line 108 of file Circuit.cpp.

◆ getNode() [2/2]

Node * Circuit::getNode ( string  name)

Definition at line 98 of file Circuit.cpp.

Referenced by MSTractionSubstation::addOverheadWireSegmentToCircuit(), MSDevice_ElecHybrid::deleteVehicleFromCircuit(), GUIOverheadWire::drawGL(), and MSDevice_ElecHybrid::notifyMove().

Here is the caller graph for this function:

◆ getNumVoltageSources()

int Circuit::getNumVoltageSources ( )

Definition at line 841 of file Circuit.cpp.

◆ getResistance()

double Circuit::getResistance ( string  name)

Definition at line 90 of file Circuit.cpp.

References Element::getResistance().

◆ getVoltage()

double Circuit::getVoltage ( string  name)

Definition at line 76 of file Circuit.cpp.

References Element::getVoltage(), and Node::getVoltage().

◆ getVoltageSource()

Element * Circuit::getVoltageSource ( int  id)

Definition at line 145 of file Circuit.cpp.

Referenced by MSDevice_ElecHybrid::deleteVehicleFromCircuit().

Here is the caller graph for this function:

◆ lock()

void Circuit::lock ( )

Definition at line 165 of file Circuit.cpp.

References circuit_lock.

◆ replaceAndDeleteNode()

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

Definition at line 701 of file Circuit.cpp.

References Node::addElement(), Node::eraseElement(), Node::getId(), Element::setId(), Node::setId(), and WRITE_ERROR.

Referenced by MSTractionSubstation::addOverheadWireSegmentToCircuit().

Here is the caller graph for this function:

◆ unlock()

void Circuit::unlock ( )

Definition at line 169 of file Circuit.cpp.

References circuit_lock.

Field Documentation

◆ alphaBest

double Circuit::alphaBest

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 69 of file Circuit.h.

Referenced by MSDevice_ElecHybrid::getCircuitAlpha(), and MSTractionSubstation::solveCircuit().

◆ elements

vector<Element*>* Circuit::elements
private

Definition at line 43 of file Circuit.h.

◆ iscleaned

bool Circuit::iscleaned
private

Definition at line 47 of file Circuit.h.

◆ lastId

int Circuit::lastId
private

Definition at line 46 of file Circuit.h.

Referenced by descreaseLastId(), and getLastId().

◆ nodes

vector<Node*>* Circuit::nodes
private

Definition at line 42 of file Circuit.h.

◆ voltageSources

vector<Element*>* Circuit::voltageSources
private

Definition at line 44 of file Circuit.h.


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