Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

refactoring AMT Gearbox: disengage if InTorque < 0 (instead of outTorque).

in some cases outTorque may be smalller than 0, while inTorque is greater than 0 => this would lead to an overload response.
parent 1047ad0b
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,7 @@ using TUGraz.VectoCore.Models.Connector.Ports.Impl;
using TUGraz.VectoCore.Models.Simulation;
using TUGraz.VectoCore.Models.Simulation.Data;
using TUGraz.VectoCore.Models.Simulation.DataBus;
using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox;
using TUGraz.VectoCore.OutputData;
using TUGraz.VectoCore.Utils;
......@@ -180,20 +181,35 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
_engageTime = absTime + dt;
}
var gear = NextGear.Gear;
var avgOutAngularVelocity = (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0;
var inTorqueLossResult = ModelData.Gears[gear].LossMap.GetTorqueLoss(avgOutAngularVelocity, outTorque);
if (avgOutAngularVelocity.IsEqual(0, 1e-9)) {
inTorqueLossResult.Value = 0.SI<NewtonMeter>();
}
var inAngularVelocity = outAngularVelocity * ModelData.Gears[gear].Ratio;
var inTorque = outTorque / ModelData.Gears[gear].Ratio + inTorqueLossResult.Value;
var inertiaTorqueLossOut = !inAngularVelocity.IsEqual(0)
? Formulas.InertiaPower(outAngularVelocity, PreviousState.OutAngularVelocity, ModelData.Inertia, dt) /
avgOutAngularVelocity
: 0.SI<NewtonMeter>();
inTorque += inertiaTorqueLossOut / ModelData.Gears[gear].Ratio;
var halted = DataBus.DrivingAction == DrivingAction.Halt;
var driverDeceleratingNegTorque = DataBus.DriverBehavior == DrivingBehavior.Braking &&
(DataBus.BrakePower.IsGreater(0) || outTorque < 0);
(DataBus.BrakePower.IsGreater(0) || inTorque < 0);
var vehiclespeedBelowThreshold =
DataBus.VehicleSpeed.IsSmaller(Constants.SimulationSettings.ClutchDisengageWhenHaltingSpeed);
if (halted || (driverDeceleratingNegTorque && vehiclespeedBelowThreshold)) {
_engageTime = VectoMath.Max(_engageTime, absTime + dt);
return RequestGearDisengaged(absTime, dt, outTorque, outAngularVelocity, dryRun);
return RequestGearDisengaged(absTime, dt, outTorque, outAngularVelocity, inTorque, dryRun);
}
return ClutchClosed(absTime)
? RequestGearEngaged(absTime, dt, outTorque, outAngularVelocity, dryRun)
: RequestGearDisengaged(absTime, dt, outTorque, outAngularVelocity, dryRun);
? RequestGearEngaged(absTime, dt, outTorque, outAngularVelocity, inTorque, inTorqueLossResult, inertiaTorqueLossOut, dryRun)
: RequestGearDisengaged(absTime, dt, outTorque, outAngularVelocity, inTorque, dryRun);
}
/// <summary>
......@@ -208,7 +224,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <item><term>else</term><description>Response from NextComponent</description></item>
/// </list>
/// </returns>
private IResponse RequestGearDisengaged(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity,
private IResponse RequestGearDisengaged(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque,
bool dryRun)
{
Disengaged = true;
......@@ -218,19 +234,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var gear = NextGear.Gear;
var avgOutAngularVelocity = (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0;
var inTorqueLossResult = ModelData.Gears[gear].LossMap.GetTorqueLoss(avgOutAngularVelocity, outTorque);
if (avgOutAngularVelocity.IsEqual(0, 1e-9)) {
inTorqueLossResult.Value = 0.SI<NewtonMeter>();
}
var inTorque = outTorque / ModelData.Gears[gear].Ratio + inTorqueLossResult.Value;
var inAngularVelocity = outAngularVelocity * ModelData.Gears[gear].Ratio;
var inertiaTorqueLossOut = !inAngularVelocity.IsEqual(0)
? Formulas.InertiaPower(outAngularVelocity, PreviousState.OutAngularVelocity, ModelData.Inertia, dt) /
avgOutAngularVelocity
: 0.SI<NewtonMeter>();
inTorque += inertiaTorqueLossOut / ModelData.Gears[gear].Ratio;
var avgInAngularVelocity = (PreviousState.InAngularVelocity + inAngularVelocity) / 2.0;
if (dryRun) {
......@@ -299,8 +306,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <item><term>else</term><description>Response from NextComponent.</description></item>
/// </list>
/// </returns>
private IResponse RequestGearEngaged(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity,
bool dryRun)
private IResponse RequestGearEngaged(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, TransmissionLossMap.LossMapResult inTorqueLossResult, NewtonMeter inertiaTorqueLossOut, bool dryRun)
{
// Set a Gear if no gear was set and engineSpeed is not zero
//if (!Disengaged && DataBus.VehicleStopped && !outAngularVelocity.IsEqual(0))
......@@ -313,19 +319,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
var inAngularVelocity = outAngularVelocity * ModelData.Gears[Gear].Ratio;
var avgInAngularVelocity = (PreviousState.InAngularVelocity + inAngularVelocity) / 2.0;
var avgOutAngularVelocity = (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0;
var inTorqueLossResult = ModelData.Gears[Gear].LossMap.GetTorqueLoss(avgOutAngularVelocity, outTorque);
var inTorque = !avgInAngularVelocity.IsEqual(0)
? outTorque * (avgOutAngularVelocity / avgInAngularVelocity)
: outTorque / ModelData.Gears[Gear].Ratio;
inTorque += inTorqueLossResult.Value;
var inertiaTorqueLossOut = !inAngularVelocity.IsEqual(0)
? Formulas.InertiaPower(outAngularVelocity, PreviousState.OutAngularVelocity, ModelData.Inertia, dt) /
avgOutAngularVelocity
: 0.SI<NewtonMeter>();
inTorque += inertiaTorqueLossOut / ModelData.Gears[Gear].Ratio;
if (dryRun) {
var dryRunResponse = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity, true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment