Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSSimpleDriverState Class Reference

Provides an interface to an error whose fluctuation is controlled via the driver's 'awareness', which can be controlled externally,. More...

#include <MSDriverState.h>

Collaboration diagram for MSSimpleDriverState:
[legend]

Public Member Functions

bool debugLocked () const
 
void lockDebug ()
 
 MSSimpleDriverState (MSVehicle *veh)
 
void unlockDebug ()
 
void update ()
 Trigger updates for the errorProcess, assumed gaps, etc.
 
void updateAssumedGaps ()
 Update the assumed gaps to the known objects according to the corresponding perceived speed differences.
 
virtual ~MSSimpleDriverState ()
 
Getter methods
double getMinAwareness () const
 
double getInitialAwareness () const
 
double getErrorTimeScaleCoefficient () const
 
double getErrorNoiseIntensityCoefficient () const
 
double getErrorTimeScale () const
 
double getErrorNoiseIntensity () const
 
double getSpeedDifferenceErrorCoefficient () const
 
double getHeadwayErrorCoefficient () const
 
double getFreeSpeedErrorCoefficient () const
 
double getSpeedDifferenceChangePerceptionThreshold () const
 
double getHeadwayChangePerceptionThreshold () const
 
double getAwareness () const
 
double getMaximalReactionTime () const
 
double getOriginalReactionTime () const
 
double getActionStepLength () const
 
double getErrorState () const
 
Setter methods
void setMinAwareness (const double value)
 
void setInitialAwareness (const double value)
 
void setErrorTimeScaleCoefficient (const double value)
 
void setErrorNoiseIntensityCoefficient (const double value)
 
void setSpeedDifferenceErrorCoefficient (const double value)
 
void setHeadwayErrorCoefficient (const double value)
 
void setFreeSpeedErrorCoefficient (const double value)
 
void setSpeedDifferenceChangePerceptionThreshold (const double value)
 
void setHeadwayChangePerceptionThreshold (const double value)
 
void setMaximalReactionTime (const double value)
 
void setOriginalReactionTime (const double value)
 
void setAwareness (const double value)
 
void setErrorState (const double state)
 
void setErrorTimeScale (const double value)
 
void setErrorNoiseIntensity (const double value)
 
Methods to obtain the current error quantities to be used by the car-following model
See also
TCIModel
double getPerceivedOwnSpeed (double speed)
 apply perception error to own speed
 
double getPerceivedSpeedDifference (const double trueSpeedDifference, const double trueGap, const void *objID=nullptr)
 This method checks whether the errorneous speed difference that would be perceived for this step differs sufficiently from the previously perceived to be actually perceived. If so, it sets the flag myReactionFlag[objID]=true, which should be checked just after the call to this method because it will be overwritten by subsequent calls.
 
double getPerceivedHeadway (const double trueGap, const void *objID=nullptr)
 

Private Member Functions

void updateError ()
 
void updateReactionTime ()
 
void updateStepDuration ()
 

Private Attributes

double myActionStepLength
 Action step length (~current maximal reaction time) induced by awareness level.
 
double myAwareness
 Driver's 'awareness' \in [0,1].
 
bool myDebugLock
 Used to prevent infinite loops in debugging outputs,.
 
OUProcess myError
 Driver's 'error',.
 
double myErrorNoiseIntensityCoefficient
 Coefficient controlling the impact of awareness on the noise intensity of the error process.
 
double myErrorTimeScaleCoefficient
 Coefficient controlling the impact of awareness on the time scale of the error process.
 
double myFreeSpeedErrorCoefficient
 
double myHeadwayChangePerceptionThreshold
 Thresholds above a change in the corresponding quantity is perceived.
 
double myHeadwayErrorCoefficient
 
double myInitialAwareness
 Initial value for 'awareness' \in [0,1].
 
double myMaximalReactionTime
 Maximal reaction time (value set for the actionStepLength at awareness=myMinAwareness)
 
double myMinAwareness
 Minimal value for 'awareness' \in [0,1].
 
double myOriginalReactionTime
 Maximal reaction time (value set for the actionStepLength at awareness=1)
 
double mySpeedDifferenceChangePerceptionThreshold
 
double mySpeedDifferenceErrorCoefficient
 Scaling coefficients for the magnitude of errors.
 
MSVehiclemyVehicle
 Vehicle corresponding to this driver state.
 
