 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
18 #ifndef MSRailSignal_h
19 #define MSRailSignal_h
56 const std::string&
id,
const std::string& programID,
57 const std::map<std::string, std::string>& parameters);
210 typedef std::pair<const SUMOVehicle* const, const MSLink::ApproachingVehicleInformation>
Approaching;
211 typedef std::set<const MSLane*, ComparatorNumericalIdLess>
LaneSet;
306 void checkFlanks(
const std::vector<MSLane*>& lanes,
const LaneSet& visited,
bool allFoes);
330 std::string
getID()
const;
358 static std::string
describeLinks(std::vector<MSLink*> links);
#define UNUSED_PARAMETER(x)
std::vector< const MSLane * > myConflictLanes
the lanes that must be clear of trains before this signal can switch to green
void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)
Changes the current phase and her duration.
SUMOTime getOffsetFromIndex(int index) const
Returns the position (start of a phase during a cycle) from of a given step.
int getIndexFromOffset(SUMOTime offset) const
Returns the step (the phasenumber) of a given position of the cycle.
int myIndex
index in the list of driveways
Representation of a lane in the micro simulation.
SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const
Returns the index of the logic at the given simulation step.
SUMOTime trySwitch()
Switches to the next phase.
Static storage of an output device and its base (abstract) implementation.
std::vector< MSLink * > myProtectingSwitches
ConstMSEdgeVector::const_iterator MSRouteIterator
void buildRoute(MSLink *origin, double length, MSRouteIterator next, MSRouteIterator end, LaneSet &visited)
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
bool hasLinkConflict(const Approaching &closest, MSLink *foeLink) const
Whether the approaching vehicle is prevent from driving by another vehicle approaching the given link...
LinkInfo(MSLink *link)
constructor
int myPhaseIndex
MSTrafficLightLogic requires that the phase index changes whenever signals change their state.
std::vector< MSLane * > myBidi
Representation of a vehicle.
void init(NLDetectorBuilder &nb)
Initialises the rail signal with information about adjacent rail signals.
int getPhaseNumber() const
Returns the number of phases.
const Phases & getPhases() const
Returns the phases of this tls program.
bool overlap(const DriveWay &other) const
Wether this driveway overlaps with the given one.
static std::string getTLLinkID(MSLink *link)
return logicID_linkIndex
void findFlankProtection(MSLink *link, double length, LaneSet &visited, MSLink *origLink)
find upstream protection from the given link
std::vector< const MSLane * > myFlank
std::set< const MSLane *, ComparatorNumericalIdLess > LaneSet
void checkCrossingFlanks(MSLink *dwLink, const LaneSet &visited)
find links that cross the driveway without entering it
void adaptLinkInformationFrom(const MSTrafficLightLogic &logic)
Applies information about controlled links and lanes from the given logic.
SUMOVehicle * myLastRerouteVehicle
std::vector< DriveWay > myDriveways
all driveways immediately following this link
SUMOTime myLastRerouteTime
bool conflictLinkApproached() const
Whether any of the conflict linkes have approaching vehicles.
static Approaching getClosest(MSLink *link)
get the closest vehicle approaching the given link
static std::string getClickableTLLinkID(MSLink *link)
return logicID_linkIndex in a way that allows clicking in sumo-gui
DriveWay & getDriveWay(const SUMOVehicle *)
retrieve an existing Driveway or construct a new driveway based on the vehicles route
DriveWay(int index)
Constructor.
int getCurrentPhaseIndex() const
Returns the current index within the program.
MSRailSignal(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const std::map< std::string, std::string > ¶meters)
Constructor.
double myMaxFlankLength
the maximum flank length searched while building this driveway
static std::string describeLinks(std::vector< MSLink * > links)
print link descriptions
std::pair< const SUMOVehicle *const, const MSLink::ApproachingVehicleInformation > Approaching
void checkFlanks(const std::vector< MSLane * > &lanes, const LaneSet &visited, bool allFoes)
find switches that threathen this driveway
bool findProtection(const Approaching &veh, MSLink *link) const
find protection for the given vehicle starting at a switch
void writeBlocks(OutputDevice &od) const
write rail signal block output for all links and driveways
MSPhaseDefinition myCurrentPhase
The current phase.
bool myUniqueDriveWay
whether there is only a single DriveWay following this link
void addLink(MSLink *link, MSLane *lane, int pos)
Adds a link on building.
const SUMOVehicle * myActive
whether the current signal is switched green for a train approaching this block
std::vector< const MSEdge * > myRoute
list of lanes for matching against train routes
~MSRailSignal()
Destructor.
The parent class for traffic light logics.
std::string getID() const
return id for this railsignal-link
void reroute(SUMOVehicle *veh, const MSEdgeVector &occupied)
try rerouting vehicle if reservation failed
Phases myPhases
The list of phases this logic uses.
std::vector< MSEdge * > MSEdgeVector
bool conflictLaneOccupied() const
whether any of myConflictLanes is occupied
std::vector< MSLink * > myFlankSwitches
static bool hasOncomingRailTraffic(MSLink *link)
void updateCurrentPhase()
returns the state of the signal that actually required
A class that stores and controls tls and switching of their programs.
bool reserve(const Approaching &closest, MSEdgeVector &occupied)
attempt reserve this driveway for the given vehicle
std::vector< LinkInfo > myLinkInfos
data storage for every link at this node (more than one when directly guarding a switch)
The definition of a single phase of a tls logic.
const MSPhaseDefinition & getCurrentPhaseDef() const
Returns the definition of the current phase.
std::vector< MSLane * > myForward
void writeBlocks(OutputDevice &od) const
Write block items for this driveway.
const MSPhaseDefinition & getPhase(int givenstep) const
Returns the definition of the phase from the given position within the plan.
Builds detectors for microsim.
std::vector< MSLink * > myConflictLinks
DriveWay & buildDriveWay(MSRouteIterator first, MSRouteIterator end)
construct a new driveway by searching along the given route until all block structures are found