From f85e6ba4678c2656c3fb78d0c1a4b0852f1b7406 Mon Sep 17 00:00:00 2001 From: Harald Martini <harald.martini@student.tugraz.at> Date: Tue, 10 May 2022 09:24:34 +0200 Subject: [PATCH] implemented some checks in VectoRun as methods which are overriden in VectoMockupRun --- .../Models/Simulation/Impl/VectoRun.cs | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs index 641291ebdc..c32d35109c 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs @@ -81,6 +81,10 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl public IVehicleContainer GetContainer() => Container; + public virtual bool CalculateAggregateValues() + { + return !(GetContainer().RunData.Exempted || GetContainer().RunData.MultistageRun); + } public void Run() { if (Container.RunStatus != Status.Pending) { @@ -119,7 +123,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl Container.AbsTime = AbsTime; } } while (response is ResponseSuccess); - if (!(GetContainer().RunData.Exempted || GetContainer().RunData.MultistageRun)) { + if (CalculateAggregateValues()) { //foreach (var fuel in GetContainer().RunData.EngineData.Fuels) { // calculate vehicleline correction here in local thread context because writing sum-data and // report afterwards is synchronized @@ -165,12 +169,16 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl throw ex; } - if (Container.RunData.Exempted || Container.RunData.MultistageRun) - Container.RunStatus = Status.Success; - else if (CyclePort.Progress < 1) - Container.RunStatus = response is ResponseBatteryEmpty ? Status.REESSEmpty : Status.Aborted; - else + if (CheckCyclePortProgress()) { + if (CyclePort.Progress < 1) { + Container.RunStatus = response is ResponseBatteryEmpty ? Status.REESSEmpty : Status.Aborted; + } else { + Container.RunStatus = Status.Success; + } + } else { Container.RunStatus = Status.Success; + } + Container.FinishSimulationRun(); WritingResultsDone = true; if (Progress.IsSmaller(1, 1e-9)) { @@ -188,6 +196,11 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl Log.Info("VectoJob finished."); } + protected virtual bool CheckCyclePortProgress() + { + return !Container.RunData.Exempted && !Container.RunData.MultistageRun; + } + public bool PostProcessingDone { get; protected set; } public bool WritingResultsDone { get; protected set; } -- GitLab