42 if (trainType.compare(
"RB425") == 0) {
44 }
else if (trainType.compare(
"RB628") == 0) {
46 }
else if (trainType.compare(
"NGT400") == 0) {
48 }
else if (trainType.compare(
"NGT400_16") == 0) {
50 }
else if (trainType.compare(
"ICE1") == 0) {
52 }
else if (trainType.compare(
"REDosto7") == 0) {
54 }
else if (trainType.compare(
"Freight") == 0) {
56 }
else if (trainType.compare(
"ICE3") == 0) {
59 WRITE_ERROR(
"Unknown train type: " + trainType +
". Exiting!");
70 double ,
double )
const {
98 double totalRes = res + gr;
103 if (speed < targetSpeed) {
107 if (totalRes > trac) {
124 double totalRes = res + gr;
129 return speed - a *
DELTA_T / 1000.;
134 std::map<double, double>::const_iterator low, prev;
135 low = lookUpMap->lower_bound(speed);
137 if (low == lookUpMap->end()) {
138 return (lookUpMap->rbegin())->second;
141 if (low == lookUpMap->begin()) {
148 double range = low->first - prev->first;
149 double dist = speed - prev->first;
153 double weight = dist / range;
155 double res = (1 - weight) * prev->second + weight * low->second;
178 WRITE_ERROR(
"function call not allowd for rail model. Exiting!");
189 const double oldV = veh->
getSpeed();
198 const bool onInsertion)
const {
218 const double y =
MAX2(0.0, ((sqrt((b + 2.0 * v) * (b + 2.0 * v) + 8.0 * b * dist) - b) * 0.5 - v) / b);
219 const double yFull = floor(y);
220 const double exactGap = (yFull * yFull + yFull) * 0.5 * b + yFull * v + (y > yFull ? v : 0.0);
222 return DIST2SPEED(
MAX2(0.0, dist - exactGap) / (yFull + 1)) + fullSpeedGain + targetSpeed;
224 WRITE_ERROR(
"Anything else then semi implicit euler update is not yet implemented. Exiting!");
virtual MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
Representation of a vehicle in the micro simulation.
TrainParams initFreightParams() const
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...
The car-following model abstraction.
double maximumSafeStopSpeed(double gap, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap.
TrainParams initRB628Params() const
std::map< double, double > LookUpMap
MSCFModel::VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting...
virtual int getModelID() const
Returns the model's ID; the XML-Tag number is used.
TrainParams initRB425Params() const
The car-following model and parameter.
MSAbstractLaneChangeModel & getLaneChangeModel()
double getSlope() const
Returns the slope of the road at vehicle's position.
virtual double patchSpeed(const double min, const double wanted, const double max, const MSCFModel &cfModel)=0
Called to adapt the speed in order to allow a lane change. It uses information on LC-related desired ...
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
TrainParams initNGT400Params() const
TrainParams initNGT400_16Params() const
TrainParams initICE1Params() const
double getSpeedAfterMaxDecel(double v) const
Returns the velocity after maximum deceleration.
double myDecel
The vehicle's maximum deceleration [m/s^2].
virtual ~MSCFModel_Rail()
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 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) ...
TrainParams initICE3Params() const
double getMaxSpeedOnLane() const
Returns the maximal speed for the vehicle on its current lane (including speed factor and deviation...
virtual void setMaxDecel(double decel)
Sets a new value for maximal comfortable deceleration [m/s^2].
double processNextStop(double currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
TrainParams myTrainParams
double moveHelper(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
double getInterpolatedValueFromLookUpMap(double speed, const LookUpMap *lookUpMap) const
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const
Computes the vehicle's follow speed (no dawdling)
static bool gSemiImplicitEulerUpdate
MSCFModel_Rail(const MSVehicleType *vtype, std::string trainType)
Constructor.
TrainParams initREDosto7Params() const
double getSpeed() const
Returns the vehicle's current speed.