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

added test and corrected bug for gearbox inertia

parent 747888fc
No related branches found
No related tags found
No related merge requests found
...@@ -352,6 +352,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -352,6 +352,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var inAngularVelocity = outAngularVelocity * ModelData.Gears[Gear].Ratio; var inAngularVelocity = outAngularVelocity * ModelData.Gears[Gear].Ratio;
NewtonMeter inertiaTorqueLossOut;
if (!inAngularVelocity.IsEqual(0)) {
// MQ 19.2.2016: check! inertia is related to output side, torque loss accounts to input side
inertiaTorqueLossOut =
Formulas.InertiaPower(outAngularVelocity, PreviousState.OutAngularVelocity, ModelData.Inertia, dt) /
avgOutAngularVelocity;
inTorque += CurrentState.InertiaTorqueLossOut / ModelData.Gears[Gear].Ratio;
} else {
inertiaTorqueLossOut = 0.SI<NewtonMeter>();
}
if (dryRun) { if (dryRun) {
var dryRunResponse = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity, true); var dryRunResponse = NextComponent.Request(absTime, dt, inTorque, inAngularVelocity, true);
dryRunResponse.GearboxPowerRequest = outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0; dryRunResponse.GearboxPowerRequest = outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0;
...@@ -385,16 +396,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -385,16 +396,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// this code has to be _after_ the check for a potential gear-shift! // this code has to be _after_ the check for a potential gear-shift!
// (the above block issues dry-run requests and thus may update the CurrentState!) // (the above block issues dry-run requests and thus may update the CurrentState!)
CurrentState.TransmissionTorqueLoss = inTorque - (outTorque / ModelData.Gears[Gear].Ratio); // begin critical section
if (!inAngularVelocity.IsEqual(0)) { CurrentState.TransmissionTorqueLoss = inTorque - outTorque / ModelData.Gears[Gear].Ratio;
// MQ 19.2.2016: check! inertia is related to output side, torque loss accounts to input side CurrentState.InertiaTorqueLossOut = inertiaTorqueLossOut;
CurrentState.InertiaTorqueLossOut =
Formulas.InertiaPower(outAngularVelocity, PreviousState.OutAngularVelocity, ModelData.Inertia, dt) /
avgOutAngularVelocity;
inTorque += CurrentState.InertiaTorqueLossOut / ModelData.Gears[Gear].Ratio;
} else {
CurrentState.InertiaTorqueLossOut = 0.SI<NewtonMeter>();
}
CurrentState.TorqueLossResult = inTorqueLossResult; CurrentState.TorqueLossResult = inTorqueLossResult;
CurrentState.SetState(inTorque, inAngularVelocity, outTorque, outAngularVelocity); CurrentState.SetState(inTorque, inAngularVelocity, outTorque, outAngularVelocity);
CurrentState.Gear = Gear; CurrentState.Gear = Gear;
......
...@@ -60,14 +60,14 @@ namespace TUGraz.VectoCore.Tests.Integration ...@@ -60,14 +60,14 @@ namespace TUGraz.VectoCore.Tests.Integration
public const string GearboxFullLoadCurveFile = @"TestData\Components\Gearbox.vfld"; public const string GearboxFullLoadCurveFile = @"TestData\Components\Gearbox.vfld";
public static VectoRun CreateEngineeringRun(DrivingCycleData cycleData, string modFileName, public static VectoRun CreateEngineeringRun(DrivingCycleData cycleData, string modFileName,
bool overspeed = false) bool overspeed = false, KilogramSquareMeter gearBoxInertia = null)
{ {
var container = CreatePowerTrain(cycleData, Path.GetFileNameWithoutExtension(modFileName), overspeed); var container = CreatePowerTrain(cycleData, Path.GetFileNameWithoutExtension(modFileName), overspeed, gearBoxInertia);
return new DistanceRun(container); return new DistanceRun(container);
} }
public static VehicleContainer CreatePowerTrain(DrivingCycleData cycleData, string modFileName, public static VehicleContainer CreatePowerTrain(DrivingCycleData cycleData, string modFileName,
bool overspeed = false) bool overspeed = false, KilogramSquareMeter gearBoxInertia = null)
{ {
var fileWriter = new FileOutputWriter(modFileName); var fileWriter = new FileOutputWriter(modFileName);
var modData = new ModalDataContainer(modFileName, fileWriter, ExecutionMode.Engineering); var modData = new ModalDataContainer(modFileName, fileWriter, ExecutionMode.Engineering);
...@@ -78,6 +78,9 @@ namespace TUGraz.VectoCore.Tests.Integration ...@@ -78,6 +78,9 @@ namespace TUGraz.VectoCore.Tests.Integration
var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile); var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(EngineFile);
var axleGearData = CreateAxleGearData(); var axleGearData = CreateAxleGearData();
var gearboxData = CreateGearboxData(); var gearboxData = CreateGearboxData();
if (gearBoxInertia != null)
gearboxData.Inertia = gearBoxInertia;
var vehicleData = CreateVehicleData(3300.SI<Kilogram>()); var vehicleData = CreateVehicleData(3300.SI<Kilogram>());
//var retarder = new RetarderData { Type = RetarderData.RetarderType.None }; //var retarder = new RetarderData { Type = RetarderData.RetarderType.None };
var driverData = CreateDriverData(AccelerationFile, overspeed); var driverData = CreateDriverData(AccelerationFile, overspeed);
......
using NUnit.Framework;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Tests.Integration;
namespace TUGraz.VectoCore.Tests.Models.Simulation
{
[TestFixture]
public class GearboxInertiaTest
{
[Test]
public void RunWithGearboxInertia()
{
var cycleData = "0, 0, 0, 2\n" +
"1000, 80, 0, 0";
var cycle = SimpleDrivingCycles.CreateCycleData(cycleData);
var run = CoachPowerTrain.CreateEngineeringRun(cycle, "RunWithGearboxInertia.vmod",
gearBoxInertia: 0.12.SI<KilogramSquareMeter>());
run.Run();
Assert.IsTrue(run.FinishedWithoutErrors);
}
}
}
\ No newline at end of file
...@@ -95,6 +95,7 @@ ...@@ -95,6 +95,7 @@
<Compile Include="Models\Simulation\FactoryTest.cs" /> <Compile Include="Models\Simulation\FactoryTest.cs" />
<Compile Include="Models\Simulation\LossMapRangeValidationTest.cs" /> <Compile Include="Models\Simulation\LossMapRangeValidationTest.cs" />
<Compile Include="Models\Simulation\LACDecisionFactorTest.cs" /> <Compile Include="Models\Simulation\LACDecisionFactorTest.cs" />
<Compile Include="Models\Simulation\GearboxInertiaTest.cs" />
<Compile Include="Reports\ModDataTest.cs" /> <Compile Include="Reports\ModDataTest.cs" />
<Compile Include="Models\Simulation\MeasuredSpeedModeTest.cs" /> <Compile Include="Models\Simulation\MeasuredSpeedModeTest.cs" />
<Compile Include="Models\Simulation\PwheelModeTests.cs" /> <Compile Include="Models\Simulation\PwheelModeTests.cs" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment