Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

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

introduce driving behavior (databus)

gearbox disengages when braking and engine-speed would drop below idle speed
parent 1a519af6
No related branches found
No related tags found
No related merge requests found
......@@ -305,7 +305,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Case<ResponseSuccess>().
Case<ResponseUnderload>(). // driver limits acceleration, operating point may be below engine's
//drag load resp. below 0
//Case<ResponseOverload>(). // driver limits acceleration, operating point may be above 0 (GBX), use brakes
Case<ResponseOverload>(). // driver limits acceleration, operating point may be above 0 (GBX), use brakes
Case<ResponseGearShift>().
Case<ResponseFailTimeInterval>(r => {
retVal = new ResponseDrivingCycleDistanceExceeded() {
......@@ -769,10 +769,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <returns></returns>
public IResponse DrivingActionHalt(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient)
{
if (!targetVelocity.IsEqual(0) || !DataBus.VehicleSpeed.IsEqual(0)) {
if (!targetVelocity.IsEqual(0) || !DataBus.VehicleSpeed.IsEqual(0, 1e-3)) {
throw new NotImplementedException("TargetVelocity or VehicleVelocity is not zero!");
}
DataBus.BreakPower = double.PositiveInfinity.SI<Watt>();
DataBus.BreakPower = Double.PositiveInfinity.SI<Watt>();
var retVal = NextComponent.Request(absTime, dt, 0.SI<MeterPerSquareSecond>(), gradient);
retVal.Switch().
Case<ResponseGearShift>(r => {
......
......@@ -186,6 +186,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// </returns>
public IResponse Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity, bool dryRun)
{
Log.Debug("Gearbox Power Request: torque: {0}, angularVelocity: {1}", torque, angularVelocity);
if (DataBus.VehicleStopped) {
_shiftTime = absTime;
}
......@@ -293,7 +294,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
if (dryRun) {
if (inEngineSpeed < DataBus.EngineIdleSpeed && DataBus.VehicleSpeed < Constants.SimulationSettings.VehicleStopClutchDisengageSpeed) {
if ((DataBus.DrivingBehavior == DrivingBehavior.Braking || DataBus.DrivingBehavior == DrivingBehavior.Coasting) &&
inEngineSpeed < DataBus.EngineIdleSpeed &&
DataBus.VehicleSpeed < Constants.SimulationSettings.VehicleStopClutchDisengageSpeed) {
_disengaged = true;
_shiftTime = absTime + dt;
_strategy.Disengage(absTime, dt, outTorque, outAngularVelocity);
......
......@@ -289,18 +289,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Gearbox.Gear = tryNextGear;
var response = (ResponseDryRun)Gearbox.Request(absTime, dt, outTorque, outAngularVelocity, true);
Gearbox.Gear = tmpGear;
inAngularVelocity = Data.Gears[tryNextGear].Ratio * outAngularVelocity;
inTorque = response.ClutchPowerRequest / inAngularVelocity;
// if next gear supplied enough power reserve: take it
// otherwise take
if (!IsBelowDownShiftCurve(tryNextGear, inTorque, inAngularVelocity)) {
var fullLoadPower = response.EnginePowerRequest - response.DeltaFullLoad;
var reserve = 1 - (response.EnginePowerRequest / fullLoadPower).Cast<Scalar>();
if (reserve >= Data.TorqueReserve) {
NextGear = tryNextGear;
if (!(response is ResponseEngineSpeedTooLow)) {
inAngularVelocity = Data.Gears[tryNextGear].Ratio * outAngularVelocity;
inTorque = response.ClutchPowerRequest / inAngularVelocity;
// if next gear supplied enough power reserve: take it
// otherwise take
if (!IsBelowDownShiftCurve(tryNextGear, inTorque, inAngularVelocity)) {
var fullLoadPower = response.EnginePowerRequest - response.DeltaFullLoad;
var reserve = 1 - (response.EnginePowerRequest / fullLoadPower).Cast<Scalar>();
if (reserve >= Data.TorqueReserve) {
NextGear = tryNextGear;
}
}
}
}
......
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