Eclipse SUMO - Simulation of Urban MObility
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:

Public Member Functions

bool debugLocked () const
 
void lockDebug ()
 
 MSSimpleDriverState (MSVehicle *veh)
 
void unlockDebug ()
 
void update ()
 Trigger updates for the errorProcess, assumed gaps, etc. More...
 
void updateAssumedGaps ()
 Update the assumed gaps to the known objects according to the corresponding perceived speed differences. More...
 
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 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 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 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. More...
 
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. More...
 
double myAwareness
 Driver's 'awareness' \in [0,1]. More...
 
bool myDebugLock
 Used to prevent infinite loops in debugging outputs,. More...
 
OUProcess myError
 Driver's 'error',. More...
 
double myErrorNoiseIntensityCoefficient
 Coefficient controlling the impact of awareness on the noise intensity of the error process. More...
 
double myErrorTimeScaleCoefficient
 Coefficient controlling the impact of awareness on the time scale of the error process. More...
 
double myHeadwayChangePerceptionThreshold
 Thresholds above a change in the corresponding quantity is perceived. More...
 
double myHeadwayErrorCoefficient
 
double myInitialAwareness
 Initial value for 'awareness' \in [0,1]. More...
 
double myMaximalReactionTime
 Maximal reaction time (value set for the actionStepLength at awareness=myMinAwareness) More...
 
double myMinAwareness
 Minimal value for 'awareness' \in [0,1]. More...
 
double myOriginalReactionTime
 Maximal reaction time (value set for the actionStepLength at awareness=1) More...
 
double mySpeedDifferenceChangePerceptionThreshold
 
double mySpeedDifferenceErrorCoefficient
 Scaling coefficients for the magnitude of errors. More...
 
MSVehiclemyVehicle
 Vehicle corresponding to this driver state. More...
 
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. More...
 
std::map< const void *, double > myAssumedGap
 The assumed gaps to different objects. More...
 
std::map< const void *, double > myLastPerceivedSpeedDifference
 The last perceived speed differences to the corresponding objects. More...
 

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 104 of file MSDriverState.h.

Constructor & Destructor Documentation

◆ MSSimpleDriverState()

MSSimpleDriverState::MSSimpleDriverState ( MSVehicle veh)

Definition at line 127 of file MSDriverState.cpp.

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

◆ ~MSSimpleDriverState()

virtual MSSimpleDriverState::~MSSimpleDriverState ( )
inlinevirtual

Definition at line 108 of file MSDriverState.h.

Member Function Documentation

◆ debugLocked()

bool MSSimpleDriverState::debugLocked ( ) const
inline

Definition at line 267 of file MSDriverState.h.

References myDebugLock.

Referenced by getPerceivedHeadway(), and getPerceivedSpeedDifference().

◆ getActionStepLength()

double MSSimpleDriverState::getActionStepLength ( ) const
inline

Definition at line 165 of file MSDriverState.h.

References myActionStepLength.

◆ getAwareness()

double MSSimpleDriverState::getAwareness ( ) const
inline

Definition at line 153 of file MSDriverState.h.

References myAwareness.

◆ getErrorNoiseIntensity()

double MSSimpleDriverState::getErrorNoiseIntensity ( ) const
inline

Definition at line 133 of file MSDriverState.h.

References OUProcess::getNoiseIntensity(), and myError.

◆ getErrorNoiseIntensityCoefficient()

double MSSimpleDriverState::getErrorNoiseIntensityCoefficient ( ) const
inline

Definition at line 125 of file MSDriverState.h.

References myErrorNoiseIntensityCoefficient.

◆ getErrorState()

double MSSimpleDriverState::getErrorState ( ) const
inline

Definition at line 169 of file MSDriverState.h.

References OUProcess::getState(), and myError.

◆ getErrorTimeScale()

double MSSimpleDriverState::getErrorTimeScale ( ) const
inline

Definition at line 129 of file MSDriverState.h.

References OUProcess::getTimeScale(), and myError.

◆ getErrorTimeScaleCoefficient()

double MSSimpleDriverState::getErrorTimeScaleCoefficient ( ) const
inline

Definition at line 121 of file MSDriverState.h.

References myErrorTimeScaleCoefficient.

◆ getHeadwayChangePerceptionThreshold()

double MSSimpleDriverState::getHeadwayChangePerceptionThreshold ( ) const
inline

Definition at line 149 of file MSDriverState.h.

References myHeadwayChangePerceptionThreshold.

◆ getHeadwayErrorCoefficient()

double MSSimpleDriverState::getHeadwayErrorCoefficient ( ) const
inline

Definition at line 141 of file MSDriverState.h.

References myHeadwayErrorCoefficient.

◆ getInitialAwareness()

double MSSimpleDriverState::getInitialAwareness ( ) const
inline

Definition at line 117 of file MSDriverState.h.

References myInitialAwareness.

◆ getMaximalReactionTime()

double MSSimpleDriverState::getMaximalReactionTime ( ) const
inline

Definition at line 157 of file MSDriverState.h.

References myMaximalReactionTime.

◆ getMinAwareness()

double MSSimpleDriverState::getMinAwareness ( ) const
inline

Definition at line 113 of file MSDriverState.h.

References myMinAwareness.

◆ getOriginalReactionTime()

double MSSimpleDriverState::getOriginalReactionTime ( ) const
inline

Definition at line 161 of file MSDriverState.h.

References myOriginalReactionTime.

◆ getPerceivedHeadway()

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

◆ 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 281 of file MSDriverState.cpp.

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

◆ getSpeedDifferenceChangePerceptionThreshold()

double MSSimpleDriverState::getSpeedDifferenceChangePerceptionThreshold ( ) const
inline

Definition at line 145 of file MSDriverState.h.

References mySpeedDifferenceChangePerceptionThreshold.

◆ getSpeedDifferenceErrorCoefficient()

double MSSimpleDriverState::getSpeedDifferenceErrorCoefficient ( ) const
inline

Definition at line 137 of file MSDriverState.h.

References mySpeedDifferenceErrorCoefficient.

◆ lockDebug()

void MSSimpleDriverState::lockDebug ( )
inline

Definition at line 259 of file MSDriverState.h.

References myDebugLock.

◆ setAwareness()

void MSSimpleDriverState::setAwareness ( const double  value)

◆ setErrorNoiseIntensity()

void MSSimpleDriverState::setErrorNoiseIntensity ( const double  value)
inline

Definition at line 229 of file MSDriverState.h.

References myError, and OUProcess::setNoiseIntensity().

◆ setErrorNoiseIntensityCoefficient()

void MSSimpleDriverState::setErrorNoiseIntensityCoefficient ( const double  value)
inline

Definition at line 189 of file MSDriverState.h.

References myErrorNoiseIntensityCoefficient.

◆ setErrorState()

void MSSimpleDriverState::setErrorState ( const double  state)
inline

Definition at line 221 of file MSDriverState.h.

References myError, and OUProcess::setState().

◆ setErrorTimeScale()

void MSSimpleDriverState::setErrorTimeScale ( const double  value)
inline

Definition at line 225 of file MSDriverState.h.

References myError, and OUProcess::setTimeScale().

◆ setErrorTimeScaleCoefficient()

void MSSimpleDriverState::setErrorTimeScaleCoefficient ( const double  value)
inline

Definition at line 185 of file MSDriverState.h.

References myErrorTimeScaleCoefficient.

◆ setHeadwayChangePerceptionThreshold()

void MSSimpleDriverState::setHeadwayChangePerceptionThreshold ( const double  value)
inline

Definition at line 205 of file MSDriverState.h.

References myHeadwayChangePerceptionThreshold.

◆ setHeadwayErrorCoefficient()

void MSSimpleDriverState::setHeadwayErrorCoefficient ( const double  value)
inline

Definition at line 197 of file MSDriverState.h.

References myHeadwayErrorCoefficient.

◆ setInitialAwareness()

void MSSimpleDriverState::setInitialAwareness ( const double  value)
inline

Definition at line 181 of file MSDriverState.h.

References myInitialAwareness.

◆ setMaximalReactionTime()

void MSSimpleDriverState::setMaximalReactionTime ( const double  value)
inline

Definition at line 209 of file MSDriverState.h.

References myMaximalReactionTime, and updateReactionTime().

◆ setMinAwareness()

void MSSimpleDriverState::setMinAwareness ( const double  value)
inline

Definition at line 177 of file MSDriverState.h.

References myMinAwareness.

◆ setOriginalReactionTime()

void MSSimpleDriverState::setOriginalReactionTime ( const double  value)
inline

Definition at line 214 of file MSDriverState.h.

References myOriginalReactionTime, and updateReactionTime().

◆ setSpeedDifferenceChangePerceptionThreshold()

void MSSimpleDriverState::setSpeedDifferenceChangePerceptionThreshold ( const double  value)
inline

Definition at line 201 of file MSDriverState.h.

References mySpeedDifferenceChangePerceptionThreshold.

◆ setSpeedDifferenceErrorCoefficient()

void MSSimpleDriverState::setSpeedDifferenceErrorCoefficient ( const double  value)
inline

Definition at line 193 of file MSDriverState.h.

References mySpeedDifferenceErrorCoefficient.

◆ unlockDebug()

void MSSimpleDriverState::unlockDebug ( )
inline

Definition at line 263 of file MSDriverState.h.

References myDebugLock.

◆ update()

void MSSimpleDriverState::update ( )

Trigger updates for the errorProcess, assumed gaps, etc.

Definition at line 153 of file MSDriverState.cpp.

References DEBUG_COND, MSBaseVehicle::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 264 of file MSDriverState.cpp.

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

Referenced by update().

◆ updateError()

◆ updateReactionTime()

void MSSimpleDriverState::updateReactionTime ( )
private

◆ updateStepDuration()

void MSSimpleDriverState::updateStepDuration ( )
private

Definition at line 175 of file MSDriverState.cpp.

References myLastUpdateTime, myStepDuration, and SIMTIME.

Referenced by update().

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 311 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 328 of file MSDriverState.h.

Referenced by getPerceivedHeadway(), and updateAssumedGaps().

◆ myAwareness

double MSSimpleDriverState::myAwareness
private

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

Definition at line 285 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 334 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 295 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 293 of file MSDriverState.h.

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

◆ 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 303 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 289 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 330 of file MSDriverState.h.

Referenced by getPerceivedSpeedDifference(), and updateAssumedGaps().

◆ myLastUpdateTime

double MSSimpleDriverState::myLastUpdateTime
private

Time point of the last state update.

Definition at line 323 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 315 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 287 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 313 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 298 of file MSDriverState.h.

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

◆ myStepDuration

double MSSimpleDriverState::myStepDuration
private

Definition at line 321 of file MSDriverState.h.

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

◆ myVehicle

MSVehicle* MSSimpleDriverState::myVehicle
private

Vehicle corresponding to this driver state.

Definition at line 282 of file MSDriverState.h.

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


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