Eclipse SUMO - Simulation of Urban MObility
MSRailCrossing.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-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 /****************************************************************************/
14 // A rail signal logic
15 /****************************************************************************/
16 #ifndef MSRailCrossing_h
17 #define MSRailCrossing_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
26 #include "MSPhaseDefinition.h"
27 #include "MSTLLogicControl.h"
28 
29 
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
39 public:
47  const std::string& id, const std::string& programID, SUMOTime delay,
48  const std::map<std::string, std::string>& parameters);
49 
50 
55  void init(NLDetectorBuilder& nb);
56 
57 
60 
63 
69  void addLink(MSLink* link, MSLane* lane, int pos);
70 
77 
78 
81 
82 
85 
91 
93 
94 
97 
102  SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const;
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 
140 protected:
141 
143  std::vector<MSLink*> myIncomingRailLinks;
144 
145 protected:
146 
147 
150 
153 
156 
157 };
158 
159 
160 #endif
161 
162 /****************************************************************************/
163 
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:31
MSTLLogicControl.h
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
MSRailCrossing::~MSRailCrossing
~MSRailCrossing()
Destructor.
Definition: MSRailCrossing.cpp:66
MSSimpleTrafficLightLogic.h
MSRailCrossing::changeStepAndDuration
void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)
Changes the current phase and her duration.
Definition: MSRailCrossing.h:132
MSRailCrossing::getIndexFromOffset
int getIndexFromOffset(SUMOTime offset) const
Returns the step (the phasenumber) of a given position of the cycle.
Definition: MSRailCrossing.cpp:144
MSRailCrossing::init
void init(NLDetectorBuilder &nb)
Initialises the rail signal with information about adjacent rail signals.
Definition: MSRailCrossing.cpp:54
MSRailCrossing::getOffsetFromIndex
SUMOTime getOffsetFromIndex(int index) const
Returns the position (start of a phase during a cycle) from of a given step.
Definition: MSRailCrossing.cpp:139
MSRailCrossing::getPhaseIndexAtTime
SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const
Returns the index of the logic at the given simulation step.
Definition: MSRailCrossing.cpp:134
MSSimpleTrafficLightLogic
A fixed traffic light logic.
Definition: MSSimpleTrafficLightLogic.h:54
MSRailCrossing::trySwitch
SUMOTime trySwitch()
Switches to the next phase.
Definition: MSRailCrossing.cpp:79
MSTrafficLightLogic
The parent class for traffic light logics.
Definition: MSTrafficLightLogic.h:55
MSRailCrossing::myIncomingRailLinks
std::vector< MSLink * > myIncomingRailLinks
The incoming rail links.
Definition: MSRailCrossing.h:143
MSRailCrossing::MSRailCrossing
MSRailCrossing(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, SUMOTime delay, const std::map< std::string, std::string > &parameters)
Constructor.
Definition: MSRailCrossing.cpp:40
MSRailCrossing::myMinGreenTime
SUMOTime myMinGreenTime
minimum green time
Definition: MSRailCrossing.h:152
MSRailCrossing
A signal for rails.
Definition: MSRailCrossing.h:38
MSRailCrossing::adaptLinkInformationFrom
void adaptLinkInformationFrom(const MSTrafficLightLogic &logic)
Applies information about controlled links and lanes from the given logic.
Definition: MSRailCrossing.cpp:71
MSPhaseDefinition.h
MSRailCrossing::addLink
void addLink(MSLink *link, MSLane *lane, int pos)
Adds a link on building.
Definition: MSRailCrossing.cpp:150
config.h
MSTLLogicControl
A class that stores and controls tls and switching of their programs.
Definition: MSTLLogicControl.h:59
MSRailCrossing::mySecurityGap
SUMOTime mySecurityGap
minimum time gap between closing the crossing (end of yellow time) and train passing the crossing
Definition: MSRailCrossing.h:149
MSRailCrossing::myYellowTime
SUMOTime myYellowTime
minimum green time
Definition: MSRailCrossing.h:155
MSRailCrossing::updateCurrentPhase
SUMOTime updateCurrentPhase()
updates the current phase of the signal
Definition: MSRailCrossing.cpp:87
NLDetectorBuilder
Builds detectors for microsim.
Definition: NLDetectorBuilder.h:55