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