diff --git a/VectoCore/Models/SimulationComponent/IEngineAuxPort.cs b/VectoCore/Models/SimulationComponent/IEngineAuxPort.cs index 5a00a7d9f3881e7f5428b15ccf102dfea330f6df..9433e2f40a48e9d7ea9a153c3467447857900f5e 100644 --- a/VectoCore/Models/SimulationComponent/IEngineAuxPort.cs +++ b/VectoCore/Models/SimulationComponent/IEngineAuxPort.cs @@ -47,6 +47,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent { NewtonMeter Initialize(NewtonMeter torque, PerSecond angularSpeed); - NewtonMeter PowerDemand(Second absTime, Second dt, NewtonMeter torque, PerSecond angularSpeed, bool dryRun = false); + NewtonMeter PowerDemand(Second absTime, Second dt, NewtonMeter torquePowerTrain, NewtonMeter torqueEngine, + PerSecond angularSpeed, + bool dryRun = false); } } \ No newline at end of file diff --git a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index 80468d16cc4a1e43b72eb64a6ca899e6e43cf66c..4f687b302e24056e4dd00759fbac2e076bd0b445 100644 --- a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -176,7 +176,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var auxTorqueDemand = EngineAux == null ? 0.SI<NewtonMeter>() - : EngineAux.PowerDemand(absTime, dt, CurrentState.EngineTorqueOut, angularVelocity, dryRun); + : EngineAux.PowerDemand(absTime, dt, CurrentState.EngineTorqueOut, CurrentState.EngineTorqueOut + CurrentState.InertiaTorqueLoss, angularVelocity, dryRun); // compute the torque the engine has to provide. powertrain + aux + its own inertia var totalTorqueDemand = torqueOut + auxTorqueDemand + CurrentState.InertiaTorqueLoss; diff --git a/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs b/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs index 7fa801557996a5b3e2b3cce98f3c3ecb86462dc8..731cf23b2be3f4e2cdbc44191ba29f4f0c61e221 100644 --- a/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs +++ b/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs @@ -56,7 +56,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return this; } - public NewtonMeter PowerDemand(Second absTime, Second dt, NewtonMeter torque, PerSecond angularSpeed, + public NewtonMeter PowerDemand(Second absTime, Second dt, NewtonMeter torquePowerTrain, NewtonMeter torqueEngine, + PerSecond angularSpeed, bool dryRun = false) { CurrentState.AngularSpeed = angularSpeed; diff --git a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyCombustionEngine.cs b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyCombustionEngine.cs index e0e9f486d17654f8becd98be64873981a295154d..fa753ea9c54eda7f3cbf5d409cd4f02a7f270d5b 100644 --- a/VectoCore/Models/SimulationComponent/Impl/EngineOnlyCombustionEngine.cs +++ b/VectoCore/Models/SimulationComponent/Impl/EngineOnlyCombustionEngine.cs @@ -57,13 +57,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var avgEngineSpeed = (PreviousState.EngineSpeed + CurrentState.EngineSpeed) / 2.0; - var auxTorqueDemand = EngineAux == null - ? 0.SI<NewtonMeter>() - : EngineAux.PowerDemand(absTime, dt, CurrentState.EngineTorqueOut, angularVelocity, dryRun); - CurrentState.InertiaTorqueLoss = Formulas.InertiaPower(angularVelocity, PreviousState.EngineSpeed, ModelData.Inertia, dt) / avgEngineSpeed; + + var auxTorqueDemand = EngineAux == null + ? 0.SI<NewtonMeter>() + : EngineAux.PowerDemand(absTime, dt, CurrentState.EngineTorqueOut, + CurrentState.EngineTorqueOut + CurrentState.InertiaTorqueLoss, angularVelocity, dryRun); + var totalTorqueDemand = CurrentState.EngineTorqueOut + auxTorqueDemand + CurrentState.InertiaTorqueLoss; CurrentState.EngineTorque = totalTorqueDemand;