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-2018 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& subid,
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 
101  const std::string getLogicType() const {
102  return "railCrossing";
103  }
105 
106 
109 
114  SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const;
115 
116 
122  SUMOTime getOffsetFromIndex(int index) const;
123 
124 
130  int getIndexFromOffset(SUMOTime offset) const;
132 
133 
136 
144  void changeStepAndDuration(MSTLLogicControl& tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration) {
145  UNUSED_PARAMETER(tlcontrol);
146  UNUSED_PARAMETER(simStep);
147  UNUSED_PARAMETER(step);
148  UNUSED_PARAMETER(stepDuration);
149  }
151 
152 protected:
153 
155  std::vector<MSLink*> myIncomingRailLinks;
156 
157 protected:
158 
159 
162 
165 
168 
169 };
170 
171 
172 #endif
173 
174 /****************************************************************************/
175 
Builds detectors for microsim.
long long int SUMOTime
Definition: SUMOTime.h:36
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:33
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
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:71
SUMOTime myMinGreenTime
minimum green time