 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
47 #define DEBUG_COND (true)
80 double DriverStateDefaults::minAwareness = 0.1;
81 double DriverStateDefaults::initialAwareness = 1.0;
82 double DriverStateDefaults::errorTimeScaleCoefficient = 100.0;
83 double DriverStateDefaults::errorNoiseIntensityCoefficient = 0.2;
84 double DriverStateDefaults::speedDifferenceErrorCoefficient = 0.15;
85 double DriverStateDefaults::headwayErrorCoefficient = 0.75;
86 double DriverStateDefaults::speedDifferenceChangePerceptionThreshold = 0.1;
87 double DriverStateDefaults::headwayChangePerceptionThreshold = 0.1;
88 double DriverStateDefaults::maximalReactionTimeFactor = 1.0;
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;
130 myMinAwareness(DriverStateDefaults::minAwareness),
132 myErrorTimeScaleCoefficient(DriverStateDefaults::errorTimeScaleCoefficient),
133 myErrorNoiseIntensityCoefficient(DriverStateDefaults::errorNoiseIntensityCoefficient),
134 mySpeedDifferenceErrorCoefficient(DriverStateDefaults::speedDifferenceErrorCoefficient),
135 myHeadwayErrorCoefficient(DriverStateDefaults::headwayErrorCoefficient),
136 myHeadwayChangePerceptionThreshold(DriverStateDefaults::headwayChangePerceptionThreshold),
137 mySpeedDifferenceChangePerceptionThreshold(DriverStateDefaults::speedDifferenceChangePerceptionThreshold),
138 myOriginalReactionTime(veh->getActionStepLengthSecs()),
139 myMaximalReactionTime(DriverStateDefaults::maximalReactionTimeFactor * myOriginalReactionTime),
144 #ifdef DEBUG_DRIVERSTATE
145 std::cout <<
"Constructing driver state for veh '" << veh->
getID() <<
"'." << std::endl;
154 #ifdef DEBUG_AWARENESS
167 #ifdef DEBUG_AWARENESS
209 #ifdef DEBUG_AWARENESS
224 #ifdef DEBUG_PERCEPTION_ERRORS
228 <<
" trueGap=" << trueGap <<
" objID=" << objID << std::endl;
238 #ifdef DEBUG_PERCEPTION_ERRORS
240 std::cout <<
" new perceived gap (=" << perceivedGap <<
") differs significantly from the assumed (="
241 << (assumedGap ==
myAssumedGap.end() ?
"NA" :
toString(assumedGap->second)) <<
")" << std::endl;
250 #ifdef DEBUG_PERCEPTION_ERRORS
253 std::cout <<
" new perceived gap (=" << perceivedGap <<
") does *not* differ significantly from the assumed (="
254 << (assumedGap->second) <<
")" << std::endl;
266 const void* objID = p.first;
268 double assumedSpeedDiff;
271 assumedSpeedDiff = speedDiff->second;
282 #ifdef DEBUG_PERCEPTION_ERRORS
286 <<
" trueGap=" << trueGap <<
" trueSpeedDifference=" << trueSpeedDifference <<
" objID=" << objID << std::endl;
295 #ifdef DEBUG_PERCEPTION_ERRORS
298 std::cout <<
" new perceived speed difference (=" << perceivedSpeedDifference <<
") differs significantly from the last perceived (="
307 return perceivedSpeedDifference;
309 #ifdef DEBUG_PERCEPTION_ERRORS
311 std::cout <<
" new perceived speed difference (=" << perceivedSpeedDifference <<
") does *not* differ significantly from the last perceived (="
312 << (lastPerceivedSpeedDifference->second) <<
")" << std::endl;
316 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.