Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

extend engineAuxPort to pass internal engine power

parent 0b4cf415
Branches
Tags v0.0.3
No related merge requests found
......@@ -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
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment