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 /****************************************************************************/
15 // A rail signal logic
16 /****************************************************************************/
17 #ifndef MSRailCrossing_h
18 #define MSRailCrossing_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
27 #include "MSPhaseDefinition.h"
28 #include "MSTLLogicControl.h"
29 
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
40 public:
48  const std::string& id, const std::string& programID,
49  const std::map<std::string, std::string>& parameters);
50 
51 
56  void init(NLDetectorBuilder& nb);
57 
58 
61 
64 
70  void addLink(MSLink* link, MSLane* lane, int pos);
71 
78 
79 
82 
83 
86 
92 
94 
95 
98 
103  SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const;
104 
105 
111  SUMOTime getOffsetFromIndex(int index) const;
112 
113 
119  int getIndexFromOffset(SUMOTime offset) const;
121 
122 
125 
133  void changeStepAndDuration(MSTLLogicControl& tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration) {
134  UNUSED_PARAMETER(tlcontrol);
135  UNUSED_PARAMETER(simStep);
136  UNUSED_PARAMETER(step);
137  UNUSED_PARAMETER(stepDuration);
138  }
140 
141 protected:
142 
144  std::vector<MSLink*> myIncomingRailLinks;
145 
146 protected:
147 
148 
151 
154 
157 
158 };
159 
160 
161 #endif
162 
163 /****************************************************************************/
164 
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
MSTLLogicControl.h
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
MSRailCrossing::~MSRailCrossing
~MSRailCrossing()
Destructor.
Definition: MSRailCrossing.cpp:67
MSSimpleTrafficLightLogic.h
MSRailCrossing::changeStepAndDuration
void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)
Changes the current phase and her duration.
Definition: MSRailCrossing.h:133
MSRailCrossing::getIndexFromOffset
int getIndexFromOffset(SUMOTime offset) const
Returns the step (the phasenumber) of a given position of the cycle.
Definition: MSRailCrossing.cpp:145
MSRailCrossing::init
void init(NLDetectorBuilder &nb)
Initialises the rail signal with information about adjacent rail signals.
Definition: MSRailCrossing.cpp:55
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:140
MSRailCrossing::getPhaseIndexAtTime
SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const
Returns the index of the logic at the given simulation step.
Definition: MSRailCrossing.cpp:135
MSSimpleTrafficLightLogic
A fixed traffic light logic.
Definition: MSSimpleTrafficLightLogic.h:55
MSRailCrossing::trySwitch
SUMOTime trySwitch()
Switches to the next phase.
Definition: MSRailCrossing.cpp:80
MSRailCrossing::MSRailCrossing
MSRailCrossing(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const std::map< std::string, std::string > &parameters)
Constructor.
Definition: MSRailCrossing.cpp:41
MSTrafficLightLogic
The parent class for traffic light logics.
Definition: MSTrafficLightLogic.h:56
MSRailCrossing::myIncomingRailLinks
std::vector< MSLink * > myIncomingRailLinks
The incoming rail links.
Definition: MSRailCrossing.h:144
MSRailCrossing::myMinGreenTime
SUMOTime myMinGreenTime
minimum green time
Definition: MSRailCrossing.h:153
MSRailCrossing
A signal for rails.
Definition: MSRailCrossing.h:39
MSRailCrossing::adaptLinkInformationFrom
void adaptLinkInformationFrom(const MSTrafficLightLogic &logic)
Applies information about controlled links and lanes from the given logic.
Definition: MSRailCrossing.cpp:72
MSPhaseDefinition.h
MSRailCrossing::addLink
void addLink(MSLink *link, MSLane *lane, int pos)
Adds a link on building.
Definition: MSRailCrossing.cpp:151
config.h
MSTLLogicControl
A class that stores and controls tls and switching of their programs.
Definition: MSTLLogicControl.h:60
MSRailCrossing::mySecurityGap
SUMOTime mySecurityGap
minimum time gap between closing the crossing (end of yellow time) and train passing the crossing
Definition: MSRailCrossing.h:150
MSRailCrossing::myYellowTime
SUMOTime myYellowTime
minimum green time
Definition: MSRailCrossing.h:156
MSRailCrossing::updateCurrentPhase
SUMOTime updateCurrentPhase()
updates the current phase of the signal
Definition: MSRailCrossing.cpp:88
NLDetectorBuilder
Builds detectors for microsim.
Definition: NLDetectorBuilder.h:56