From a73163596cce97db3a9059e8d442b3bb2ba5f0b2 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Mon, 10 Aug 2015 18:11:28 +0200 Subject: [PATCH] use new SI functionality --- .../Models/SimulationComponent/Data/AccelerationCurve.cs | 2 +- VectoCore/Models/SimulationComponent/Impl/Driver.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs b/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs index 24024dc4f7..1dd22d194b 100644 --- a/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs +++ b/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs @@ -137,7 +137,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data var m = v1 + d / k; var b = -d / k; var c = 0.SI<Meter>() - m / k; - var t = (Math.Log((v2 * k + d).Value() / (v1 * k + d).Value()) / k.Value()).SI<Second>(); + var t = Math.Log(((v2 * k + d) / (v1 * k + d)).Cast<Scalar>()) / k; // TODO @@@quam: remove .SI<> when bug #VECTO-111 is fixed... return m / k * Math.Exp((k * t).Value()) + b * t + c; diff --git a/VectoCore/Models/SimulationComponent/Impl/Driver.cs b/VectoCore/Models/SimulationComponent/Impl/Driver.cs index 84e1cbca42..7a76fa86a0 100644 --- a/VectoCore/Models/SimulationComponent/Impl/Driver.cs +++ b/VectoCore/Models/SimulationComponent/Impl/Driver.cs @@ -380,7 +380,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { var exceeded = new List<Watt>(); // only used while testing var acceleration = new List<double>(); // only used while testing - var searchInterval = CurrentState.Acceleration.Value() / 2.0; + var searchInterval = CurrentState.Acceleration / 2.0; Meter originalDs = ds; do { @@ -413,7 +413,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // check for minimum acceleration, add some safety margin due to search if (Math.Abs(CurrentState.Acceleration.Value()) < Constants.SimulationSettings.MinimumAcceleration.Value() / 5.0 && - Math.Abs(searchInterval) < Constants.SimulationSettings.MinimumAcceleration.Value() / 20.0) { + searchInterval.Abs() < Constants.SimulationSettings.MinimumAcceleration / 20.0) { throw new VectoSimulationException("Could not achieve minimum acceleration"); } searchInterval /= 2.0; -- GitLab