42 const std::string&
id,
const std::string& programID,
SUMOTime delay,
81 if (key ==
"time-gap") {
83 }
else if (key ==
"space-gap") {
85 }
else if (key ==
"min-green") {
87 }
else if (key ==
"opening-delay") {
89 }
else if (key ==
"opening-time") {
91 }
else if (key ==
"yellow-time") {
109 const int oldStep =
myStep;
126 for (
const auto& it_avi : link->getApproaching()) {
136 if (link->getViaLane() !=
nullptr && link->getViaLane()->getVehicleNumberWithPartials() > 0) {
142 const SUMOTime wait = stayRedUntil - now;
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
@ LINKSTATE_TL_REDYELLOW
The link has red light (must brake) but indicates upcoming green.
@ LINKSTATE_TL_GREEN_MAJOR
The link has green light, may pass.
@ LINKSTATE_TL_YELLOW_MINOR
The link has yellow light, has to brake anyway.
@ LINKSTATE_TL_RED
The link has red light (must brake)
#define SUMO_MAX_CONNECTIONS
the maximum number of connections across an intersection
Representation of a lane in the micro simulation.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
The definition of a single phase of a tls logic.
void init(NLDetectorBuilder &nb)
Initialises the rail signal with information about adjacent rail signals.
SUMOTime getOffsetFromIndex(int index) const
Returns the position (start of a phase during a cycle) from of a given step.
void setParameter(const std::string &key, const std::string &value)
Sets a parameter and updates internal constants.
SUMOTime myOpeningDelay
red time after the train has left
SUMOTime myYellowTime
yellow time
int getIndexFromOffset(SUMOTime offset) const
Returns the step (the phasenumber) of a given position of the cycle.
~MSRailCrossing()
Destructor.
MSRailCrossing(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, SUMOTime delay, const Parameterised::Map ¶meters)
Constructor.
SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const
Returns the index of the logic at the given simulation step.
SUMOTime trySwitch()
Switches to the next phase.
double mySpaceGap
minimum distance between the train and the crossing which triggers closing (-1 means time only)
void adaptLinkInformationFrom(const MSTrafficLightLogic &logic)
Applies information about controlled links and lanes from the given logic.
SUMOTime myTimeGap
minimum time gap between closing the crossing (end of yellow time) and train passing the crossing
SUMOTime updateCurrentPhase()
updates the current phase of the signal
std::vector< MSLink * > myIncomingRailLinks
The incoming rail links.
void addLink(MSLink *link, MSLane *lane, int pos)
Adds a link on building.
SUMOTime myOpeningTime
red-yellow time after the delay while opening
SUMOTime myMinGreenTime
minimum green time
A fixed traffic light logic.
Phases myPhases
The list of phases this logic uses.
int myStep
The current step.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const override
gets a parameter
A class that stores and controls tls and switching of their programs.
The parent class for traffic light logics.
virtual void adaptLinkInformationFrom(const MSTrafficLightLogic &logic)
Applies information about controlled links and lanes from the given logic.
SUMOTime myDefaultCycleTime
The cycle time (without changes)
int myNumLinks
number of controlled links
bool setTrafficLightSignals(SUMOTime t) const
Applies the current signal states to controlled links.
virtual void addLink(MSLink *link, MSLane *lane, int pos)
Adds a link on building.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
LinkVectorVector myLinks
The list of LinkVectors; each vector contains the links that belong to the same link index.
Builds detectors for microsim.
std::map< std::string, std::string > Map
parameters map
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter