SUMO - Simulation of Urban MObility
|
A SUMO-compliant built logic for a traffic light. More...
#include <NBTrafficLightLogic.h>
Data Structures | |
class | PhaseDefinition |
The definition of a single phase of the logic. More... |
Public Member Functions | |
void | addStep (SUMOTime duration, const std::string &state, int index=-1) |
Adds a phase to the logic. | |
void | closeBuilding () |
closes the building process | |
void | deletePhase (unsigned int index) |
SUMOTime | getDuration () const |
Returns the duration of the complete cycle. | |
const std::string & | getID () const |
Returns the id. | |
unsigned int | getNumLinks () |
Returns the number of participating links. | |
SUMOTime | getOffset () const |
Returns the offset of first switch. | |
const std::vector < PhaseDefinition > & | getPhases () const |
Returns the phases. | |
const std::string & | getProgramID () const |
Returns the ProgramID. | |
NBTrafficLightLogic (const std::string &id, const std::string &subid, unsigned int noLinks) | |
Constructor. | |
NBTrafficLightLogic (const NBTrafficLightLogic *logic) | |
Copy Constructor. | |
void | resetPhases () |
void | setID (const std::string &newID) |
resets the id | |
void | setOffset (SUMOTime offset) |
Sets the offset of this tls. | |
void | setPhaseDuration (unsigned int phaseIndex, SUMOTime duration) |
Modifies the duration for an existing phase (used by NETEDIT) | |
void | setPhaseState (unsigned int phaseIndex, int tlIndex, LinkState linkState) |
Modifies the state for an existing phase (used by NETEDIT) | |
~NBTrafficLightLogic () | |
Destructor. |
Protected Attributes | |
std::string | myID |
The name of the object. |
Private Types | |
typedef std::vector < PhaseDefinition > | PhaseDefinitionVector |
Definition of a vector of traffic light phases. |
Private Attributes | |
unsigned int | myNumLinks |
The number of participating links. | |
SUMOTime | myOffset |
The tls program's offset. | |
PhaseDefinitionVector | myPhases |
The junction logic's storage for traffic light phase list. | |
const std::string | mySubID |
The tls program's subid. |
Static Private Attributes | |
static const std::string | ALLOWED_STATES |
static const char | allowedStatesInitializer [] |
all allowed characters for phase state (see SUMOXMLDefinitions) |
A SUMO-compliant built logic for a traffic light.
Definition at line 58 of file NBTrafficLightLogic.h.
|
private |
Definition of a vector of traffic light phases.
Definition at line 207 of file NBTrafficLightLogic.h.
NBTrafficLightLogic::NBTrafficLightLogic | ( | const std::string & | id, |
const std::string & | subid, | ||
unsigned int | noLinks | ||
) |
Constructor.
[in] | id | The id of the traffic light |
[in] | subid | The id of the program |
[in] | noLinks | Number of links that are controlled by this tls. 0 means the value is not known beforehand |
Definition at line 70 of file NBTrafficLightLogic.cpp.
NBTrafficLightLogic::NBTrafficLightLogic | ( | const NBTrafficLightLogic * | logic | ) |
Copy Constructor.
[in] | logic | The logic to copy |
Definition at line 75 of file NBTrafficLightLogic.cpp.
NBTrafficLightLogic::~NBTrafficLightLogic | ( | ) |
Destructor.
Definition at line 83 of file NBTrafficLightLogic.cpp.
Adds a phase to the logic.
[in] | duration | The duration of the phase to add |
[in] | state | The state definition of a tls phase |
[in] | index | The index of the new phase (-1 means append to end) |
Definition at line 87 of file NBTrafficLightLogic.cpp.
References ALLOWED_STATES, myNumLinks, myPhases, and toString().
Referenced by NBLoadedSUMOTLDef::addPhase(), NBOwnTLDef::myCompute(), NBLoadedTLDef::myCompute(), and NBLoadedSUMOTLDef::removeConnection().
void NBTrafficLightLogic::closeBuilding | ( | ) |
closes the building process
Joins equal steps.
Definition at line 138 of file NBTrafficLightLogic.cpp.
References myPhases.
Referenced by NBLoadedSUMOTLDef::myCompute(), and NBLoadedTLDef::myCompute().
void NBTrafficLightLogic::deletePhase | ( | unsigned int | index | ) |
Definition at line 111 of file NBTrafficLightLogic.cpp.
References myPhases, and toString().
SUMOTime NBTrafficLightLogic::getDuration | ( | ) | const |
Returns the duration of the complete cycle.
Definition at line 128 of file NBTrafficLightLogic.cpp.
References myPhases.
Referenced by NBTrafficLightLogicCont::computeSingleLogic(), and NBOwnTLDef::myCompute().
|
inlineinherited |
Returns the id.
Reimplemented in MS_E2_ZS_CollectorOverLanes.
Definition at line 61 of file Named.h.
References Named::myID.
Referenced by MSDetectorControl::add(), ShapeContainer::add(), RORouteDef_Alternatives::addAlternative(), MSNet::addBusStop(), NBLoadedSUMOTLDef::addConnection(), NLHandler::addConnection(), NIImporter_OpenDrive::addE2EConnectionsSecure(), RONet::addNode(), NIImporter_SUMO::addPhase(), RONet::addRouteDef(), NBDistrict::addSink(), NBDistrict::addSource(), MSRouteHandler::addStop(), NIXMLTrafficLightsHandler::addTlConnection(), NIVissimDisturbance::addToNode(), MSVehicle::addTraciStop(), NIVisumTL::build(), MS_E2_ZS_CollectorOverLanes::buildCollector(), NIImporter_VISUM::buildDistrictNode(), NIVissimConnection::buildEdgeConnections(), NBEdge::buildInnerEdges(), NIVissimEdge::buildNBEdge(), NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), ODDistrictHandler::closeDistrict(), NBTrafficLightDefinition::collectEdges(), NBOwnTLDef::collectLinks(), NBTrafficLightDefinition::compute(), NBNode::computeInternalLaneShape(), NBEdge::computeLaneShapes(), NBNode::computeLogic(), NBNode::computeNodeShape(), NBTrafficLightLogicCont::computeSingleLogic(), NBTurningDirectionsComputer::computeTurnDirectionsForNode(), NBEdge::connections_sorter(), MSLane::detectCollisions(), NIVissimDistrictConnection::dict_BuildDistricts(), MSE3Collector::enter(), Command_SaveTLSSwitches::execute(), MSVTypeProbe::execute(), NBNodeCont::extract(), NBTrafficLightLogicCont::extract(), NBEdgeCont::extract(), MSNet::getBusStopID(), NIImporter_VISUM::getNamedEdgeContinuating(), NLTriggerBuilder::getPosition(), NBNode::getPossiblySplittedIncoming(), NBNode::getPossiblySplittedOutgoing(), NIImporter_VISUM::getReversedContinuating(), NBEdgeCont::ignoreFilterMatch(), MSActuatedTrafficLightLogic::init(), MSAgentbasedTrafficLightLogic::init(), NIImporter_SUMO::initTrafficLightLogic(), NIXMLTrafficLightsHandler::initTrafficLightLogic(), NBDistrictCont::insert(), NBTrafficLightLogicCont::insert(), NBNodeCont::insert(), NBEdgeCont::insert(), NBEdgeCont::joinSameNodeConnectingEdges(), MSE3Collector::leave(), NIImporter_OpenDrive::loadNetwork(), MSLane::moveCritical(), MSVehicle::MSVehicle(), RORDLoader_SUMOBase::myCharacters(), NBOwnTLDef::myCompute(), NBLoadedTLDef::myCompute(), NIXMLTrafficLightsHandler::myEndElement(), NIXMLEdgesHandler::myEndElement(), NIImporter_SUMO::myEndElement(), NIXMLConnectionsHandler::myStartElement(), MSLaneSpeedTrigger::myStartElement(), MSTriggeredRerouter::myStartElement(), NBConnection::NBConnection(), NBRequest::NBRequest(), MSDevice_Tripinfo::notifyEnter(), MSDevice_Tripinfo::notifyLeave(), Named::ComparatorIdLess::operator()(), NBTurningDirectionsComputer::combination_by_angle_sorter::operator()(), NBOwnTLDef::edge_by_incoming_priority_sorter::operator()(), NBNetBuilder::by_id_sorter::operator()(), NBContHelper::same_connection_edge_sorter::operator()(), NBNode::nodes_by_id_sorter::operator()(), NIImporter_VISUM::parse_EdgePolys(), NIImporter_VISUM::parse_Lanes(), NIImporter_VISUM::parse_LanesConnections(), NIImporter_VISUM::parse_Turns(), NIImporter_VISUM::parse_TurnsToSignalGroups(), NIXMLConnectionsHandler::parseDeprecatedLaneDefinition(), NIXMLConnectionsHandler::parseLaneBound(), NBLoadedTLDef::SignalGroup::patchTYellow(), RORouteDef_Complete::preComputeCurrentRoute(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Vehicle::processGet(), NWWriter_SUMO::prohibitionConnection(), NBLoadedTLDef::SignalGroup::remapIncoming(), NBLoadedTLDef::SignalGroup::remapOutgoing(), NBLoadedSUMOTLDef::removeConnection(), NBNode::removeSelfLoops(), NBEdgeCont::removeUnwishedEdges(), NBNodeCont::removeUnwishedNodes(), NBNodeCont::rename(), NBEdgeCont::rename(), NBConnection::replaceFrom(), MSBaseVehicle::replaceRouteEdges(), NBConnection::replaceTo(), NIXMLTrafficLightsHandler::retrieveLaneIndex(), NBNodeCont::setAsTLControlled(), NBEdge::setControllingTLInformation(), MSLane::setCritical(), NIXMLEdgesHandler::setNodes(), NBOwnTLDef::setTLControllingInformation(), NBLoadedSUMOTLDef::setTLControllingInformation(), NBLoadedTLDef::setTLControllingInformation(), NBEdgeCont::splitAt(), RORDLoader_SUMOBase::startRoute(), NBEdge::startShapeAt(), NIXMLConnectionsHandler::validateLaneInfo(), MSInstantInductLoop::write(), NWWriter_SUMO::writeConnection(), NWWriter_SUMO::writeDistrict(), NWWriter_SUMO::writeEdge(), MSMeanData::writeEdge(), NWWriter_XML::writeEdgesAndConnections(), NWWriter_SUMO::writeInternalConnections(), NWWriter_SUMO::writeJunction(), NWWriter_OpenDrive::writeNetwork(), NWWriter_XML::writeNodes(), MSInductLoop::writeTypedXMLOutput(), MSRouteProbe::writeXMLOutput(), and MSE2Collector::writeXMLOutput().
|
inline |
Returns the number of participating links.
Definition at line 191 of file NBTrafficLightLogic.h.
References myNumLinks.
Referenced by NBLoadedSUMOTLDef::addConnection(), and NBLoadedSUMOTLDef::setTLControllingInformation().
|
inline |
Returns the offset of first switch.
Definition at line 184 of file NBTrafficLightLogic.h.
References myOffset.
Referenced by NBLoadedSUMOTLDef::removeConnection().
|
inline |
Returns the phases.
Definition at line 176 of file NBTrafficLightLogic.h.
References myPhases.
Referenced by NBLoadedSUMOTLDef::removeConnection().
|
inline |
Returns the ProgramID.
Definition at line 168 of file NBTrafficLightLogic.h.
References mySubID.
void NBTrafficLightLogic::resetPhases | ( | ) |
Definition at line 121 of file NBTrafficLightLogic.cpp.
References myNumLinks, and myPhases.
Referenced by NIXMLTrafficLightsHandler::myStartElement().
|
inlineinherited |
resets the id
Definition at line 67 of file Named.h.
References Named::myID.
Referenced by NBNodeCont::rename(), and NBEdgeCont::rename().
|
inline |
Sets the offset of this tls.
[in] | offset | The offset of this cycle |
Definition at line 160 of file NBTrafficLightLogic.h.
References myOffset.
Referenced by NBTrafficLightLogicCont::computeSingleLogic(), NIXMLTrafficLightsHandler::initTrafficLightLogic(), NBLoadedSUMOTLDef::NBLoadedSUMOTLDef(), and NBLoadedSUMOTLDef::removeConnection().
Modifies the duration for an existing phase (used by NETEDIT)
[in] | phaseIndex | The index of the phase to modify |
[in] | duration | The new duration for this phase |
Definition at line 160 of file NBTrafficLightLogic.cpp.
References myPhases.
void NBTrafficLightLogic::setPhaseState | ( | unsigned int | phaseIndex, |
int | tlIndex, | ||
LinkState | linkState | ||
) |
Modifies the state for an existing phase (used by NETEDIT)
[in] | phaseIndex | The index of the phase to modify |
[in] | tlIndex | The index at which to modify the state |
[in] | linkState | The new link state for the given index |
Definition at line 151 of file NBTrafficLightLogic.cpp.
References myPhases.
|
staticprivate |
Definition at line 214 of file NBTrafficLightLogic.h.
Referenced by addStep().
|
staticprivate |
all allowed characters for phase state (see SUMOXMLDefinitions)
Definition at line 213 of file NBTrafficLightLogic.h.
|
protectedinherited |
The name of the object.
Definition at line 83 of file Named.h.
Referenced by NLDetectorBuilder::addE3Entry(), NLDetectorBuilder::addE3Exit(), NBEdge::computeEdgeShape(), Named::getID(), NBEdge::getLaneID(), NBEdge::init(), RORouteDef_OrigDest::preComputeCurrentRoute(), RORouteDef_Alternatives::preComputeCurrentRoute(), RORouteDef_Complete::preComputeCurrentRoute(), MSRoute::release(), Named::setID(), NBEdge::splitGeometry(), MSXMLRawOut::writeLane(), NBNode::writeLogic(), MSE3Collector::writeXMLOutput(), and MSMeanData::writeXMLOutput().
|
private |
The number of participating links.
Definition at line 198 of file NBTrafficLightLogic.h.
Referenced by addStep(), getNumLinks(), and resetPhases().
|
private |
The tls program's offset.
Definition at line 204 of file NBTrafficLightLogic.h.
Referenced by getOffset(), and setOffset().
|
private |
The junction logic's storage for traffic light phase list.
Definition at line 210 of file NBTrafficLightLogic.h.
Referenced by addStep(), closeBuilding(), deletePhase(), getDuration(), getPhases(), resetPhases(), setPhaseDuration(), and setPhaseState().
|
private |
The tls program's subid.
Definition at line 201 of file NBTrafficLightLogic.h.
Referenced by getProgramID().