46#define DEBUG_COND (true)
95 : myState(initialState),
96 myTimeScale(timeScale),
97 myNoiseIntensity(noiseIntensity) {}
105#ifdef DEBUG_OUPROCESS
106 const double oldstate =
myState;
109#ifdef DEBUG_OUPROCESS
110 std::cout <<
" OU-step (" << dt <<
" s.): " << oldstate <<
"->" <<
myState << std::endl;
136 mySpeedDifferenceChangePerceptionThreshold(
DriverStateDefaults::speedDifferenceChangePerceptionThreshold),
137 myOriginalReactionTime(veh->getActionStepLengthSecs()),
138 myMaximalReactionTime(
DriverStateDefaults::maximalReactionTimeFactor * myOriginalReactionTime),
143#ifdef DEBUG_DRIVERSTATE
144 std::cout <<
"Constructing driver state for veh '" << veh->
getID() <<
"'." << std::endl;
153#ifdef DEBUG_AWARENESS
166#ifdef DEBUG_AWARENESS
208#ifdef DEBUG_AWARENESS
223#ifdef DEBUG_PERCEPTION_ERRORS
227 <<
" trueGap=" << trueGap <<
" objID=" << objID << std::endl;
237#ifdef DEBUG_PERCEPTION_ERRORS
239 std::cout <<
" new perceived gap (=" << perceivedGap <<
") differs significantly from the assumed (="
240 << (assumedGap ==
myAssumedGap.end() ?
"NA" :
toString(assumedGap->second)) <<
")" << std::endl;
249#ifdef DEBUG_PERCEPTION_ERRORS
252 std::cout <<
" new perceived gap (=" << perceivedGap <<
") does *not* differ significantly from the assumed (="
253 << (assumedGap->second) <<
")" << std::endl;
265 const void* objID = p.first;
267 double assumedSpeedDiff;
270 assumedSpeedDiff = speedDiff->second;
281#ifdef DEBUG_PERCEPTION_ERRORS
285 <<
" trueGap=" << trueGap <<
" trueSpeedDifference=" << trueSpeedDifference <<
" objID=" << objID << std::endl;
294#ifdef DEBUG_PERCEPTION_ERRORS
297 std::cout <<
" new perceived speed difference (=" << perceivedSpeedDifference <<
") differs significantly from the last perceived (="
306 return perceivedSpeedDifference;
308#ifdef DEBUG_PERCEPTION_ERRORS
310 std::cout <<
" new perceived speed difference (=" << perceivedSpeedDifference <<
") does *not* differ significantly from the last perceived (="
311 << (lastPerceivedSpeedDifference->second) <<
")" << std::endl;
315 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 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 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 headwayErrorCoefficient
static double errorTimeScaleCoefficient
static double errorNoiseIntensityCoefficient
static double speedDifferenceErrorCoefficient