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 042ce100 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

Merge pull request #324 in VECTO/vecto-sim from...

Merge pull request #324 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:bugfix/VECTO-395-vecto-crasch-during-locked-gears to develop

* commit '77081550':
  handle the case where PT1 would get negative
  Cycle gearbox: don't initialize engine twice (if torque converter is availalbe)
  Measured speed with gear: more  comprehensive error message when using invalid gear in input
parents 5452eb8b 77081550
Branches
Tags
No related merge requests found
......@@ -431,18 +431,22 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
CurrentState.StationaryFullLoadTorque = ModelData.FullLoadCurve.FullLoadStationaryTorque(angularVelocity);
var stationaryFullLoadPower = CurrentState.StationaryFullLoadTorque * angularVelocity;
Watt dynFullPowerCalculated;
Watt dynFullPowerCalculated = 0.SI<Watt>();
// disable pt1 behaviour if PT1Disabled is true, or if the previous enginepower is greater than the current stationary fullload power (in this case the pt1 calculation fails)
if (PT1Disabled || PreviousState.EnginePower.IsGreaterOrEqual(stationaryFullLoadPower)) {
dynFullPowerCalculated = stationaryFullLoadPower;
} else {
try {
var pt1 = ModelData.FullLoadCurve.PT1(angularVelocity).Value();
var powerRatio = (PreviousState.EnginePower / stationaryFullLoadPower).Value();
var tStarPrev = pt1 * Math.Log(1.0 / (1 - powerRatio), Math.E).SI<Second>();
var tStar = tStarPrev + PreviousState.dt;
dynFullPowerCalculated = stationaryFullLoadPower * (1 - Math.Exp((-tStar / pt1).Value()));
dynFullPowerCalculated = VectoMath.Max(PreviousState.EnginePower, dynFullPowerCalculated);
} catch (Exception ) {
Log.Error("failed to calculate dynamic full-load power - using stationary idle full-load. n: {0}", angularVelocity);
}
}
// new check in vecto 3.x (according to Martin Rexeis)
......
......@@ -104,13 +104,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
response = (TorqueConverterActive != null && TorqueConverterActive.Value)
? TorqueConverter.Initialize(inTorque, inAngularVelocity)
: NextComponent.Initialize(inTorque, inAngularVelocity);
} else {
response = NextComponent.Initialize(inTorque, inAngularVelocity);
}
CurrentState.SetState(inTorque, inAngularVelocity, outTorque, outAngularVelocity);
PreviousState.SetState(inTorque, inAngularVelocity, outTorque, outAngularVelocity);
PreviousState.InertiaTorqueLossOut = 0.SI<NewtonMeter>();
PreviousState.Gear = Gear;
response = NextComponent.Initialize(inTorque, inAngularVelocity);
response.GearboxPowerRequest = inTorque * inAngularVelocity;
return response;
}
......@@ -176,6 +177,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
effectiveLossMap = ModelData.Gears[Gear].TorqueConverterGearLossMap;
}
if (effectiveLossMap == null || double.IsNaN(effectiveRatio)) {
throw new VectoSimulationException("Ratio or loss-map for gear {0}{1} invalid. Please check input data", Gear,
torqueConverterLocked ? "L" : "C");
}
var avgOutAngularVelocity = (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0;
var inTorqueLossResult = effectiveLossMap.GetTorqueLoss(avgOutAngularVelocity, outTorque);
CurrentState.TorqueLossResult = inTorqueLossResult;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment