Eclipse SUMO - Simulation of Urban MObility
NLJunctionControlBuilder.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // Builder of microsim-junctions and tls
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <map>
27 #include <string>
28 #include <vector>
29 #include <list>
30 #include <algorithm>
33 #include <utils/common/ToString.h>
34 #include <microsim/MSGlobals.h>
35 #include <microsim/MSNet.h>
57 #include "NLBuilder.h"
59 
60 
61 // ===========================================================================
62 // static members
63 // ===========================================================================
65 
66 // ===========================================================================
67 // method definitions
68 // ===========================================================================
70  myNet(net),
71  myDetectorBuilder(db),
72  myOffset(0),
73  myJunctions(nullptr),
74  myNetIsLoaded(false) {
77 }
78 
79 
81  delete myLogicControl;
82  delete myJunctions;
83 }
84 
85 
86 void
88  const std::string& key,
89  const SumoXMLNodeType type,
90  const Position pos,
91  const PositionVector& shape,
92  const std::vector<MSLane*>& incomingLanes,
93  const std::vector<MSLane*>& internalLanes) {
94  myActiveInternalLanes = internalLanes;
95  myActiveIncomingLanes = incomingLanes;
96  myActiveID = id;
97  myActiveKey = key;
98  myType = type;
99  myPosition.set(pos);
100  myShape = shape;
101  myAdditionalParameter.clear();
102 }
103 
104 
105 void
106 NLJunctionControlBuilder::closeJunction(const std::string& basePath) {
107  if (myJunctions == nullptr) {
108  throw ProcessError("Information about the number of nodes was missing.");
109  }
110  MSJunction* junction = nullptr;
111  switch (myType) {
112  case NODETYPE_NOJUNCTION:
113  case NODETYPE_DEAD_END:
115  case NODETYPE_DISTRICT:
117  junction = buildNoLogicJunction();
118  break;
122  case NODETYPE_PRIORITY:
125  case NODETYPE_ZIPPER:
126  junction = buildLogicJunction();
127  break;
128  case NODETYPE_INTERNAL:
130  junction = buildInternalJunction();
131  }
132  break;
135  myOffset = 0;
137  myActiveProgram = "0";
139  closeTrafficLightLogic(basePath);
140  junction = buildLogicJunction();
141  break;
142  default:
143  throw InvalidArgument("False junction logic type.");
144  }
145  if (junction != nullptr) {
146  if (!myJunctions->add(myActiveID, junction)) {
147  throw InvalidArgument("Another junction with the id '" + myActiveID + "' exists.");
148  }
149  }
151 }
152 
153 
157  myJunctions = nullptr;
158  return js;
159 }
160 
161 
162 MSJunction*
166 }
167 
168 
169 MSJunction*
172  // build the junction
175  jtype);
176 }
177 
178 
179 MSJunction*
181  // build the junction
184 }
185 
186 
189  // get and check the junction logic
190  if (myLogics.find(myActiveID) == myLogics.end()) {
191  throw InvalidArgument("Missing junction logic '" + myActiveID + "'.");
192  }
193  return myLogics[myActiveID];
194 }
195 
196 
198 NLJunctionControlBuilder::getTLLogic(const std::string& id) const {
199  return getTLLogicControlToUse().get(id);
200 }
201 
202 
203 void
205  if (myActiveProgram == "off") {
206  if (myAbsDuration > 0) {
207  throw InvalidArgument("The off program for TLS '" + myActiveKey + "' has phases.");
208  }
211  throw InvalidArgument("Another logic with id '" + myActiveKey + "' and programID '" + myActiveProgram + "' exists.");
212  }
213  return;
214  }
215  SUMOTime firstEventOffset = 0;
216  int step = 0;
217  MSTrafficLightLogic* existing = nullptr;
218  MSSimpleTrafficLightLogic::Phases::const_iterator i = myActivePhases.begin();
220  if (myAbsDuration == 0) {
222  if (existing == nullptr) {
223  throw InvalidArgument("TLS program '" + myActiveProgram + "' for TLS '" + myActiveKey + "' has a duration of 0.");
224  } else {
225  // only modify the offset of an existing logic
226  myAbsDuration = existing->getDefaultCycleTime();
227  i = existing->getPhases().begin();
228  }
229  }
230  // compute the initial step and first switch time of the tls-logic
231  // a positive offset delays all phases by x (advance by absDuration - x) while a negative offset advances all phases by x seconds
232  // @note The implementation of % for negative values is implementation defined in ISO1998
233  SUMOTime offset; // the time to run the traffic light in advance
234  if (myOffset >= 0) {
236  } else {
238  }
239  while (offset >= (*i)->duration) {
240  step++;
241  offset -= (*i)->duration;
242  ++i;
243  }
244  firstEventOffset = (*i)->duration - offset + myNet.getCurrentTimeStep();
245  if (existing != nullptr) {
247  myNet.getCurrentTimeStep(), step, (*i)->duration - offset);
248  return;
249  }
250  }
251 
252  if (myActiveProgram == "") {
253  myActiveProgram = "default";
254  }
255  MSTrafficLightLogic* tlLogic = nullptr;
256  // build the tls-logic in dependance to its type
257  switch (myLogicType) {
258  case TLTYPE_SWARM_BASED:
259  firstEventOffset = DELTA_T; //this is needed because swarm needs to update the pheromone on the lanes at every step
261  break;
264  break;
265  case TLTYPE_SOTL_REQUEST:
267  break;
268  case TLTYPE_SOTL_PLATOON:
270  break;
271  case TLTYPE_SOTL_WAVE:
273  break;
274  case TLTYPE_SOTL_PHASE:
276  break;
279  break;
280  case TLTYPE_ACTUATED:
281  // @note it is unclear how to apply the given offset in the context
282  // of variable-length phases
285  myActivePhases, step, (*i)->minDuration + myNet.getCurrentTimeStep(),
286  myAdditionalParameter, basePath);
287  break;
288  case TLTYPE_DELAYBASED:
291  myActivePhases, step, (*i)->minDuration + myNet.getCurrentTimeStep(),
292  myAdditionalParameter, basePath);
293  break;
294  case TLTYPE_STATIC:
297  myActivePhases, step, firstEventOffset,
299  break;
300  case TLTYPE_RAIL_SIGNAL:
301  tlLogic = new MSRailSignal(getTLLogicControlToUse(),
304  break;
306  tlLogic = new MSRailCrossing(getTLLogicControlToUse(),
309  break;
310  case TLTYPE_OFF:
312  break;
313  case TLTYPE_INVALID:
314  throw ProcessError("Invalid traffic light type '" + toString(myLogicType) + "'");
315  }
316  myActivePhases.clear();
317  if (tlLogic != nullptr) {
318  if (getTLLogicControlToUse().add(myActiveKey, myActiveProgram, tlLogic)) {
319  if (myNetIsLoaded) {
320  tlLogic->init(myDetectorBuilder);
321  } else {
322  myLogics2PostLoadInit.push_back(tlLogic);
323  }
324  } else {
325  WRITE_ERROR("Another logic with id '" + myActiveKey + "' and programID '" + myActiveProgram + "' exists.");
326  delete tlLogic;
327  }
328  }
329 }
330 
331 
332 void
334  myActiveKey = id;
335  myActiveProgram = "";
336  myActiveLogic.clear();
337  myActiveFoes.clear();
338  myActiveConts.reset();
339  myRequestSize = NO_REQUEST_SIZE; // seems not to be used
341  myCurrentHasError = false;
342 }
343 
344 
345 void
347  const std::string& response,
348  const std::string& foes,
349  bool cont) {
350  if (myCurrentHasError) {
351  // had an error
352  return;
353  }
354  if (request >= SUMO_MAX_CONNECTIONS) {
355  // bad request
356  myCurrentHasError = true;
357  throw InvalidArgument("Junction logic '" + myActiveKey + "' is larger than allowed; recheck the network.");
358  }
360  // initialize
361  myRequestSize = (int)response.size();
362  }
363  if (static_cast<int>(response.size()) != myRequestSize) {
364  myCurrentHasError = true;
365  throw InvalidArgument("Invalid response size " + toString(response.size()) +
366  " in Junction logic '" + myActiveKey + "' (expected " + toString(myRequestSize) + ")");
367  }
368  if (static_cast<int>(foes.size()) != myRequestSize) {
369  myCurrentHasError = true;
370  throw InvalidArgument("Invalid foes size " + toString(foes.size()) +
371  " in Junction logic '" + myActiveKey + "' (expected " + toString(myRequestSize) + ")");
372  }
373  // assert that the logicitems come ordered by their request index
374  assert((int)myActiveLogic.size() == request);
375  assert((int)myActiveFoes.size() == request);
376  // add the read response for the given request index
377  myActiveLogic.push_back(std::bitset<SUMO_MAX_CONNECTIONS>(response));
378  // add the read junction-internal foes for the given request index
379  myActiveFoes.push_back(std::bitset<SUMO_MAX_CONNECTIONS>(foes));
380  // add whether the vehicle may drive a little bit further
381  myActiveConts.set(request, cont);
382  // increse number of set information
384 }
385 
386 
387 void
388 NLJunctionControlBuilder::initTrafficLightLogic(const std::string& id, const std::string& programID,
389  TrafficLightType type, SUMOTime offset) {
390  myActiveKey = id;
391  myActiveProgram = programID;
392  myActivePhases.clear();
393  myAbsDuration = 0;
395  myLogicType = type;
396  myOffset = offset;
397  myAdditionalParameter.clear();
398 }
399 
400 
401 void
402 NLJunctionControlBuilder::addPhase(SUMOTime duration, const std::string& state, const std::vector<int>& nextPhases, SUMOTime minDuration, SUMOTime maxDuration, const std::string& name, bool transient_notdecisional, bool commit, MSPhaseDefinition::LaneIdVector* targetLanes) {
403  // build and add the phase definition to the list
404  myActivePhases.push_back(new MSPhaseDefinition(duration, state, minDuration, maxDuration, nextPhases, name, transient_notdecisional, commit, targetLanes));
405  // add phase duration to the absolute duration
406  myAbsDuration += duration;
407 }
408 
409 
410 void
411 NLJunctionControlBuilder::addPhase(SUMOTime duration, const std::string& state, const std::vector<int>& nextPhases,
412  SUMOTime minDuration, SUMOTime maxDuration, const std::string& name) {
413  // build and add the phase definition to the list
414  myActivePhases.push_back(new MSPhaseDefinition(duration, state, minDuration, maxDuration, nextPhases, name));
415  // add phase duration to the absolute duration
416  myAbsDuration += duration;
417 }
418 
419 
420 void
423  // We have a legacy network. junction element did not contain logicitems; read the logic later
424  return;
425  }
426  if (myCurrentHasError) {
427  // had an error before...
428  return;
429  }
431  throw InvalidArgument("The description for the junction logic '" + myActiveKey + "' is malicious.");
432  }
433  if (myLogics.count(myActiveKey) > 0) {
434  throw InvalidArgument("Junction logic '" + myActiveKey + "' was defined twice.");
435  }
439  myActiveConts);
440  myLogics[myActiveKey] = logic;
441 }
442 
443 
446  postLoadInitialization(); // must happen after edgeBuilder is finished
448  throw ProcessError("Traffic lights could not be built.");
449  }
451  myLogicControl = nullptr;
452  return ret;
453 }
454 
455 
456 void
457 NLJunctionControlBuilder::addParam(const std::string& key,
458  const std::string& value) {
459  myAdditionalParameter[key] = value;
460 }
461 
462 
465  if (myLogicControl != nullptr) {
466  return *myLogicControl;
467  }
468  return myNet.getTLSControl();
469 }
470 
471 
472 const std::string&
474  return myActiveKey;
475 }
476 
477 
478 const std::string&
480  return myActiveProgram;
481 }
482 
483 
484 void
486  for (MSTrafficLightLogic* const logic : myLogics2PostLoadInit) {
487  logic->init(myDetectorBuilder);
488  }
489  myNetIsLoaded = true;
490 }
491 
492 
493 MSJunction*
494 NLJunctionControlBuilder::retrieve(const std::string id) {
495  if (myJunctions != nullptr) {
496  return myJunctions->get(id);
497  } else {
498  return nullptr;
499  }
500 }
501 
502 /****************************************************************************/
NLJunctionControlBuilder::~NLJunctionControlBuilder
virtual ~NLJunctionControlBuilder()
Destructor.
Definition: NLJunctionControlBuilder.cpp:80
NLJunctionControlBuilder::initTrafficLightLogic
void initTrafficLightLogic(const std::string &id, const std::string &programID, TrafficLightType type, SUMOTime offset)
Begins the reading of a traffic lights logic.
Definition: NLJunctionControlBuilder.cpp:388
TLTYPE_SOTL_PLATOON
Definition: SUMOXMLDefinitions.h:1204
MSRightOfWayJunction.h
NODETYPE_PRIORITY
Definition: SUMOXMLDefinitions.h:1061
NLJunctionControlBuilder::myDetectorBuilder
NLDetectorBuilder & myDetectorBuilder
The detector builder to use.
Definition: NLJunctionControlBuilder.h:332
NODETYPE_TRAFFIC_LIGHT_RIGHT_ON_RED
Definition: SUMOXMLDefinitions.h:1058
TLTYPE_SOTL_MARCHING
Definition: SUMOXMLDefinitions.h:1207
MSTrafficLightLogic::getPhases
virtual const Phases & getPhases() const =0
Returns the phases of this tls program.
TLTYPE_SWARM_BASED
Definition: SUMOXMLDefinitions.h:1208
ToString.h
NLJunctionControlBuilder::myActiveConts
std::bitset< SUMO_MAX_CONNECTIONS > myActiveConts
The description about which lanes have an internal follower.
Definition: NLJunctionControlBuilder.h:347
NODETYPE_ZIPPER
Definition: SUMOXMLDefinitions.h:1065
NLJunctionControlBuilder::postLoadInitialization
void postLoadInitialization()
initialize junctions after all connections have been loaded
Definition: NLJunctionControlBuilder.cpp:485
MSNoLogicJunction
Definition: MSNoLogicJunction.h:48
MSTLLogicControl.h
NODETYPE_DEAD_END_DEPRECATED
Definition: SUMOXMLDefinitions.h:1070
MSNet.h
MSSOTLMarchingPolicy
Class for low-level marching policy.
Definition: MSSOTLMarchingPolicy.h:33
MSSOTLPlatoonPolicy.h
MSJunction
The base class for an intersection.
Definition: MSJunction.h:60
DELTA_T
SUMOTime DELTA_T
Definition: SUMOTime.cpp:36
NLBuilder.h
MSDeterministicHiLevelTrafficLightLogic
Definition: MSDeterministicHiLevelTrafficLightLogic.h:33
NLJunctionControlBuilder::myActiveInternalLanes
LaneVector myActiveInternalLanes
The list of the internal lanes of the currently chosen junction.
Definition: NLJunctionControlBuilder.h:365
TLTYPE_STATIC
Definition: SUMOXMLDefinitions.h:1198
TLTYPE_INVALID
Definition: SUMOXMLDefinitions.h:1211
MSJunctionLogic.h
MSSOTLWaveTrafficLightLogic
Definition: MSSOTLWaveTrafficLightLogic.h:26
NLJunctionControlBuilder::myActiveLogic
MSBitsetLogic::Logic myActiveLogic
The right-of-way-logic of the currently chosen bitset-logic.
Definition: NLJunctionControlBuilder.h:341
MSOffTrafficLightLogic.h
NLJunctionControlBuilder::myActiveKey
std::string myActiveKey
The key of the currently chosen junction.
Definition: NLJunctionControlBuilder.h:371
MSNet
The simulated network and simulation perfomer.
Definition: MSNet.h:91
NLJunctionControlBuilder::myActiveProgram
std::string myActiveProgram
Definition: NLJunctionControlBuilder.h:371
NLJunctionControlBuilder::closeJunctionLogic
void closeJunctionLogic()
Ends the building of a junction logic (row-logic)
Definition: NLJunctionControlBuilder.cpp:421
NLJunctionControlBuilder::NO_REQUEST_SIZE
static const int NO_REQUEST_SIZE
Definition: NLJunctionControlBuilder.h:415
NLJunctionControlBuilder::buildInternalJunction
virtual MSJunction * buildInternalJunction()
Builds an internal junction.
Definition: NLJunctionControlBuilder.cpp:180
MSSwarmTrafficLightLogic
Definition: MSSwarmTrafficLightLogic.h:100
MSBitSetLogic::Foes
std::vector< std::bitset< N > > Foes
Container holding the information which internal lanes prohibt which links Build the same way as Logi...
Definition: MSBitSetLogic.h:55
TrafficLightType
TrafficLightType
Definition: SUMOXMLDefinitions.h:1197
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
NODETYPE_INTERNAL
Definition: SUMOXMLDefinitions.h:1068
NLJunctionControlBuilder::myAbsDuration
SUMOTime myAbsDuration
The absolute duration of a tls-control loop.
Definition: NLJunctionControlBuilder.h:380
NLJunctionControlBuilder::myNet
MSNet & myNet
The net to use.
Definition: NLJunctionControlBuilder.h:329
MSSOTLRequestPolicy.h
MSJunctionControl.h
MSInternalJunction
Definition: MSInternalJunction.h:51
MSPhaseDefinition::LaneIdVector
std::vector< std::string > LaneIdVector
Definition: MSPhaseDefinition.h:66
MSInternalJunction.h
TLTYPE_RAIL_SIGNAL
Definition: SUMOXMLDefinitions.h:1199
PositionVector
A list of positions.
Definition: PositionVector.h:45
NLJunctionControlBuilder::getActiveSubKey
const std::string & getActiveSubKey() const
Returns the active sub key.
Definition: NLJunctionControlBuilder.cpp:479
MSSimpleTrafficLightLogic.h
NLJunctionControlBuilder::myShape
PositionVector myShape
The shape of the current junction.
Definition: NLJunctionControlBuilder.h:383
NLJunctionControlBuilder::closeJunction
void closeJunction(const std::string &basePath)
Closes (ends) the processing of the current junction.
Definition: NLJunctionControlBuilder.cpp:106
MSSOTLPolicyBasedTrafficLightLogic
A self-organizing traffic light logic based on a particular policy.
Definition: MSSOTLPolicyBasedTrafficLightLogic.h:40
NLJunctionControlBuilder::myPosition
Position myPosition
The position of the junction.
Definition: NLJunctionControlBuilder.h:377
MSTrafficLightLogic.h
NLJunctionControlBuilder::myOffset
SUMOTime myOffset
The switch offset within the tls.
Definition: NLJunctionControlBuilder.h:335
MSJunctionControl
Container for junctions; performs operations on all stored junctions.
Definition: MSJunctionControl.h:44
TLTYPE_SOTL_WAVE
Definition: SUMOXMLDefinitions.h:1206
NODETYPE_ALLWAY_STOP
Definition: SUMOXMLDefinitions.h:1064
NODETYPE_RAIL_SIGNAL
Definition: SUMOXMLDefinitions.h:1059
NLJunctionControlBuilder::getTLLogic
MSTLLogicControl::TLSLogicVariants & getTLLogic(const std::string &id) const
Returns a previously build tls logic.
Definition: NLJunctionControlBuilder.cpp:198
MSJunctionLogic
Definition: MSJunctionLogic.h:38
MSSOTLWaveTrafficLightLogic.h
MSTrafficLightLogic::changeStepAndDuration
virtual void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)=0
Changes the current phase and her duration.
Parameterised::updateParameters
void updateParameters(const std::map< std::string, std::string > &mapArg)
Adds or updates all given parameters from the map.
Definition: Parameterised.cpp:58
MSTLLogicControl::get
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
Definition: MSTLLogicControl.cpp:589
NLJunctionControlBuilder::myJunctions
MSJunctionControl * myJunctions
The junctions controls.
Definition: NLJunctionControlBuilder.h:359
NLJunctionControlBuilder::myActiveID
std::string myActiveID
The id of the currently chosen junction.
Definition: NLJunctionControlBuilder.h:368
NODETYPE_PRIORITY_STOP
Definition: SUMOXMLDefinitions.h:1062
NODETYPE_TRAFFIC_LIGHT_NOJUNCTION
Definition: SUMOXMLDefinitions.h:1057
NLJunctionControlBuilder::myActivePhases
MSSimpleTrafficLightLogic::Phases myActivePhases
The current phase definitions for a simple traffic light.
Definition: NLJunctionControlBuilder.h:350
MSBitSetLogic::Logic
std::vector< std::bitset< N > > Logic
Container that holds the right of way bitsets. Each link has it's own bitset. The bits in the bitsets...
Definition: MSBitSetLogic.h:51
NLJunctionControlBuilder::buildLogicJunction
virtual MSJunction * buildLogicJunction()
Builds a junction with a logic.
Definition: NLJunctionControlBuilder.cpp:170
NLJunctionControlBuilder::myLogicType
TrafficLightType myLogicType
The current logic type.
Definition: NLJunctionControlBuilder.h:338
NLJunctionControlBuilder::closeTrafficLightLogic
virtual void closeTrafficLightLogic(const std::string &basePath)
Ends the building of a traffic lights logic.
Definition: NLJunctionControlBuilder.cpp:204
SumoXMLNodeType
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
Definition: SUMOXMLDefinitions.h:1054
Position::set
void set(double x, double y)
set positions x and y
Definition: Position.h:86
MSNet::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:283
MSRailSignal
A signal for rails.
Definition: MSRailSignal.h:46
NLJunctionControlBuilder::openJunction
void openJunction(const std::string &id, const std::string &key, const SumoXMLNodeType type, const Position pos, const PositionVector &shape, const std::vector< MSLane * > &incomingLanes, const std::vector< MSLane * > &internalLanes)
Begins the processing of the named junction.
Definition: NLJunctionControlBuilder.cpp:87
MSTrafficLightLogic::getDefaultCycleTime
SUMOTime getDefaultCycleTime() const
Returns the cycle time (in ms)
Definition: MSTrafficLightLogic.h:270
MSRailCrossing.h
NLJunctionControlBuilder::myLogics
std::map< std::string, MSJunctionLogic * > myLogics
Map of loaded junction logics.
Definition: NLJunctionControlBuilder.h:402
ProcessError
Definition: UtilExceptions.h:39
MSOffTrafficLightLogic
A traffic lights logic which represents a tls in an off-mode.
Definition: MSOffTrafficLightLogic.h:42
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
MSSimpleTrafficLightLogic
A fixed traffic light logic.
Definition: MSSimpleTrafficLightLogic.h:54
MSDeterministicHiLevelTrafficLightLogic.h
NLJunctionControlBuilder::myRequestSize
int myRequestSize
The size of the request.
Definition: NLJunctionControlBuilder.h:353
NLJunctionControlBuilder::retrieve
MSJunction * retrieve(const std::string id)
try to retrieve junction by id
Definition: NLJunctionControlBuilder.cpp:494
NLJunctionControlBuilder::myNetIsLoaded
bool myNetIsLoaded
whether the network has been loaded
Definition: NLJunctionControlBuilder.h:418
MSGlobals.h
UtilExceptions.h
MSNoLogicJunction.h
MSActuatedTrafficLightLogic
An actuated (adaptive) traffic light logic.
Definition: MSActuatedTrafficLightLogic.h:50
NLJunctionControlBuilder::addParam
void addParam(const std::string &key, const std::string &value)
Adds a parameter.
Definition: NLJunctionControlBuilder.cpp:457
MSTrafficLightLogic
The parent class for traffic light logics.
Definition: MSTrafficLightLogic.h:55
MSDelayBasedTrafficLightLogic.h
TLTYPE_SOTL_PHASE
Definition: SUMOXMLDefinitions.h:1203
NLJunctionControlBuilder::myRequestItemNumber
int myRequestItemNumber
Counter for the inserted items.
Definition: NLJunctionControlBuilder.h:356
MSSOTLRequestPolicy
Class for low-level request policy.
Definition: MSSOTLRequestPolicy.h:32
NODETYPE_RAIL_CROSSING
Definition: SUMOXMLDefinitions.h:1060
NODETYPE_RIGHT_BEFORE_LEFT
Definition: SUMOXMLDefinitions.h:1063
MSRightOfWayJunction
A junction with right-of-way - rules.
Definition: MSRightOfWayJunction.h:51
NODETYPE_DEAD_END
Definition: SUMOXMLDefinitions.h:1069
NLJunctionControlBuilder::NLJunctionControlBuilder
NLJunctionControlBuilder(MSNet &net, NLDetectorBuilder &db)
Constructor.
Definition: NLJunctionControlBuilder.cpp:69
NLJunctionControlBuilder::getTLLogicControlToUse
MSTLLogicControl & getTLLogicControlToUse() const
Returns the used tls control.
Definition: NLJunctionControlBuilder.cpp:464
NLJunctionControlBuilder::myCurrentHasError
bool myCurrentHasError
Information whether the current logic had an error.
Definition: NLJunctionControlBuilder.h:405
NODETYPE_DISTRICT
Definition: SUMOXMLDefinitions.h:1066
NLJunctionControlBuilder::myActiveFoes
MSBitsetLogic::Foes myActiveFoes
The description about which lanes disallow other passing the junction simultaneously.
Definition: NLJunctionControlBuilder.h:344
MSGlobals::gUsingInternalLanes
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
Definition: MSGlobals.h:68
MSSwarmTrafficLightLogic.h
MSNet::getTLSControl
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition: MSNet.h:409
NLJunctionControlBuilder::buildNoLogicJunction
virtual MSJunction * buildNoLogicJunction()
Builds a junction that does not use a logic.
Definition: NLJunctionControlBuilder.cpp:163
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
TLTYPE_RAIL_CROSSING
Definition: SUMOXMLDefinitions.h:1200
MSRailCrossing
A signal for rails.
Definition: MSRailCrossing.h:38
NLJunctionControlBuilder::myType
SumoXMLNodeType myType
The type of the currently chosen junction.
Definition: NLJunctionControlBuilder.h:374
MSSOTLPhasePolicy
Class for low-level phase policy.
Definition: MSSOTLPhasePolicy.h:33
MSBitsetLogic
MSBitSetLogic< SUMO_MAX_CONNECTIONS > MSBitsetLogic
Definition: MSBitSetLogic.h:120
NLJunctionControlBuilder::myAdditionalParameter
StringParameterMap myAdditionalParameter
Parameter map (key->value)
Definition: NLJunctionControlBuilder.h:398
TLTYPE_DELAYBASED
Definition: SUMOXMLDefinitions.h:1202
InvalidArgument
Definition: UtilExceptions.h:56
SUMO_MAX_CONNECTIONS
#define SUMO_MAX_CONNECTIONS
the maximum number of connections across an intersection
Definition: StdDefs.h:42
NLJunctionControlBuilder::myActiveIncomingLanes
LaneVector myActiveIncomingLanes
The list of the incoming lanes of the currently chosen junction.
Definition: NLJunctionControlBuilder.h:362
NLJunctionControlBuilder::addPhase
void addPhase(SUMOTime duration, const std::string &state, const std::vector< int > &nextPhases, SUMOTime min, SUMOTime max, const std::string &name)
Adds a phase to the currently built traffic lights logic.
Definition: NLJunctionControlBuilder.cpp:411
NamedObjectCont::get
T get(const std::string &id) const
Retrieves an item.
Definition: NamedObjectCont.h:98
MSSOTLMarchingPolicy.h
MSDelayBasedTrafficLightLogic
An actuated traffic light logic based on time delay of approaching vehicles.
Definition: MSDelayBasedTrafficLightLogic.h:46
NLJunctionControlBuilder::myLogicControl
MSTLLogicControl * myLogicControl
The tls control to use (0 if net's tls control shall be used)
Definition: NLJunctionControlBuilder.h:391
NLJunctionControlBuilder::initJunctionLogic
void initJunctionLogic(const std::string &id)
Initialises a junction logic.
Definition: NLJunctionControlBuilder.cpp:333
MSTLLogicControl::TLSLogicVariants
Storage for all programs of a single tls.
Definition: MSTLLogicControl.h:85
NLJunctionControlBuilder.h
NLJunctionControlBuilder::myLogics2PostLoadInit
std::vector< MSTrafficLightLogic * > myLogics2PostLoadInit
The container for information which junctions shall be initialised using which values.
Definition: NLJunctionControlBuilder.h:387
config.h
TLTYPE_OFF
Definition: SUMOXMLDefinitions.h:1210
MSTLLogicControl
A class that stores and controls tls and switching of their programs.
Definition: MSTLLogicControl.h:59
MSSOTLPlatoonPolicy
Class for low-level platoon policy.
Definition: MSSOTLPlatoonPolicy.h:35
MSSOTLPhasePolicy.h
NLJunctionControlBuilder::getJunctionLogicSecure
MSJunctionLogic * getJunctionLogicSecure()
Returns the current junction logic.
Definition: NLJunctionControlBuilder.cpp:188
MSEventControl.h
MSPhaseDefinition
The definition of a single phase of a tls logic.
Definition: MSPhaseDefinition.h:51
TLTYPE_HILVL_DETERMINISTIC
Definition: SUMOXMLDefinitions.h:1209
MSTrafficLightLogic::init
virtual void init(NLDetectorBuilder &nb)
Initialises the tls with information about incoming lanes.
Definition: MSTrafficLightLogic.cpp:115
MSSOTLPolicyBasedTrafficLightLogic.h
NLJunctionControlBuilder::build
MSJunctionControl * build() const
Builds the MSJunctionControl which holds all of the simulations junctions.
Definition: NLJunctionControlBuilder.cpp:155
TLTYPE_SOTL_REQUEST
Definition: SUMOXMLDefinitions.h:1205
NLJunctionControlBuilder::buildTLLogics
MSTLLogicControl * buildTLLogics()
Returns the built tls-logic control.
Definition: NLJunctionControlBuilder.cpp:445
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
MSTLLogicControl::closeNetworkReading
bool closeNetworkReading()
Lets MSTLLogicControl know that the network has been loaded.
Definition: MSTLLogicControl.cpp:641
SUMOXMLDefinitions.h
NLDetectorBuilder
Builds detectors for microsim.
Definition: NLDetectorBuilder.h:55
NLJunctionControlBuilder::getActiveKey
const std::string & getActiveKey() const
Returns the active key.
Definition: NLJunctionControlBuilder.cpp:473
NLJunctionControlBuilder::addLogicItem
void addLogicItem(int request, const std::string &response, const std::string &foes, bool cont)
Adds a logic item.
Definition: NLJunctionControlBuilder.cpp:346
TLTYPE_ACTUATED
Definition: SUMOXMLDefinitions.h:1201
NODETYPE_NOJUNCTION
Definition: SUMOXMLDefinitions.h:1067
NamedObjectCont::add
bool add(const std::string &id, T item)
Adds an item.
Definition: NamedObjectCont.h:65
NODETYPE_TRAFFIC_LIGHT
Definition: SUMOXMLDefinitions.h:1056
MSRailSignal.h