67 const std::string&
id,
const std::string& programID,
71 const std::map<std::string, std::string>& parameter,
72 const std::string& basePath);
107 std::map<int, std::vector<MSE2Collector*>> temp;
109 temp[detectInfo.first] = detectInfo.second.detectors;
120 std::string
combineStates(std::string state1, std::string state2);
124 int nextPhase(std::vector<int> ring,
int phaseNum,
int& distance,
bool sameAllowed);
126 std::tuple<int, int>
getNextPhases(
int currentR1Index,
int currentR2Index,
bool toUpdateR1,
bool toUpdateR2,
bool stayOk =
false);
149 for (
char ch : state) {
150 if (ch ==
'g' || ch ==
'G') {
158 void setParameter(
const std::string& key,
const std::string& value)
override;
161 const std::string
getParameter(
const std::string& key,
const std::string defaultValue =
"")
const override;
249 std::vector<std::vector<int>>
rings;
std::vector< int > LaneVector
container for (sorted) lanes. The lanes are sorted from rightmost (id=0) to leftmost (id=nolanes-1)
An areal detector corresponding to a sequence of consecutive lanes.
Representation of a lane in the micro simulation.
The definition of a single phase of a tls logic.
A fixed traffic light logic.
A class that stores and controls tls and switching of their programs.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
A NEMA (adaptive) traffic light logic based on E2Detector.
void setCycleLength(double newCycleLength)
std::vector< std::vector< DetectorInfo * > > detectorMap
std::map< int, phaseDetectorInfo > phase2DetectorMap
std::map< std::string, double > getDetectorStates() const override
retrieve all detectors used by this program
bool isDetectorActivated(int phaseNumber, int depth) const
void setNewMaxGreens(std::vector< double > newMaxGreens)
const std::string getParameter(const std::string &key, const std::string defaultValue="") const override
try to get the value of the given parameter. Parameters prefixed with 'NEMA.' control functionality
std::vector< DetectorInfo > myDetectorInfoVector
void init(NLDetectorBuilder &nb) override
Initialises the tls with information about incoming lanes.
std::string myVehicleTypes
Whether detector output separates by vType.
std::string myFile
The output file for generated detectors.
std::string combineStates(std::string state1, std::string state2)
void constructBarrierMap(int ring, std::vector< std::vector< int >> &barrierMap)
helps to construct myRingBarrierMapping
bool showDetectors() const
std::vector< std::vector< int > > rings
SUMOTime myFreq
The frequency for aggregating detector output.
DetectorLaneMap myDetectorLaneMap
A map from detectors to lanes.
SUMOTime trySwitch() override
Switches to the next phase.
std::vector< int > coordinatePhaseIndecies
int nextPhase(std::vector< int > ring, int phaseNum, int &distance, bool sameAllowed)
int findBarrier(int desiredPhase, int ring)
std::vector< std::string > string2vector(std::string s)
std::string transitionState(std::string curState, int RYG)
NEMALogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const SUMOTime offset, const MSSimpleTrafficLightLogic::Phases &phases, int step, SUMOTime delay, const std::map< std::string, std::string > ¶meter, const std::string &basePath)
Constructor.
void activateProgram() override
called when switching programs
void setShowDetectors(bool show)
std::map< int, std::vector< MSE2Collector * > > getPhase2DetectorMap()
double phaseExpectedDuration[8]
std::string outputStateFilePath
std::tuple< int, int > getNextPhases(int currentR1Index, int currentR2Index, bool toUpdateR1, bool toUpdateR2, bool stayOk=false)
void setParameter(const std::string &key, const std::string &value) override
try to set the given parameter. Parameters prefixed with 'NEMA.' control functionality
void error_handle_not_set(std::string param_variable, std::string param_name)
std::string NEMA_control()
void setNewOffset(double newOffset)
std::set< std::string > getLaneIDsFromNEMAState(std::string state)
std::map< MSLane *, MSE2Collector * > LaneDetectorMap
Definition of a map from lanes to corresponding area detectors.
std::string currentR2State
bool isGreenPhase(std::string state)
std::vector< int > readParaFromString(std::string s)
std::map< MSE2Collector *, MSLane *, ComparatorIdLess > DetectorLaneMap
Definition of a map from detectors to corresponding lanes.
std::string currentR1State
bool myShowDetectors
Whether the detectors shall be shown in the GUI.
detectorMap myDetectorForPhase
int string2int(std::string s)
bool hasMajor(const std::string &state, const LaneVector &lanes) const
return whether there is a major link from the given lane in the given phase
void deactivateProgram() override
MSPhaseDefinition myPhase
virtual phase that holds the current state
double myDetectorLengthLeftTurnLane
double getCurrentCycleLength()
std::ofstream outputStateFile
bool isLeftTurnLane(const MSLane *const lane) const
LaneDetectorMap myLaneDetectorMap
A map from lanes to detectors.
std::vector< int > barrierPhaseIndecies
double ModeCycle(double a, double b)
void setNewCycleLength(double newCycleLength)
std::vector< std::vector< int > > myRingBarrierMapping[2]
const MSPhaseDefinition & getCurrentPhaseDef() const override
Returns the definition of the current phase.
std::map< int, std::vector< std::string > > phase2ControllerLanesMap
void setNewSplits(std::vector< double > newSplits)
Builds detectors for microsim.
DetectorInfo(MSE2Collector *_det, int numPhases)
std::vector< bool > servedPhase
phaseDetectorInfo(int _cross_phase_source)
std::vector< MSE2Collector * > detectors