46#define DEBUG_COND (true)
96 : myState(initialState),
97 myTimeScale(timeScale),
98 myNoiseIntensity(noiseIntensity) {}
106#ifdef DEBUG_OUPROCESS
107 const double oldstate =
myState;
110#ifdef DEBUG_OUPROCESS
111 std::cout <<
" OU-step (" << dt <<
" s.): " << oldstate <<
"->" <<
myState << std::endl;
138 mySpeedDifferenceChangePerceptionThreshold(
DriverStateDefaults::speedDifferenceChangePerceptionThreshold),
139 myOriginalReactionTime(veh->getActionStepLengthSecs()),
140 myMaximalReactionTime(
DriverStateDefaults::maximalReactionTimeFactor * myOriginalReactionTime),
145#ifdef DEBUG_DRIVERSTATE
146 std::cout <<
"Constructing driver state for veh '" << veh->
getID() <<
"'." << std::endl;
155#ifdef DEBUG_AWARENESS
168#ifdef DEBUG_AWARENESS
210#ifdef DEBUG_AWARENESS
231#ifdef DEBUG_PERCEPTION_ERRORS
235 <<
" trueGap=" << trueGap <<
" objID=" << objID << std::endl;
245#ifdef DEBUG_PERCEPTION_ERRORS
247 std::cout <<
" new perceived gap (=" << perceivedGap <<
") differs significantly from the assumed (="
248 << (assumedGap ==
myAssumedGap.end() ?
"NA" :
toString(assumedGap->second)) <<
")" << std::endl;
257#ifdef DEBUG_PERCEPTION_ERRORS
260 std::cout <<
" new perceived gap (=" << perceivedGap <<
") does *not* differ significantly from the assumed (="
261 << (assumedGap->second) <<
")" << std::endl;
273 const void* objID = p.first;
275 double assumedSpeedDiff;
278 assumedSpeedDiff = speedDiff->second;
289#ifdef DEBUG_PERCEPTION_ERRORS
293 <<
" trueGap=" << trueGap <<
" trueSpeedDifference=" << trueSpeedDifference <<
" objID=" << objID << std::endl;
302#ifdef DEBUG_PERCEPTION_ERRORS
305 std::cout <<
" new perceived speed difference (=" << perceivedSpeedDifference <<
") differs significantly from the last perceived (="
314 return perceivedSpeedDifference;
316#ifdef DEBUG_PERCEPTION_ERRORS
318 std::cout <<
" new perceived speed difference (=" << perceivedSpeedDifference <<
") does *not* differ significantly from the last perceived (="
319 << (lastPerceivedSpeedDifference->second) <<
")" << std::endl;
323 return lastPerceivedSpeedDifference->second;
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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 diff...
double myMinAwareness
Minimal value for 'awareness' \in [0,1].
double myHeadwayErrorCoefficient
double myHeadwayChangePerceptionThreshold
Thresholds above a change in the corresponding quantity is perceived.
OUProcess myError
Driver's 'error',.
double myActionStepLength
Action step length (~current maximal reaction time) induced by awareness level.
double myErrorNoiseIntensityCoefficient
Coefficient controlling the impact of awareness on the noise intensity of the error process.
double getPerceivedHeadway(const double trueGap, const void *objID=nullptr)
MSSimpleDriverState(MSVehicle *veh)
double myAwareness
Driver's 'awareness' \in [0,1].
double mySpeedDifferenceErrorCoefficient
Scaling coefficients for the magnitude of errors.
double getPerceivedOwnSpeed(double speed)
apply perception error to own speed
double myMaximalReactionTime
Maximal reaction time (value set for the actionStepLength at awareness=myMinAwareness)
void updateReactionTime()
std::map< const void *, double > myAssumedGap
The assumed gaps to different objects.
void updateStepDuration()
MSVehicle * myVehicle
Vehicle corresponding to this driver state.
double myFreeSpeedErrorCoefficient
double myOriginalReactionTime
Maximal reaction time (value set for the actionStepLength at awareness=1)
void setAwareness(const double value)
void update()
Trigger updates for the errorProcess, assumed gaps, etc.
std::map< const void *, double > myLastPerceivedSpeedDifference
The last perceived speed differences to the corresponding objects.
void updateAssumedGaps()
Update the assumed gaps to the known objects according to the corresponding perceived speed differenc...
double mySpeedDifferenceChangePerceptionThreshold
double myErrorTimeScaleCoefficient
Coefficient controlling the impact of awareness on the time scale of the error process.
double myLastUpdateTime
Time point of the last state update.
Representation of a vehicle in the micro simulation.
double getSpeed() const
Returns the vehicle's current speed.
const std::string & getID() const
Returns the id.
double getState() const
Obtain the current state of the process.
static SumoRNG myRNG
Random generator for OUProcesses.
void setTimeScale(double timeScale)
set the process' timescale to a new value
OUProcess(double initialState, double timeScale, double noiseIntensity)
constructor
double myState
The current state of the process.
double myTimeScale
The time scale of the process.
double myNoiseIntensity
The noise intensity of the process.
void step(double dt)
evolve for a time step of length dt.
void setNoiseIntensity(double noiseIntensity)
set the process' noise intensity to a new value
void setState(double state)
set the process' state to a new value
static double randNorm(double mean, double variance, SumoRNG *rng=nullptr)
Access to a random number from a normal distribution.
Default values for the MSDriverState parameters.
static double speedDifferenceChangePerceptionThreshold
static double headwayChangePerceptionThreshold
static double initialAwareness
static double maximalReactionTimeFactor
static double minAwareness
static double freeSpeedErrorCoefficient
static double headwayErrorCoefficient
static double errorTimeScaleCoefficient
static double errorNoiseIntensityCoefficient
static double speedDifferenceErrorCoefficient