47 #define DEFAULT_MAX_GAP "3.0" 48 #define DEFAULT_PASSING_TIME "1.9" 49 #define DEFAULT_DETECTOR_GAP "2.0" 51 #define DEFAULT_LENGTH_WITH_GAP 7.5 58 const std::string&
id,
const std::string& programID,
61 const std::map<std::string, std::string>& parameter,
62 const std::string& basePath) :
82 LaneVectorVector::const_iterator i2;
83 LaneVector::const_iterator i;
85 double maxDetectorGap = 0;
88 for (i = lanes.begin(); i != lanes.end(); i++) {
98 double ilpos = length - inductLoopPosition;
108 maxDetectorGap =
MAX2(maxDetectorGap, length - ilpos);
123 if (phase->minDuration != phase->maxDuration) {
124 result =
MIN2(result, phase->minDuration);
138 if (detectionGap < std::numeric_limits<double>::max()) {
165 if (newDuration % 1000 != 0) {
166 const SUMOTime totalDur = newDuration + actDuration;
167 newDuration = (totalDur / 1000 + 1) * 1000 - actDuration;
179 double result = std::numeric_limits<double>::max();
192 for (
int i = 0; i < (int) state.size(); i++) {
194 const std::vector<MSLane*>& lanes =
getLanesAt(i);
195 for (LaneVector::const_iterator j = lanes.begin(); j != lanes.end(); j++) {
202 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
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.
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter ...
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)
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
virtual void init(NLDetectorBuilder &nb)
Initialises the tls with information about incoming lanes.
~MSActuatedTrafficLightLogic()
Destructor.
#define DEFAULT_PASSING_TIME
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
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
const std::string myProgramID
The id of the logic.
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...
bool noVehicles(SVCPermissions permissions)
Returns whether an edge with the given permission forbids vehicles.
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.