49 #ifdef CHECK_MEMORY_LEAKS
51 #endif // CHECK_MEMORY_LEAKS
57 #define DEFAULT_MAX_GAP "3.1"
58 #define DEFAULT_PASSING_TIME "1.9"
59 #define DEFAULT_DETECTOR_GAP "3.0"
66 const std::string&
id,
const std::string& programID,
69 const std::map<std::string, std::string>& parameter) :
85 LaneVectorVector::const_iterator i2;
86 LaneVector::const_iterator i;
90 for (i = lanes.begin(); i != lanes.end(); i++) {
96 SUMOReal ilpos = length - inductLoopPosition;
158 if (newDuration % 1000 != 0) {
159 const SUMOTime totalDur = newDuration + actDuration;
160 newDuration = (totalDur / 1000 + 1) * 1000 - actDuration;
185 for (
unsigned int i = 0; i < (
unsigned int) state.size(); i++) {
187 const std::vector<MSLane*>& lanes =
getLanesAt(i);
188 for (LaneVector::const_iterator j = lanes.begin(); j != lanes.end(); j++) {
193 myInductLoops.find(*j)->second->getTimestepsSinceLastDetection();
195 result =
MIN2(result, actualGap);
The link has green light, may pass.
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, bool splitByType)
Creates an instance of an e1 detector using the given values.
Builds detectors for microsim.
const std::string & getState() const
Returns the state within this phase.
unsigned int myStep
The current step.
std::string myProgramID
The id of the logic.
static SUMOReal _2SUMOReal(const E *const data)
static bool _2bool(const E *const data)
The link has green light, has to brake.
SUMOReal getLength() const
Returns the lane's length.
void init(NLDetectorBuilder &nb)
Initialises the tls with information about incoming lanes.
Phases myPhases
The list of phases this logic uses.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
#define DEFAULT_DETECTOR_GAP
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
A fixed traffic light logic.
LaneVectorVector myLanes
The list of LaneVectors; each vector contains the incoming lanes that belong to the same link index...
A class that stores and controls tls and switching of their programs.
const std::string & getID() const
Returns the id.
SUMOReal myMaxGap
The maximum gap to check in seconds.
SUMOReal myPassingTime
The passing time used in seconds.
virtual void init(NLDetectorBuilder &nb)
Initialises the tls with information about incoming lanes.
~MSActuatedTrafficLightLogic()
Destructor.
#define DEFAULT_PASSING_TIME
const LaneVector & getLanesAt(unsigned int i) const
Returns the list of lanes that are controlled by the signals at the given position.
const MSPhaseDefinition & getCurrentPhaseDef() const
Returns the definition of the current phase.
SUMOReal getSpeedLimit() const
Returns the lane's maximum allowed speed.
MSDetectorControl & getDetectorControl()
Returns the detector control.
InductLoopMap myInductLoops
A map from lanes to induct loops lying on them.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
SUMOReal myDetectorGap
The detector distance in seconds.
std::string myID
The name of the object.
std::vector< MSLane * > LaneVector
Definition of the list of links that participate in this tl-light.
SUMOTime duration(const SUMOReal detectionGap) const
Returns the minimum duration of the current phase.
void add(SumoXMLTag type, MSDetectorFileOutput *d, const std::string &device, int splInterval, SUMOTime begin=-1)
Adds a detector/output combination into the containers.
SUMOTime minDuration
The minimum duration of the phase.
MSActuatedTrafficLightLogic(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 > ¶meter)
Constructor.
Representation of a lane in the micro simulation.
SUMOReal gapControl()
Return the minimum detection gap of all detectors if the current phase should be extended and SUMORea...
bool myShowDetectors
Whether the detectors shall be shown in the GUI.
SUMOTime trySwitch()
Switches to the next phase.
An unextended detector measuring at a fixed position on a fixed lane.