SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSAgentbasedTrafficLightLogic Class Reference

An agentbased traffic light logic. More...

#include <MSAgentbasedTrafficLightLogic.h>

Inheritance diagram for MSAgentbasedTrafficLightLogic:
MSSimpleTrafficLightLogic MSTrafficLightLogic Named Parameterised

Public Types

typedef std::map< MSLane
*, MS_E2_ZS_CollectorOverLanes * > 
E2DetectorMap
 Definition of a map from lanes to lane state detectors lying on them.
typedef std::map< unsigned int,
SUMOReal
MeanDataMap
 Definition of a map which stores the mean data of several (numberOfValues) cycles.
typedef std::map< unsigned int,
ValueType
PhaseValueMap
 Definition of a map which stores the step of the greenphases and their detector values.
typedef std::deque< SUMORealValueType
 Definition of a map which stores the detector values of one single phase.
Structure definitions
typedef std::vector
< MSPhaseDefinition * > 
Phases
 Definition of a list of phases, being the junction logic.
typedef std::vector< MSLink * > LinkVector
 Definition of the list of links that participate in this tl-light.
typedef std::vector< LinkVectorLinkVectorVector
 Definition of a list that holds lists of links that do have the same attribute.
typedef std::vector< MSLane * > LaneVector
 Definition of the list of links that participate in this tl-light.
typedef std::vector< LaneVectorLaneVectorVector
 Definition of a list that holds lists of links that do have the same attribute.

Public Member Functions

void addParameter (const std::string &key, const std::string &value)
 Adds a parameter.
void addParameter (const std::map< std::string, std::string > &mapArg)
 Adds all given parameter.
void addParameter (const Parameterised &p)
 Adds all given parameter.
void addTo (const StoringVisitor &cont) const
 Adds this object to the given container.
void clearParameter ()
 Clears the parameter map.
const std::string & getID () const
 Returns the id.
const std::map< std::string,
std::string > & 
getMap () const
 Returns the inner key/value map.
const std::string & getParameter (const std::string &key, const std::string &defaultValue) const
 Returns the value for a given key.
void init (NLDetectorBuilder &nb)
 Initialises the tls with information about incoming lanes.
bool knowsParameter (const std::string &key) const
 Returns whether the parameter is known.
 MSAgentbasedTrafficLightLogic (MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const MSSimpleTrafficLightLogic::Phases &phases, unsigned int step, SUMOTime delay, const std::map< std::string, std::string > &parameter)
 Constructor.
void setID (const std::string &newID)
 resets the id
 ~MSAgentbasedTrafficLightLogic ()
 Destructor.
Switching and setting current rows
SUMOTime trySwitch (bool isActive)
 Switches to the next phase.
Static Information Retrieval
unsigned int getPhaseNumber () const
 Returns the number of phases.
const PhasesgetPhases () const
 Returns the phases of this tls program.
PhasesgetPhases ()
 Returns the phases of this tls program.
const MSPhaseDefinitiongetPhase (unsigned int givenstep) const
 Returns the definition of the phase from the given position within the plan.
Dynamic Information Retrieval
unsigned int getCurrentPhaseIndex () const
 Returns the current index within the program.
const MSPhaseDefinitiongetCurrentPhaseDef () const
 Returns the definition of the current phase.
Conversion between time and phase
SUMOTime getPhaseIndexAtTime (SUMOTime simStep) const
 Returns the index of the logic at the given simulation step.
SUMOTime getOffsetFromIndex (unsigned int index) const
 Returns the position (start of a phase during a cycle) from of a given step.
unsigned int getIndexFromOffset (SUMOTime offset) const
 Returns the step (the phasenumber) of a given position of the cycle.
Changing phases and phase durations
void changeStepAndDuration (MSTLLogicControl &tlcontrol, SUMOTime simStep, unsigned int step, SUMOTime stepDuration)
 Changes the current phase and her duration.
void setPhases (const Phases &phases, unsigned int index)
 Replaces the phases and set the phase index.
Handling of controlled links
void addLink (MSLink *link, MSLane *lane, unsigned int pos)
 Adds a link on building.
virtual void adaptLinkInformationFrom (const MSTrafficLightLogic &logic)
 Applies information about controlled links and lanes from the given logic.
std::map< MSLink *, LinkStatecollectLinkStates () const
 Returns the (uncontrolled) states of the controlled links.
void resetLinkStates (const std::map< MSLink *, LinkState > &vals) const
 Resets the states of controlled links.
Switching and setting current rows
bool setTrafficLightSignals (SUMOTime t) const
 Applies the current signal states to controlled links.
Static Information Retrieval
const std::string & getProgramID () const
 Returns this tl-logic's id.
const LaneVectorVectorgetLaneVectors () const
 Returns the list of lists of all lanes controlled by this tls.
const LaneVectorgetLanesAt (unsigned int i) const
 Returns the list of lanes that are controlled by the signals at the given position.
const LinkVectorVectorgetLinks () const
 Returns the list of lists of all affected links.
const LinkVectorgetLinksAt (unsigned int i) const
 Returns the list of links that are controlled by the signals at the given position.
int getLinkIndex (const MSLink *const link) const
 Returns the index of the given link.
Dynamic Information Retrieval
SUMOTime getDefaultCycleTime () const
 Returns the cycle time (in ms)
SUMOTime getNextSwitchTime () const
 Returns the assumed next switch time.
Changing phases and phase durations
void addOverridingDuration (SUMOTime duration)
 Changes the duration of the next phase.
void setCurrentDurationIncrement (SUMOTime delay)
 Delays current phase by the given delay.

Protected Member Functions

"agentbased" algorithm methods
unsigned int nextStep ()
 Returns the index of the phase next to the given phase.
void collectData ()
 Collects the traffic data.
void aggregateRawData ()
 Aggregates the data of one phase, collected during different cycles.
void calculateDuration ()
 Calculates the duration for all real phases except intergreen phases.
void lengthenCycleTime (unsigned int toLenghten)
 lenghtens the actual cycle by an given value
void cutCycleTime (unsigned int toCut)
 cuts the actual cycle by an given value
unsigned int findStepOfMaxValue () const
 Returns the step of the phase with the longest Queue_Lengt_Ahead_Of_Traffic_Lights.
unsigned int findStepOfMinValue () const
 Returns the step of the phase with the shortest Queue_Lengt_Ahead_Of_Traffic_Lights.

Protected Attributes

SUMOReal deltaLimit
SUMOTime myCurrentDurationIncrement
 A value for enlarge the current duration.
SUMOTime myDefaultCycleTime
 The cycle time (without changes)
E2DetectorMap myE2Detectors
 A map from lanes to E2 detectors lying on them.
std::string myID
 The name of the object.
LaneVectorVector myLanes
 The list of links which do participate in this traffic light.
LinkVectorVector myLinks
 The list of links which do participate in this traffic light.
MeanDataMap myMeanDetectorData
 A map of the step of the greenphases and their aggregated detectordata.
std::vector< SUMOTimemyOverridingTimes
 A list of duration overrides.
Phases myPhases
 The list of phases this logic uses.
std::string myProgramID
 The id of the logic.
PhaseValueMap myRawDetectorData
 A map of the step of the greenphases and their detectorvalues for several (mumberofValues) cycles.
unsigned int myStep
 The current step.
SwitchCommandmySwitchCommand
 The current switch command.
unsigned int numberOfValues
 The number of detector values whivh is considered to make a decision.
unsigned int stepOfLastDecision
 Stores the step of the phase, when the last decision was made.
unsigned int tCycle
 The cycletime of the trafficlight.
unsigned int tDecide
 the interval in which the traffic light can make a decision
unsigned int tSinceLastDecision
 The number of cycles, before the last decision was made.

Detailed Description

An agentbased traffic light logic.

Definition at line 60 of file MSAgentbasedTrafficLightLogic.h.

Member Typedef Documentation

Definition of a map from lanes to lane state detectors lying on them.

Definition at line 64 of file MSAgentbasedTrafficLightLogic.h.

typedef std::vector<MSLane*> MSTrafficLightLogic::LaneVector
inherited

Definition of the list of links that participate in this tl-light.

Definition at line 78 of file MSTrafficLightLogic.h.

typedef std::vector<LaneVector> MSTrafficLightLogic::LaneVectorVector
inherited

Definition of a list that holds lists of links that do have the same attribute.

Definition at line 81 of file MSTrafficLightLogic.h.

typedef std::vector<MSLink*> MSTrafficLightLogic::LinkVector
inherited

Definition of the list of links that participate in this tl-light.

Definition at line 72 of file MSTrafficLightLogic.h.

typedef std::vector<LinkVector> MSTrafficLightLogic::LinkVectorVector
inherited

Definition of a list that holds lists of links that do have the same attribute.

Definition at line 75 of file MSTrafficLightLogic.h.

Definition of a map which stores the mean data of several (numberOfValues) cycles.

Definition at line 73 of file MSAgentbasedTrafficLightLogic.h.

typedef std::vector<MSPhaseDefinition*> MSTrafficLightLogic::Phases
inherited

Definition of a list of phases, being the junction logic.

Definition at line 69 of file MSTrafficLightLogic.h.

Definition of a map which stores the step of the greenphases and their detector values.

Definition at line 70 of file MSAgentbasedTrafficLightLogic.h.

Definition of a map which stores the detector values of one single phase.

Definition at line 67 of file MSAgentbasedTrafficLightLogic.h.

Constructor & Destructor Documentation

MSAgentbasedTrafficLightLogic::MSAgentbasedTrafficLightLogic ( MSTLLogicControl tlcontrol,
const std::string &  id,
const std::string &  programID,
const MSSimpleTrafficLightLogic::Phases phases,
unsigned int  step,
SUMOTime  delay,
const std::map< std::string, std::string > &  parameter 
)

Constructor.

Parameters
[in]tlcontrolThe tls control responsible for this tls
[in]idThis tls' id
[in]programIDThis tls' sub-id (program id)
[in]phasesDefinitions of the phases
[in]stepThe initial phase index
[in]delayThe time to wait before the first switch
[in]parameterThe parameter to use for tls set-up

Definition at line 64 of file MSAgentbasedTrafficLightLogic.cpp.

References TplConvert::_2int(), TplConvert::_2SUMOReal(), DEFAULT_CYCLE_TIME, DEFAULT_LEARN_HORIZON, DEFAULT_MIN_DIFF, DEFAULT_T_DECIDE, deltaLimit, Parameterised::getParameter(), numberOfValues, tCycle, and tDecide.

MSAgentbasedTrafficLightLogic::~MSAgentbasedTrafficLightLogic ( )

Destructor.

Definition at line 136 of file MSAgentbasedTrafficLightLogic.cpp.

Member Function Documentation

void MSTrafficLightLogic::adaptLinkInformationFrom ( const MSTrafficLightLogic logic)
virtualinherited

Applies information about controlled links and lanes from the given logic.

If we load a logic after the network has been loaded, we do not get the information about controlled links afterwards. We have to copy them from a previously loaded logic.

Parameters
[in]logicThe logic to use the information about controlled links/lanes from

