From 16635b6b988f8ed50bd6db1763373f6bd2fb987f Mon Sep 17 00:00:00 2001 From: david Date: Tue, 1 Jul 2003 20:52:12 +0000 Subject: [PATCH] Move the turbulence magnitude away from the peaks. --- src/FDM/JSBSim/FGAtmosphere.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/FDM/JSBSim/FGAtmosphere.cpp b/src/FDM/JSBSim/FGAtmosphere.cpp index 6eb0aa157..26404342a 100644 --- a/src/FDM/JSBSim/FGAtmosphere.cpp +++ b/src/FDM/JSBSim/FGAtmosphere.cpp @@ -267,7 +267,11 @@ void FGAtmosphere::Turbulence(void) vDirectiondAccelDt(eY) = 1 - 2.0*(double(rand())/double(RAND_MAX)); vDirectiondAccelDt(eZ) = 1 - 2.0*(double(rand())/double(RAND_MAX)); - MagnitudedAccelDt = 1 - 2.0*(double(rand())/double(RAND_MAX)); + MagnitudedAccelDt = 1 - 2.0*(double(rand())/double(RAND_MAX)) - Magnitude; + // Scale the magnitude so that it moves + // away from the peaks + MagnitudedAccelDt = ((MagnitudedAccelDt - Magnitude) / + (1 + fabs(Magnitude))); MagnitudeAccel += MagnitudedAccelDt*rate*State->Getdt(); Magnitude += MagnitudeAccel*rate*State->Getdt();