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

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

combustion engine: validate power demand on commit (not during normal request)

parent 4cc9cdc3
No related branches found
No related tags found
No related merge requests found
......@@ -200,7 +200,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Log.Debug("Dynamic FullLoad: torque: {0}, power: {1}", dynamicFullLoadTorque, dynamicFullLoadPower);
ValidatePowerDemand(totalTorqueDemand, dynamicFullLoadTorque, fullDragTorque);
//ValidatePowerDemand(totalTorqueDemand, dynamicFullLoadTorque, fullDragTorque);
// get max. torque as limited by gearbox. gearbox only limits torqueOut!
var gearboxFullLoad = DataBus.GearMaxTorque;
......@@ -328,7 +328,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <summary>
/// Validates the requested power demand [W].
/// </summary>
protected virtual void ValidatePowerDemand(NewtonMeter torqueDemand, NewtonMeter dynamicFullLoadTorque, NewtonMeter fullDragTorque)
protected virtual void ValidatePowerDemand(NewtonMeter torqueDemand, NewtonMeter dynamicFullLoadTorque,
NewtonMeter fullDragTorque)
{
if (fullDragTorque.IsGreater(0) && torqueDemand < 0) {
throw new VectoSimulationException("P_engine_drag > 0! Tq_drag: {0}, Tq_eng: {1}, n_eng_avg: {2} [1/min] ",
......@@ -347,6 +348,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected override void DoWriteModalResults(IModalDataContainer container)
{
ValidatePowerDemand(CurrentState.EngineTorque, CurrentState.DynamicFullLoadTorque, CurrentState.FullDragTorque);
var avgEngineSpeed = (PreviousState.EngineSpeed + CurrentState.EngineSpeed) / 2.0;
if (avgEngineSpeed.IsSmaller(EngineIdleSpeed,
DataBus.ExecutionMode == ExecutionMode.Engineering ? 20.RPMtoRad() : 1e-3.RPMtoRad())) {
......
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