Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit bea13407 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

adding additional check that the weighting factors of all simulated cycles have to sum up to 1!

parent 31d8c74e
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment