From 55070ff4f5af86bee25cf2ca97fc2d72c2f18f5a Mon Sep 17 00:00:00 2001 From: HOS Date: Wed, 2 Nov 2022 09:25:40 +0100 Subject: [PATCH] Propose better unit-handling in equation. --- Modelica/Blocks/Sources.mo | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modelica/Blocks/Sources.mo b/Modelica/Blocks/Sources.mo index 143c2ee387..058c0992a8 100644 --- a/Modelica/Blocks/Sources.mo +++ b/Modelica/Blocks/Sources.mo @@ -941,13 +941,14 @@ The Real output y is a trapezoid signal: equation y = if time < startTime then wMin else if time < (startTime + max(duration,eps)) then - 10^(log10(wMin) + (log10(wMax) - log10(wMin))*min(1, (time-startTime)/max(duration,eps))) + wMin * (wMax/wMin)^min(1, (time-startTime)/max(duration,eps)) else wMax; annotation (defaultComponentName="logSweep", Documentation(info="

The output y performs a logarithmic frequency sweep. The logarithm of frequency w performs a linear ramp from log10(wMin) to log10(wMax). +It uses wMin*(wMax/wMin)^x instead of the equivalent 10^(log10(wMin)+log10(wMax)-log10(wMin)*x) to help with unit-checking. The output is the decimal power of this logarithmic ramp.

For time < startTime the output is equal to wMin.