83 #ifdef DEBUG_REGISTER_DRIVEWAY
84 std::cout <<
"MSRailSignalControl edge=" << edge->getID() <<
" used by vehicle " << vehicle->
getID() <<
". Updating " <<
myProtectedDriveways[edge].size() <<
" driveways\n";
101 #ifdef DEBUG_REGISTER_DRIVEWAY
102 std::cout <<
"MSRailSignalControl edge=" << protectedBidi->
getID() <<
" assumed secure by driveway " << driveWayID <<
" at signal " << rs->
getID() <<
"\n";
109 item.first->updateDriveway(item.second);
126 if (item.second < item2.second) {
127 bool conflict =
false;
128 std::pair<int, int> code(item.second, item2.second);
131 conflict = it->second;
141 #ifdef DEBUG_RECHECKGREEN
152 state[item.first->getTLIndex()] =
'r';
155 #ifdef DEBUG_RECHECKGREEN
156 std::cout <<
SIMTIME <<
" reset to red " << getClickableTLLinkID(item.first)
157 <<
" (" << veh.first->getID() <<
" yields to " << veh2.first->getID() <<
"\n";
159 #ifdef DEBUG_SIGNALSTATE
161 std::cout <<
SIMTIME <<
" reset to red " << getClickableTLLinkID(item.first)
162 <<
" (" << veh.first->getID() <<
" yields to " << veh2.first->getID() <<
"\n";
167 state[item2.first->getTLIndex()] =
'r';
170 #ifdef DEBUG_RECHECKGREEN
171 std::cout <<
SIMTIME <<
" reset to red " << getClickableTLLinkID(item2.first)
172 <<
" (" << veh2.first->getID() <<
" yields to " << veh.first->getID() <<
"\n";
174 #ifdef DEBUG_SIGNALSTATE
176 std::cout <<
SIMTIME <<
" reset to red " << getClickableTLLinkID(item2.first)
177 <<
" (" << veh2.first->getID() <<
" yields to " << veh.first->getID() <<
"\n";
#define DEBUG_HELPER(obj)
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permissions is a railway edge.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A road/street connecting two junctions.
VehicleState
Definition of a vehicle state.
@ BUILT
The vehicle was built, but has not yet departed.
@ NEWROUTE
The vehicle got a new route.
@ DEPARTED
The vehicle has departed (was inserted into the network)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
The definition of a single phase of a tls logic.
const std::string & getState() const
Returns the state within this phase.
void addSignal(MSRailSignal *signal)
void vehicleStateChanged(const SUMOVehicle *const vehicle, MSNet::VehicleState to, const std::string &info="")
Called if a vehicle changes its state.
std::map< const MSEdge *, std::vector< std::pair< MSRailSignal *, int > > > myProtectedDriveways
map of driveways that must perform additional checks if the key edge is used by a train route
std::vector< MSRailSignal * > mySignals
list of all rail signals
MSRailSignalControl()
Constructor.
std::set< const MSEdge * > myUsedEdges
all rail edges that are part of a known route
void recheckGreen()
final check for driveway compatibility of signals that switched green in this step
static MSRailSignalControl * myInstance
static MSRailSignalControl & getInstance()
void updateDriveways(const MSEdge *used)
compute additioanl deadlock-check requirements for registered driveways
std::map< std::pair< int, int >, bool > myDriveWayCompatibility
static void clearState()
Perform resets events when quick-loading state.
std::vector< std::pair< MSLink *, int > > mySwitchedGreenFlanks
list of signals that switched green along with driveway index
void registerProtectedDriveway(MSRailSignal *rs, int driveWayID, const MSEdge *protectedBidi)
mark driveway that must receive additional checks if protectedBidi is ever used by a train route
static Approaching getClosest(MSLink *link)
get the closest vehicle approaching the given link
std::pair< const SUMOVehicle *const, const MSLink::ApproachingVehicleInformation > Approaching
const DriveWay & retrieveDriveWay(int numericalID) const
const MSPhaseDefinition & getCurrentPhaseDef() const override
Returns the definition of the current phase.
static void initDriveWays(const SUMOVehicle *ego, bool update)
const ConstMSEdgeVector & getEdges() const
bool setTrafficLightSignals(SUMOTime t) const
Applies the current signal states to controlled links.
const std::string & getID() const
Returns the id.
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
Representation of a vehicle.
virtual const MSRoute & getRoute() const =0
Returns the current route.
virtual bool hasDeparted() const =0
Returns whether this vehicle has departed.
std::vector< const MSEdge * > myRoute
list of edges for matching against train routes
bool flankConflict(const DriveWay &other) const
Wether there is a flank conflict with the given driveway.
static bool mustYield(const Approaching &veh, const Approaching &foe)
Whether veh must yield to the foe train.