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

at gearbox: handle the case that strategy is null (test-powertrain), set gear...

at gearbox: handle the case that strategy is null (test-powertrain), set gear in previous state during initialize when disengaged
parent a2e7c8aa
Branches
Tags
No related merge requests found
...@@ -67,7 +67,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -67,7 +67,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
: base(container) : base(container)
{ {
_strategy = strategy; _strategy = strategy;
if (_strategy != null) {
_strategy.Gearbox = this; _strategy.Gearbox = this;
}
LastShift = -double.MaxValue.SI<Second>(); LastShift = -double.MaxValue.SI<Second>();
TorqueConverter = new TorqueConverter(this, _strategy, container, ModelData.TorqueConverterData, TorqueConverter = new TorqueConverter(this, _strategy, container, ModelData.TorqueConverterData,
container.RunData); container.RunData);
...@@ -126,7 +128,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -126,7 +128,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public override IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity) public override IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity)
{ {
if (CurrentState.Disengaged) { if (_strategy != null && CurrentState.Disengaged) {
Gear = _strategy.InitGear(0.SI<Second>(), Constants.SimulationSettings.TargetTimeInterval, outTorque, Gear = _strategy.InitGear(0.SI<Second>(), Constants.SimulationSettings.TargetTimeInterval, outTorque,
outAngularVelocity); outAngularVelocity);
} }
...@@ -146,6 +148,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -146,6 +148,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
inTorque = outTorque / effectiveRatio + torqueLossResult.Value; inTorque = outTorque / effectiveRatio + torqueLossResult.Value;
} }
if (CurrentState.Disengaged) { if (CurrentState.Disengaged) {
PreviousState.Gear = new GearshiftPosition(0);
return NextComponent.Initialize(0.SI<NewtonMeter>(), null); return NextComponent.Initialize(0.SI<NewtonMeter>(), null);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment