 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
48 #define DEBUG_COND (true)
81 double DriverStateDefaults::minAwareness = 0.1;
82 double DriverStateDefaults::initialAwareness = 1.0;
83 double DriverStateDefaults::errorTimeScaleCoefficient = 100.0;
84 double DriverStateDefaults::errorNoiseIntensityCoefficient = 0.2;
85 double DriverStateDefaults::speedDifferenceErrorCoefficient = 0.15;
86 double DriverStateDefaults::headwayErrorCoefficient = 0.75;
87 double DriverStateDefaults::speedDifferenceChangePerceptionThreshold = 0.1;
88 double DriverStateDefaults::headwayChangePerceptionThreshold = 0.1;
89 double DriverStateDefaults::maximalReactionTimeFactor = 1.0;
97 : myState(initialState),
98 myTimeScale(timeScale),
99 myNoiseIntensity(noiseIntensity) {}
107 #ifdef DEBUG_OUPROCESS
108 const double oldstate =
myState;
111 #ifdef DEBUG_OUPROCESS
112 std::cout <<
" OU-step (" << dt <<
" s.): " << oldstate <<
"->" <<
myState << std::endl;
126 myMinAwareness(DriverStateDefaults::minAwareness),
128 myErrorTimeScaleCoefficient(DriverStateDefaults::errorTimeScaleCoefficient),
129 myErrorNoiseIntensityCoefficient(DriverStateDefaults::errorNoiseIntensityCoefficient),
130 mySpeedDifferenceErrorCoefficient(DriverStateDefaults::speedDifferenceErrorCoefficient),
131 myHeadwayErrorCoefficient(DriverStateDefaults::headwayErrorCoefficient),
132 myHeadwayChangePerceptionThreshold(DriverStateDefaults::headwayChangePerceptionThreshold),
133 mySpeedDifferenceChangePerceptionThreshold(DriverStateDefaults::speedDifferenceChangePerceptionThreshold),
134 myOriginalReactionTime(veh->getActionStepLengthSecs()),
135 myMaximalReactionTime(DriverStateDefaults::maximalReactionTimeFactor * myOriginalReactionTime),
140 #ifdef DEBUG_DRIVERSTATE
141 std::cout <<
"Constructing driver state for veh '" << veh->
getID() <<
"'." << std::endl;
150 #ifdef DEBUG_AWARENESS
163 #ifdef DEBUG_AWARENESS
205 #ifdef DEBUG_AWARENESS
220 #ifdef DEBUG_PERCEPTION_ERRORS
224 <<
" trueGap=" << trueGap <<
" objID=" << objID << std::endl;
234 #ifdef DEBUG_PERCEPTION_ERRORS
236 std::cout <<
" new perceived gap (=" << perceivedGap <<
") differs significantly from the assumed (="
237 << (assumedGap ==
myAssumedGap.end() ?
"NA" :
toString(assumedGap->second)) <<
")" << std::endl;
246 #ifdef DEBUG_PERCEPTION_ERRORS
249 std::cout <<
" new perceived gap (=" << perceivedGap <<
") does *not* differ significantly from the assumed (="
250 << (assumedGap->second) <<
")" << std::endl;
262 const void* objID = p.first;
264 double assumedSpeedDiff;
267 assumedSpeedDiff = speedDiff->second;
278 #ifdef DEBUG_PERCEPTION_ERRORS
282 <<
" trueGap=" << trueGap <<
" trueSpeedDifference=" << trueSpeedDifference <<
" objID=" << objID << std::endl;
291 #ifdef DEBUG_PERCEPTION_ERRORS
294 std::cout <<
" new perceived speed difference (=" << perceivedSpeedDifference <<
") differs significantly from the last perceived (="
303 return perceivedSpeedDifference;
305 #ifdef DEBUG_PERCEPTION_ERRORS
307 std::cout <<
" new perceived speed difference (=" << perceivedSpeedDifference <<
") does *not* differ significantly from the last perceived (="
308 << (lastPerceivedSpeedDifference->second) <<
")" << std::endl;
312 return lastPerceivedSpeedDifference->second;
double myTimeScale
The time scale of the process.
void step(double dt)
evolve for a time step of length dt.
double myState
The current state of the process.
double myOriginalReactionTime
Maximal reaction time (value set for the actionStepLength at awareness=1)
void setState(double state)
set the process' state to a new value
OUProcess myError
Driver's 'error',.
double mySpeedDifferenceChangePerceptionThreshold
double myMaximalReactionTime
Maximal reaction time (value set for the actionStepLength at awareness=myMinAwareness)
static double randNorm(double mean, double variance, std::mt19937 *rng=0)
Access to a random number from a normal distribution.
OUProcess(double initialState, double timeScale, double noiseIntensity)
constructor
double myHeadwayErrorCoefficient
double getState() const
Obtain the current state of the process.
double myNoiseIntensity
The noise intensity of the process.
double myMinAwareness
Minimal value for 'awareness' \in [0,1].
double mySpeedDifferenceErrorCoefficient
Scaling coefficients for the magnitude of errors.
std::map< const void *, double > myLastPerceivedSpeedDifference
The last perceived speed differences to the corresponding objects.
void updateReactionTime()
void updateStepDuration()
double myHeadwayChangePerceptionThreshold
Thresholds above a change in the corresponding quantity is perceived.
double myActionStepLength
Action step length (~current maximal reaction time) induced by awareness level.
void update()
Trigger updates for the errorProcess, assumed gaps, etc.
MSVehicle * myVehicle
Vehicle corresponding to this driver state.
double getPerceivedHeadway(const double trueGap, const void *objID=nullptr)
void setAwareness(const double value)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
MSSimpleDriverState(MSVehicle *veh)
void updateAssumedGaps()
Update the assumed gaps to the known objects according to the corresponding perceived speed differenc...
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...
static std::mt19937 myRNG
Random generator for OUProcesses.
const std::string & getID() const
Returns the name of the vehicle.
std::map< const void *, double > myAssumedGap
The assumed gaps to different objects.
double getSpeed() const
Returns the vehicle's current speed.
double myLastUpdateTime
Time point of the last state update.
double myAwareness
Driver's 'awareness' \in [0,1].
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.
void setNoiseIntensity(double noiseIntensity)
set the process' noise intensity to a new value
void setTimeScale(double timeScale)
set the process' timescale to a new value
Representation of a vehicle in the micro simulation.