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 1acdf170 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

pwheel finished

parent 5d1ec14e
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ using TUGraz.VectoCore.Configuration; ...@@ -22,6 +22,7 @@ using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Exceptions; using TUGraz.VectoCore.Exceptions;
using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Connector.Ports;
using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Connector.Ports.Impl;
using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation;
using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Data;
using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.Simulation.DataBus;
...@@ -184,25 +185,25 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -184,25 +185,25 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return new ResponseSuccess { EnginePowerRequest = requestedEnginePower }; return new ResponseSuccess { EnginePowerRequest = requestedEnginePower };
} }
protected Watt ComputeRequestedEnginePower(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity) protected Watt ComputeRequestedEnginePower(Second absTime, Second dt, NewtonMeter torque, PerSecond angularSpeed)
{ {
var requestedPower = torque * angularVelocity; CurrentState.dt = dt;
var enginePowerLoss = Formulas.InertiaPower(angularVelocity, PreviousState.EngineSpeed, Data.Inertia, dt); CurrentState.EngineSpeed = angularSpeed;
var requestedEnginePower = requestedPower + enginePowerLoss; CurrentState.AbsTime = absTime;
var requestedPower = torque * angularSpeed;
CurrentState.EnginePowerLoss = Formulas.InertiaPower(angularSpeed, PreviousState.EngineSpeed, Data.Inertia, dt);
var requestedEnginePower = requestedPower + CurrentState.EnginePowerLoss;
if (angularVelocity < Data.IdleSpeed.Value() - EngineIdleSpeedStopThreshold) { if (angularSpeed < Data.IdleSpeed.Value() - EngineIdleSpeedStopThreshold) {
CurrentState.OperationMode = EngineOperationMode.Stopped; CurrentState.OperationMode = EngineOperationMode.Stopped;
//todo: _currentState.EnginePowerLoss = enginePowerLoss; //todo: _currentState.EnginePowerLoss = enginePowerLoss;
} }
CurrentState.dt = dt; CurrentState.FullDragTorque = Data.FullLoadCurve.DragLoadStationaryTorque(angularSpeed);
CurrentState.EngineSpeed = angularVelocity; CurrentState.FullDragPower = CurrentState.FullDragTorque * angularSpeed;
CurrentState.AbsTime = absTime;
CurrentState.EnginePowerLoss = enginePowerLoss;
CurrentState.FullDragTorque = Data.FullLoadCurve.DragLoadStationaryTorque(angularVelocity);
CurrentState.FullDragPower = CurrentState.FullDragTorque * angularVelocity;
Log.Debug("EnginePowerLoss: {0}", enginePowerLoss); Log.Debug("EnginePowerLoss: {0}", CurrentState.EnginePowerLoss);
Log.Debug("Drag Curve: torque: {0}, power: {1}", CurrentState.FullDragTorque, CurrentState.FullDragPower); Log.Debug("Drag Curve: torque: {0}, power: {1}", CurrentState.FullDragTorque, CurrentState.FullDragPower);
return requestedEnginePower; return requestedEnginePower;
...@@ -324,30 +325,34 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -324,30 +325,34 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
throw new VectoException("ComputeFullLoadPower cannot compute for simulation interval length 0."); throw new VectoException("ComputeFullLoadPower cannot compute for simulation interval length 0.");
} }
var stationaryFullLoadTorque = Data.FullLoadCurve.FullLoadStationaryTorque(angularVelocity); //_currentState.StationaryFullLoadPower = _data.GetFullLoadCurve(gear).FullLoadStationaryPower(rpm);
var stationaryFullLoadPower = stationaryFullLoadTorque * angularVelocity; CurrentState.StationaryFullLoadTorque =
Data.FullLoadCurve.FullLoadStationaryTorque(angularVelocity);
CurrentState.StationaryFullLoadPower = CurrentState.StationaryFullLoadTorque * angularVelocity;
Watt dynFullPower;
if (PT1Disabled) {
dynFullPower = stationaryFullLoadPower;
} else {
var pt1 = Data.FullLoadCurve.PT1(angularVelocity).Value(); var pt1 = Data.FullLoadCurve.PT1(angularVelocity).Value();
var powerRatio = PreviousState.EnginePower / stationaryFullLoadPower;
var tStarPrev = pt1 * Math.Log(1 / (1 - powerRatio.Value())).SI<Second>(); // var dynFullPowerCalculated = (1 / (pt1 + 1)) *
// (_currentState.StationaryFullLoadPower + pt1 * _previousState.EnginePower);
var tStarPrev = pt1 *
Math.Log(1 / (1 - (PreviousState.EnginePower / CurrentState.StationaryFullLoadPower).Value()), Math.E)
.SI<Second>();
var tStar = tStarPrev + PreviousState.dt; var tStar = tStarPrev + PreviousState.dt;
dynFullPower = stationaryFullLoadPower * (1 - Math.Exp((-tStar / pt1).Value())); var dynFullPowerCalculated = CurrentState.StationaryFullLoadPower * (1 - Math.Exp((-tStar / pt1).Value()));
CurrentState.DynamicFullLoadPower = (dynFullPowerCalculated < CurrentState.StationaryFullLoadPower)
? dynFullPowerCalculated
: CurrentState.StationaryFullLoadPower;
// new check in vecto 3.x (according to Martin Rexeis)
if (CurrentState.DynamicFullLoadPower < StationaryIdleFullLoadPower) {
CurrentState.DynamicFullLoadPower = StationaryIdleFullLoadPower;
} }
CurrentState.StationaryFullLoadPower = stationaryFullLoadPower;
CurrentState.StationaryFullLoadTorque = stationaryFullLoadTorque;
CurrentState.DynamicFullLoadPower = VectoMath.Limit(dynFullPower, StationaryIdleFullLoadPower,
stationaryFullLoadPower);
CurrentState.DynamicFullLoadTorque = CurrentState.DynamicFullLoadPower / angularVelocity; CurrentState.DynamicFullLoadTorque = CurrentState.DynamicFullLoadPower / angularVelocity;
Log.Debug("FullLoad: torque: {0}, power: {1}", CurrentState.DynamicFullLoadTorque, CurrentState.DynamicFullLoadPower); Log.Debug("FullLoad: torque: {0}, power: {1}", CurrentState.DynamicFullLoadTorque, CurrentState.DynamicFullLoadPower);
} }
protected bool IsFullLoad(Watt requestedPower, Watt maxPower) protected bool IsFullLoad(Watt requestedPower, Watt maxPower)
{ {
var testValue = (requestedPower / maxPower).Cast<Scalar>() - 1.0; var testValue = (requestedPower / maxPower).Cast<Scalar>() - 1.0;
......
...@@ -42,9 +42,8 @@ namespace TUGraz.VectoCore.Tests.Integration.EngineOnlyCycle ...@@ -42,9 +42,8 @@ namespace TUGraz.VectoCore.Tests.Integration.EngineOnlyCycle
public void TestEngineOnlyDrivingCycle() public void TestEngineOnlyDrivingCycle()
{ {
var data = DrivingCycleDataReader.ReadFromFile(TestContext.DataRow["CycleFile"].ToString(), CycleType.EngineOnly); var data = DrivingCycleDataReader.ReadFromFile(TestContext.DataRow["CycleFile"].ToString(), CycleType.EngineOnly);
var container = new VehicleContainer();
var cycle = new MockDrivingCycle(container, data);
var vehicle = new VehicleContainer(); var vehicle = new VehicleContainer();
var cycle = new MockDrivingCycle(vehicle, data);
var engineData = var engineData =
MockSimulationDataFactory.CreateEngineDataFromFile(TestContext.DataRow["EngineFile"].ToString()); MockSimulationDataFactory.CreateEngineDataFromFile(TestContext.DataRow["EngineFile"].ToString());
......
...@@ -156,7 +156,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation ...@@ -156,7 +156,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
Assert.IsTrue(jobContainer.Runs.All(r => r.Success), string.Join("", jobContainer.Runs.Select(r => r.ExecException))); Assert.IsTrue(jobContainer.Runs.All(r => r.Success), string.Join("", jobContainer.Runs.Select(r => r.ExecException)));
ResultFileHelper.TestModFile(@"TestData\Results\Pwheel\Atego_HDVCO2_RD_#1_AuxStd.vmod", ResultFileHelper.TestModFile(@"TestData\Results\Pwheel\Atego_HDVCO2_RD_#1_AuxStd.vmod",
@"TestData\Jobs\Pwheel_ultimate_RD_#1_Pwheel_AuxStd.vmod"); @"TestData\Jobs\Pwheel_ultimate_RD_#1_Pwheel_AuxStd.vmod", testRowCount: false);
} }
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment