diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index e6716a6f60ad29c4025df33483f8bf6199ce98fe..4589bf566507df4cadeec2c6f59f374bf532d308 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -36,12 +36,15 @@ using System.Linq; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.Reader.ComponentData; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.SimulationComponent; using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; using TUGraz.VectoCore.Models.SimulationComponent.Impl; using TUGraz.VectoCore.Models.SimulationComponent.Strategies; using TUGraz.VectoCore.OutputData; @@ -134,6 +137,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl directAux.AddCycle(Constants.Auxiliaries.Cycle); container.ModalData.AddAuxiliary(Constants.Auxiliaries.Cycle); var engine = new EngineOnlyCombustionEngine(container, data.EngineData); + new EngineOnlyGearboxInfo(container); + new ZeroMileageCounter(container); + new DummyDriverInfo(container); engine.Connect(directAux.Port()); cycle.InPort().Connect(engine.OutPort()); @@ -155,6 +161,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl .AddComponent(data.AngledriveData != null ? new Angledrive(container, data.AngledriveData) : null) .AddComponent(gearbox, data.Retarder, container) .AddComponent(new Clutch(container, data.EngineData)); + new ZeroMileageCounter(container); var engine = new StopStartCombustionEngine(container, data.EngineData, pt1Disabled: true); var idleController = GetIdleController(data.PTO, engine, container); @@ -179,6 +186,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl .AddComponent(data.AngledriveData != null ? new Angledrive(container, data.AngledriveData) : null) .AddComponent(gearbox, data.Retarder, container) .AddComponent(new Clutch(container, data.EngineData)); + new ZeroMileageCounter(container); var engine = new VTPCombustionEngine(container, data.EngineData, pt1Disabled: true); if (data.VehicleData.VehicleCategory.IsLorry()) { @@ -289,6 +297,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl .AddComponent(new AxleGear(container, data.AxleGearData)) .AddComponent(data.AngledriveData != null ? new Angledrive(container, data.AngledriveData) : null) .AddComponent(new CycleGearbox(container, data)); + new ATClutchInfo(container); if (data.GearboxData.Type.ManualTransmission()) { powertrain = powertrain.AddComponent(new Clutch(container, data.EngineData)); } @@ -660,4 +669,244 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl .ToList(); } } + + internal class DummyDriverInfo : VectoSimulationComponent, IDriverInfo + { + public DummyDriverInfo(VehicleContainer container) : base(container) + { + + } + + #region Overrides of VectoSimulationComponent + + protected override void DoWriteModalResults(Second time, Second simulationInterval, IModalDataContainer container) + { + + } + + protected override void DoCommitSimulationStep() + { + + } + + #endregion + + #region Implementation of IDriverInfo + + public DrivingBehavior DriverBehavior + { + get { return DrivingBehavior.Accelerating; } + } + + public DrivingAction DrivingAction + { + get { return DrivingAction.Accelerate; } + } + + public MeterPerSquareSecond DriverAcceleration + { + get { return 0.SI<MeterPerSquareSecond>(); } + } + + #endregion + } + + internal class EngineOnlyGearboxInfo : VectoSimulationComponent, IGearboxInfo + { + public EngineOnlyGearboxInfo(VehicleContainer container) : base(container) + { + + } + + #region Overrides of VectoSimulationComponent + + protected override void DoWriteModalResults(Second time, Second simulationInterval, IModalDataContainer container) + { + + } + + protected override void DoCommitSimulationStep() + { + + } + + #endregion + + #region Implementation of IGearboxInfo + + public GearboxType GearboxType + { + get {return GearboxType.DrivingCycle; } + } + + public uint Gear + { + get { return 0; } + } + + public bool TCLocked + { + get { return true; } + } + + public MeterPerSecond StartSpeed + { + get { throw new VectoException("No Gearbox available. StartSpeed unknown."); } + } + + public MeterPerSquareSecond StartAcceleration + { + get { throw new VectoException("No Gearbox available. StartAcceleration unknown."); } + } + + public Watt GearboxLoss() + { + throw new VectoException("No Gearbox available."); + } + + public Second LastShift + { + get { throw new VectoException("No Gearbox available."); } + } + + public GearData GetGearData(uint gear) + { + throw new VectoException("No Gearbox available."); + } + + public GearInfo NextGear + { + get { throw new VectoException("No Gearbox available."); } + } + + public Second TractionInterruption + { + get { throw new NotImplementedException(); } + } + + public uint NumGears + { + get { throw new NotImplementedException(); } + } + + public bool DisengageGearbox + { + get { throw new VectoException("No Gearbox available."); } + } + + public bool GearEngaged(Second absTime) + { + throw new VectoException("No Gearbox available."); + } + + #endregion + } + + internal class ZeroMileageCounter : VectoSimulationComponent, IMileageCounter + { + public ZeroMileageCounter(VehicleContainer container) : base(container) + { + + } + + #region Overrides of VectoSimulationComponent + + protected override void DoWriteModalResults(Second time, Second simulationInterval, IModalDataContainer container) + { + + } + + protected override void DoCommitSimulationStep() + { + + } + + #endregion + + #region Implementation of IMileageCounter + + public Meter Distance + { + get { return 0.SI<Meter>(); } + } + + #endregion + } + + public class DummyVehicleInfo : VectoSimulationComponent, IVehicleInfo + { + public DummyVehicleInfo(VehicleContainer container) : base(container) + { + + } + + #region Overrides of VectoSimulationComponent + + protected override void DoWriteModalResults(Second time, Second simulationInterval, IModalDataContainer container) + { + + } + + protected override void DoCommitSimulationStep() + { + + } + + #endregion + + #region Implementation of IVehicleInfo + + public MeterPerSecond VehicleSpeed + { + get { return 0.SI<MeterPerSecond>(); } + } + + public bool VehicleStopped + { + get { throw new System.NotImplementedException(); } + } + + public Kilogram VehicleMass + { + get { throw new System.NotImplementedException(); } + } + + public Kilogram VehicleLoading + { + get { throw new System.NotImplementedException(); } + } + + public Kilogram TotalMass + { + get { throw new System.NotImplementedException(); } + } + + public CubicMeter CargoVolume + { + get { throw new System.NotImplementedException(); } + } + + public Newton AirDragResistance(MeterPerSecond previousVelocity, MeterPerSecond nextVelocity) + { + throw new System.NotImplementedException(); + } + + public Newton RollingResistance(Radian gradient) + { + throw new System.NotImplementedException(); + } + + public Newton SlopeResistance(Radian gradient) + { + throw new System.NotImplementedException(); + } + + public MeterPerSecond MaxVehicleSpeed + { + get { throw new System.NotImplementedException(); } + } + + #endregion + } + } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs index 2dc02bbe2a563b99aceaf06e6c6b0796c7d5868f..ea78505d1363f96abb64991fc1b5b94506468d93 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs @@ -200,7 +200,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl if (data.Report != null) { data.Report.PrepareResult(data.Loading, data.Mission, data.EngineData?.FuelMode ?? 0, data); } - return new ExemptedRun(new VehicleContainer(data.ExecutionMode) { RunData = data }, modData => { + return new ExemptedRun(new ExemptedRunContainer(data.ExecutionMode) { RunData = data }, modData => { if (data.Report != null) { data.Report.AddResult(data.Loading, data.Mission, data.EngineData?.FuelMode ?? 0, data, modData); } diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs index 0979903a5d7dfa03e06cf025d67fdf08fc608339..2b535b9fd8f6db0f25b519d5ff4d8e522b1fedbe 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs @@ -234,4 +234,49 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl } + + public class ExemptedRunContainer : VehicleContainer + { + private IMileageCounter _mileageCounter; + private IVehicleInfo _vehicleInfo; + + private IGearboxInfo _gearboxInfo; + + public ExemptedRunContainer( + ExecutionMode executionMode, IModalDataContainer modData = null, WriteSumData writeSumData = null) : base( + executionMode, modData, writeSumData) + { + _mileageCounter = new ZeroMileageCounter(this); + _vehicleInfo = new DummyVehicleInfo(this); + _gearboxInfo = new EngineOnlyGearboxInfo(this); + } + + #region Overrides of VehicleContainer + + public override IMileageCounter MileageCounter + { + get { return _mileageCounter; } + + } + + #endregion + + #region Overrides of VehicleContainer + + public override IVehicleInfo VehicleInfo + { + get { return _vehicleInfo; } + } + + #endregion + + #region Overrides of VehicleContainer + + public override IGearboxInfo GearboxInfo + { + get { return _gearboxInfo; } + } + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyVoith.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyVoith.cs index c5168205f8d84f87b8e1903a72b90d78213c34c9..218d3cc175b3f2ecf983af42551adcbe2ec14854 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyVoith.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyVoith.cs @@ -163,7 +163,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl base.Request(absTime, dt, outTorque, outAngularVelocity); } - protected override bool DoCheckShiftRequired( + public override bool ShiftRequired( Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, uint gear, Second lastShiftTime, IResponse response) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BaseShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BaseShiftStrategy.cs index c7a0261593210e83c6e896c88a69da78264bc47f..c47448fdd7d0cdbd042a5e7dc90722457448fd49 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BaseShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BaseShiftStrategy.cs @@ -54,7 +54,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl DataBus = dataBus; } - public bool ShiftRequired(Second absTime, Second dt, NewtonMeter outTorque, + public virtual bool ShiftRequired(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, uint gear, Second lastShiftTime, IResponse response) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index 0cd4e085de1fd0a9493d705c557d8fdc54feebb7..c9d6574362c3e9f3cb44be21876802bc0a0b0f95 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -640,7 +640,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (outAngularVelocity != null) { throw new VectoException("IdleController can only handle idle requests, i.e. angularVelocity == null!"); } - if (!outTorque.IsEqual(0, 1e-3)) { + if (!outTorque.IsEqual(0, 1e-2)) { throw new VectoException("Torque has to be 0 for idle requests!"); } diff --git a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs index 2082475abec53b4454bfc986baeff81fa4d8d525..c381d3b1871af33410d4ec2b12ded7ba69a4cda2 100644 --- a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs @@ -216,7 +216,9 @@ namespace TUGraz.VectoCore.OutputData row.Field<SI>(GetColumnName(fuel, ModalResultField.FCFinal)).Value()) : null) .Where(x => x != null && x.X > 0 && x.Y > 0), out k, out d, out r); - + if (double.IsInfinity(k) || double.IsNaN(k)) { + k = 0; + } _vehLine[fuel.FuelType] = k.SI<KilogramPerWattSecond>(); return _vehLine[fuel.FuelType]; } diff --git a/VectoCore/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs b/VectoCore/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs index 201a1e18d4ae60733448bb37897636fca1cfd542..4383ef87120058a11b2519ed284c6e9d26b34ff5 100644 --- a/VectoCore/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs +++ b/VectoCore/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs @@ -90,7 +90,9 @@ namespace TUGraz.VectoCore.Tests.Integration.EngineOnlyCycle var engine = new EngineOnlyCombustionEngine(vehicle, engineData); engine.Connect(aux); - + new EngineOnlyGearboxInfo(vehicle); + new ZeroMileageCounter(vehicle); + new DummyDriverInfo(vehicle); //aux.InPort().Connect(engine.OutPort()); var port = engine.OutPort(); diff --git a/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs b/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs index d33d0c61fd5032a49805e934897f8247c4f1150a..af6bf653a0ed750e761aadc0e927d1983ad3e123 100644 --- a/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs @@ -116,6 +116,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns var absTime = 0.SI<Second>(); var ds = Constants.SimulationSettings.DriveOffDistance; + container.AbsTime = absTime; IResponse response; var cnt = 0; @@ -188,6 +189,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns var absTime = 0.SI<Second>(); var ds = Constants.SimulationSettings.DriveOffDistance; var response = cyclePort.Request(absTime, ds); + container.AbsTime = absTime; Assert.IsInstanceOf<ResponseSuccess>(response); container.CommitSimulationStep(absTime, response.SimulationInterval); absTime += response.SimulationInterval; @@ -266,6 +268,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns //container.Gear = 0; var absTime = 0.SI<Second>(); var ds = Constants.SimulationSettings.DriveOffDistance; + container.AbsTime = absTime; var response = cyclePort.Request(absTime, ds); Assert.IsInstanceOf<ResponseSuccess>(response); container.CommitSimulationStep(absTime, response.SimulationInterval); diff --git a/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs b/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs index 7e9408b1756664c2e7851c293c6d30ab4deb5b97..d035f9d0e66615afe5a60ff1c3926329e918dedc 100644 --- a/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs @@ -49,6 +49,7 @@ using Wheels = TUGraz.VectoCore.Models.SimulationComponent.Impl.Wheels; using NUnit.Framework; using System.IO; using TUGraz.VectoCore.InputData.Reader.Impl; +using TUGraz.VectoCore.Tests.Models.SimulationComponent; namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns { @@ -98,7 +99,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns .AddComponent(engine); var gbx = new MockGearbox(container); - + new DummyCycle(container); var driverPort = driver.OutPort(); gbx.Gear = 1; diff --git a/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs index b41ab6d3626cf4ae359e936a701c5a478f8aaf86..0af1dd6718f57036c8321108b8e8361a315f5024 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs @@ -83,7 +83,8 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation (modalData) => sumWriter.Write(modalData, 0, 0, new MockRunData())); var data = DrivingCycleDataReader.ReadFromFile(@"TestData\Cycles\LongHaul_short.vdri", CycleType.DistanceBased, false); new MockDrivingCycle(container, data); - + new ZeroMileageCounter(container); + new DummyDriverInfo(container); var aux = new EngineAuxiliary(container); var hdvClass = VehicleClass.Class5; diff --git a/VectoCore/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs index 50fef424dd4836f8951359c113ebb17740cacea5..8438d3a3dc757f941a608bac488ab2929f4b3dc6 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs @@ -47,6 +47,12 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation [TestFixture] public class DrivingCycleTests { + [OneTimeSetUp] + public void Init() + { + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); + } + [TestCase()] public void TestEngineOnly() { @@ -56,6 +62,9 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation var cycleData = DrivingCycleDataReader.ReadFromFile(@"TestData\Cycles\Coach Engine Only.vdri", CycleType.EngineOnly, false); var cycle = new PowertrainDrivingCycle(container, cycleData); + new EngineOnlyGearboxInfo(container); + new ZeroMileageCounter(container); + new DummyDriverInfo(container); var outPort = new MockTnOutPort(); var inPort = cycle.InPort(); @@ -87,7 +96,9 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation var cycleData = DrivingCycleDataReader.ReadFromFile(@"TestData\Cycles\Coach Engine Only Paux_var-dt.vdri", CycleType.EngineOnly, false); var cycle = new PowertrainDrivingCycle(container, cycleData); - + new EngineOnlyGearboxInfo(container); + new ZeroMileageCounter(container); + new DummyDriverInfo(container); var outPort = new MockTnOutPort(); var inPort = cycle.InPort(); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs index 9fd9f131043273beb806738e2fad2a8bd6c9981f..cbce31ab0f6a78b05be96ec8eef87227949dc23f 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs @@ -173,6 +173,9 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var vehicleContainer = new VehicleContainer(ExecutionMode.Engineering); var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(engineFile, 0); var engine = new EngineOnlyCombustionEngine(vehicleContainer, engineData); + new EngineOnlyGearboxInfo(vehicleContainer); + new ZeroMileageCounter(vehicleContainer); + new DummyDriverInfo(vehicleContainer); var expectedResults = VectoCSVFile.Read(resultFile); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/DistanceBasedDrivingCycleTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/DistanceBasedDrivingCycleTest.cs index 20ed6af003d31bba7b024a8649336874327c2776..7fea18ef5ef611ae79dd9ae668d248a5218b33a2 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/DistanceBasedDrivingCycleTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/DistanceBasedDrivingCycleTest.cs @@ -38,9 +38,12 @@ using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.InputData.Reader.ComponentData; using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.Models.SimulationComponent; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Impl; +using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.Tests.Integration; using TUGraz.VectoCore.Tests.Utils; @@ -76,7 +79,8 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var cycle = new DistanceBasedDrivingCycle(container, cycleData); var gbx = new MockGearbox(container); - + new ZeroMileageCounter(container); + new DummyVehicleInfo(container); var driver = new MockDriver(container); cycle.InPort().Connect(driver.OutPort()); @@ -159,6 +163,8 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var cycle = new DistanceBasedDrivingCycle(container, cycleData); var gbx = new MockGearbox(container); + new ZeroMileageCounter(container); + new DummyVehicleInfo(container); var driver = new MockDriver(container); cycle.InPort().Connect(driver.OutPort()); @@ -268,4 +274,80 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent Assert.IsTrue(run.FinishedWithoutErrors, "Cycle start witout stoptime FAILED"); } } + + public class DummyVehicleInfo : VectoSimulationComponent, IVehicleInfo + { + public DummyVehicleInfo(VehicleContainer container) : base(container) + { + + } + + #region Overrides of VectoSimulationComponent + + protected override void DoWriteModalResults(Second time, Second simulationInterval, IModalDataContainer container) + { + + } + + protected override void DoCommitSimulationStep() + { + + } + + #endregion + + #region Implementation of IVehicleInfo + + public MeterPerSecond VehicleSpeed + { + get { return 0.SI<MeterPerSecond>(); } + } + + public bool VehicleStopped + { + get { throw new System.NotImplementedException(); } + } + + public Kilogram VehicleMass + { + get { throw new System.NotImplementedException(); } + } + + public Kilogram VehicleLoading + { + get { throw new System.NotImplementedException(); } + } + + public Kilogram TotalMass + { + get { throw new System.NotImplementedException(); } + } + + public CubicMeter CargoVolume + { + get { throw new System.NotImplementedException(); } + } + + public Newton AirDragResistance(MeterPerSecond previousVelocity, MeterPerSecond nextVelocity) + { + throw new System.NotImplementedException(); + } + + public Newton RollingResistance(Radian gradient) + { + throw new System.NotImplementedException(); + } + + public Newton SlopeResistance(Radian gradient) + { + throw new System.NotImplementedException(); + } + + public MeterPerSecond MaxVehicleSpeed + { + get { throw new System.NotImplementedException(); } + } + + #endregion + } } diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs index b101df6b156797101fd0be94f19dfba993561b53..e927ebe883377981336d86a17ace2fe3cac6bc6b 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs @@ -274,6 +274,8 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var driver = new Driver(vehicleContainer, driverData, new DefaultDriverStrategy(vehicleContainer)); new MockEngine(vehicleContainer); + new EngineOnlyGearboxInfo(vehicleContainer); + new ATClutchInfo(vehicleContainer); var cycle = new MockDrivingCycle(vehicleContainer, null); var brakes = new Brakes(vehicleContainer); @@ -344,6 +346,8 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent }; var vehicle = new MockVehicle(vehicleContainer); new MockEngine(vehicleContainer); + new EngineOnlyGearboxInfo(vehicleContainer); + new ATClutchInfo(vehicleContainer); var driverData = MockSimulationDataFactory.CreateDriverDataFromFile(JobFile); var driver = new Driver(vehicleContainer, driverData, new DefaultDriverStrategy(vehicleContainer)); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs index 4efc971e29a155be43b6e268374806a84ccd6a95..5ed66dadf95d9a8f220a636a160025d00de578f0 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs @@ -89,7 +89,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent CombustionEngine engine; var cycleDataStr = "0, 0, 0, 2\n100, 20, 0, 0\n1000, 50, 0, 0"; var container = CreateVehicle(cycleDataStr, preShiftRpm, out axleGear, out gbx, out engine); - + new ATClutchInfo(container); gbx.Gear = gear; var absTime = 20.SI<Second>(); @@ -198,7 +198,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var container = new VehicleContainer(ExecutionMode.Engineering); gearboxData.PowershiftShiftTime = 0.8.SI<Second>(); - + new ATClutchInfo(container); var cycleData = SimpleDrivingCycles.CreateCycleData(cycleDataStr); var cycle = new MockDrivingCycle(container, cycleData); diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/VehicleTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/VehicleTest.cs index 2116089f442b5a6bfa899658d6c32b1804d8dca3..41f404febef29bc758d006a7a5cc5f1832ec6c3d 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/VehicleTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/VehicleTest.cs @@ -30,6 +30,7 @@ */ using System; +using System.Collections.Generic; using System.IO; using NUnit.Framework; using TUGraz.VectoCommon.Models; @@ -39,8 +40,10 @@ using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.Models.SimulationComponent; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Impl; +using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.Tests.Utils; namespace TUGraz.VectoCore.Tests.Models.SimulationComponent @@ -71,6 +74,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent //vehicleData.CrossWindCorrectionMode = CrossWindCorrectionMode.NoCorrection; var vehicle = new Vehicle(container, vehicleData, airdragData); var driver = new MockDriver(container) { DriverBehavior = DrivingBehavior.Driving }; + new DummyCycle(container); var mockPort = new MockFvOutPort(); vehicle.InPort().Connect(mockPort); @@ -110,6 +114,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent DeclarationDataAdapterHeavyLorry.GetDeclarationAirResistanceCurve("TractorSemitrailer", 6.46.SI<SquareMeter>(), height.SI<Meter>()), CrossWindCorrectionMode.DeclarationModeCorrection); var vehicle = new Vehicle(container, vehicleData,airdragData); + new DummyCycle(container); var mockPort = new MockFvOutPort(); vehicle.InPort().Connect(mockPort); @@ -136,6 +141,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent var vehicle = new Vehicle(container, vehicleData,airdragData); var driver = new MockDriver(container) { DriverBehavior = DrivingBehavior.Driving }; + new DummyCycle(container); var mockPort = new MockFvOutPort(); vehicle.InPort().Connect(mockPort); @@ -208,4 +214,90 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent Tolerance); } } + + public class DummyCycle : VectoSimulationComponent, IDrivingCycleInfo + { + public DummyCycle(VehicleContainer container) :base(container) + { + + } + + #region Overrides of VectoSimulationComponent + + protected override void DoWriteModalResults(Second time, Second simulationInterval, IModalDataContainer container) + { + + } + + protected override void DoCommitSimulationStep() + { + + } + + #endregion + + #region Implementation of IDrivingCycleInfo + + public CycleData CycleData + { + get { throw new NotImplementedException(); } + } + + public bool PTOActive + { + get { throw new NotImplementedException(); } + } + + public DrivingCycleData.DrivingCycleEntry CycleLookAhead(Meter distance) + { + throw new NotImplementedException(); + } + + public Meter Altitude + { + get { throw new NotImplementedException(); } + } + + public Radian RoadGradient + { + get { throw new NotImplementedException(); } + } + + public MeterPerSecond TargetSpeed + { + get { throw new NotImplementedException(); } + } + + public Second StopTime + { + get { throw new NotImplementedException(); } + } + + public Meter CycleStartDistance + { + get { return 0.SI<Meter>(); } + } + + public IReadOnlyList<DrivingCycleData.DrivingCycleEntry> LookAhead(Meter lookaheadDistance) + { + throw new NotImplementedException(); + } + + public IReadOnlyList<DrivingCycleData.DrivingCycleEntry> LookAhead(Second time) + { + throw new NotImplementedException(); + } + + public SpeedChangeEntry LastTargetspeedChange + { + get { throw new NotImplementedException(); } + } + + public void FinishSimulation() + { + throw new NotImplementedException(); + } + + #endregion + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Reports/ActualModalSimulationDataTest.cs b/VectoCore/VectoCoreTest/Reports/ActualModalSimulationDataTest.cs index f77a16e75eeb5cced71bdf465fc7c4c7c355f9f4..9e3dc421ca5105d0d8a8acc65eadb0492dc634a6 100644 --- a/VectoCore/VectoCoreTest/Reports/ActualModalSimulationDataTest.cs +++ b/VectoCore/VectoCoreTest/Reports/ActualModalSimulationDataTest.cs @@ -29,6 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ +using System.IO; using NUnit.Framework; using TUGraz.VectoCommon.Models; using TUGraz.VectoCore.InputData.FileIO.JSON; @@ -41,6 +42,11 @@ namespace TUGraz.VectoCore.Tests.Reports [TestFixture] public class ActualModalSimulationDataTest { + [OneTimeSetUp] + public void RunBeforeAnyTests() + { + Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); + } [Category("LongRunning")] [Test]