46#define DEBUG_COND (true)
106#ifdef DEBUG_OUPROCESS
107 const double oldstate =
myState;
110#ifdef DEBUG_OUPROCESS
111 std::cout <<
" OU-step (" << dt <<
" s.): " << oldstate <<
"->" <<
myState << std::endl;
145#ifdef DEBUG_DRIVERSTATE
146 std::cout <<
"Constructing driver state for veh '" << veh->
getID() <<
"'." << std::endl;
155#ifdef DEBUG_AWARENESS
157 std::cout <<
SIMTIME <<
" veh=" <<
myVehicle->getID() <<
", DriverState::update()" << std::endl;
168#ifdef DEBUG_AWARENESS
210#ifdef DEBUG_AWARENESS
231#ifdef DEBUG_PERCEPTION_ERRORS
234 std::cout <<
SIMTIME <<
" getPerceivedHeadway() for veh '" <<
myVehicle->getID() <<
"'\n"
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;
281 assumedSpeedDiff = -
myVehicle->getSpeed();
289#ifdef DEBUG_PERCEPTION_ERRORS
292 std::cout <<
SIMTIME <<
" getPerceivedSpeedDifference() for veh '" <<
myVehicle->getID() <<
"'\n"
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;
const std::string invalid_return< std::string >::value
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.
bool myDebugLock
Used to prevent infinite loops in debugging outputs,.
double myLastUpdateTime
Time point of the last state update.
Representation of a vehicle in the micro simulation.
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.
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.
static double randNorm(double mean, double variance, SumoRNG *rng=nullptr)
Access to a random number from a normal distribution.
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