]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim.cxx
More property node optimizations.
[flightgear.git] / src / FDM / JSBSim.cxx
1 // JSBsim.cxx -- interface to the JSBsim flight model
2 //
3 // Written by Curtis Olson, started February 1999.
4 //
5 // Copyright (C) 1999  Curtis L. Olson  - curt@flightgear.org
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #include <simgear/compiler.h>
25
26 #ifdef SG_MATH_EXCEPTION_CLASH
27 #  include <math.h>
28 #endif
29
30 #include STL_STRING
31
32 #include <simgear/constants.h>
33 #include <simgear/debug/logstream.hxx>
34 #include <simgear/math/sg_geodesy.hxx>
35 #include <simgear/misc/sg_path.hxx>
36
37 #include <Scenery/scenery.hxx>
38
39 #include <Aircraft/aircraft.hxx>
40 #include <Controls/controls.hxx>
41 #include <Main/globals.hxx>
42 #include <Main/fg_props.hxx>
43
44 #include <FDM/JSBSim/FGFDMExec.h>
45 #include <FDM/JSBSim/FGAircraft.h>
46 #include <FDM/JSBSim/FGFCS.h>
47 #include <FDM/JSBSim/FGPosition.h>
48 #include <FDM/JSBSim/FGRotation.h>
49 #include <FDM/JSBSim/FGState.h>
50 #include <FDM/JSBSim/FGTranslation.h>
51 #include <FDM/JSBSim/FGAuxiliary.h>
52 #include <FDM/JSBSim/FGDefs.h>
53 #include <FDM/JSBSim/FGInitialCondition.h>
54 #include <FDM/JSBSim/FGTrim.h>
55 #include <FDM/JSBSim/FGAtmosphere.h>
56 #include <FDM/JSBSim/FGMassBalance.h>
57 #include <FDM/JSBSim/FGAerodynamics.h>
58 #include "JSBSim.hxx"
59
60 /******************************************************************************/
61
62 FGJSBsim::FGJSBsim( double dt ) 
63   : FGInterface(dt)
64 {
65     bool result;
66    
67     fdmex=new FGFDMExec;
68     
69     State        = fdmex->GetState();
70     Atmosphere   = fdmex->GetAtmosphere();
71     FCS          = fdmex->GetFCS();
72     MassBalance  = fdmex->GetMassBalance();
73     Propulsion   = fdmex->GetPropulsion();
74     Aircraft     = fdmex->GetAircraft();
75     Translation  = fdmex->GetTranslation();
76     Rotation     = fdmex->GetRotation();
77     Position     = fdmex->GetPosition();
78     Auxiliary    = fdmex->GetAuxiliary();
79     Aerodynamics = fdmex->GetAerodynamics();
80
81     fgic=new FGInitialCondition(fdmex);
82     needTrim=true;
83   
84     SGPath aircraft_path( globals->get_fg_root() );
85     aircraft_path.append( "Aircraft" );
86
87     SGPath engine_path( globals->get_fg_root() );
88     engine_path.append( "Engine" );
89     set_delta_t( dt );
90     State->Setdt( dt );
91
92     result = fdmex->LoadModel( aircraft_path.str(),
93                                engine_path.str(),
94                                fgGetString("/sim/aircraft") );
95     
96     int Neng = Propulsion->GetNumEngines();
97     SG_LOG(SG_FLIGHT,SG_INFO, "Neng: " << Neng );
98     
99     for(int i=0;i<Neng;i++) {
100         add_engine( FGEngInterface() );
101     }  
102     
103     fgSetDouble("/fdm/trim/pitch-trim", FCS->GetPitchTrimCmd());
104     fgSetDouble("/fdm/trim/throttle",   FCS->GetThrottleCmd(0));
105     fgSetDouble("/fdm/trim/aileron",    FCS->GetDaCmd());
106     fgSetDouble("/fdm/trim/rudder",     FCS->GetDrCmd());
107
108     startup_trim = fgGetNode("/sim/startup/trim", true);
109
110     trimmed = fgGetNode("/fdm/trim/trimmed", true);
111     trimmed->setBoolValue(false);
112
113     pitch_trim = fgGetNode("/fdm/trim/pitch-trim", true );
114     throttle_trim = fgGetNode("/fdm/trim/throttle", true );
115     aileron_trim = fgGetNode("/fdm/trim/aileron", true );
116     rudder_trim = fgGetNode("/fdm/trim/rudder", true );
117 }
118
119 /******************************************************************************/
120 FGJSBsim::~FGJSBsim(void) {
121     if(fdmex != NULL) {
122         delete fdmex;
123         delete fgic;
124     }  
125 }
126
127 /******************************************************************************/
128
129 // Initialize the JSBsim flight model, dt is the time increment for
130 // each subsequent iteration through the EOM
131
132 void FGJSBsim::init() {
133                 // Explicitly call the superclass's
134                 // init method first.
135     FGInterface::init();
136
137     bool result;
138
139     SG_LOG( SG_FLIGHT, SG_INFO, "Starting and initializing JSBsim" );
140
141     Atmosphere->UseInternal();
142
143     SG_LOG( SG_FLIGHT, SG_INFO, "  Initializing JSBSim with:" );
144
145     switch(fgic->GetSpeedSet()) {
146     case setned:
147         SG_LOG(SG_FLIGHT,SG_INFO, "  Vn,Ve,Vd= "
148                << Position->GetVn() << ", "
149                << Position->GetVe() << ", "
150                << Position->GetVd() << " ft/s");
151     break;
152     case setuvw:
153         SG_LOG(SG_FLIGHT,SG_INFO, "  U,V,W= "
154                << Translation->GetUVW(1) << ", "
155                << Translation->GetUVW(2) << ", "
156                << Translation->GetUVW(3) << " ft/s");
157     break;
158     case setmach:
159         SG_LOG(SG_FLIGHT,SG_INFO, "  Mach: "
160                << Translation->GetMach() );
161     break;
162     case setvc:
163     default:
164         SG_LOG(SG_FLIGHT,SG_INFO, "  Indicated Airspeed: "
165                << Auxiliary->GetVcalibratedKTS() << " knots" );
166     break;
167     }
168
169     SG_LOG( SG_FLIGHT, SG_INFO, "  Bank Angle: "
170             <<  Rotation->Getphi()*RADTODEG << " deg");
171     SG_LOG( SG_FLIGHT, SG_INFO, "  Pitch Angle: "
172             << Rotation->Gettht()*RADTODEG << " deg"  );
173     SG_LOG( SG_FLIGHT, SG_INFO, "  True Heading: "
174             << Rotation->Getpsi()*RADTODEG << " deg"  );
175     SG_LOG( SG_FLIGHT, SG_INFO, "  Latitude: "
176             <<  Position->GetLatitude() << " deg" );
177     SG_LOG( SG_FLIGHT, SG_INFO, "  Longitude: "
178             <<  Position->GetLongitude() << " deg"  );
179
180     SG_LOG( SG_FLIGHT, SG_INFO, "  loaded initial conditions" );
181
182     SG_LOG( SG_FLIGHT, SG_INFO, "  set dt" );
183
184     SG_LOG( SG_FLIGHT, SG_INFO, "Finished initializing JSBSim" );
185 }
186
187 /******************************************************************************/
188
189 // Run an iteration of the EOM (equations of motion)
190
191 bool FGJSBsim::update( int multiloop ) {
192
193     int i;
194
195     double save_alt = 0.0;
196
197     copy_to_JSBsim();
198
199     trimmed->setBoolValue(false);
200
201     if ( needTrim && startup_trim->getBoolValue() ) {
202
203         //fgic->SetSeaLevelRadiusFtIC( get_Sea_level_radius() );
204         //fgic->SetTerrainAltitudeFtIC( scenery.cur_elev * SG_METER_TO_FEET );
205
206         FGTrim *fgtrim;
207         if(fgic->GetVcalibratedKtsIC() < 10 ) {
208             fgic->SetVcalibratedKtsIC(0.0);
209             fgtrim=new FGTrim(fdmex,fgic,tGround);
210         } else {
211             fgtrim=new FGTrim(fdmex,fgic,tLongitudinal);
212         }
213         if(!fgtrim->DoTrim()) {
214             fgtrim->Report();
215             fgtrim->TrimStats();
216         } else {
217             trimmed->setBoolValue(true);
218         }
219         fgtrim->ReportState();
220         delete fgtrim;
221
222         needTrim=false;
223
224         pitch_trim->setDoubleValue( FCS->GetPitchTrimCmd() );
225         throttle_trim->setDoubleValue( FCS->GetThrottleCmd(0) );
226         aileron_trim->setDoubleValue( FCS->GetDaCmd() );
227         rudder_trim->setDoubleValue( FCS->GetDrCmd() );
228
229         controls.set_elevator_trim(FCS->GetPitchTrimCmd());
230         controls.set_elevator(FCS->GetDeCmd());
231         controls.set_throttle(FGControls::ALL_ENGINES,
232                               FCS->GetThrottleCmd(0));
233
234         controls.set_aileron(FCS->GetDaCmd());
235         controls.set_rudder( FCS->GetDrCmd());
236     
237         SG_LOG( SG_FLIGHT, SG_INFO, "  Trim complete" );
238     }
239   
240     for( i=0; i<get_num_engines(); i++ ) {
241       get_engine(i)->set_RPM( Propulsion->GetThruster(i)->GetRPM() );
242       get_engine(i)->set_Throttle( controls.get_throttle(i) );
243     }
244
245     for ( i=0; i < multiloop; i++ ) {
246         fdmex->Run();
247     }
248
249     // printf("%d FG_Altitude = %.2f\n", i, FG_Altitude * 0.3048);
250     // printf("%d Altitude = %.2f\n", i, Altitude * 0.3048);
251
252     // translate JSBsim back to FG structure so that the
253     // autopilot (and the rest of the sim can use the updated values
254
255     copy_from_JSBsim();
256     return true;
257 }
258
259 /******************************************************************************/
260
261 // Convert from the FGInterface struct to the JSBsim generic_ struct
262
263 bool FGJSBsim::copy_to_JSBsim() {
264     // copy control positions into the JSBsim structure
265
266     FCS->SetDaCmd( controls.get_aileron());
267     FCS->SetDeCmd( controls.get_elevator());
268     FCS->SetPitchTrimCmd(controls.get_elevator_trim());
269     FCS->SetDrCmd( -controls.get_rudder());
270     FCS->SetDfCmd(  controls.get_flaps() );
271     FCS->SetDsbCmd( 0.0 ); //speedbrakes
272     FCS->SetDspCmd( 0.0 ); //spoilers
273     FCS->SetThrottleCmd( FGControls::ALL_ENGINES,
274                          controls.get_throttle( 0 ));
275     FCS->SetLBrake( controls.get_brake( 0 ) );
276     FCS->SetRBrake( controls.get_brake( 1 ) );
277     FCS->SetCBrake( controls.get_brake( 2 ) );
278
279     Position->SetSeaLevelRadius( get_Sea_level_radius() );
280     Position->SetRunwayRadius( scenery.cur_elev*SG_METER_TO_FEET
281                                + get_Sea_level_radius() );
282
283     Atmosphere->SetExTemperature(get_Static_temperature());
284     Atmosphere->SetExPressure(get_Static_pressure());
285     Atmosphere->SetExDensity(get_Density());
286     Atmosphere->SetWindNED(get_V_north_airmass(),
287                            get_V_east_airmass(),
288                            get_V_down_airmass());
289 //    SG_LOG(SG_FLIGHT,SG_INFO, "Wind NED: "
290 //                  << get_V_north_airmass() << ", "
291 //                  << get_V_east_airmass()  << ", "
292 //                  << get_V_down_airmass() );
293
294     return true;
295 }
296
297 /******************************************************************************/
298
299 // Convert from the JSBsim generic_ struct to the FGInterface struct
300
301 bool FGJSBsim::copy_from_JSBsim() {
302     unsigned int i, j;
303
304     _set_Inertias( MassBalance->GetMass(),
305                    MassBalance->GetIxx(),
306                    MassBalance->GetIyy(),
307                    MassBalance->GetIzz(),
308                    MassBalance->GetIxz() );
309
310     _set_CG_Position( MassBalance->GetXYZcg(1),
311                       MassBalance->GetXYZcg(2),
312                       MassBalance->GetXYZcg(3) );
313
314     _set_Accels_Body( Translation->GetUVWdot(1),
315                       Translation->GetUVWdot(2),
316                       Translation->GetUVWdot(3) );
317
318     _set_Accels_CG_Body( Translation->GetUVWdot(1),
319                          Translation->GetUVWdot(2),
320                          Translation->GetUVWdot(3) );
321
322     //_set_Accels_CG_Body_N ( Translation->GetNcg(1),
323     //                       Translation->GetNcg(2),
324     //                       Translation->GetNcg(3) );
325     //
326     _set_Accels_Pilot_Body( Auxiliary->GetPilotAccel(1),
327                             Auxiliary->GetPilotAccel(2),
328                             Auxiliary->GetPilotAccel(3) );
329
330     //_set_Accels_Pilot_Body_N( Auxiliary->GetNpilot(1),
331     //                         Auxiliary->GetNpilot(2),
332     //                         Auxiliary->GetNpilot(3) );
333
334     _set_Nlf( Aerodynamics->GetNlf() );
335
336     // Velocities
337
338     _set_Velocities_Local( Position->GetVn(),
339                            Position->GetVe(),
340                            Position->GetVd() );
341
342     _set_Velocities_Wind_Body( Translation->GetUVW(1),
343                                Translation->GetUVW(2),
344                                Translation->GetUVW(3) );
345
346     _set_V_rel_wind( Translation->GetVt() );
347
348     _set_V_equiv_kts( Auxiliary->GetVequivalentKTS() );
349
350     // _set_V_calibrated( Auxiliary->GetVcalibratedFPS() );
351
352     _set_V_calibrated_kts( Auxiliary->GetVcalibratedKTS() );
353
354     _set_V_ground_speed( Position->GetVground() );
355
356     _set_Omega_Body( Rotation->GetPQR(1),
357                      Rotation->GetPQR(2),
358                      Rotation->GetPQR(3) );
359
360     _set_Euler_Rates( Rotation->GetEulerRates(1),
361                       Rotation->GetEulerRates(2),
362                       Rotation->GetEulerRates(3) );
363
364     _set_Geocentric_Rates(Position->GetLatitudeDot(),
365                           Position->GetLongitudeDot(),
366                           Position->Gethdot() );
367
368     _set_Mach_number( Translation->GetMach() );
369
370     // Positions
371     _updatePosition( Position->GetLatitude(),
372                      Position->GetLongitude(),
373                      Position->Geth() );
374
375     _set_Euler_Angles( Rotation->Getphi(),
376                        Rotation->Gettht(),
377                        Rotation->Getpsi() );
378
379     _set_Alpha( Translation->Getalpha() );
380     _set_Beta( Translation->Getbeta() );
381
382
383     _set_Gamma_vert_rad( Position->GetGamma() );
384     // set_Gamma_horiz_rad( Gamma_horiz_rad );
385
386     _set_Earth_position_angle( Auxiliary->GetEarthPositionAngle() );
387
388     _set_Climb_Rate( Position->Gethdot() );
389
390
391     for ( i = 1; i <= 3; i++ ) {
392         for ( j = 1; j <= 3; j++ ) {
393             _set_T_Local_to_Body( i, j, State->GetTl2b(i,j) );
394         }
395     }
396     return true;
397 }
398
399 void FGJSBsim::snap_shot(void) {
400     fgic->SetLatitudeRadIC(get_Lat_geocentric() );
401     fgic->SetLongitudeRadIC( get_Longitude() );
402     fgic->SetAltitudeFtIC( get_Altitude() );
403     fgic->SetTerrainAltitudeFtIC( get_Runway_altitude() );
404     fgic->SetVtrueFpsIC( get_V_rel_wind() );
405     fgic->SetPitchAngleRadIC( get_Theta() );
406     fgic->SetRollAngleRadIC( get_Phi() );
407     fgic->SetTrueHeadingRadIC( get_Psi() );
408     fgic->SetClimbRateFpsIC( get_Climb_Rate() );
409 }
410
411
412 bool FGJSBsim::ToggleDataLogging(void) {
413     return fdmex->GetOutput()->Toggle();
414 }
415
416
417 bool FGJSBsim::ToggleDataLogging(bool state) {
418     if (state) {
419       fdmex->GetOutput()->Enable();
420       return true;
421     } else {
422       fdmex->GetOutput()->Disable();
423       return false;
424     }
425 }
426
427
428 //Positions
429 void FGJSBsim::set_Latitude(double lat) {
430     double sea_level_radius_meters,lat_geoc;
431
432     SG_LOG(SG_FLIGHT,SG_INFO,"FGJSBsim::set_Latitude: " << lat );
433
434     snap_shot();
435     sgGeodToGeoc( lat, get_Altitude() , &sea_level_radius_meters, &lat_geoc);
436     _set_Sea_level_radius( sea_level_radius_meters * SG_METER_TO_FEET  );
437     fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * SG_METER_TO_FEET  );
438     fgic->SetLatitudeRadIC( lat_geoc );
439     fdmex->RunIC(fgic); //loop JSBSim once
440     copy_from_JSBsim(); //update the bus
441     needTrim=true;
442 }
443
444 void FGJSBsim::set_Longitude(double lon) {
445
446     SG_LOG(SG_FLIGHT,SG_INFO,"FGJSBsim::set_Longitude: " << lon );
447
448     snap_shot();
449     fgic->SetLongitudeRadIC(lon);
450     fdmex->RunIC(fgic); //loop JSBSim once
451     copy_from_JSBsim(); //update the bus
452     needTrim=true;
453 }
454
455 void FGJSBsim::set_Altitude(double alt) {
456     double sea_level_radius_meters,lat_geoc;
457
458     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Altitude: " << alt );
459
460     snap_shot();
461     sgGeodToGeoc( get_Latitude(), alt , &sea_level_radius_meters, &lat_geoc);
462     _set_Sea_level_radius( sea_level_radius_meters * SG_METER_TO_FEET  );
463     fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * SG_METER_TO_FEET );
464     fgic->SetLatitudeRadIC( lat_geoc );
465     fgic->SetAltitudeFtIC(alt);
466     fdmex->RunIC(fgic); //loop JSBSim once
467     copy_from_JSBsim(); //update the bus
468     needTrim=true;
469 }
470
471 void FGJSBsim::set_V_calibrated_kts(double vc) {
472     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_V_calibrated_kts: " <<  vc );
473
474     snap_shot();
475     fgic->SetVcalibratedKtsIC(vc);
476     fdmex->RunIC(fgic); //loop JSBSim once
477     copy_from_JSBsim(); //update the bus
478     needTrim=true;
479 }
480
481 void FGJSBsim::set_Mach_number(double mach) {
482     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Mach_number: " <<  mach );
483
484     snap_shot();
485     fgic->SetMachIC(mach);
486     fdmex->RunIC(fgic); //loop JSBSim once
487     copy_from_JSBsim(); //update the bus
488     needTrim=true;
489 }
490
491 void FGJSBsim::set_Velocities_Local( double north, double east, double down ){
492     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Velocities_Local: "
493        << north << ", " <<  east << ", " << down );
494
495     snap_shot();
496     fgic->SetVnorthFpsIC(north);
497     fgic->SetVeastFpsIC(east);
498     fgic->SetVdownFpsIC(down);
499     fdmex->RunIC(fgic); //loop JSBSim once
500     copy_from_JSBsim(); //update the bus
501     needTrim=true;
502 }
503
504 void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w){
505     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Velocities_Wind_Body: "
506        << u << ", " <<  v << ", " <<  w );
507
508     snap_shot();
509     fgic->SetUBodyFpsIC(u);
510     fgic->SetVBodyFpsIC(v);
511     fgic->SetWBodyFpsIC(w);
512     fdmex->RunIC(fgic); //loop JSBSim once
513     copy_from_JSBsim(); //update the bus
514     needTrim=true;
515 }
516
517 //Euler angles
518 void FGJSBsim::set_Euler_Angles( double phi, double theta, double psi ) {
519     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Euler_Angles: "
520        << phi << ", " << theta << ", " << psi );
521
522     snap_shot();
523     fgic->SetPitchAngleRadIC(theta);
524     fgic->SetRollAngleRadIC(phi);
525     fgic->SetTrueHeadingRadIC(psi);
526     fdmex->RunIC(fgic); //loop JSBSim once
527     copy_from_JSBsim(); //update the bus
528     needTrim=true;
529 }
530
531 //Flight Path
532 void FGJSBsim::set_Climb_Rate( double roc) {
533     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Climb_Rate: " << roc );
534
535     snap_shot();
536     fgic->SetClimbRateFpsIC(roc);
537     fdmex->RunIC(fgic); //loop JSBSim once
538     copy_from_JSBsim(); //update the bus
539     needTrim=true;
540 }
541
542 void FGJSBsim::set_Gamma_vert_rad( double gamma) {
543     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Gamma_vert_rad: " << gamma );
544
545     snap_shot();
546     fgic->SetFlightPathAngleRadIC(gamma);
547     fdmex->RunIC(fgic); //loop JSBSim once
548     copy_from_JSBsim(); //update the bus
549     needTrim=true;
550 }
551
552 //Earth
553 void FGJSBsim::set_Sea_level_radius(double slr) {
554     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Sea_level_radius: " << slr );
555
556     snap_shot();
557     fgic->SetSeaLevelRadiusFtIC(slr);
558     fdmex->RunIC(fgic); //loop JSBSim once
559     copy_from_JSBsim(); //update the bus
560     needTrim=true;
561 }
562
563 void FGJSBsim::set_Runway_altitude(double ralt) {
564     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Runway_altitude: " << ralt );
565
566     snap_shot();
567     _set_Runway_altitude( ralt );
568     fgic->SetTerrainAltitudeFtIC( ralt );
569     fdmex->RunIC(fgic); //loop JSBSim once
570     copy_from_JSBsim(); //update the bus
571     needTrim=true;
572 }
573
574 void FGJSBsim::set_Static_pressure(double p) {
575     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Static_pressure: " << p );
576
577     snap_shot();
578     Atmosphere->SetExPressure(p);
579     if(Atmosphere->External() == true)
580     needTrim=true;
581 }
582
583 void FGJSBsim::set_Static_temperature(double T) {
584     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Static_temperature: " << T );
585     
586     snap_shot();
587     Atmosphere->SetExTemperature(T);
588     if(Atmosphere->External() == true)
589     needTrim=true;
590 }
591  
592
593 void FGJSBsim::set_Density(double rho) {
594     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Density: " << rho );
595     
596     snap_shot();
597     Atmosphere->SetExDensity(rho);
598     if(Atmosphere->External() == true)
599     needTrim=true;
600 }
601   
602
603 void FGJSBsim::set_Velocities_Local_Airmass (double wnorth, 
604                          double weast, 
605                          double wdown ) {
606     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Velocities_Local_Airmass: " 
607        << wnorth << ", " << weast << ", " << wdown );
608     
609     _set_Velocities_Local_Airmass( wnorth, weast, wdown );
610     snap_shot();
611     Atmosphere->SetWindNED(wnorth, weast, wdown );
612     if(Atmosphere->External() == true)
613         needTrim=true;
614 }     
615