Variables for tracking update instants

Elapsed time since the last state update

See also
updateStepDuration()
double myStepDuration
 
double myLastUpdateTime
 Time point of the last state update.
 
std::map< const void *, double > myAssumedGap
 The assumed gaps to different objects.
 
std::map< const void *, double > myLastPerceivedSpeedDifference
 The last perceived speed differences to the corresponding objects.
 

Detailed Description

Provides an interface to an error whose fluctuation is controlled via the driver's 'awareness', which can be controlled externally,.

See also
MSDevice_ToC

Definition at line 103 of file MSDriverState.h.

Constructor & Destructor Documentation

◆ MSSimpleDriverState()

MSSimpleDriverState::MSSimpleDriverState ( MSVehicle veh)

Definition at line 127 of file MSDriverState.cpp.

References Named::getID(), updateError(), and updateReactionTime().

◆ ~MSSimpleDriverState()

virtual MSSimpleDriverState::~MSSimpleDriverState ( )
inlinevirtual

Definition at line 107 of file MSDriverState.h.

Member Function Documentation

◆ debugLocked()

bool MSSimpleDriverState::debugLocked ( ) const
inline

Definition at line 277 of file MSDriverState.h.

References myDebugLock.

Referenced by getPerceivedHeadway(), and getPerceivedSpeedDifference().

Here is the caller graph for this function:

◆ getActionStepLength()

double MSSimpleDriverState::getActionStepLength ( ) const
inline

Definition at line 168 of file MSDriverState.h.

References myActionStepLength.

◆ getAwareness()

double MSSimpleDriverState::getAwareness ( ) const
inline

Definition at line 156 of file MSDriverState.h.

References myAwareness.

◆ getErrorNoiseIntensity()

double MSSimpleDriverState::getErrorNoiseIntensity ( ) const
inline

Definition at line 132 of file MSDriverState.h.

References OUProcess::getNoiseIntensity(), and myError.

◆ getErrorNoiseIntensityCoefficient()

double MSSimpleDriverState::getErrorNoiseIntensityCoefficient ( ) const
inline

Definition at line 124 of file MSDriverState.h.

References myErrorNoiseIntensityCoefficient.

◆ getErrorState()

double MSSimpleDriverState::getErrorState ( ) const
inline

Definition at line 172 of file MSDriverState.h.

References OUProcess::getState(), and myError.

◆ getErrorTimeScale()

double MSSimpleDriverState::getErrorTimeScale ( ) const
inline

Definition at line 128 of file MSDriverState.h.

References OUProcess::getTimeScale(), and myError.

◆ getErrorTimeScaleCoefficient()

double MSSimpleDriverState::getErrorTimeScaleCoefficient ( ) const
inline

Definition at line 120 of file MSDriverState.h.

References myErrorTimeScaleCoefficient.

◆ getFreeSpeedErrorCoefficient()

double MSSimpleDriverState::getFreeSpeedErrorCoefficient ( ) const
inline

Definition at line 144 of file MSDriverState.h.

References myFreeSpeedErrorCoefficient.

◆ getHeadwayChangePerceptionThreshold()

double MSSimpleDriverState::getHeadwayChangePerceptionThreshold ( ) const
inline

Definition at line 152 of file MSDriverState.h.

References myHeadwayChangePerceptionThreshold.

◆ getHeadwayErrorCoefficient()

double MSSimpleDriverState::getHeadwayErrorCoefficient ( ) const
inline

Definition at line 140 of file MSDriverState.h.

References myHeadwayErrorCoefficient.

◆ getInitialAwareness()

double MSSimpleDriverState::getInitialAwareness ( ) const
inline

Definition at line 116 of file MSDriverState.h.

References myInitialAwareness.

◆ getMaximalReactionTime()

double MSSimpleDriverState::getMaximalReactionTime ( ) const
inline

Definition at line 160 of file MSDriverState.h.

References myMaximalReactionTime.

◆ getMinAwareness()

double MSSimpleDriverState::getMinAwareness ( ) const
inline

Definition at line 112 of file MSDriverState.h.

References myMinAwareness.

◆ getOriginalReactionTime()

double MSSimpleDriverState::getOriginalReactionTime ( ) const
inline

Definition at line 164 of file MSDriverState.h.

References myOriginalReactionTime.

◆ getPerceivedHeadway()

