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