Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 24c54bb1 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

use constants / model data instead of fixed values

parent d6cabe04
No related branches found
No related tags found
No related merge requests found
......@@ -149,6 +149,8 @@ namespace TUGraz.VectoCore.Configuration
public const int MaximumIterationCountForSimulationStep = 30;
public static readonly MeterPerSecond VehicleStopClutchDisengageSpeed = 10.KMPHtoMeterPerSecond();
public static readonly Meter GearboxLookaheadForAccelerationEstimation = 100.SI<Meter>();
}
}
}
\ No newline at end of file
......@@ -130,5 +130,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
/// <c>true</c> if this instance has torque converter; otherwise, <c>false</c>.
/// </value>
public bool HasTorqueConverter { get; internal set; }
public Second UpshiftAfterDownshiftDelay { get; internal set; }
public Second DownshiftAfterUpshiftDelay { get; internal set; }
public MeterPerSquareSecond UpshiftMinAcceleration { get; internal set; }
}
}
\ No newline at end of file
......@@ -164,7 +164,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if (DataBus.DriverBehavior != DrivingBehavior.Accelerating && DataBus.DriverBehavior != DrivingBehavior.Driving) {
return currentGear;
}
if ((absTime - Gearbox.LastDownshift).IsSmaller(10.SI<Second>())) {
if ((absTime - Gearbox.LastDownshift).IsSmaller(Gearbox.ModelData.UpshiftAfterDownshiftDelay)) {
return currentGear;
}
var nextGear = DoCheckUpshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear);
......@@ -173,14 +173,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
// estimate acceleration for selected gear
if (EstimateAccelerationForGear(nextGear, outAngularVelocity).IsSmaller(0.1.SI<MeterPerSquareSecond>())) {
if (EstimateAccelerationForGear(nextGear, outAngularVelocity).IsSmaller(Gearbox.ModelData.UpshiftMinAcceleration)) {
// if less than 0.1 for next gear, don't shift
if (nextGear - currentGear == 1) {
return currentGear;
}
// if a gear is skipped but acceleration is less than 0.1, try for next gear. if acceleration is still below 0.1 don't shift!
if (nextGear > currentGear &&
EstimateAccelerationForGear(currentGear + 1, outAngularVelocity).IsSmaller(0.1.SI<MeterPerSquareSecond>())) {
EstimateAccelerationForGear(currentGear + 1, outAngularVelocity).IsSmaller(Gearbox.ModelData.UpshiftMinAcceleration))
{
return currentGear;
}
nextGear = currentGear + 1;
......@@ -192,7 +193,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected virtual uint CheckDownshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity,
NewtonMeter inTorque, PerSecond inAngularVelocity, uint currentGear)
{
if ((absTime - Gearbox.LastUpshift).IsSmaller(10.SI<Second>())) {
if ((absTime - Gearbox.LastUpshift).IsSmaller(Gearbox.ModelData.DownshiftAfterUpshiftDelay)) {
return currentGear;
}
return DoCheckDownshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear);
......
......@@ -33,6 +33,7 @@ using System;
using System.Drawing.Design;
using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Models.Simulation.DataBus;
using TUGraz.VectoCore.Models.SimulationComponent.Data;
using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox;
......@@ -77,7 +78,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var maxEnginePower = DataBus.EngineStationaryFullPower(nextEngineSpeed);
var avgSlope =
((DataBus.CycleLookAhead(100.SI<Meter>()).Altitude - DataBus.Altitude) / 100.SI<Meter>()).Value().SI<Radian>();
((DataBus.CycleLookAhead(Constants.SimulationSettings.GearboxLookaheadForAccelerationEstimation).Altitude -
DataBus.Altitude) / Constants.SimulationSettings.GearboxLookaheadForAccelerationEstimation).Value().SI<Radian>();
var airDragLoss = DataBus.AirDragResistance(vehicleSpeed, vehicleSpeed) * DataBus.VehicleSpeed;
var rollResistanceLoss = DataBus.RollingResistance(avgSlope) * DataBus.VehicleSpeed;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment