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

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

combustion engine: remove unnecessary call of update engine state, (fails if...

combustion engine: remove unnecessary call of update engine state, (fails if engine drag torque == 0 for low speed)
parent 2c7f63ce
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); // requires CurrentState.FullDragTorque and DynamicfullLoad to be set!
ValidatePowerDemand(totalTorqueDemand, dynamicFullLoadTorque, fullDragTorque);
// get max. torque as limited by gearbox. gearbox only limits torqueOut!
var gearboxFullLoad = DataBus.GearMaxTorque;
......@@ -277,7 +277,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
};
}
UpdateEngineState(CurrentState.EnginePower, avgEngineSpeed);
//UpdateEngineState(CurrentState.EnginePower, avgEngineSpeed);
return new ResponseSuccess {
EnginePowerRequest = totalTorqueDemand * avgEngineSpeed,
......@@ -328,16 +328,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <summary>
/// Validates the requested power demand [W].
/// </summary>
protected virtual void ValidatePowerDemand(NewtonMeter torqueDemand)
protected virtual void ValidatePowerDemand(NewtonMeter torqueDemand, NewtonMeter dynamicFullLoadTorque, NewtonMeter fullDragTorque)
{
if (CurrentState.FullDragTorque >= 0 && torqueDemand < 0) {
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] ",
CurrentState.FullDragTorque, torqueDemand, CurrentState.EngineSpeed.AsRPM);
fullDragTorque, torqueDemand, CurrentState.EngineSpeed.AsRPM);
}
if (CurrentState.DynamicFullLoadTorque <= 0 && torqueDemand > 0) {
if (dynamicFullLoadTorque <= 0 && torqueDemand > 0) {
throw new VectoSimulationException("P_engine_full < 0! Tq_full: {0}, Tq_eng: {1}, n_eng_avg: {2} [1/min] ",
CurrentState.DynamicFullLoadTorque, torqueDemand, CurrentState.EngineSpeed.AsRPM);
dynamicFullLoadTorque, torqueDemand, CurrentState.EngineSpeed.AsRPM);
}
}
......@@ -348,7 +348,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected override void DoWriteModalResults(IModalDataContainer container)
{
var avgEngineSpeed = (PreviousState.EngineSpeed + CurrentState.EngineSpeed) / 2.0;
if (avgEngineSpeed.IsSmaller(EngineIdleSpeed, DataBus.ExecutionMode == ExecutionMode.Engineering ? 20.RPMtoRad():1e-3.RPMtoRad())) {
if (avgEngineSpeed.IsSmaller(EngineIdleSpeed,
DataBus.ExecutionMode == ExecutionMode.Engineering ? 20.RPMtoRad() : 1e-3.RPMtoRad())) {
Log.Warn("EngineSpeed below idling speed! n_eng_avg: {0}, n_idle: {1}", avgEngineSpeed, EngineIdleSpeed);
}
container[ModalResultField.P_eng_fcmap] = CurrentState.EngineTorque * avgEngineSpeed;
......
......@@ -71,7 +71,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var dynamicFullLoadPower = ComputeFullLoadPower(avgEngineSpeed, dt, dryRun);
CurrentState.DynamicFullLoadTorque = dynamicFullLoadPower / avgEngineSpeed;
ValidatePowerDemand(totalTorqueDemand);
ValidatePowerDemand(totalTorqueDemand, CurrentState.DynamicFullLoadTorque, CurrentState.FullDragTorque);
CurrentState.EngineTorque = LimitEnginePower(CurrentState.EngineTorque, avgEngineSpeed, absTime);
......@@ -83,7 +83,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
};
}
UpdateEngineState(CurrentState.EnginePower, avgEngineSpeed);
//UpdateEngineState(CurrentState.EnginePower, avgEngineSpeed);
CurrentState.EngineTorque = CurrentState.EnginePower / CurrentState.EngineSpeed;
......
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