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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // A rail signal logic
18 /****************************************************************************/
19 #ifndef MSRailCrossing_h
20 #define MSRailCrossing_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
33 #include "MSPhaseDefinition.h"
34 #include "MSTLLogicControl.h"
35 
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
46 public:
54  const std::string& id, const std::string& subid,
55  const std::map<std::string, std::string>& parameters);
56 
57 
62  void init(NLDetectorBuilder& nb);
63 
64 
67 
70 
76  void addLink(MSLink* link, MSLane* lane, int pos);
77 
84 
85 
88 
89 
92 
98 
100 
101 
104 
107  const std::string getLogicType() const {
108  return "railCrossing";
109  }
111 
112 
115 
120  SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const;
121 
122 
128  SUMOTime getOffsetFromIndex(int index) const;
129 
130 
136  int getIndexFromOffset(SUMOTime offset) const;
138 
139 
142 
150  void changeStepAndDuration(MSTLLogicControl& tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration) {
151  UNUSED_PARAMETER(tlcontrol);
152  UNUSED_PARAMETER(simStep);
153  UNUSED_PARAMETER(step);
154  UNUSED_PARAMETER(stepDuration);
155  }
157 
158 protected:
159 
161  std::vector<MSLink*> myIncomingRailLinks;
162 
163 protected:
164 
165 
168 
171 
174 
175 };
176 
177 
178 #endif
179 
180 /****************************************************************************/
181 
Builds detectors for microsim.
int getIndexFromOffset(SUMOTime offset) const
Returns the step (the phasenumber) of a given position of the cycle.
void adaptLinkInformationFrom(const MSTrafficLightLogic &logic)
Applies information about controlled links and lanes from the given logic.
SUMOTime updateCurrentPhase()
updates the current phase of the signal
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
A fixed traffic light logic.
~MSRailCrossing()
Destructor.
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.
A class that stores and controls tls and switching of their programs.
const std::string getLogicType() const
Returns the type of the logic as a string.
A signal for rails.
SUMOTime mySecurityGap
minimum time gap between closing the crossing (end of yellow time) and train passing the crossing ...
SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const
Returns the index of the logic at the given simulation step.
MSRailCrossing(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &subid, const std::map< std::string, std::string > &parameters)
Constructor.
void addLink(MSLink *link, MSLane *lane, int pos)
Adds a link on building.
void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)
Changes the current phase and her duration.
The parent class for traffic light logics.
SUMOTime myYellowTime
minimum green time
long long int SUMOTime
Definition: TraCIDefs.h:51
SUMOTime trySwitch()
Switches to the next phase.
std::vector< MSLink * > myIncomingRailLinks
The incoming rail links.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
SUMOTime myMinGreenTime
minimum green time