53 #define DEFAULT_MAX_GAP "3.0" 54 #define DEFAULT_PASSING_TIME "1.9" 55 #define DEFAULT_DETECTOR_GAP "2.0" 57 #define DEFAULT_LENGTH_WITH_GAP 7.5 64 const std::string&
id,
const std::string& programID,
67 const std::map<std::string, std::string>& parameter,
68 const std::string& basePath) :
88 LaneVectorVector::const_iterator i2;
89 LaneVector::const_iterator i;
91 double maxDetectorGap = 0;
94 for (i = lanes.begin(); i != lanes.end(); i++) {
100 double ilpos = length - inductLoopPosition;
110 maxDetectorGap =
MAX2(maxDetectorGap, length - ilpos);
125 if (phase->minDuration != phase->maxDuration) {
126 result =
MIN2(result, phase->minDuration);
140 if (detectionGap < std::numeric_limits<double>::max()) {
167 if (newDuration % 1000 != 0) {
168 const SUMOTime totalDur = newDuration + actDuration;
169 newDuration = (totalDur / 1000 + 1) * 1000 - actDuration;
181 double result = std::numeric_limits<double>::max();
194 for (
int i = 0; i < (int) state.size(); i++) {
196 const std::vector<MSLane*>& lanes =
getLanesAt(i);
197 for (LaneVector::const_iterator j = lanes.begin(); j != lanes.end(); j++) {
204 result =
MIN2(result, actualGap);
The link has green light, may pass.
const std::string & getState() const
Returns the state within this phase.
Builds detectors for microsim.
alternative tag for e1 detector
std::string myProgramID
The id of the logic.
static bool _2bool(const E *const data)
converts a 0-terminated char-type array into the boolean value described by it
The link has green light, has to brake.
void init(NLDetectorBuilder &nb)
Initialises the tls with information about incoming lanes.
Phases myPhases
The list of phases this logic uses.
std::string time2string(SUMOTime t)
int myStep
The current step.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
std::string myFile
The output file for generated detectors.
double getLength() const
Returns the lane's length.
#define DEFAULT_DETECTOR_GAP
const std::string & getID() const
Returns the id.
#define WRITE_WARNING(msg)
SUMOTime duration(const double detectionGap) const
Returns the minimum duration of the current phase.
const MSPhaseDefinition & getCurrentPhaseDef() const
Returns the definition of the current phase.
A fixed traffic light logic.
LaneVectorVector myLanes
The list of LaneVectors; each vector contains the incoming lanes that belong to the same link index...
const LaneVector & getLanesAt(int i) const
Returns the list of lanes that are controlled by the signals at the given position.
A class that stores and controls tls and switching of their programs.
std::string myVehicleTypes
Whether detector output separates by vType.
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, double pos, const std::string &vTypes, bool show=true)
Creates an instance of an e1 detector using the given values.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
virtual void init(NLDetectorBuilder &nb)
Initialises the tls with information about incoming lanes.
~MSActuatedTrafficLightLogic()
Destructor.
#define DEFAULT_PASSING_TIME
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
double myMaxGap
The maximum gap to check in seconds.
void add(SumoXMLTag type, MSDetectorFileOutput *d, const std::string &device, SUMOTime splInterval, SUMOTime begin=-1)
Adds a detector/output combination into the containers.
MSDetectorControl & getDetectorControl()
Returns the detector control.
double getTimeSinceLastDetection() const
Returns the time since the last vehicle left the detector.
#define DEFAULT_LENGTH_WITH_GAP
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.
std::string myID
The name of the object.
std::vector< MSLane * > LaneVector
Definition of the list of arrival lanes subjected to this tls.
SUMOTime getMinimumMinDuration() const
get the minimum min duration for all stretchable phases
double gapControl()
Return the minimum detection gap of all detectors if the current phase should be extended and double:...
static std::string checkForRelativity(const std::string &filename, const std::string &basePath)
Returns the path from a configuration so that it is accessable from the current working directory...
static double _2double(const E *const data)
converts a char-type array into the double value described by it
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
SUMOTime minDuration
The minimum duration of the phase.
double myDetectorGap
The detector distance in seconds.
double myPassingTime
The passing time used in seconds.
MSActuatedTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const MSSimpleTrafficLightLogic::Phases &phases, int step, SUMOTime delay, const std::map< std::string, std::string > ¶meter, const std::string &basePath)
Constructor.
SUMOTime myFreq
The frequency for aggregating detector output.
Representation of a lane in the micro simulation.
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.