Reimplemented in MSOffTrafficLightLogic.

Definition at line 170 of file MSTrafficLightLogic.cpp.

References MSTrafficLightLogic::myLanes, and MSTrafficLightLogic::myLinks.

Referenced by MSTLLogicControl::TLSLogicVariants::addLogic().

void MSTrafficLightLogic::addLink ( MSLink link,
MSLane lane,
unsigned int  pos 
)
inherited

Adds a link on building.

Parameters
[in]linkThe controlled link
[in]laneThe lane this link starts at
[in]posThe link's index (signal group) within this program

Definition at line 152 of file MSTrafficLightLogic.cpp.

References MSTrafficLightLogic::getCurrentPhaseDef(), MSNet::getInstance(), MSTrafficLightLogic::myLanes, MSTrafficLightLogic::myLinks, and MSLink::setTLState().

void MSTrafficLightLogic::addOverridingDuration ( SUMOTime  duration)
inherited

Changes the duration of the next phase.

Parameters
[in]durationThe new duration

Definition at line 243 of file MSTrafficLightLogic.cpp.

References MSTrafficLightLogic::myOverridingTimes.

void Parameterised::addParameter ( const std::string &  key,
const std::string &  value 
)
inherited
void Parameterised::addParameter ( const std::map< std::string, std::string > &  mapArg)
inherited

Adds all given parameter.

Parameters
[in]mapArgThe keys/values to insert

Definition at line 59 of file Parameterised.cpp.

References Parameterised::myMap.

void Parameterised::addParameter ( const Parameterised p)
inherited

Adds all given parameter.

Parameters
[in]pThe keys/values to insert

Definition at line 67 of file Parameterised.cpp.

References Parameterised::myMap.

void Named::addTo ( const StoringVisitor cont) const
inlineinherited

Adds this object to the given container.

Parameters
in,filled]cont The container to add this item to

Definition at line 121 of file Named.h.

References Named::StoringVisitor::add().

void MSAgentbasedTrafficLightLogic::aggregateRawData ( )
protected

Aggregates the data of one phase, collected during different cycles.

Definition at line 228 of file MSAgentbasedTrafficLightLogic.cpp.

References myMeanDetectorData, myRawDetectorData, and SUMOReal.

Referenced by calculateDuration().

void MSAgentbasedTrafficLightLogic::calculateDuration ( )
protected
void MSSimpleTrafficLightLogic::changeStepAndDuration ( MSTLLogicControl tlcontrol,
SUMOTime  simStep,
unsigned int  step,
SUMOTime  stepDuration 
)
virtualinherited

Changes the current phase and her duration.

Parameters
[in]tlcontrolThe responsible traffic lights control
[in]simStepThe current simulation step
[in]stepIndex of the phase to use
[in]stepDurationThe left duration of the phase
See Also
MSTrafficLightLogic::changeStepAndDuration

Implements MSTrafficLightLogic.

Definition at line 194 of file MSSimpleTrafficLightLogic.cpp.

References MSEventControl::ADAPT_AFTER_EXECUTION, MSEventControl::addEvent(), MSTrafficLightLogic::SwitchCommand::deschedule(), MSTLLogicControl::TLSLogicVariants::executeOnSwitchActions(), MSTLLogicControl::get(), MSNet::getBeginOfTimestepEvents(), Named::getID(), MSNet::getInstance(), MSSimpleTrafficLightLogic::myStep, MSTrafficLightLogic::mySwitchCommand, and MSTrafficLightLogic::setTrafficLightSignals().

Referenced by GUIViewTraffic::onGamingClick().

void Parameterised::clearParameter ( )
inherited

Clears the parameter map.

Definition at line 91 of file Parameterised.cpp.

References Parameterised::myMap.

void MSAgentbasedTrafficLightLogic::collectData ( )
protected

Collects the traffic data.

!! SUMOReal tmp = currentForLane(E2::QUEUE_LENGTH_AHEAD_OF_TRAFFIC_LIGHTS_IN_VEHICLES, *j); if (maxPerBit < tmp) { maxPerBit = tmp; } E2DetectorMap::const_iterator it=myE2Detectors.find(*j); (*it).second->resetQueueLengthAheadOfTrafficLights();

Definition at line 181 of file MSAgentbasedTrafficLightLogic.cpp.

References MSEdge::EDGEFUNCTION_INTERNAL, MSSimpleTrafficLightLogic::getCurrentPhaseDef(), MSTrafficLightLogic::getLanesAt(), MSPhaseDefinition::getState(), LINKSTATE_TL_GREEN_MAJOR, LINKSTATE_TL_GREEN_MINOR, myRawDetectorData, MSSimpleTrafficLightLogic::myStep, numberOfValues, and SUMOReal.

Referenced by trySwitch().

std::map< MSLink *, LinkState > MSTrafficLightLogic::collectLinkStates ( ) const
inherited

Returns the (uncontrolled) states of the controlled links.

Returns
The controlled link's states

Definition at line 177 of file MSTrafficLightLogic.cpp.

References MSTrafficLightLogic::myLinks.

void MSAgentbasedTrafficLightLogic::cutCycleTime ( unsigned int  toCut)
protected

cuts the actual cycle by an given value

Parameters
[in]toCutThe time decrease

Definition at line 305 of file MSAgentbasedTrafficLightLogic.cpp.

References MSSimpleTrafficLightLogic::myPhases, and SUMOReal.

Referenced by init().

unsigned int MSAgentbasedTrafficLightLogic::findStepOfMaxValue ( ) const
protected

Returns the step of the phase with the longest Queue_Lengt_Ahead_Of_Traffic_Lights.

Returns
Which step has the longest queue

Definition at line 344 of file MSAgentbasedTrafficLightLogic.cpp.

References myMeanDetectorData, MSSimpleTrafficLightLogic::myPhases, and SUMOReal.

Referenced by calculateDuration().

unsigned int MSAgentbasedTrafficLightLogic::findStepOfMinValue ( ) const
protected

Returns the step of the phase with the shortest Queue_Lengt_Ahead_Of_Traffic_Lights.

Returns
Which step has the shortest queue

Definition at line 365 of file MSAgentbasedTrafficLightLogic.cpp.

References myMeanDetectorData, MSSimpleTrafficLightLogic::myPhases, and SUMOReal.

Referenced by calculateDuration().

const MSPhaseDefinition & MSSimpleTrafficLightLogic::getCurrentPhaseDef ( ) const
virtualinherited
unsigned int MSSimpleTrafficLightLogic::getCurrentPhaseIndex ( ) const
virtualinherited

Returns the current index within the program.

Returns
The index of the current phase within the tls
See Also
MSTrafficLightLogic::getCurrentPhaseIndex

Implements MSTrafficLightLogic.

Definition at line 130 of file MSSimpleTrafficLightLogic.cpp.

References MSSimpleTrafficLightLogic::myStep.

SUMOTime MSTrafficLightLogic::getDefaultCycleTime ( ) const
inlineinherited

Returns the cycle time (in ms)

Returns
The (maybe changing) cycle time of this tls

Definition at line 259 of file MSTrafficLightLogic.h.

References MSTrafficLightLogic::myDefaultCycleTime.

Referenced by MSTLLogicControl::WAUTSwitchProcedure::isPosAtGSP().

const std::string& Named::getID ( ) const
inlineinherited

Returns the id.

Returns
The stored id

Definition at line 60 of file Named.h.

References Named::myID.

