SUMO - Simulation of Urban MObility
MSRailCrossing.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // A rail signal logic
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef MSRailCrossing_h
21 #define MSRailCrossing_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
34 #include "MSPhaseDefinition.h"
35 #include "MSTLLogicControl.h"
36 
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
47 public:
55  const std::string& id, const std::string& subid,
56  const std::map<std::string, std::string>& parameters);
57 
58 
63  void init(NLDetectorBuilder& nb);
64 
65 
68 
71 
77  void addLink(MSLink* link, MSLane* lane, int pos);
78 
85 
86 
89 
90 
93 
99 
101 
102 
105 
108  const std::string getLogicType() const {
109  return "railCrossing";
110  }
112 
113 
116 
121  SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const;
122 
123 
129  SUMOTime getOffsetFromIndex(int index) const;
130 
131 
137  int getIndexFromOffset(SUMOTime offset) const;
139 
140 
143 
151  void changeStepAndDuration(MSTLLogicControl& tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration) {
152  UNUSED_PARAMETER(tlcontrol);
153  UNUSED_PARAMETER(simStep);
154  UNUSED_PARAMETER(step);
155  UNUSED_PARAMETER(stepDuration);
156  }
158 
159 protected:
160 
162  std::vector<MSLink*> myIncomingRailLinks;
163 
164 protected:
165 
166 
169 
172 
175 
176 };
177 
178 
179 #endif
180 
181 /****************************************************************************/
182 
SUMOTime getOffsetFromIndex(int index) const
Returns the position (start of a phase during a cycle) from of a given step.
Builds detectors for microsim.
long long int SUMOTime
Definition: SUMOTime.h:43
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.
const std::string getLogicType() const
Returns the type of the logic as a string.
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.
A class that stores and controls tls and switching of their programs.
A signal for rails.
SUMOTime mySecurityGap
minimum time gap between closing the crossing (end of yellow time) and train passing the crossing ...
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.
SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const
Returns the index of the logic at the given simulation step.
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:79
SUMOTime myMinGreenTime
minimum green time