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

Brakes: Implemented IUpdateable

parent 30283a51
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,7 @@ using TUGraz.VectoCommon.Utils;
namespace TUGraz.VectoCore.Models.SimulationComponent
{
public interface IBrakes
public interface IBrakes: IUpdateable
{
Watt BrakePower { get; set; }
}
......
......@@ -581,7 +581,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
#region Implementation of IUpdateable
public bool UpdateFrom(object other) {
if (other is ElectricMotor e) {
if (other is ElectricMotor e && Position == e.Position) {
PreviousState = e.PreviousState.Clone();
ElectricPower = e.ElectricPower;
ThermalBuffer = e.ThermalBuffer;
......
......@@ -574,10 +574,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Disengaged = g.Disengaged;
DisengageGearbox = g.DisengageGearbox;
_nextGear = g.NextGear;
Gear = g.Gear;
if (DataBus.VehicleInfo.VehicleStopped) {
Gear = _nextGear;
} else {
Gear = g.Gear;
}
return true;
......
......@@ -118,7 +118,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
public void UpdateComponents() => Container.UpdateComponents(RealContainer);
}
public class MockBrakes : VectoSimulationComponent, IBrakes
public class MockBrakes : VectoSimulationComponent, IBrakes, IUpdateable
{
public MockBrakes(IVehicleContainer container) : base(container)
{
......@@ -144,6 +144,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
public Watt BrakePower { get; set; }
#endregion
#region Implementation of IUpdateable
public bool UpdateFrom(object other) {
if (other is IBrakes b) {
BrakePower = b.BrakePower;
return true;
}
return false;
}
#endregion
}
public class MockDrivingCycle : VectoSimulationComponent, IDrivingCycleInfo
......
......@@ -36,7 +36,7 @@ using TUGraz.VectoCore.OutputData;
namespace TUGraz.VectoCore.Tests.Utils
{
public class MockBrakes : VectoSimulationComponent, IBrakes
public class MockBrakes : VectoSimulationComponent, IBrakes, IUpdateable
{
public MockBrakes(IVehicleContainer vehicle) : base(vehicle)
{
......@@ -48,5 +48,18 @@ namespace TUGraz.VectoCore.Tests.Utils
protected override void DoWriteModalResults(Second time, Second simulationInterval, IModalDataContainer container) {}
protected override void DoCommitSimulationStep(Second time, Second simulationInterval) {}
#region Implementation of IUpdateable
public bool UpdateFrom(object other) {
if (other is IBrakes b) {
BrakePower = b.BrakePower;
return true;
}
return false;
}
#endregion
}
}
\ No newline at end of file
......@@ -48,7 +48,7 @@ using TUGraz.VectoCore.OutputData;
namespace TUGraz.VectoCore.Tests.Utils
{
public class MockVehicleContainer : IVehicleContainer, IEngineInfo, IEngineControl, IVehicleInfo, IClutchInfo, IBrakes, IAxlegearInfo, IWheelsInfo, IDriverInfo, IDrivingCycleInfo, IMileageCounter, IGearboxInfo, IGearboxControl, IPowertainInfo
public class MockVehicleContainer : IVehicleContainer, IEngineInfo, IEngineControl, IVehicleInfo, IClutchInfo, IBrakes, IAxlegearInfo, IWheelsInfo, IDriverInfo, IDrivingCycleInfo, IMileageCounter, IGearboxInfo, IGearboxControl, IPowertainInfo, IUpdateable
{
// only CycleData Lookup is set / accessed...
......@@ -337,5 +337,13 @@ namespace TUGraz.VectoCore.Tests.Utils
public VectoSimulationJobType VehicleArchitecutre { get; }
#endregion
#region Implementation of IUpdateable
public bool UpdateFrom(object other) {
return false;
}
#endregion
}
}
\ 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