 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
34 if (trainType.compare(
"RB425") == 0) {
36 }
else if (trainType.compare(
"RB628") == 0) {
38 }
else if (trainType.compare(
"NGT400") == 0) {
40 }
else if (trainType.compare(
"NGT400_16") == 0) {
42 }
else if (trainType.compare(
"ICE1") == 0) {
44 }
else if (trainType.compare(
"REDosto7") == 0) {
46 }
else if (trainType.compare(
"Freight") == 0) {
48 }
else if (trainType.compare(
"ICE3") == 0) {
51 WRITE_ERROR(
"Unknown train type: " + trainType +
". Exiting!");
73 double ,
double ,
const MSVehicle*
const )
const {
79 double safetyGap = 5.0;
80 if (speed >= 30 / 3.6) {
89 return MIN2(vsafe, vmax);
93 return MAX2(
MIN2(vsafe, vmax), vmin);
120 double totalRes = res + gr;
125 if (speed < targetSpeed) {
129 if (totalRes > trac) {
143 const double slope = veh->
getSlope();
146 const double totalRes = res + gr;
148 const double vMin = speed - a *
DELTA_T / 1000.;
150 return MAX2(vMin, 0.);
167 std::map<double, double>::const_iterator low, prev;
168 low = lookUpMap->lower_bound(speed);
170 if (low == lookUpMap->end()) {
171 return (lookUpMap->rbegin())->second;
174 if (low == lookUpMap->begin()) {
181 double range = low->first - prev->first;
182 double dist = speed - prev->first;
186 double weight = dist / range;
188 double res = (1 - weight) * prev->second + weight * low->second;
211 WRITE_ERROR(
"function call not allowd for rail model. Exiting!");
226 const bool onInsertion)
const {
246 const double y =
MAX2(0.0, ((sqrt((b + 2.0 * v) * (b + 2.0 * v) + 8.0 * b * dist) - b) * 0.5 - v) / b);
247 const double yFull = floor(y);
248 const double exactGap = (yFull * yFull + yFull) * 0.5 * b + yFull * v + (y > yFull ? v : 0.0);
250 return DIST2SPEED(
MAX2(0.0, dist - exactGap) / (yFull + 1)) + fullSpeedGain + targetSpeed;
252 WRITE_ERROR(
"Anything else than semi implicit euler update is not yet implemented. Exiting!");
The car-following model and parameter.
virtual int getModelID() const
Returns the model's ID; the XML-Tag number is used.
virtual void setEmergencyDecel(double decel)
Sets a new value for maximal physically possible deceleration [m/s^2].
MSCFModel::VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting.
TrainParams initRB628Params() const
TrainParams initICE3Params() const
TrainParams initICE1Params() const
MSCFModel_Rail(const MSVehicleType *vtype)
Constructor.
TrainParams initNGT400Params() const
TrainParams initREDosto7Params() const
virtual double minNextSpeedEmergency(double speed, const MSVehicle *const veh=0) const
Returns the minimum speed after emergency braking, given the current speed (depends on the numerical ...
double getSpeedAfterMaxDecel(double v) const
Returns the velocity after maximum deceleration.
virtual double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences. Called at most once per simulation...
double getInterpolatedValueFromLookUpMap(double speed, const LookUpMap *lookUpMap) const
double getSlope() const
Returns the slope of the road at vehicle's position.
virtual void setMaxDecel(double decel)
Sets a new value for maximal comfortable deceleration [m/s^2].
TrainParams myTrainParams
virtual double minNextSpeed(double speed, const MSVehicle *const veh) const
Returns the minimum speed given the current speed (depends on the numerical update scheme and its ste...
double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion) const
Computes the vehicle's safe speed without a leader.
double maximumSafeStopSpeed(double gap, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap.
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
double stopSpeed(const MSVehicle *const veh, const double speed, double gap) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
double getCFParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
std::map< double, double > LookUpMap
double getLength() const
Get vehicle's length [m].
bool wasSet(int what) const
Returns whether the given parameter was set.
double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences. Called at most once per simulation...
double myDecel
The vehicle's maximum deceleration [m/s^2].
const SUMOVTypeParameter & getParameter() const
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
The car-following model abstraction.
std::string getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
const int VTYPEPARS_LENGTH_SET
virtual ~MSCFModel_Rail()
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const
Computes the vehicle's follow speed (no dawdling)
TrainParams initRB425Params() const
static bool gSemiImplicitEulerUpdate
virtual MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
const int VTYPEPARS_MAXSPEED_SET
TrainParams initFreightParams() const
TrainParams initNGT400_16Params() const
Representation of a vehicle in the micro simulation.