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

Skip to content
Snippets Groups Projects
Commit 0991a4be authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

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

Merge pull request #550 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:feature/VECTO-592-eptp-simulation-mode to master

* commit 'bc077337':
  more expressive error message if extrapolated full-load is lower than drag load
parents ae529629 bc077337
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,7 @@
*/
using System;
using System.Linq;
using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
......@@ -250,7 +251,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var minTorque = CurrentState.FullDragTorque;
var maxTorque = CurrentState.DynamicFullLoadTorque;
CurrentState.EngineTorque = totalTorqueDemand.LimitTo(minTorque, maxTorque);
try {
CurrentState.EngineTorque = totalTorqueDemand.LimitTo(minTorque, maxTorque);
} catch (Exception) {
var extrapolated = avgEngineSpeed > ModelData.FullLoadCurves[0].FullLoadEntries.Last().EngineSpeed;
Log.Error("Engine full-load torque is below drag torque. max_torque: {0}, drag_torque: {1}, extrapolated: {2}", maxTorque, minTorque, extrapolated);
throw;
}
CurrentState.EnginePower = CurrentState.EngineTorque * avgEngineSpeed;
if (totalTorqueDemand.IsGreater(0) &&
......
......@@ -30,6 +30,7 @@
*/
using System;
using System.Linq;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
......@@ -56,7 +57,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var fullDragTorque = ModelData.FullLoadCurves[DataBus.Gear].DragLoadStationaryTorque(avgEngineSpeed);
var fullLoadTorque = ModelData.FullLoadCurves[DataBus.Gear].FullLoadStationaryTorque(angularVelocity);
var fullLoadTorque = ModelData.FullLoadCurves[DataBus.Gear].FullLoadStationaryTorque(avgEngineSpeed);
var inertiaTorqueLoss =
Formulas.InertiaPower(angularVelocity, PreviousState.EngineSpeed, ModelData.Inertia, dt) /
......@@ -107,7 +108,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var minTorque = CurrentState.FullDragTorque;
var maxTorque = CurrentState.DynamicFullLoadTorque;
CurrentState.EngineTorque = totalTorqueDemand.LimitTo(minTorque, maxTorque);
try {
CurrentState.EngineTorque = totalTorqueDemand.LimitTo(minTorque, maxTorque);
} catch (Exception) {
var extrapolated = avgEngineSpeed > ModelData.FullLoadCurves[0].FullLoadEntries.Last().EngineSpeed;
Log.Error("Engine full-load torque is below drag torque. max_torque: {0}, drag_torque: {1}, extrapolated: {2}", maxTorque, minTorque, extrapolated);
throw;
}
CurrentState.EnginePower = CurrentState.EngineTorque * avgEngineSpeed;
if (totalTorqueDemand.IsGreater(0) &&
......
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