diff --git a/conf/settings/nps.xml b/conf/settings/nps.xml index 073e4e0b7f..ba8aa8f8c6 100644 --- a/conf/settings/nps.xml +++ b/conf/settings/nps.xml @@ -10,6 +10,7 @@ + diff --git a/sw/simulator/nps/nps_atmosphere.c b/sw/simulator/nps/nps_atmosphere.c index e676b089cb..d3aba4bfcf 100644 --- a/sw/simulator/nps/nps_atmosphere.c +++ b/sw/simulator/nps/nps_atmosphere.c @@ -39,6 +39,10 @@ #define NPS_WIND_DIR 0 #endif +#ifndef NPS_TURBULENCE_SEVERITY +#define NPS_TURBULENCE_SEVERITY 0 +#endif + struct NpsAtmosphere nps_atmosphere; void nps_atmosphere_init(void) { @@ -46,10 +50,12 @@ void nps_atmosphere_init(void) { nps_atmosphere.qnh = NPS_QNH; nps_atmosphere.wind_speed = NPS_WIND_SPEED; nps_atmosphere.wind_dir = NPS_WIND_DIR; + nps_atmosphere.turbulence_severity = NPS_TURBULENCE_SEVERITY; } void nps_atmosphere_update(double dt __attribute__((unused))) { - nps_fdm_set_wind(nps_atmosphere.wind_speed, nps_atmosphere.wind_dir); + nps_fdm_set_wind(nps_atmosphere.wind_speed, nps_atmosphere.wind_dir, + nps_atmosphere.turbulence_severity); } diff --git a/sw/simulator/nps/nps_atmosphere.h b/sw/simulator/nps/nps_atmosphere.h index 88cc1cf820..683db7e974 100644 --- a/sw/simulator/nps/nps_atmosphere.h +++ b/sw/simulator/nps/nps_atmosphere.h @@ -33,6 +33,7 @@ struct NpsAtmosphere { double qnh; ///< barometric pressure at sea level in Pascal double wind_speed; ///< wind magnitude in m/s double wind_dir; ///< wind direction in radians north=0, increasing CCW + int turbulence_severity; ///< turbulence severity from 0-7 }; extern struct NpsAtmosphere nps_atmosphere; diff --git a/sw/simulator/nps/nps_fdm.h b/sw/simulator/nps/nps_fdm.h index c223c9fda6..99c0ec8691 100644 --- a/sw/simulator/nps/nps_fdm.h +++ b/sw/simulator/nps/nps_fdm.h @@ -94,6 +94,6 @@ extern struct NpsFdm fdm; extern void nps_fdm_init(double dt); extern void nps_fdm_run_step(double* commands); -extern void nps_fdm_set_wind(double speed, double dir); +extern void nps_fdm_set_wind(double speed, double dir, int turbulence_severity); #endif /* NPS_FDM */ diff --git a/sw/simulator/nps/nps_fdm_jsbsim.c b/sw/simulator/nps/nps_fdm_jsbsim.c index 64dd9dc813..30a438d7e2 100644 --- a/sw/simulator/nps/nps_fdm_jsbsim.c +++ b/sw/simulator/nps/nps_fdm_jsbsim.c @@ -180,10 +180,14 @@ void nps_fdm_run_step(double* commands) { } -void nps_fdm_set_wind(double speed, double dir) { +void nps_fdm_set_wind(double speed, double dir, int turbulence_severity) { FGWinds* Winds = FDMExec->GetWinds(); Winds->SetWindspeed(FeetOfMeters(speed)); Winds->SetWindPsi(dir); + + /* wind speed used for turbulence */ + Winds->SetWindspeed20ft(FeetOfMeters(speed)/2); + Winds->SetProbabilityOfExceedence(turbulence_severity); } /**