diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport.cs index 09376d879bc36075ecfd60fc6db358169b77806c..7ae2afd106007a37e458e7dbd215024c42ff92f0 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport.cs @@ -38,6 +38,7 @@ using System.Text; using System.Xml; using System.Xml.Linq; using System.Xml.XPath; +using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Resources; @@ -198,6 +199,10 @@ namespace TUGraz.VectoCore.OutputData.XML protected internal override void DoWriteReport() { + var sumWeightinFactors = Missions.Values.Sum(x => x.ResultEntry.Values.Sum(y => y.WeightingFactor)); + if (!sumWeightinFactors.IsEqual(0) || !sumWeightinFactors.IsEqual(1)) { + throw new VectoException("Mission Profile Weighting factors do not sum up to 1!"); + } foreach (var result in Missions.OrderBy(m => m.Key)) { _manufacturerReport.WriteResult(result.Value); _customerReport.WriteResult(result.Value); diff --git a/VectoCore/VectoCore/Resources/Declaration/CO2Standards/MissionProfileWeights.csv b/VectoCore/VectoCore/Resources/Declaration/CO2Standards/MissionProfileWeights.csv index 407379303d27af18a5b1aab070fc354c90f94727..1c18bcdb4ff93409a2cb286e5bfc36be2d1f01be 100644 --- a/VectoCore/VectoCore/Resources/Declaration/CO2Standards/MissionProfileWeights.csv +++ b/VectoCore/VectoCore/Resources/Declaration/CO2Standards/MissionProfileWeights.csv @@ -13,4 +13,4 @@ Weighting Group , LongHaul , LongHaul EMS , Regional Delivery , Regional Delive 10-LH , 0.27/0.63 , 0/0 , 0.03/0.07 , 0/0 , 0/0 , 0/0 , 0/0 11 , 0/0 , 0/0 , 0.15/0.35 , 0/0 , 0/0 , 0/0 , 0.15/0.35 12 , 0/0 , 0/0 , 0.21/0.49 , 0/0 , 0/0 , 0/0 , 0.09/0.21 -16 , 0/0 , 0/0 , 0.15/0.35 , 0/0 , 0/0 , 0/0 , 0.15/0.35 +16 , 0/0 , 0/0 , 0/0 , 0/0 , 0/0 , 0/0 , 0.30/0.70