Referenced by NIImporter_SUMO::_loadNetwork(), MSVehicleTransfer::add(), TraCIServerAPI_Lane::StoringVisitor::add(), Named::StoringVisitor::add(), MSDetectorControl::add(), RORouteDef::addAlternative(), MSNet::addBusStop(), NBLoadedSUMOTLDef::addConnection(), NLHandler::addConnection(), NIXMLConnectionsHandler::addCrossing(), RODFDetectorCon::addDetector(), RONet::addEdge(), ROJTREdge::addFollowerProbability(), MSTLLogicControl::TLSLogicVariants::addLogic(), RONet::addNode(), NIImporter_SUMO::addPhase(), RONet::addRouteDef(), NBDistrict::addSink(), NBDistrict::addSource(), NBTrafficLightLogic::addStep(), MSRouteHandler::addStop(), NIXMLTrafficLightsHandler::addTlConnection(), NIVissimDisturbance::addToNode(), MSVehicle::addTraciStop(), GUITrafficLightLogicWrapper::begin2TrackPhases(), MSPerson::MSPersonStage_Driving::beginEventOutput(), MSPerson::MSPersonStage_Waiting::beginEventOutput(), NIVisumTL::build(), RODFNet::buildApproachList(), MS_E2_ZS_CollectorOverLanes::buildCollector(), NBNode::buildCrossings(), NIImporter_VISUM::buildDistrictNode(), NIVissimConnection::buildEdgeConnections(), RODFNet::buildEdgeFlowMap(), NBNode::buildInnerEdges(), NBEdge::buildInnerEdges(), NGEdge::buildNBEdge(), NIVissimEdge::buildNBEdge(), NBRampsComputer::buildOffRamp(), NBRampsComputer::buildOnRamp(), NBNode::buildWalkingAreas(), MSSimpleTrafficLightLogic::changeStepAndDuration(), NBEdge::checkGeometry(), MSVehicleTransfer::checkInsertions(), ODDistrictHandler::closeDistrict(), NLHandler::closeEdge(), RORouteHandler::closeRouteDistribution(), RORouteHandler::closeVehicle(), NBTrafficLightDefinition::collectAllLinks(), NBTrafficLightDefinition::collectEdges(), ROJTRRouter::compute(), NBTrafficLightDefinition::compute(), NBNode::computeInternalLaneShape(), NBEdge::computeLaneShapes(), NBNode::computeLogic(), NBNode::computeNodeShape(), RODFNet::computeRoutesFor(), NBTrafficLightLogicCont::computeSingleLogic(), NBTurningDirectionsComputer::computeTurnDirectionsForNode(), NGNet::connect(), MSAbstractLaneChangeModel::continueLaneChangeManeuver(), NLDetectorBuilder::convUncontE2PosLength(), GUINet::createTLWrapper(), MSLane::detectCollisions(), NIVissimDistrictConnection::dict_BuildDistricts(), MSPerson::MSPersonStage_Driving::endEventOutput(), MSPerson::MSPersonStage_Waiting::endEventOutput(), MSE3Collector::enter(), MSCalibrator::execute(), Command_SaveTLSState::execute(), Command_SaveTLSSwitchStates::execute(), Command_SaveTLSSwitches::execute(), MSVTypeProbe::execute(), MSPModel_Striping::MovePedestrians::execute(), MSVehicle::executeMove(), MSLane::executeMovements(), NBNodeCont::extract(), NBTrafficLightLogicCont::extract(), NBEdgeCont::extract(), RODFDetectorCon::getAggFlowFor(), RODFDetectorCon::getAnyDetectorForEdge(), MSNet::getBusStopID(), NBEdge::getCrossingAngle(), RODFNet::getDetectorEdge(), MSMeanData::getEdgeID(), PedestrianEdge< E, L, N >::getEffort(), NBEdge::getFirstNonPedestrianLane(), MS_E2_ZS_CollectorOverLanes::getLanePredeccessorLanes(), AGStreet::getName(), NIImporter_VISUM::getNamedEdgeContinuating(), MSPModel_Striping::getNextLane(), GUIVehicle::getParameterWindow(), GUITrafficLightLogicWrapper::getPopUpMenu(), NLTriggerBuilder::getPosition(), NLDetectorBuilder::getPositionChecking(), NBNode::getPossiblySplittedIncoming(), NBNode::getPossiblySplittedOutgoing(), NIImporter_VISUM::getReversedContinuating(), NBNode::guessCrossings(), RODFDetectorCon::guessEmptyFlows(), NBNodeCont::guessTLs(), GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerWindow(), NBEdgeCont::ignoreFilterMatch(), MSActuatedTrafficLightLogic::init(), init(), MSTrafficLightLogic::init(), PedestrianEdge< E, L, N >::initPedestrianNetwork(), NIImporter_SUMO::initTrafficLightLogic(), NIXMLTrafficLightsHandler::initTrafficLightLogic(), NBDistrictCont::insert(), NBTrafficLightLogicCont::insert(), NBNodeCont::insert(), NBEdgeCont::insert(), NBNode::invalidateTLS(), MSTLLogicControl::isActive(), RODFNet::isDestination(), RODFNet::isFalseSource(), RODFNet::isSource(), NBEdgeCont::joinSameNodeConnectingEdges(), MSE3Collector::leave(), NIImporter_OpenDrive::loadNetwork(), NBRampsComputer::moveRampRight(), MSPModel_Striping::PState::moveToNextLane(), MSCalibrator::MSCalibrator(), MSPerson::MSPersonStage_Waiting::MSPersonStage_Waiting(), NBOwnTLDef::myCompute(), NBLoadedTLDef::myCompute(), NIXMLTrafficLightsHandler::myEndElement(), NIXMLEdgesHandler::myEndElement(), NIImporter_SUMO::myEndElement(), NIXMLConnectionsHandler::myStartElement(), MSLaneSpeedTrigger::myStartElement(), MSTriggeredRerouter::myStartElement(), NBConnection::NBConnection(), NBRequest::NBRequest(), MSDevice_BTreceiver::notifyEnter(), MSDevice_Tripinfo::notifyEnter(), MSDevice_BTsender::notifyEnter(), MSDevice_Example::notifyEnter(), MSCalibrator::VehicleRemover::notifyEnter(), MSDevice_Tripinfo::notifyLeave(), MSDevice_Person::notifyLeave(), MSDevice_Example::notifyLeave(), MSDevice_BTreceiver::notifyLeave(), MSDevice_BTsender::notifyLeave(), MSDevice_Example::notifyMove(), MSDevice_BTreceiver::notifyMove(), MSDevice_BTsender::notifyMove(), GUIViewTraffic::onGamingClick(), RORouteHandler::openRoute(), Named::ComparatorIdLess::operator()(), NBTurningDirectionsComputer::combination_by_angle_sorter::operator()(), RODFNet::idComp::operator()(), NBOwnTLDef::edge_by_incoming_priority_sorter::operator()(), NBNetBuilder::by_id_sorter::operator()(), NBContHelper::same_connection_edge_sorter::operator()(), MSEdge::by_id_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(), NBLoadedSUMOTLDef::patchIfCrossingsAdded(), MSLCM_JE2013::patchSpeed(), NBLoadedTLDef::SignalGroup::patchTYellow(), MSRightOfWayJunction::postloadInit(), AGStreet::print(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_Vehicle::processSet(), NWWriter_SUMO::prohibitionConnection(), MSPModel_Striping::PState::PState(), NBEdgeCont::recheckPostProcessConnections(), NBLoadedTLDef::SignalGroup::remapIncoming(), NBLoadedTLDef::SignalGroup::remapOutgoing(), NBLoadedSUMOTLDef::removeConnection(), MSCalibrator::removePending(), NBNode::removeSelfLoops(), NBEdgeCont::removeUnwishedEdges(), NBNodeCont::removeUnwishedNodes(), NBNodeCont::rename(), NBEdgeCont::rename(), NBConnection::replaceFrom(), MSBaseVehicle::replaceRouteEdges(), NBConnection::replaceTo(), NIImporter_DlrNavteq::TrafficlightsHandler::report(), NIXMLTrafficLightsHandler::retrieveLaneIndex(), RODFNet::revalidateFlows(), PCPolyContainer::save(), RONet::saveAndRemoveRoutesUntil(), MSBaseVehicle::saveState(), NBNodeCont::setAsTLControlled(), NBEdge::setControllingTLInformation(), NIXMLEdgesHandler::setNodes(), MSLink::setRequestInformation(), NBOwnTLDef::setTLControllingInformation(), NBLoadedSUMOTLDef::setTLControllingInformation(), NBLoadedTLDef::setTLControllingInformation(), NBEdgeCont::splitAt(), MSLane::succLinkSec(), GUITrafficLightLogicWrapper::switchTLSLogic(), MSDevice_BTreceiver::BTreceiverUpdate::updateVisibility(), TraCIServerAPI_Vehicle::vtdMap_matchingEdgeLane(), TraCIServerAPI_Vehicle::vtdMap_matchingRoutePosition(), MSLCM_JE2013::wantsChange(), MSFCDExport::write(), MSEmissionExport::write(), MSInstantInductLoop::write(), NBSign::writeAsPOI(), NWWriter_SUMO::writeConnection(), NWWriter_SUMO::writeDistrict(), MSFullExport::writeEdge(), MSXMLRawOut::writeEdge(), NWWriter_SUMO::writeEdge(), MSMeanData::writeEdge(), NWWriter_XML::writeEdgesAndConnections(), RODFDetector::writeEmitterDefinition(), RODFDetectorCon::writeEmitterPOIs(), RODFDetectorCon::writeEmitters(), RODFDetectorCon::writeEndRerouterDetectors(), NWWriter_SUMO::writeInternalConnections(), NWWriter_SUMO::writeJunction(), MSQueueExport::writeLane(), MSFullExport::writeLane(), NWWriter_DlrNavteq::writeLinksUnsplitted(), NWWriter_OpenDrive::writeNetwork(), NWWriter_XML::writeNodes(), NWWriter_DlrNavteq::writeNodesUnsplitted(), NWWriter_SUMO::writeRoundabout(), RODFDetectorCon::writeSpeedTrigger(), NWWriter_DlrNavteq::writeTrafficSignals(), MSInductLoop::writeTypedXMLOutput(), RODFDetectorCon::writeValidationDetectors(), MSFullExport::writeVehicles(), MSRouteProbe::writeXMLOutput(), and MSE2Collector::writeXMLOutput().

unsigned int MSSimpleTrafficLightLogic::getIndexFromOffset ( SUMOTime  offset) const
virtualinherited

Returns the step (the phasenumber) of a given position of the cycle.

Parameters
[in]offsetThe offset (time) for which the according phase shall be returned
Returns
The according phase
See Also
MSTrafficLightLogic::getIndexFromOffset

Implements MSTrafficLightLogic.

Definition at line 172 of file MSSimpleTrafficLightLogic.cpp.

References MSPhaseDefinition::duration, MSSimpleTrafficLightLogic::getPhase(), MSTrafficLightLogic::myDefaultCycleTime, and MSSimpleTrafficLightLogic::myPhases.

const LaneVector& MSTrafficLightLogic::getLanesAt ( unsigned int  i) const
inlineinherited

Returns the list of lanes that are controlled by the signals at the given position.

Parameters
[in]iThe index of the signal
Returns
The lanes controlled by the signal at the given index

Definition at line 191 of file MSTrafficLightLogic.h.

References MSTrafficLightLogic::myLanes.

Referenced by collectData(), GUITrafficLightLogicWrapper::drawGL(), MSActuatedTrafficLightLogic::duration(), Command_SaveTLSSwitches::execute(), MSActuatedTrafficLightLogic::gapControl(), and GUIViewTraffic::onGamingClick().

const LaneVectorVector& MSTrafficLightLogic::getLaneVectors ( ) const
inlineinherited

Returns the list of lists of all lanes controlled by this tls.

Returns
All lanes controlled by this tls, sorted by the signal index

Definition at line 182 of file MSTrafficLightLogic.h.

References MSTrafficLightLogic::myLanes.

Referenced by GUITrafficLightLogicWrapper::getCenteringBoundary(), TraCIServerAPI_TLS::processGet(), and MSFullExport::writeTLS().

int MSTrafficLightLogic::getLinkIndex ( const MSLink *const  link) const
inherited

Returns the index of the given link.

Parameters
[in]linkThe link to retrieve the index for
Returns
The index of the given link (-1 if it is not controlled by this tls)

Definition at line 219 of file MSTrafficLightLogic.cpp.

References MSTrafficLightLogic::myLinks.

Referenced by GUITrafficLightLogicWrapper::getLinkIndex().

const LinkVectorVector& MSTrafficLightLogic::getLinks ( ) const
inlineinherited
const LinkVector& MSTrafficLightLogic::getLinksAt ( unsigned int  i) const
inlineinherited

Returns the list of links that are controlled by the signals at the given position.

Parameters
[in]iThe index of the signal
Returns
The links controlled by the signal at the given index

Definition at line 208 of file MSTrafficLightLogic.h.

References MSTrafficLightLogic::myLinks.

const std::map<std::string, std::string>& Parameterised::getMap ( ) const
inlineinherited

Returns the inner key/value map.

Returns
the inner map

Definition at line 107 of file Parameterised.h.

References Parameterised::myMap.

Referenced by NBTrafficLightDefinition::compute(), GUIVehicle::getParameterWindow(), and PCPolyContainer::save().

SUMOTime MSTrafficLightLogic::getNextSwitchTime ( ) const
inherited

Returns the assumed next switch time.

The time may change in case of adaptive/actuated traffic lights.

Returns
The assumed next switch time (simulation time)

Definition at line 236 of file MSTrafficLightLogic.cpp.

References MSTrafficLightLogic::SwitchCommand::getNextSwitchTime(), and MSTrafficLightLogic::mySwitchCommand.

Referenced by MSTLLogicControl::WAUTSwitchProcedure::isPosAtGSP(), and TraCIServerAPI_TLS::processGet().

SUMOTime MSSimpleTrafficLightLogic::getOffsetFromIndex ( unsigned int  index) const
virtualinherited

Returns the position (start of a phase during a cycle) from of a given step.

Parameters
[in]indexThe index of the phase to return the begin of
Returns
The begin time of the phase
See Also
MSTrafficLightLogic::getOffsetFromIndex

Implements MSTrafficLightLogic.

Definition at line 158 of file MSSimpleTrafficLightLogic.cpp.

References MSPhaseDefinition::duration, MSSimpleTrafficLightLogic::getPhase(), and MSSimpleTrafficLightLogic::myPhases.

const std::string & Parameterised::getParameter ( const std::string &  key,
const std::string &  defaultValue 
) const
inherited
const MSPhaseDefinition & MSSimpleTrafficLightLogic::getPhase ( unsigned int  givenstep) const
virtualinherited

Returns the definition of the phase from the given position within the plan.

Parameters
[in]givenstepThe index of the phase within the plan
Returns
The definition of the phase at the given position
See Also
MSTrafficLightLogic::getPhase

Implements MSTrafficLightLogic.

Definition at line 122 of file MSSimpleTrafficLightLogic.cpp.

References MSSimpleTrafficLightLogic::myPhases.

Referenced by MSSimpleTrafficLightLogic::getIndexFromOffset(), MSSimpleTrafficLightLogic::getOffsetFromIndex(), MSSimpleTrafficLightLogic::getPhaseIndexAtTime(), and GUIViewTraffic::onGamingClick().

SUMOTime MSSimpleTrafficLightLogic::getPhaseIndexAtTime ( SUMOTime  simStep) const
virtualinherited

Returns the index of the logic at the given simulation step.

Returns
The (estimated) index of the tls at the given simulation time step
See Also
MSTrafficLightLogic::getPhaseIndexAtTime

Implements MSTrafficLightLogic.

Definition at line 143 of file MSSimpleTrafficLightLogic.cpp.

References MSPhaseDefinition::duration, MSSimpleTrafficLightLogic::getPhase(), MSTrafficLightLogic::myDefaultCycleTime, MSPhaseDefinition::myLastSwitch, and MSSimpleTrafficLightLogic::myStep.

unsigned int MSSimpleTrafficLightLogic::getPhaseNumber ( ) const
virtualinherited

Returns the number of phases.

Returns
The number of this tls program's phases
See Also
MSTrafficLightLogic::getPhaseNumber

Implements MSTrafficLightLogic.

Definition at line 104 of file MSSimpleTrafficLightLogic.cpp.

References MSSimpleTrafficLightLogic::myPhases.

const MSSimpleTrafficLightLogic::Phases & MSSimpleTrafficLightLogic::getPhases ( ) const
virtualinherited

Returns the phases of this tls program.

Returns
The phases of this tls program
See Also
MSTrafficLightLogic::getPhases

Implements MSTrafficLightLogic.

Definition at line 110 of file MSSimpleTrafficLightLogic.cpp.

References MSSimpleTrafficLightLogic::myPhases.

MSSimpleTrafficLightLogic::Phases & MSSimpleTrafficLightLogic::getPhases ( )
inherited

Returns the phases of this tls program.

Returns
The phases of this tls program
Todo:
Recheck!

Definition at line 116 of file MSSimpleTrafficLightLogic.cpp.

References MSSimpleTrafficLightLogic::myPhases.

const std::string& MSTrafficLightLogic::getProgramID ( ) const
inlineinherited
void MSAgentbasedTrafficLightLogic::init ( NLDetectorBuilder nb)
virtual

Initialises the tls with information about incoming lanes.

Parameters
[in]nbThe detector builder
[in]edgeContinuationsInformation about edge predecessors/successors
Exceptions
ProcessErrorIf something fails on initialisation

Calculation of starting values

Reimplemented from MSTrafficLightLogic.

Definition at line 80 of file MSAgentbasedTrafficLightLogic.cpp.

References TplConvert::_2SUMOReal(), NLDetectorBuilder::buildMultiLaneE2Det(), cutCycleTime(), DEFAULT_DETECTOR_OFFSET, DU_TL_CONTROL, Named::getID(), Parameterised::getParameter(), lengthenCycleTime(), myE2Detectors, Named::myID, MSTrafficLightLogic::myLanes, MSSimpleTrafficLightLogic::myPhases, MSTrafficLightLogic::myProgramID, SUMOReal, and tCycle.

bool Parameterised::knowsParameter ( const std::string &  key) const
inherited

Returns whether the parameter is known.

Parameters
[in]keyThe key to ask for
Returns
Whether the key is known

Definition at line 75 of file Parameterised.cpp.

References Parameterised::myMap.

Referenced by MSDevice_Example::buildVehicleDevices(), MSDevice::equippedByDefaultAssignmentOptions(), and TraCIServerAPI_Vehicle::vtdMap_matchingNearest().

void MSAgentbasedTrafficLightLogic::lengthenCycleTime ( unsigned int  toLenghten)
protected

lenghtens the actual cycle by an given value

Parameters
[in]toLenghtenThe time increase

Definition at line 266 of file MSAgentbasedTrafficLightLogic.cpp.

References MSSimpleTrafficLightLogic::myPhases, and SUMOReal.

Referenced by init().

unsigned int MSAgentbasedTrafficLightLogic::nextStep ( )
protected

Returns the index of the phase next to the given phase.

Stores the duration of the phase, which was just sent or stores the activation-time in myLastphase of the phase next

Returns
The index of the next step

Definition at line 165 of file MSAgentbasedTrafficLightLogic.cpp.

References MSSimpleTrafficLightLogic::myPhases, MSSimpleTrafficLightLogic::myStep, stepOfLastDecision, and tSinceLastDecision.

Referenced by trySwitch().

void MSTrafficLightLogic::resetLinkStates ( const std::map< MSLink *, LinkState > &  vals) const
inherited

Resets the states of controlled links.

Parameters
[in]valsThe state of controlled links to use

Definition at line 206 of file MSTrafficLightLogic.cpp.

References MSNet::getCurrentTimeStep(), MSNet::getInstance(), and MSTrafficLightLogic::myLinks.

void MSTrafficLightLogic::setCurrentDurationIncrement ( SUMOTime  delay)
inherited

Delays current phase by the given delay.

Parameters
[in]delayThe time by which the current phase shall be delayed

Definition at line 249 of file MSTrafficLightLogic.cpp.

References MSTrafficLightLogic::myCurrentDurationIncrement.

void Named::setID ( const std::string &  newID)
inlineinherited

resets the id

Parameters
[in]newIDThe new id of this object

Definition at line 68 of file Named.h.

References Named::myID.

Referenced by NBNodeCont::rename(), and NBEdgeCont::rename().

void MSSimpleTrafficLightLogic::setPhases ( const Phases phases,
unsigned int  index 
)
inherited

Replaces the phases and set the phase index.

Definition at line 210 of file MSSimpleTrafficLightLogic.cpp.

References MSSimpleTrafficLightLogic::deletePhases(), MSSimpleTrafficLightLogic::myPhases, and MSSimpleTrafficLightLogic::myStep.

bool MSTrafficLightLogic::setTrafficLightSignals ( SUMOTime  t) const
inherited

Applies the current signal states to controlled links.

Parameters
[in]tThe current time
Returns
Always true
See Also
LinkState
MSLink::setTLState

Definition at line 190 of file MSTrafficLightLogic.cpp.

References MSTrafficLightLogic::getCurrentPhaseDef(), MSPhaseDefinition::getState(), and MSTrafficLightLogic::myLinks.

Referenced by MSTLLogicControl::TLSLogicVariants::addLogic(), and MSSimpleTrafficLightLogic::changeStepAndDuration().

SUMOTime MSAgentbasedTrafficLightLogic::trySwitch ( bool  isActive)
virtual

Switches to the next phase.

Parameters
[in]isActiveWhether this program is the currently used one
Returns
The time of the next switch
See Also
MSTrafficLightLogic::trySwitch

Reimplemented from MSSimpleTrafficLightLogic.

Definition at line 141 of file MSAgentbasedTrafficLightLogic.cpp.

References calculateDuration(), collectData(), MSPhaseDefinition::duration, MSSimpleTrafficLightLogic::getCurrentPhaseDef(), MSSimpleTrafficLightLogic::myPhases, MSSimpleTrafficLightLogic::myStep, nextStep(), tDecide, and tSinceLastDecision.

Field Documentation

SUMOReal MSAgentbasedTrafficLightLogic::deltaLimit
protected
SUMOTime MSTrafficLightLogic::myCurrentDurationIncrement
protectedinherited

A value for enlarge the current duration.

Definition at line 402 of file MSTrafficLightLogic.h.

Referenced by MSTrafficLightLogic::setCurrentDurationIncrement(), and MSSimpleTrafficLightLogic::trySwitch().

E2DetectorMap MSAgentbasedTrafficLightLogic::myE2Detectors
protected

A map from lanes to E2 detectors lying on them.

Definition at line 172 of file MSAgentbasedTrafficLightLogic.h.

Referenced by init().

LaneVectorVector MSTrafficLightLogic::myLanes
protectedinherited
MeanDataMap MSAgentbasedTrafficLightLogic::myMeanDetectorData
protected

A map of the step of the greenphases and their aggregated detectordata.

Definition at line 178 of file MSAgentbasedTrafficLightLogic.h.

Referenced by aggregateRawData(), calculateDuration(), findStepOfMaxValue(), and findStepOfMinValue().

std::vector<SUMOTime> MSTrafficLightLogic::myOverridingTimes
protectedinherited

A list of duration overrides.

Definition at line 399 of file MSTrafficLightLogic.h.

Referenced by MSTrafficLightLogic::addOverridingDuration(), and MSSimpleTrafficLightLogic::trySwitch().

std::string MSTrafficLightLogic::myProgramID
protectedinherited

The id of the logic.

Definition at line 390 of file MSTrafficLightLogic.h.

Referenced by MSTrafficLightLogic::getProgramID(), MSActuatedTrafficLightLogic::init(), and init().

PhaseValueMap MSAgentbasedTrafficLightLogic::myRawDetectorData
protected

A map of the step of the greenphases and their detectorvalues for several (mumberofValues) cycles.

Definition at line 175 of file MSAgentbasedTrafficLightLogic.h.

Referenced by aggregateRawData(), and collectData().

SwitchCommand* MSTrafficLightLogic::mySwitchCommand
protectedinherited
unsigned int MSAgentbasedTrafficLightLogic::numberOfValues
protected

The number of detector values whivh is considered to make a decision.

it's only possible to get one value per cycle per greenphase

Definition at line 194 of file MSAgentbasedTrafficLightLogic.h.

Referenced by collectData(), and MSAgentbasedTrafficLightLogic().

unsigned int MSAgentbasedTrafficLightLogic::stepOfLastDecision
protected

Stores the step of the phase, when the last decision was made.

Definition at line 189 of file MSAgentbasedTrafficLightLogic.h.

Referenced by calculateDuration(), and nextStep().

unsigned int MSAgentbasedTrafficLightLogic::tCycle
protected

The cycletime of the trafficlight.

Definition at line 197 of file MSAgentbasedTrafficLightLogic.h.

Referenced by init(), and MSAgentbasedTrafficLightLogic().

unsigned int MSAgentbasedTrafficLightLogic::tDecide
protected

the interval in which the traffic light can make a decision

The interval is given in integer numbers of cycles

Definition at line 183 of file MSAgentbasedTrafficLightLogic.h.

Referenced by MSAgentbasedTrafficLightLogic(), and trySwitch().

unsigned int MSAgentbasedTrafficLightLogic::tSinceLastDecision
protected

The number of cycles, before the last decision was made.

Definition at line 186 of file MSAgentbasedTrafficLightLogic.h.

Referenced by calculateDuration(), nextStep(), and trySwitch().


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