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

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

more expressive error message if extrapolated full-load is lower than drag load

parent da2d101a
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) &&
......
using System;
using System.Linq;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
......@@ -25,7 +26,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) /
......@@ -76,7 +77,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