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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A rail signal logic
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
24 #include "MSPhaseDefinition.h"
25 #include "MSTLLogicControl.h"
26 
27 
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
37 public:
45  const std::string& id, const std::string& programID, SUMOTime delay,
46  const std::map<std::string, std::string>& parameters);
47 
48 
53  void init(NLDetectorBuilder& nb);
54 
55 
58 
61 
67  void addLink(MSLink* link, MSLane* lane, int pos);
68 
75 
76 
79 
80 
83 
89 
91 
92 
95 
100  SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const;
101 
102 
108  SUMOTime getOffsetFromIndex(int index) const;
109 
110 
116  int getIndexFromOffset(SUMOTime offset) const;
118 
119 
122 
130  void changeStepAndDuration(MSTLLogicControl& tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration) {
131  UNUSED_PARAMETER(tlcontrol);
132  UNUSED_PARAMETER(simStep);
133  UNUSED_PARAMETER(step);
134  UNUSED_PARAMETER(stepDuration);
135  }
137 
138 protected:
139 
141  std::vector<MSLink*> myIncomingRailLinks;
142 
143 protected:
144 
145 
148 
151 
154 
155 };
long long int SUMOTime
Definition: SUMOTime.h:31
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:29
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
A signal for rails.
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.
SUMOTime myYellowTime
minimum green time
SUMOTime mySecurityGap
minimum time gap between closing the crossing (end of yellow time) and train passing the crossing
int getIndexFromOffset(SUMOTime offset) const
Returns the step (the phasenumber) of a given position of the cycle.
~MSRailCrossing()
Destructor.
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.
SUMOTime trySwitch()
Switches to the next phase.
MSRailCrossing(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, SUMOTime delay, const std::map< std::string, std::string > &parameters)
Constructor.
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
std::vector< MSLink * > myIncomingRailLinks
The incoming rail links.
void addLink(MSLink *link, MSLane *lane, int pos)
Adds a link on building.
SUMOTime myMinGreenTime
minimum green time
A fixed traffic light logic.
A class that stores and controls tls and switching of their programs.
The parent class for traffic light logics.
Builds detectors for microsim.