Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

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

adapt testcases

parent 431c0a65
No related branches found
No related tags found
No related merge requests found
Showing with 25 additions and 18 deletions
......@@ -88,7 +88,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var response = _gearbox.Initialize(gear, outTorque, outAngularVelocity);
var fullLoadPower = response.EnginePowerRequest - response.DeltaFullLoad;
var fullLoadPower = response.DynamicFullLoadPower; //EnginePowerRequest - response.DeltaFullLoad;
var reserve = 1 - response.EnginePowerRequest / fullLoadPower;
var inTorque = response.ClutchPowerRequest / inAngularSpeed;
......
......@@ -61,6 +61,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// mAAUX_Global.advancedAuxModel.Signals.WHTC = Declaration.WHTCcorrFactor
CurrentState = new BusAuxState();
PreviousState = new BusAuxState();
PreviousState.AngularSpeed = engineIdleSpeed;
AdditionalAux = additionalAux;
......
......@@ -75,14 +75,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected IAuxPort EngineAux;
public CombustionEngine(IVehicleContainer cockpit, CombustionEngineData modelData, bool pt1Disabled = false)
: base(cockpit)
public CombustionEngine(IVehicleContainer container, CombustionEngineData modelData, bool pt1Disabled = false)
: base(container)
{
PT1Disabled = pt1Disabled;
ModelData = modelData;
PreviousState.OperationMode = EngineOperationMode.Idle;
//PreviousState.EnginePower = 0.SI<Watt>();
PreviousState.OperationMode = EngineOperationMode.Undef;
PreviousState.EnginePower = 0.SI<Watt>();
PreviousState.EngineSpeed = ModelData.IdleSpeed;
PreviousState.dt = 1.SI<Second>();
......@@ -305,7 +305,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
}
var auxDemand = EngineAux == null ? 0.SI<NewtonMeter>() : EngineAux.Initialize(outTorque, outAngularVelocity);
PreviousState = new EngineState {
EngineSpeed = PreviousState.EngineSpeed,
EngineSpeed = outAngularVelocity,
dt = 1.SI<Second>(),
InertiaTorqueLoss = 0.SI<NewtonMeter>(),
StationaryFullLoadTorque = ModelData.FullLoadCurve.FullLoadStationaryTorque(outAngularVelocity),
......@@ -514,9 +514,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity,
bool dryRun = false)
{
if (!_dataBus.VehicleStopped && _dataBus.Gear != _dataBus.NextGear && _dataBus.Gear != 0 && _dataBus.NextGear != 0)
if (!_dataBus.VehicleStopped && _dataBus.Gear != _dataBus.NextGear && _dataBus.Gear != 0 && _dataBus.NextGear != 0) {
return RequestDoubleClutch(absTime, dt, outTorque, outAngularVelocity, dryRun);
else {
} else {
return RequestIdling(absTime, dt, outTorque, outAngularVelocity, dryRun);
}
}
......@@ -535,8 +535,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var velocitySlope = (targetVelocity - _engine.PreviousState.EngineSpeed) / _dataBus.TractionInterruption;
var nextAngularSpeed = (velocitySlope * dt + _engine.PreviousState.EngineSpeed);
if (nextAngularSpeed < _engine.ModelData.IdleSpeed)
if (nextAngularSpeed < _engine.ModelData.IdleSpeed) {
nextAngularSpeed = _engine.ModelData.IdleSpeed;
}
var retVal = RequestPort.Request(absTime, dt, 0.SI<NewtonMeter>(), nextAngularSpeed);
retVal.Switch().
......@@ -549,8 +550,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
criterion: result => ((ResponseDryRun)result).DeltaDragLoad.Value());
Log.Debug("Found operating point for idling. absTime: {0}, dt: {1}, torque: {2}, angularSpeed: {3}", absTime, dt,
0.SI<NewtonMeter>(), angularSpeed);
if (angularSpeed < _engine.ModelData.IdleSpeed)
if (angularSpeed < _engine.ModelData.IdleSpeed) {
angularSpeed = _engine.ModelData.IdleSpeed;
}
retVal = RequestPort.Request(absTime, dt, 0.SI<NewtonMeter>(), angularSpeed);
}).
......
......@@ -43,8 +43,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
{
protected readonly List<Second> EnginePowerCorrections = new List<Second>();
public EngineOnlyCombustionEngine(IVehicleContainer cockpit, CombustionEngineData modelData)
: base(cockpit, modelData) {}
public EngineOnlyCombustionEngine(IVehicleContainer container, CombustionEngineData modelData)
: base(container, modelData) {}
// the behavior in engine-only mode differs a little bit from normal driving cycle simulation: in engine-only mode
// certain amount of overload is tolerated.
......
......@@ -14,7 +14,8 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns
[Category("UserBugs"),
TestCase("Kies-20161115"),
TestCase("Mandl-20161115"),
TestCase("Silberholz-20161121")]
TestCase("Silberholz-20161121"),
TestCase("Kies-20161212_ObjectReference")]
public static void RunJob_Eng(string jobName)
{
var writer = new FileOutputWriter(jobName);
......
......@@ -268,7 +268,8 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent
var container = new VehicleContainer(ExecutionMode.Engineering);
var gearbox = new MockGearbox(container);
var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(CoachEngine);
var vehicle = new MockVehicle(container);
vehicle.MyVehicleSpeed = 0.SI<MeterPerSecond>();
var engine = new CombustionEngine(container, engineData);
var clutch = new Clutch(container, engineData);
......@@ -533,7 +534,8 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent
aux.AddConstant("CONST", 5000.SI<Watt>());
gearbox.Gear = 1;
var vehicle = new MockVehicle(container);
vehicle.MyVehicleSpeed = 0.SI<MeterPerSecond>();
//gearbox.InPort().Connect(engine.OutPort());
gearbox.InPort().Connect(clutch.OutPort());
clutch.InPort().Connect(engine.OutPort());
......
......@@ -158,7 +158,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent
vehicleContainer.CommitSimulationStep(absTime, response.SimulationInterval);
absTime += response.SimulationInterval;
Assert.AreEqual(4.9812, vehicleContainer.VehicleSpeed.Value(), Tolerance);
Assert.AreEqual(4.9816, vehicleContainer.VehicleSpeed.Value(), Tolerance);
Assert.AreEqual(0.2004, response.SimulationInterval.Value(), Tolerance);
Assert.AreEqual(engine.PreviousState.FullDragTorque.Value(), engine.PreviousState.EngineTorque.Value(),
Constants.SimulationSettings.LineSearchTolerance);
......
......@@ -113,10 +113,10 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent
var container = Truck40tPowerTrain.CreatePowerTrain(cycle, "Gearbox_Initialize", 7500.0.SI<Kilogram>(),
19300.SI<Kilogram>());
var retVal = container.Cycle.Initialize();
Assert.AreEqual(11u, container.Gear);
Assert.AreEqual(12u, container.Gear);
Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess));
AssertHelper.AreRelativeEqual(1530.263.RPMtoRad(), container.EngineSpeed, toleranceFactor: 1e-3);
AssertHelper.AreRelativeEqual(1195.996.RPMtoRad(), container.EngineSpeed, toleranceFactor: 1e-3);
var absTime = 0.SI<Second>();
var ds = 1.SI<Meter>();
......
......@@ -105,6 +105,7 @@
<Compile Include="Models\Simulation\GearboxInertiaTest.cs" />
<Compile Include="Models\Simulation\MockSumWriter.cs" />
<Compile Include="Models\Simulation\GetSectionTest.cs" />
<Compile Include="Reports\ActualModalSimulationDataTest.cs" />
<Compile Include="Reports\ModDataTest.cs" />
<Compile Include="Models\Simulation\MeasuredSpeedModeTest.cs" />
<Compile Include="Models\Simulation\PwheelModeTests.cs" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment