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& 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 
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.
MSRailCrossing(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const std::map< std::string, std::string > &parameters)
Constructor.
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.
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:78
SUMOTime myMinGreenTime
minimum green time