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 0fd7dcb1 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

refactoring: avoid variable name 'engineSpeed' ->...

refactoring: avoid variable name 'engineSpeed' -> angularSpeed/angularVelocity; avoid Formulas.TorqueToPower/PowerToTorque
parent 33796ec8
No related branches found
No related tags found
No related merge requests found
......@@ -399,12 +399,7 @@ namespace TUGraz.VectoCore.FileIO.Reader
if (row.Field<string>(Fields.EnginePower).Equals("<DRAG>")) {
entry.Drag = true;
} else {
entry.EngineTorque =
Formulas.PowerToTorque(
row.ParseDouble(Fields.EnginePower)
.SI()
.Kilo.Watt.Cast<Watt>(),
entry.EngineSpeed);
entry.EngineTorque = row.ParseDouble(Fields.EnginePower).SI().Kilo.Watt.Cast<Watt>() / entry.EngineSpeed;
}
}
entry.Time = absTime;
......
......@@ -70,10 +70,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return powerDemand;
}
public IResponse Initialize(NewtonMeter torque, PerSecond engineSpeed)
public IResponse Initialize(NewtonMeter torque, PerSecond angularSpeed)
{
var powerDemand = ComputePowerDemand(engineSpeed);
return NextComponent.Initialize(torque + powerDemand / engineSpeed, engineSpeed);
var powerDemand = ComputePowerDemand(angularSpeed);
return NextComponent.Initialize(torque + powerDemand / angularSpeed, angularSpeed);
}
#endregion
......
......@@ -112,7 +112,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
((clutchSpeedNorm * engineSpeed0 / _ratedSpeed) * (_ratedSpeed - _idleSpeed) + _idleSpeed).Radian
.Cast<PerSecond>();
torqueIn = Formulas.PowerToTorque(Formulas.TorqueToPower(torque, angularVelocity) / ClutchEff, engineSpeedIn);
torqueIn = ((torque * angularVelocity) / ClutchEff / engineSpeedIn);
} else {
_clutchState = SimulationComponent.ClutchState.ClutchClosed;
}
......
......@@ -133,8 +133,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
UpdateEngineState(CurrentState.EnginePower);
// = requestedEnginePower; //todo + _currentState.EnginePowerLoss;
CurrentState.EngineTorque = Formulas.PowerToTorque(CurrentState.EnginePower,
CurrentState.EngineSpeed);
CurrentState.EngineTorque = CurrentState.EnginePower / CurrentState.EngineSpeed;
return new ResponseSuccess { EnginePowerRequest = requestedEnginePower };
}
......@@ -157,26 +156,25 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
CurrentState.FullDragTorque = Data.FullLoadCurve.DragLoadStationaryTorque(angularSpeed);
CurrentState.FullDragPower = Formulas.TorqueToPower(CurrentState.FullDragTorque, angularSpeed);
CurrentState.FullDragPower = CurrentState.FullDragTorque * angularSpeed;
}
public IResponse Initialize(NewtonMeter torque, PerSecond engineSpeed)
public IResponse Initialize(NewtonMeter torque, PerSecond angularSpeed)
{
PreviousState = new EngineState {
EngineSpeed = engineSpeed,
EngineSpeed = angularSpeed,
dt = 1.SI<Second>(),
EnginePowerLoss = 0.SI<Watt>(),
StationaryFullLoadTorque =
Data.FullLoadCurve.FullLoadStationaryTorque(engineSpeed),
FullDragTorque = Data.FullLoadCurve.DragLoadStationaryTorque(engineSpeed),
Data.FullLoadCurve.FullLoadStationaryTorque(angularSpeed),
FullDragTorque = Data.FullLoadCurve.DragLoadStationaryTorque(angularSpeed),
EngineTorque = torque,
EnginePower = Formulas.TorqueToPower(torque, engineSpeed)
EnginePower = torque * angularSpeed,
};
PreviousState.StationaryFullLoadPower = Formulas.TorqueToPower(PreviousState.StationaryFullLoadTorque,
engineSpeed);
PreviousState.StationaryFullLoadPower = PreviousState.StationaryFullLoadTorque * angularSpeed;
PreviousState.DynamicFullLoadTorque = PreviousState.StationaryFullLoadTorque;
PreviousState.DynamicFullLoadPower = PreviousState.StationaryFullLoadPower;
PreviousState.FullDragPower = Formulas.TorqueToPower(PreviousState.FullDragTorque, engineSpeed);
PreviousState.FullDragPower = PreviousState.FullDragTorque * angularSpeed;
return new ResponseSuccess { Source = this, EnginePowerRequest = PreviousState.EnginePower };
}
......@@ -275,8 +273,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
//_currentState.StationaryFullLoadPower = _data.GetFullLoadCurve(gear).FullLoadStationaryPower(rpm);
CurrentState.StationaryFullLoadTorque =
Data.FullLoadCurve.FullLoadStationaryTorque(angularVelocity);
CurrentState.StationaryFullLoadPower = Formulas.TorqueToPower(CurrentState.StationaryFullLoadTorque,
angularVelocity);
CurrentState.StationaryFullLoadPower = CurrentState.StationaryFullLoadTorque * angularVelocity;
double pt1 = Data.FullLoadCurve.PT1(angularVelocity).Value();
......@@ -296,8 +293,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
CurrentState.DynamicFullLoadPower = StationaryIdleFullLoadPower;
}
CurrentState.DynamicFullLoadTorque = Formulas.PowerToTorque(CurrentState.DynamicFullLoadPower,
angularVelocity);
CurrentState.DynamicFullLoadTorque = CurrentState.DynamicFullLoadPower / angularVelocity;
}
protected bool IsFullLoad(Watt requestedPower, Watt maxPower)
......
......@@ -39,8 +39,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
UpdateEngineState(CurrentState.EnginePower);
// = requestedEnginePower; //todo + _currentState.EnginePowerLoss;
CurrentState.EngineTorque = Formulas.PowerToTorque(CurrentState.EnginePower,
CurrentState.EngineSpeed);
CurrentState.EngineTorque = CurrentState.EnginePower / CurrentState.EngineSpeed;
return new ResponseSuccess();
}
......
......@@ -71,9 +71,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return NextComponent.Request(absTime, dt, torque, angularVelocity, dryRun);
}
public IResponse Initialize(NewtonMeter torque, PerSecond engineSpeed)
public IResponse Initialize(NewtonMeter torque, PerSecond angularSpeed)
{
return NextComponent.Initialize(torque, engineSpeed);
return NextComponent.Initialize(torque, angularSpeed);
}
#endregion
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment