20 #ifndef MSDevice_ToC_h 21 #define MSDevice_ToC_h 39 class Command_ToCTrigger;
40 class Command_ToCProcess;
66 OpenGapParams(
double timegap,
double spacing,
double changeRate,
double maxDecel,
bool active) :
67 newTimeHeadway(timegap), newSpaceHeadway(spacing), changeRate(changeRate), maxDecel(maxDecel), active(active)
149 void setParameter(
const std::string& key,
const std::string& value);
198 std::string manualType, std::string automatedType,
SUMOTime responseTime,
double recoveryRate,
302 std::queue<std::pair<SUMOTime, std::string> >
myEvents;
int myPreviousLCMode
LC mode overridden during MRM, stored for restoration.
static int LCModeMRM
LC mode operational during an MRM.
static std::string getManualType(const SUMOVehicle &v, const OptionsCont &oc)
Representation of a vehicle in the micro simulation.
void descheduleRecovery()
Remove ongoing awareness recovery process from the event-queue.
ToCState myState
Current state of the device.
std::queue< std::pair< SUMOTime, std::string > > myEvents
Storage for events to be written to the output.
bool isAutomated()
Whether the current operation mode is automated.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_ToC-options.
static double getLCAbstinence(const SUMOVehicle &v, const OptionsCont &oc)
static double getRecoveryRate(const SUMOVehicle &v, const OptionsCont &oc)
SUMOTime MRMExecutionStep(SUMOTime t)
Continue the MRM for one time step.
bool isManuallyDriven()
Whether the current operation mode is manual.
void descheduleToCPreparation()
Remove ongoing ToC-Preparation process from the event-queue.
static ToCState _2ToCState(const std::string &)
static std::set< MSDevice_ToC * > instances
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")
static OpenGapParams getOpenGapParams(const SUMOVehicle &v, const OptionsCont &oc)
MSDevice_ToC & operator=(const MSDevice_ToC &)
Invalidated assignment operator.
WrappingCommand< MSDevice_ToC > * myExecuteMRMCommand
static double getResponseTime(const SUMOVehicle &v, const OptionsCont &oc)
static std::set< std::string > createdOutputFiles
void initColorScheme()
Initialize vehicle colors for different states.
static std::string _2string(ToCState state)
SUMOTime triggerDownwardToC(SUMOTime t)
Trigger execution of a ToC X–>MANUAL ("downwards")
static bool useColorScheme(const SUMOVehicle &v, const OptionsCont &oc)
std::string myAutomatedTypeID
vehicle type ID for automated driving
void requestToC(SUMOTime timeTillMRM)
Request a ToC. If the device is in AUTOMATED or MRM state, a driver response time is sampled and the ...
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 (.
MSDevice_ToC(SUMOVehicle &holder, const std::string &id, const std::string &outputFilename, std::string manualType, std::string automatedType, SUMOTime responseTime, double recoveryRate, double lcAbstinence, double initialAwareness, double mrmDecel, bool useColorScheme, OpenGapParams ogp)
Constructor.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice *> &into)
Build devices for the given vehicle, if needed.
WrappingCommand< MSDevice_ToC > * myTriggerMRMCommand
static void cleanup()
Closes root tags of output files.
static std::string getOutputFilename(const SUMOVehicle &v, const OptionsCont &oc)
void setAwareness(double value)
Set the awareness to the given value.
SUMOTime ensureDriverStateExistence(SUMOTime)
Ensure existence of DriverState for equipped vehicles.
bool myUseColorScheme
Whether a coloring scheme shall by applied to indicate the different toc stages,. ...
Representation of a vehicle.
OutputDevice * myOutputFile
The file the devices output goes to.
double myLCAbstinence
Level of the awareness below which no lane-changes are performed.
ToCState
Enum describing the different regimes for the device,.
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key ...
MSVehicle * myHolderMS
The holder vehicle casted to MSVehicle*.
SUMOTime myResponseTime
Average response time needed by the driver to take back control.
static double getMRMDecel(const SUMOVehicle &v, const OptionsCont &oc)
static const std::set< MSDevice_ToC * > & getInstances()
returns all currently existing ToC devices
std::string myManualTypeID
vehicle type ID for manual driving
double myCurrentAwareness
Current awareness-level of the driver in [0,1].
static double getInitialAwareness(const SUMOVehicle &v, const OptionsCont &oc)
SUMOTime ToCPreparationStep(SUMOTime t)
Continue the ToC preparation for one time step.
OpenGapParams(double timegap, double spacing, double changeRate, double maxDecel, bool active)
A storage for options typed value containers)
Abstract in-vehicle device.
void setState(ToCState state)
Set the ToC device's state.
void descheduleToC()
Remove scheduled ToC-Trigger command from the event-queue.
double myRecoveryRate
Recovery rate for the driver's awareness after a ToC.
Static storage of an output device and its base (abstract) implementation.
WrappingCommand< MSDevice_ToC > * myRecoverAwarenessCommand
SUMOTime awarenessRecoveryStep(SUMOTime t)
Continue the awareness recovery for one time step.
~MSDevice_ToC()
Destructor.
void resetDeliberateLCs()
Resets the holder's LC mode to the last differing to LCModeMRM.
WrappingCommand< MSDevice_ToC > * myTriggerToCCommand
const std::string deviceName() const
return the name for this type of device
void switchHolderType(const std::string &targetTypeID)
Switch the device holder's vehicle type.
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key ...
OpenGapParams myOpenGapParams
Parameters for the openGap mechanism applied during ToC preparation phase.
SUMOTime triggerMRM(SUMOTime t)
Trigger execution of an MRM.
WrappingCommand< MSDevice_ToC > * myPrepareToCCommand
std::map< ToCState, RGBColor > myColorScheme
Coloring scheme,.
bool generatesOutput()
Whether this device requested to write output.
The ToC Device controls transition of control between automated and manual driving.
void writeOutput()
Write output to file given by option device.toc.file.
double myMRMDecel
Deceleration rate applied during MRM.
double myInitialAwareness
Average awareness the driver has initially after a ToC.
static std::string getAutomatedType(const SUMOVehicle &v, const OptionsCont &oc)