Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSRailCrossing.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2002-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// A rail signal logic
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
24#include "MSPhaseDefinition.h"
25#include "MSTLLogicControl.h"
26
27
28
29// ===========================================================================
30// class definitions
31// ===========================================================================
37public:
45 const std::string& id, const std::string& programID, SUMOTime delay,
46 const Parameterised::Map& parameters);
47
50
51
56 void init(NLDetectorBuilder& nb);
57
59 void setParameter(const std::string& key, const std::string& value);
60
63
69 void addLink(MSLink* link, MSLane* lane, int pos);
70
77
78
81
82
85
91
93
94
97
103
104
110 SUMOTime getOffsetFromIndex(int index) const;
111
112
118 int getIndexFromOffset(SUMOTime offset) const;
120
121
124
132 void changeStepAndDuration(MSTLLogicControl& tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration) {
133 UNUSED_PARAMETER(tlcontrol);
134 UNUSED_PARAMETER(simStep);
135 UNUSED_PARAMETER(step);
136 UNUSED_PARAMETER(stepDuration);
137 }
139
140protected:
141
143 std::vector<MSLink*> myIncomingRailLinks;
144
145protected:
146
147
150
153
156
159
162
165
166};
long long int SUMOTime
Definition GUI.h:36
#define UNUSED_PARAMETER(x)
Definition StdDefs.h:30
Representation of a lane in the micro simulation.
Definition MSLane.h:84
A signal for rails.
void init(NLDetectorBuilder &nb)
Initialises the rail signal with information about adjacent rail signals.
SUMOTime getOffsetFromIndex(int index) const
Returns the position (start of a phase during a cycle) from of a given step.
void setParameter(const std::string &key, const std::string &value)
Sets a parameter and updates internal constants.
SUMOTime myOpeningDelay
red time after the train has left
SUMOTime myYellowTime
yellow time
int getIndexFromOffset(SUMOTime offset) const
Returns the step (the phasenumber) of a given position of the cycle.
~MSRailCrossing()
Destructor.
void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)
Changes the current phase and her duration.
SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const
Returns the index of the logic at the given simulation step.
SUMOTime trySwitch()
Switches to the next phase.
double mySpaceGap
minimum distance between the train and the crossing which triggers closing (-1 means time only)
void adaptLinkInformationFrom(const MSTrafficLightLogic &logic)
Applies information about controlled links and lanes from the given logic.
SUMOTime myTimeGap
minimum time gap between closing the crossing (end of yellow time) and train passing the crossing
SUMOTime updateCurrentPhase()
updates the current phase of the signal
std::vector< MSLink * > myIncomingRailLinks
The incoming rail links.
void addLink(MSLink *link, MSLane *lane, int pos)
Adds a link on building.
SUMOTime myOpeningTime
red-yellow time after the delay while opening
SUMOTime myMinGreenTime
minimum green time
A fixed traffic light logic.
A class that stores and controls tls and switching of their programs.
The parent class for traffic light logics.
Builds detectors for microsim.
std::map< std::string, std::string > Map
parameters map