70 myDetectorBuilder(db),
73 myNetIsLoaded(false) {
87 const std::string& key,
91 const std::vector<MSLane*>& incomingLanes,
92 const std::vector<MSLane*>& internalLanes,
93 const std::string& name) {
109 throw ProcessError(
"Information about the number of nodes was missing.");
146 if (junction !=
nullptr) {
220 MSSimpleTrafficLightLogic::Phases::const_iterator i =
myActivePhases.begin();
224 if (existing ==
nullptr) {
241 while (offset >= (*i)->duration) {
243 offset -= (*i)->duration;
247 if (existing !=
nullptr) {
319 if (tlLogic !=
nullptr) {
349 const std::string& response,
350 const std::string& foes,
379 myActiveLogic.push_back(std::bitset<SUMO_MAX_CONNECTIONS>(response));
381 myActiveFoes.push_back(std::bitset<SUMO_MAX_CONNECTIONS>(foes));
406 myActivePhases.push_back(
new MSPhaseDefinition(duration, state, minDuration, maxDuration, nextPhases, name, transient_notdecisional, commit, targetLanes));
450 throw ProcessError(
"Traffic lights could not be built.");
460 const std::string& value) {
MSBitSetLogic< SUMO_MAX_CONNECTIONS > MSBitsetLogic
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
@ TRAFFIC_LIGHT_RIGHT_ON_RED
@ TRAFFIC_LIGHT_NOJUNCTION
#define SUMO_MAX_CONNECTIONS
the maximum number of connections across an intersection
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
An actuated (adaptive) traffic light logic.
std::vector< std::bitset< N > > Foes
Container holding the information which internal lanes prohibt which links Build the same way as Logi...
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...
An actuated traffic light logic based on time delay of approaching vehicles.
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
Container for junctions; performs operations on all stored junctions.
The base class for an intersection.
The simulated network and simulation perfomer.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
A traffic lights logic which represents a tls in an off-mode.
The definition of a single phase of a tls logic.
std::vector< std::string > LaneIdVector
A junction with right-of-way - rules.
Class for low-level marching policy.
Class for low-level phase policy.
Class for low-level platoon policy.
A self-organizing traffic light logic based on a particular policy.
Class for low-level request policy.
A fixed traffic light logic.
Storage for all programs of a single tls.
A class that stores and controls tls and switching of their programs.
bool closeNetworkReading()
Lets MSTLLogicControl know that the network has been loaded.
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
The parent class for traffic light logics.
virtual void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)=0
Changes the current phase and her duration.
SUMOTime getDefaultCycleTime() const
Returns the cycle time (in ms)
virtual const Phases & getPhases() const =0
Returns the phases of this tls program.
virtual void init(NLDetectorBuilder &nb)
Initialises the tls with information about incoming lanes.
Builds detectors for microsim.
PositionVector myShape
The shape of the current junction.
NLJunctionControlBuilder(MSNet &net, NLDetectorBuilder &db)
Constructor.
void closeJunctionLogic()
Ends the building of a junction logic (row-logic)
int myRequestItemNumber
Counter for the inserted items.
SumoXMLNodeType myType
The type of the currently chosen junction.
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.
MSTLLogicControl::TLSLogicVariants & getTLLogic(const std::string &id) const
Returns a previously build tls logic.
std::string myActiveName
the name of the current junction
virtual ~NLJunctionControlBuilder()
Destructor.
MSJunction * retrieve(const std::string id)
try to retrieve junction by id
MSBitsetLogic::Foes myActiveFoes
The description about which lanes disallow other passing the junction simultaneously.
std::string myActiveID
The id of the currently chosen junction.
SUMOTime myOffset
The switch offset within the tls.
MSTLLogicControl * myLogicControl
The tls control to use (0 if net's tls control shall be used)
static const int NO_REQUEST_SIZE
MSNet & myNet
The net to use.
std::string myActiveKey
The key of the currently chosen junction.
TrafficLightType myLogicType
The current logic type.
bool myCurrentHasError
Information whether the current logic had an error.
MSTLLogicControl * buildTLLogics()
Returns the built tls-logic control.
MSJunctionControl * build() const
Builds the MSJunctionControl which holds all of the simulations junctions.
int myRequestSize
The size of the request.
MSTLLogicControl & getTLLogicControlToUse() const
Returns the used tls control.
LaneVector myActiveIncomingLanes
The list of the incoming lanes of the currently chosen junction.
std::map< std::string, MSJunctionLogic * > myLogics
Map of loaded junction logics.
const std::string & getActiveSubKey() const
Returns the active sub key.
std::string myActiveProgram
StringParameterMap myAdditionalParameter
Parameter map (key->value)
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, const std::string &name)
Begins the processing of the named junction.
void addParam(const std::string &key, const std::string &value)
Adds a parameter.
LaneVector myActiveInternalLanes
The list of the internal lanes of the currently chosen junction.
void initJunctionLogic(const std::string &id)
Initialises a junction logic.
void initTrafficLightLogic(const std::string &id, const std::string &programID, TrafficLightType type, SUMOTime offset)
Begins the reading of a traffic lights logic.
virtual MSJunction * buildLogicJunction()
Builds a junction with a logic.
NLDetectorBuilder & myDetectorBuilder
The detector builder to use.
virtual MSJunction * buildNoLogicJunction()
Builds a junction that does not use a logic.
virtual MSJunction * buildInternalJunction()
Builds an internal junction.
MSJunctionControl * myJunctions
The junctions controls.
const std::string & getActiveKey() const
Returns the active key.
Position myPosition
The position of the junction.
MSJunctionLogic * getJunctionLogicSecure()
Returns the current junction logic.
void postLoadInitialization()
initialize junctions after all connections have been loaded
void addLogicItem(int request, const std::string &response, const std::string &foes, bool cont)
Adds a logic item.
std::vector< MSTrafficLightLogic * > myLogics2PostLoadInit
The container for information which junctions shall be initialised using which values.
MSBitsetLogic::Logic myActiveLogic
The right-of-way-logic of the currently chosen bitset-logic.
SUMOTime myAbsDuration
The absolute duration of a tls-control loop.
void closeJunction(const std::string &basePath)
Closes (ends) the processing of the current junction.
MSSimpleTrafficLightLogic::Phases myActivePhases
The current phase definitions for a simple traffic light.
bool myNetIsLoaded
whether the network has been loaded
virtual void closeTrafficLightLogic(const std::string &basePath)
Ends the building of a traffic lights logic.
std::bitset< SUMO_MAX_CONNECTIONS > myActiveConts
The description about which lanes have an internal follower.
T get(const std::string &id) const
Retrieves an item.
bool add(const std::string &id, T item)
Adds an item.
void updateParameters(const std::map< std::string, std::string > &mapArg)
Adds or updates all given parameters from the map.
A point in 2D or 3D with translation and scaling methods.
void set(double x, double y)
set positions x and y