diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index 3e387569c45e316e08594ebc474d055dc3db9bd9..c5b3a7ef1a23a901faf3213711da48feccc693ed 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -191,6 +191,8 @@ namespace TUGraz.VectoCore.Models.Declaration throw new VectoException("No Group found for vehicle"); } + + public static WeightingGroup GetVehicleGroupCO2StandardsGroup(IVehicleDeclarationInputData vehicleData) { switch (vehicleData.VehicleCategory) { @@ -198,12 +200,7 @@ namespace TUGraz.VectoCore.Models.Declaration case VehicleCategory.RigidTruck: case VehicleCategory.Tractor: var vehicleGroup = GetVehicleGroupGroup(vehicleData); - var propulsionPower = (vehicleData.Components?.EngineInputData?.RatedPowerDeclared ?? 0.SI<Watt>()) + - (vehicleData.Components?.ElectricMachines?.Entries - .Where(x => x.Position != PowertrainPosition.GEN) - .Sum(x => x.ElectricMachine.R85RatedPower * x.Count) ?? 0.SI<Watt>()) + - (vehicleData.Components?.IEPC?.R85RatedPower ?? 0.SI<Watt>()) + - (vehicleData.MaxNetPower1 ?? 0.SI<Watt>()); + var propulsionPower = GetReferencePropulsionPower(vehicleData); var co2Group = WeightingGroup.Lookup(vehicleGroup.Item1, vehicleData.SleeperCab ?? false, propulsionPower); return co2Group; default: @@ -212,6 +209,29 @@ namespace TUGraz.VectoCore.Models.Declaration //throw new VectoException("No CO2 Group found for vehicle"); } + public static Watt GetReferencePropulsionPower(IVehicleDeclarationInputData vehicleData) + { + switch (vehicleData.VehicleType) { + case VectoSimulationJobType.ConventionalVehicle: + case VectoSimulationJobType.ParallelHybridVehicle: + case VectoSimulationJobType.EngineOnlySimulation: + case VectoSimulationJobType.IHPC: + return vehicleData.Components.EngineInputData?.RatedPowerDeclared ?? 0.SI<Watt>() + vehicleData.MaxNetPower1 ?? 0.SI<Watt>(); + case VectoSimulationJobType.SerialHybridVehicle: + case VectoSimulationJobType.BatteryElectricVehicle: + case VectoSimulationJobType.IEPC_E: + case VectoSimulationJobType.IEPC_S: + return (vehicleData.Components?.EngineInputData?.RatedPowerDeclared ?? 0.SI<Watt>()) + + (vehicleData.Components?.ElectricMachines?.Entries + .Where(x => x.Position != PowertrainPosition.GEN) + .Sum(x => x.ElectricMachine.R85RatedPower * x.Count) ?? 0.SI<Watt>()) + + (vehicleData.Components?.IEPC?.R85RatedPower ?? 0.SI<Watt>()) + + (vehicleData.MaxNetPower1 ?? 0.SI<Watt>()); + default: + throw new ArgumentOutOfRangeException(); + } + } + public static WeightingGroup GetVehicleGroupCO2StandardsGroup(IMultistepBusInputDataProvider multiStageInputDataProvider) { return Declaration.WeightingGroup.Unknown;