*/
+#include <simgear/compiler.h>
+
+#include <math.h>
+#include STL_IOSTREAM
+
#include "FDM/LaRCsimIC.hxx"
#include <FDM/LaRCsim/ls_cockpit.h>
#include <FDM/LaRCsim/ls_generic.h>
#include <FDM/LaRCsim/atmos_62.h>
#include <FDM/LaRCsim/ls_constants.h>
#include <FDM/LaRCsim/ls_geodesy.h>
-#include <math.h>
-#include <iostream>
+
+SG_USING_STD(cout);
+SG_USING_STD(endl);
+
LaRCsimIC::LaRCsimIC(void) {
vt=vtg=vw=vc=ve=0;
void LaRCsimIC::SetClimbRateFpsIC( SCALAR tt) {
vtg=vt+vw;
- cout << "vtg: " << vtg << endl;
if(vtg > 0.1) {
hdot = tt - vdownwind;
gamma=asin(hdot/vtg);
getTheta();
vdown=-1*hdot;
- cout << "hdot: " << hdot << endl;
- cout << "gamma: " << gamma*RAD_TO_DEG << endl;
- cout << "vdown: " << vdown << endl;
}
}
getTheta();
vtg=vt+vw;
hdot=vtg*sin(tt);
- cout << "hdot: " << hdot << endl;
vdown=-1*hdot;
}
getAlpha();
}
-void LaRCsimIC::SetUBodyFpsIC( SCALAR tt) {
- u=tt;
+void LaRCsimIC::SetUVWFpsIC(SCALAR vu, SCALAR vv, SCALAR vw) {
+ u=vu; v=vv; w=vw;
vt=sqrt(u*u+v*v+w*w);
lastSpeedSet=lssetuvw;
}
-void LaRCsimIC::SetVBodyFpsIC( SCALAR tt) {
- v=tt;
- vt=sqrt(u*u+v*v+w*w);
- lastSpeedSet=lssetuvw;
-}
-
-void LaRCsimIC::SetWBodyFpsIC( SCALAR tt) {
- w=tt;
- vt=sqrt(u*u+v*v+w*w);
- lastSpeedSet=lssetuvw;
-}
-
-void LaRCsimIC::SetVNorthAirmassFpsIC(SCALAR tt) {
- vnorthwind=tt;
- vw=sqrt(vnorthwind*vnorthwind + veastwind*veastwind + vdownwind*vdownwind);
-}
-
-void LaRCsimIC::SetVEastAirmassFpsIC(SCALAR tt) {
- veastwind=tt;
- vw=sqrt(vnorthwind*vnorthwind + veastwind*veastwind + vdownwind*vdownwind);
-}
-
-void LaRCsimIC::SetVDownAirmassFpsIC(SCALAR tt){
- vdownwind=tt;
+void LaRCsimIC::SetVNEDAirmassFpsIC(SCALAR north, SCALAR east, SCALAR down ) {
+ vnorthwind=north; veastwind=east; vdownwind=down;
vw=sqrt(vnorthwind*vnorthwind + veastwind*veastwind + vdownwind*vdownwind);
vtg=vt+vw;
- hdot=-vtg*sin(gamma);
+ SetClimbRateFpsIC(-1*(vdown+vdownwind));
}
void LaRCsimIC::SetAltitudeFtIC( SCALAR tt) {
vdownwind;
}
-void LaRCsimIC::SetVnorthFpsIC( SCALAR tt) {
- vnorth=tt;
+void LaRCsimIC::SetVNEDFpsIC( SCALAR north, SCALAR east, SCALAR down) {
+ vnorth=north;
+ veast=east;
+ vdown=down;
+ SetClimbRateFpsIC(-1*vdown);
lastSpeedSet=lssetned;
calcVtfromNED();
}
-void LaRCsimIC::SetVeastFpsIC( SCALAR tt) {
- veast=tt;
- lastSpeedSet=lssetned;
- calcVtfromNED();
-}
-
-void LaRCsimIC::SetVdownFpsIC( SCALAR tt) {
- vdown=tt;
- calcVtfromNED();
- SetClimbRateFpsIC(-1*vdown);
- lastSpeedSet=lssetned;
-}
-
void LaRCsimIC::SetLatitudeGDRadIC(SCALAR tt) {
latitude_gd=tt;
ls_geod_to_geoc(latitude_gd,altitude,&sea_level_radius, &latitude_gc);