double MSSimpleDriverState::getPerceivedHeadway ( const double  trueGap,
const void *  objID = nullptr 
)

◆ getPerceivedOwnSpeed()

double MSSimpleDriverState::getPerceivedOwnSpeed ( double  speed)

apply perception error to own speed

Definition at line 224 of file MSDriverState.cpp.

References OUProcess::getState(), myError, and myFreeSpeedErrorCoefficient.

◆ getPerceivedSpeedDifference()

double MSSimpleDriverState::getPerceivedSpeedDifference ( const double  trueSpeedDifference,
const double  trueGap,
const void *  objID = nullptr 
)

This method checks whether the errorneous speed difference that would be perceived for this step differs sufficiently from the previously perceived to be actually perceived. If so, it sets the flag myReactionFlag[objID]=true, which should be checked just after the call to this method because it will be overwritten by subsequent calls.

Definition at line 288 of file MSDriverState.cpp.

References DEBUG_COND, debugLocked(), Named::getID(), OUProcess::getState(), myAwareness, myError, myLastPerceivedSpeedDifference, mySpeedDifferenceChangePerceptionThreshold, mySpeedDifferenceErrorCoefficient, myVehicle, SIMTIME, and toString().

◆ getSpeedDifferenceChangePerceptionThreshold()

double MSSimpleDriverState::getSpeedDifferenceChangePerceptionThreshold ( ) const
inline

Definition at line 148 of file MSDriverState.h.

References mySpeedDifferenceChangePerceptionThreshold.

◆ getSpeedDifferenceErrorCoefficient()

double MSSimpleDriverState::getSpeedDifferenceErrorCoefficient ( ) const
inline

Definition at line 136 of file MSDriverState.h.

References mySpeedDifferenceErrorCoefficient.

◆ lockDebug()

void MSSimpleDriverState::lockDebug ( )
inline

Definition at line 269 of file MSDriverState.h.

References myDebugLock.

◆ setAwareness()

void MSSimpleDriverState::setAwareness ( const double  value)

◆ setErrorNoiseIntensity()

void MSSimpleDriverState::setErrorNoiseIntensity ( const double  value)
inline

Definition at line 236 of file MSDriverState.h.

References myError, and OUProcess::setNoiseIntensity().

◆ setErrorNoiseIntensityCoefficient()

void MSSimpleDriverState::setErrorNoiseIntensityCoefficient ( const double  value)
inline

Definition at line 192 of file MSDriverState.h.

References myErrorNoiseIntensityCoefficient.

◆ setErrorState()

void MSSimpleDriverState::setErrorState ( const double  state)
inline

Definition at line 228 of file MSDriverState.h.

References myError, and OUProcess::setState().

◆ setErrorTimeScale()

void MSSimpleDriverState::setErrorTimeScale ( const double  value)
inline

Definition at line 232 of file MSDriverState.h.

References myError, and OUProcess::setTimeScale().

◆ setErrorTimeScaleCoefficient()

void MSSimpleDriverState::setErrorTimeScaleCoefficient ( const double  value)
inline

Definition at line 188 of file MSDriverState.h.

References myErrorTimeScaleCoefficient.

◆ setFreeSpeedErrorCoefficient()

void MSSimpleDriverState::setFreeSpeedErrorCoefficient ( const double  value)
inline

Definition at line 204 of file MSDriverState.h.

References myFreeSpeedErrorCoefficient.

◆ setHeadwayChangePerceptionThreshold()

void MSSimpleDriverState::setHeadwayChangePerceptionThreshold ( const double  value)
inline

Definition at line 212 of file MSDriverState.h.

References myHeadwayChangePerceptionThreshold.

◆ setHeadwayErrorCoefficient()

void MSSimpleDriverState::setHeadwayErrorCoefficient ( const double  value)
inline

Definition at line 200 of file MSDriverState.h.

References myHeadwayErrorCoefficient.

◆ setInitialAwareness()

void MSSimpleDriverState::setInitialAwareness ( const double  value)
inline

Definition at line 184 of file MSDriverState.h.

References myInitialAwareness.

◆ setMaximalReactionTime()

void MSSimpleDriverState::setMaximalReactionTime ( const double  value)
inline

Definition at line 216 of file MSDriverState.h.

References myMaximalReactionTime, and updateReactionTime().

◆ setMinAwareness()

void MSSimpleDriverState::setMinAwareness ( const double  value)
inline

Definition at line 180 of file MSDriverState.h.

References myMinAwareness.

◆ setOriginalReactionTime()

void MSSimpleDriverState::setOriginalReactionTime ( const double  value)
inline

Definition at line 221 of file MSDriverState.h.

References myOriginalReactionTime, and updateReactionTime().

◆ setSpeedDifferenceChangePerceptionThreshold()

void MSSimpleDriverState::setSpeedDifferenceChangePerceptionThreshold ( const double  value)
inline

Definition at line 208 of file MSDriverState.h.

References mySpeedDifferenceChangePerceptionThreshold.

◆ setSpeedDifferenceErrorCoefficient()

void MSSimpleDriverState::setSpeedDifferenceErrorCoefficient ( const double  value)
inline

Definition at line 196 of file MSDriverState.h.

References mySpeedDifferenceErrorCoefficient.

◆ unlockDebug()

void MSSimpleDriverState::unlockDebug ( )
inline

Definition at line 273 of file MSDriverState.h.

References myDebugLock.

◆ update()

void MSSimpleDriverState::update ( )

Trigger updates for the errorProcess, assumed gaps, etc.

Definition at line 154 of file MSDriverState.cpp.

References DEBUG_COND, Named::getID(), OUProcess::getState(), myError, myStepDuration, myVehicle, SIMTIME, updateAssumedGaps(), updateError(), updateReactionTime(), and updateStepDuration().

◆ updateAssumedGaps()

void MSSimpleDriverState::updateAssumedGaps ( )

Update the assumed gaps to the known objects according to the corresponding perceived speed differences.

Definition at line 271 of file MSDriverState.cpp.

References MSVehicle::getSpeed(), myAssumedGap, myLastPerceivedSpeedDifference, myVehicle, and SPEED2DIST.

Referenced by update().

Here is the caller graph for this function:

◆ updateError()

void MSSimpleDriverState::updateError ( )
private

Definition at line 182 of file MSDriverState.cpp.

References myAwareness, myError, myErrorNoiseIntensityCoefficient, myErrorTimeScaleCoefficient, myStepDuration, OUProcess::setNoiseIntensity(), OUProcess::setState(), OUProcess::setTimeScale(), and OUProcess::step().

Referenced by MSSimpleDriverState(), and update().

Here is the caller graph for this function:

◆ updateReactionTime()

void MSSimpleDriverState::updateReactionTime ( )
private

Definition at line 193 of file MSDriverState.cpp.

References MAX2(), myActionStepLength, myAwareness, myMaximalReactionTime, myMinAwareness, myOriginalReactionTime, and TS.

Referenced by MSSimpleDriverState(), setAwareness(), setMaximalReactionTime(), setOriginalReactionTime(), and update().

Here is the caller graph for this function:

◆ updateStepDuration()

void MSSimpleDriverState::updateStepDuration ( )
private

Definition at line 176 of file MSDriverState.cpp.

References myLastUpdateTime, myStepDuration, and SIMTIME.

Referenced by update().

Here is the caller graph for this function:

Field Documentation

◆ myActionStepLength

double MSSimpleDriverState::myActionStepLength
private

Action step length (~current maximal reaction time) induced by awareness level.

Note
This interpolates linearly from myOriginalReactionTime for awareness==1 to myMaximalReactionTime for awareness==myMinAwareness

Definition at line 322 of file MSDriverState.h.

Referenced by getActionStepLength(), and updateReactionTime().

◆ myAssumedGap

std::map<const void*, double> MSSimpleDriverState::myAssumedGap
private

The assumed gaps to different objects.

Todo:
: update each step to incorporate the assumed change given a specific speed difference

Definition at line 339 of file MSDriverState.h.

Referenced by getPerceivedHeadway(), and updateAssumedGaps().

◆ myAwareness

double MSSimpleDriverState::myAwareness
private

Driver's 'awareness' \in [0,1].

Definition at line 295 of file MSDriverState.h.

Referenced by getAwareness(), getPerceivedHeadway(), getPerceivedSpeedDifference(), setAwareness(), updateError(), and updateReactionTime().

◆ myDebugLock

bool MSSimpleDriverState::myDebugLock
private

Used to prevent infinite loops in debugging outputs,.

See also
followSpeed() and stopSpeed() (of MSCFModel_Krauss, e.g.)

Definition at line 345 of file MSDriverState.h.

Referenced by debugLocked(), lockDebug(), and unlockDebug().

◆ myError

◆ myErrorNoiseIntensityCoefficient

double MSSimpleDriverState::myErrorNoiseIntensityCoefficient
private

Coefficient controlling the impact of awareness on the noise intensity of the error process.

Definition at line 305 of file MSDriverState.h.

Referenced by getErrorNoiseIntensityCoefficient(), setErrorNoiseIntensityCoefficient(), and updateError().

◆ myErrorTimeScaleCoefficient

double MSSimpleDriverState::myErrorTimeScaleCoefficient
private

Coefficient controlling the impact of awareness on the time scale of the error process.

Definition at line 303 of file MSDriverState.h.

Referenced by getErrorTimeScaleCoefficient(), setErrorTimeScaleCoefficient(), and updateError().

◆ myFreeSpeedErrorCoefficient

double MSSimpleDriverState::myFreeSpeedErrorCoefficient
private

◆ myHeadwayChangePerceptionThreshold

double MSSimpleDriverState::myHeadwayChangePerceptionThreshold
private

Thresholds above a change in the corresponding quantity is perceived.

Note
In the comparison, we multiply the actual change amount by the current gap to the object to reflect a more precise perception if the object is closer.

Definition at line 314 of file MSDriverState.h.

Referenced by getHeadwayChangePerceptionThreshold(), getPerceivedHeadway(), and setHeadwayChangePerceptionThreshold().

◆ myHeadwayErrorCoefficient

double MSSimpleDriverState::myHeadwayErrorCoefficient
private

◆ myInitialAwareness

double MSSimpleDriverState::myInitialAwareness
private

Initial value for 'awareness' \in [0,1].

Definition at line 299 of file MSDriverState.h.

Referenced by getInitialAwareness(), and setInitialAwareness().

◆ myLastPerceivedSpeedDifference

std::map<const void*, double> MSSimpleDriverState::myLastPerceivedSpeedDifference
private

The last perceived speed differences to the corresponding objects.

Definition at line 341 of file MSDriverState.h.

Referenced by getPerceivedSpeedDifference(), and updateAssumedGaps().

◆ myLastUpdateTime

double MSSimpleDriverState::myLastUpdateTime
private

Time point of the last state update.

Definition at line 334 of file MSDriverState.h.

Referenced by updateStepDuration().

◆ myMaximalReactionTime

double MSSimpleDriverState::myMaximalReactionTime
private

Maximal reaction time (value set for the actionStepLength at awareness=myMinAwareness)

Definition at line 326 of file MSDriverState.h.

Referenced by getMaximalReactionTime(), setMaximalReactionTime(), and updateReactionTime().

◆ myMinAwareness

double MSSimpleDriverState::myMinAwareness
private

Minimal value for 'awareness' \in [0,1].

Definition at line 297 of file MSDriverState.h.

Referenced by getMinAwareness(), setAwareness(), setMinAwareness(), and updateReactionTime().

◆ myOriginalReactionTime

double MSSimpleDriverState::myOriginalReactionTime
private

Maximal reaction time (value set for the actionStepLength at awareness=1)

Definition at line 324 of file MSDriverState.h.

Referenced by getOriginalReactionTime(), setOriginalReactionTime(), and updateReactionTime().

◆ mySpeedDifferenceChangePerceptionThreshold

double MSSimpleDriverState::mySpeedDifferenceChangePerceptionThreshold
private

◆ mySpeedDifferenceErrorCoefficient

double MSSimpleDriverState::mySpeedDifferenceErrorCoefficient
private

Scaling coefficients for the magnitude of errors.

Definition at line 308 of file MSDriverState.h.

Referenced by getPerceivedSpeedDifference(), getSpeedDifferenceErrorCoefficient(), and setSpeedDifferenceErrorCoefficient().

◆ myStepDuration

double MSSimpleDriverState::myStepDuration
private

Definition at line 332 of file MSDriverState.h.

Referenced by update(), updateError(), and updateStepDuration().

◆ myVehicle

MSVehicle* MSSimpleDriverState::myVehicle
private

Vehicle corresponding to this driver state.

Definition at line 292 of file MSDriverState.h.

Referenced by getPerceivedHeadway(), getPerceivedSpeedDifference(), setAwareness(), update(), and updateAssumedGaps().


The documentation for this class was generated from the following files: