diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/ExemptedRun.cs b/VectoCore/VectoCore/Models/Simulation/Impl/ExemptedRun.cs index f91c48b7f25c66d3086c19fe2184d1b3d92d4f71..9e7a01a5038be7fd3f91be6313e5613da6330921 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/ExemptedRun.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/ExemptedRun.cs @@ -1,4 +1,5 @@ using System; +using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Simulation.Data; @@ -24,11 +25,28 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl { protected override IResponse DoSimulationStep() { + CheckValidInput(); FinishedWithoutErrors = true; _writeSumData(null); return new ResponseCycleFinished(); } + private void CheckValidInput() + { + var vehicleData = Container.RunData.VehicleData; + if (vehicleData.ZeroEmissionVehicle && vehicleData.DualFuelVehicle) { + throw new VectoException("Invalid input: ZE-HDV and DualFuelVehicle are mutually exclusive!"); + } + + if (!vehicleData.ZeroEmissionVehicle && !vehicleData.HybridElectricHDV && !vehicleData.DualFuelVehicle) { + throw new VectoException("Invalid input: at least one option of ZE-HDV, He-HDV, and DualFuelVehicle has to be set for an exempted vehicle!"); + } + + if (vehicleData.HybridElectricHDV && (vehicleData.MaxNetPower1 == null || vehicleData.MaxNetPower2 == null)) { + throw new VectoException("For He-HDV both MaxNetPower1 and MaxNetPower2 have to be provided!"); + } + } + protected override IResponse Initialize() { return new ResponseSuccess();