 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
47 #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;
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.
static double errorNoiseIntensityCoefficient
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 headwayChangePerceptionThreshold
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.
static double minAwareness
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.
static double speedDifferenceErrorCoefficient
void updateReactionTime()
void updateStepDuration()
double myHeadwayChangePerceptionThreshold
Thresholds above a change in the corresponding quantity is perceived.
static double errorTimeScaleCoefficient
static double headwayErrorCoefficient
double myActionStepLength
Action step length (~current maximal reaction time) induced by awareness level.
void update()
Trigger updates for the errorProcess, assumed gaps, etc.
static double initialAwareness
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)
static double speedDifferenceChangePerceptionThreshold
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 double maximalReactionTimeFactor
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.
Default values for the MSDriverState parameters.
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.