Connect the FlightGear /environment/turbulence-norm property to the
turbulence gain in JSBSim's FGAtmosphere class. Latest FGAtmosphere from JSBSim with working turbulence support.
This commit is contained in:
parent
86bf012f50
commit
4ecd146258
3 changed files with 10 additions and 5 deletions
|
@ -88,9 +88,9 @@ FGAtmosphere::FGAtmosphere(FGFDMExec* fdmex) : FGModel(fdmex)
|
|||
htab[7]=259186.352; //ft.
|
||||
|
||||
MagnitudedAccelDt = MagnitudeAccel = Magnitude = 0.0;
|
||||
turbType = ttNone;
|
||||
// turbType = ttBerndt; // temporarily disable turbulence until fully tested
|
||||
TurbGain = 100.0;
|
||||
// turbType = ttNone;
|
||||
turbType = ttBerndt;
|
||||
TurbGain = 0.0;
|
||||
|
||||
bind();
|
||||
Debug(0);
|
||||
|
@ -266,10 +266,11 @@ void FGAtmosphere::Turbulence(void)
|
|||
vDirectiondAccelDt(eY) = 1 - 2.0*(((double)(rand()))/RAND_MAX);
|
||||
vDirectiondAccelDt(eZ) = 1 - 2.0*(((double)(rand()))/RAND_MAX);
|
||||
|
||||
MagnitudedAccelDt = 1 - 2.0*(((double)(rand()))/RAND_MAX);
|
||||
|
||||
MagnitudedAccelDt = 1 - 2.0*(((double)(rand()))/RAND_MAX) - Magnitude;
|
||||
MagnitudeAccel += MagnitudedAccelDt*rate*State->Getdt();
|
||||
Magnitude += MagnitudeAccel*rate*State->Getdt();
|
||||
|
||||
|
||||
vDirectiondAccelDt.Normalize();
|
||||
vDirectionAccel += vDirectiondAccelDt*rate*State->Getdt();
|
||||
vDirectionAccel.Normalize();
|
||||
|
|
|
@ -178,6 +178,7 @@ FGJSBsim::FGJSBsim( double dt )
|
|||
temperature = fgGetNode("/environment/temperature-degc",true);
|
||||
pressure = fgGetNode("/environment/pressure-inhg",true);
|
||||
density = fgGetNode("/environment/density-slugft3",true);
|
||||
turbulence = fgGetNode("environment/turbulence-norm",true);
|
||||
|
||||
wind_from_north= fgGetNode("/environment/wind-from-north-fps",true);
|
||||
wind_from_east = fgGetNode("/environment/wind-from-east-fps" ,true);
|
||||
|
@ -211,6 +212,7 @@ void FGJSBsim::init() {
|
|||
9.0/5.0*(temperature->getDoubleValue()+273.15) );
|
||||
Atmosphere->SetExPressure(pressure->getDoubleValue()*70.726566);
|
||||
Atmosphere->SetExDensity(density->getDoubleValue());
|
||||
Atmosphere->SetTurbGain(turbulence->getDoubleValue()*100.0);
|
||||
} else {
|
||||
Atmosphere->UseInternal();
|
||||
}
|
||||
|
@ -398,6 +400,7 @@ bool FGJSBsim::copy_to_JSBsim() {
|
|||
9.0/5.0*(temperature->getDoubleValue()+273.15) );
|
||||
Atmosphere->SetExPressure(pressure->getDoubleValue()*70.726566);
|
||||
Atmosphere->SetExDensity(density->getDoubleValue());
|
||||
Atmosphere->SetTurbGain(turbulence->getDoubleValue()*100.0);
|
||||
|
||||
Atmosphere->SetWindNED( wind_from_north->getDoubleValue(),
|
||||
wind_from_east->getDoubleValue(),
|
||||
|
|
|
@ -263,6 +263,7 @@ private:
|
|||
SGPropertyNode *temperature;
|
||||
SGPropertyNode *pressure;
|
||||
SGPropertyNode *density;
|
||||
SGPropertyNode *turbulence;
|
||||
|
||||
SGPropertyNode *wind_from_north;
|
||||
SGPropertyNode *wind_from_east;
|
||||
|
|
Loading…
Add table
Reference in a new issue