From 7d9122cb04d0f07c2c1e085ccb6382096836b53e Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Thu, 15 Oct 2015 09:18:45 +0200 Subject: [PATCH] disable logging when searching for idling speed --- .../Models/SimulationComponent/Impl/CombustionEngine.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index 61278d67b9..21781aa91f 100644 --- a/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Resources; +using NLog; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Exceptions; using TUGraz.VectoCore.Models.Connector.Ports; @@ -528,6 +529,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private IResponse SearchIdlingSpeed(Second absTime, Second dt, NewtonMeter torque, PerSecond angularSpeed, ResponseUnderload responseUnderload) { + Log.Info("Disabling logging during search idling speed"); + LogManager.DisableLogging(); + var prevEngineSpeed = Engine.PreviousState.EngineSpeed; var searchInterval = Constants.SimulationSettings.EngineIdlingSearchInterval; @@ -549,6 +553,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl delta = response.DeltaDragLoad; debug.Add(new { engineSpeed = nextAngularSpeed, searchInterval, delta }); if (delta.IsEqual(0.SI<Watt>(), Constants.SimulationSettings.EnginePowerSearchTolerance)) { + LogManager.EnableLogging(); Log.Debug("found operating point in {0} iterations. engine speed: {1}, delta: {2}", retryCount, nextAngularSpeed, delta); return RequestPort.Request(absTime, dt, torque, nextAngularSpeed); @@ -560,6 +565,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl searchInterval *= intervalFactor; } while (retryCount++ < Constants.SimulationSettings.EngineSearchLoopThreshold); + LogManager.EnableLogging(); Log.Warn("Exceeded max iterations when searching for idling point!"); Log.Warn("acceleration: {0} ... {1}", ", ".Join(debug.Take(5).Select(x => x.acceleration)), ", ".Join(debug.Slice(-6).Select(x => x.acceleration))); -- GitLab