 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
19 #ifndef MSDevice_ToC_h
20 #define MSDevice_ToC_h
40 class Command_ToCTrigger;
41 class Command_ToCProcess;
57 static std::set<MSDevice_ToC*, ComparatorNumericalIdLess>
myInstances;
93 static const std::set<MSDevice_ToC*, ComparatorNumericalIdLess>&
getInstances() {
143 double newSpeed)
override;
146 std::string
getParameter(
const std::string& key)
const override;
149 void setParameter(
const std::string& key,
const std::string& value)
override;
200 const std::string& manualType,
const std::string& automatedType,
SUMOTime responseTime,
double recoveryRate,
201 double lcAbstinence,
double initialAwareness,
double mrmDecel,
202 double dynamicToCThreshold,
double dynamicMRMProbability,
double maxPreparationAccel,
203 bool mrmKeepRight,
const std::string& mrmSafeSpot,
SUMOTime mrmSafeSpotDuration,
bool useColorScheme, OpenGapParams ogp);
315 std::queue<std::pair<SUMOTime, std::string> >
myEvents;
363 return MIN2(2 * sqrt(leadTime), 0.7 * leadTime);
bool myUseColorScheme
Whether a coloring scheme shall by applied to indicate the different toc stages,.
Representation of a vehicle or person.
std::queue< std::pair< SUMOTime, std::string > > myEvents
Storage for events to be written to the output.
std::string myManualTypeID
vehicle type ID for manual driving
std::string myMRMSafeSpot
stop vehicle tries to reach during MRM
bool isAutomated()
Whether the current operation mode is automated.
ToCState
Enum describing the different regimes for the device,.
int myPreviousLCMode
LC mode overridden during MRM, stored for restoration.
void descheduleMRM()
Break MRM Process or remove MRM-Trigger command from the event-queue.
SUMOTime triggerUpwardToC(SUMOTime t)
Trigger execution of a ToC X-->AUTOMATED ("upwards")
OpenGapParams(double timegap, double spacing, double changeRate, double maxDecel, bool active)
bool generatesOutput()
Whether this device requested to write output.
Static storage of an output device and its base (abstract) implementation.
MSVehicle * myHolderMS
The holder vehicle casted to MSVehicle*.
double sampleResponseTime(double leadTime) const
Samples a random driver response time from a truncated Gaussian with parameters according to the look...
WrappingCommand< MSDevice_ToC > * myExecuteMRMCommand
SUMOTime myMRMSafeSpotDuration
duration at stop vehicle tries to reach during MRM
SUMOTime triggerDownwardToC(SUMOTime t)
Trigger execution of a ToC X-->MANUAL ("downwards")
void requestToC(SUMOTime timeTillMRM, SUMOTime responseTime=-1000)
Request a ToC. If the device is in AUTOMATED or MRM state, a driver response time is sampled and the ...
double myCurrentAwareness
Current awareness-level of the driver in [0,1].
std::queue< std::pair< std::string, double > > myEventLanes
Storage for events to be written to the output.
void descheduleRecovery()
Remove ongoing awareness recovery process from the event-queue.
const std::string deviceName() const override
return the name for this type of device
double myMaxPreparationAccel
Maximal acceleration that may be applied during the ToC preparation phase TODO: Make effective.
Representation of a vehicle.
static double responseTimeMean(double leadTime)
Mean of the response time distribution. (Only depends on given lead time)
static std::mt19937 myResponseTimeRNG
Random generator for ToC devices.
MSDevice_ToC(SUMOVehicle &holder, const std::string &id, const std::string &outputFilename, const std::string &manualType, const std::string &automatedType, SUMOTime responseTime, double recoveryRate, double lcAbstinence, double initialAwareness, double mrmDecel, double dynamicToCThreshold, double dynamicMRMProbability, double maxPreparationAccel, bool mrmKeepRight, const std::string &mrmSafeSpot, SUMOTime mrmSafeSpotDuration, bool useColorScheme, OpenGapParams ogp)
Constructor.
static ToCState _2ToCState(const std::string &)
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
static double getDynamicMRMProbability(const SUMOVehicle &v, const OptionsCont &oc)
void setState(ToCState state)
Set the ToC device's state.
void initColorScheme()
Initialize vehicle colors for different states.
void resetDeliberateLCs()
Resets the holder's LC mode to the last differing to LCModeMRM.
The ToC Device controls transition of control between automated and manual driving.
~MSDevice_ToC()
Destructor.
static std::vector< double > lookupResponseTimeLeadTimes
void switchHolderType(const std::string &targetTypeID)
Switch the device holder's vehicle type.
double myDynamicToCThreshold
Duration in s. for which the vehicle needs to be able to follow its route without a lane change to co...
static std::vector< double > lookupResponseTimeMRMProbs
Grid of the response time distribution.
SUMOTime triggerMRM(SUMOTime t)
Trigger execution of an MRM.
double myMRMProbability
Probability of an MRM to occur after a dynamically triggered ToC.
double myInitialAwareness
Average awareness the driver has initially after a ToC.
std::map< ToCState, RGBColor > myColorScheme
Coloring scheme,.
static double interpolateVariance(double leadTime, double pMRM)
Two-dimensional interpolation of variance from lookup table assumes pMRM >= 0, leadTime >= 0.
static std::vector< std::vector< double > > lookupResponseTimeVariances
Variances of the response time distribution. Given the lead time and the MRM probability the variance...
ToCState myState
Current state of the device.
void setAwareness(double value)
Set the awareness to the given value.
OutputDevice * myOutputFile
The file the devices output goes to.
double myOriginalMaxAccel
Storage for original maximal acceleration of vehicle.
A storage for options typed value containers)
SUMOTime ToCPreparationStep(SUMOTime t)
Continue the ToC preparation for one time step.
SUMOTime MRMExecutionStep(SUMOTime t)
Continue the MRM for one time step.
bool myMRMKeepRight
Whether vehicle tries to change to the right during an MRM.
void descheduleToCPreparation()
Remove ongoing ToC-Preparation process from the event-queue.
static std::set< MSDevice_ToC *, ComparatorNumericalIdLess > myInstances
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_ToC-options.
MSDevice_ToC & operator=(const MSDevice_ToC &)
Invalidated assignment operator.
void descheduleToC()
Remove scheduled ToC-Trigger command from the event-queue.
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed) override
Return value indicates whether the device still wants to be notified about the vehicle movement.
bool isManuallyDriven()
Whether the current operation mode is manual.
static std::string _2string(ToCState state)
bool checkDynamicToC()
Check if the vehicle should induce a ToC due to internal reasons. That is, if the route cannot be fol...
static OpenGapParams getOpenGapParams(const SUMOVehicle &v, const OptionsCont &oc)
std::string getParameter(const std::string &key) const override
try to retrieve the given parameter from this device. Throw exception for unsupported key
void requestMRM()
Request an MRM to be initiated immediately. No downward ToC will be scheduled.
void deactivateDeliberateLCs()
Resets the holder's LC mode to the operational LC-mode of the ToC Device (.
static std::set< std::string > createdOutputFiles
int myDynamicToCLane
Lane, on which the ongoing dynamic ToC was issued. It can only be aborted if the lane was changed.
static std::string getOutputFilename(const SUMOVehicle &v, const OptionsCont &oc)
WrappingCommand< MSDevice_ToC > * myPrepareToCCommand
WrappingCommand< MSDevice_ToC > * myTriggerMRMCommand
OpenGapParams myOpenGapParams
Parameters for the openGap mechanism applied during ToC preparation phase.
double myMRMDecel
Deceleration rate applied during MRM.
std::string myAutomatedTypeID
vehicle type ID for automated driving
double myRecoveryRate
Recovery rate for the driver's awareness after a ToC.
void setParameter(const std::string &key, const std::string &value) override
try to set the given parameter for this device. Throw exception for unsupported key
bool myDynamicToCActive
Switch for considering dynamic ToCs,.
WrappingCommand< MSDevice_ToC > * myRecoverAwarenessCommand
void writeOutput()
Write output to file given by option device.toc.file.
static std::mt19937 * getResponseTimeRNG()
WrappingCommand< MSDevice_ToC > * myTriggerToCCommand
static int LCModeMRM
LC mode operational during an MRM.
static const std::set< MSDevice_ToC *, ComparatorNumericalIdLess > & getInstances()
returns all currently existing ToC devices
static void cleanup()
Closes root tags of output files.
SUMOTime awarenessRecoveryStep(SUMOTime t)
Continue the awareness recovery for one time step.
bool myIssuedDynamicToC
Flag to indicate that a dynamically triggered ToC is in preparation.
Representation of a vehicle in the micro simulation.
SUMOTime myResponseTime
Average response time needed by the driver to take back control.
Abstract in-vehicle device.
double myLCAbstinence
Level of the awareness below which no lane-changes are performed.