]> git.mxchange.org Git - flightgear.git/blobdiff - src/Network/native_fdm.cxx
Add an "additive-switch" type.
[flightgear.git] / src / Network / native_fdm.cxx
index 1380feea80a88b13fc85a6b77d49a9dc3301452b..50c3c995894c328a7434f901ef4bf87772cad19c 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Written by Curtis Olson, started September 2001.
 //
-// Copyright (C) 2001  Curtis L. Olson - curt@flightgear.org
+// Copyright (C) 2001  Curtis L. Olson - http://www.flightgear.org/~curt
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -133,6 +133,8 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
     net->phi = cur_fdm_state->get_Phi();
     net->theta = cur_fdm_state->get_Theta();
     net->psi = cur_fdm_state->get_Psi();
+    net->alpha = cur_fdm_state->get_Alpha();
+    net->beta = cur_fdm_state->get_Beta();
     net->phidot = cur_fdm_state->get_Phi_dot_degps() * SG_DEGREES_TO_RADIANS;
     net->thetadot = cur_fdm_state->get_Theta_dot_degps()
         * SG_DEGREES_TO_RADIANS;
@@ -161,16 +163,19 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
     for ( i = 0; i < net->num_engines; ++i ) {
         SGPropertyNode *node = fgGetNode("engines/engine", i, true);
         if ( node->getBoolValue( "running" ) ) {
-            net->eng_state[0] = 2;
+            net->eng_state[i] = 2;
         } else if ( node->getBoolValue( "cranking" ) ) {
-            net->eng_state[0] = 1;
+            net->eng_state[i] = 1;
         } else {
-            net->eng_state[0] = 0;
+            net->eng_state[i] = 0;
         }
         net->rpm[i] = node->getDoubleValue( "rpm" );
         net->fuel_flow[i] = node->getDoubleValue( "fuel-flow-gph" );
-        net->EGT[i] = node->getDoubleValue( "egt-degf" );
+        net->egt[i] = node->getDoubleValue( "egt-degf" );
         // cout << "egt = " << aero->EGT << endl;
+        net->cht[i] = node->getDoubleValue( "cht-degf" );
+        net->mp_osi[i] = node->getDoubleValue( "mp-osi" );
+        net->tit[i] = node->getDoubleValue( "tit" );
         net->oil_temp[i] = node->getDoubleValue( "oil-temperature-degf" );
         net->oil_px[i] = node->getDoubleValue( "oil-pressure-psi" );
     }
@@ -200,10 +205,15 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
     // Control surface positions
     SGPropertyNode *node = fgGetNode("/surface-positions", true);
     net->elevator = node->getDoubleValue( "elevator-pos-norm" );
-    net->flaps = node->getDoubleValue( "flap-pos-norm" );
+    net->elevator_trim_tab
+        = node->getDoubleValue( "elevator-trim-tab-pos-norm" );
+    // FIXME: CLO 10/28/04 - This really should be separated out into 2 values
+    net->left_flap = node->getDoubleValue( "flap-pos-norm" );
+    net->right_flap = node->getDoubleValue( "flap-pos-norm" );
     net->left_aileron = node->getDoubleValue( "left-aileron-pos-norm" );
     net->right_aileron = node->getDoubleValue( "right-aileron-pos-norm" );
     net->rudder = node->getDoubleValue( "rudder-pos-norm" );
+    net->rudder = node->getDoubleValue( "nose-wheel-pos-norm" );
     net->speedbrake = node->getDoubleValue( "speedbrake-pos-norm" );
     net->spoilers = node->getDoubleValue( "spoilers-pos-norm" );
 
@@ -218,6 +228,8 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
         htonf(net->phi);
         htonf(net->theta);
         htonf(net->psi);
+        htonf(net->alpha);
+        htonf(net->beta);
 
         htonf(net->phidot);
         htonf(net->thetadot);
@@ -242,7 +254,10 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
             net->eng_state[i] = htonl(net->eng_state[i]);
             htonf(net->rpm[i]);
             htonf(net->fuel_flow[i]);
-            htonf(net->EGT[i]);
+            htonf(net->egt[i]);
+            htonf(net->cht[i]);
+            htonf(net->mp_osi[i]);
+            htonf(net->tit[i]);
             htonf(net->oil_temp[i]);
             htonf(net->oil_px[i]);
         }
@@ -266,10 +281,13 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
         htonf(net->visibility);
 
         htonf(net->elevator);
-        htonf(net->flaps);
+        htonf(net->elevator_trim_tab);
+        htonf(net->left_flap);
+        htonf(net->right_flap);
         htonf(net->left_aileron);
         htonf(net->right_aileron);
         htonf(net->rudder);
+        htonf(net->nose_wheel);
         htonf(net->speedbrake);
         htonf(net->spoilers);
     }
@@ -290,6 +308,8 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
         htonf(net->phi);
         htonf(net->theta);
         htonf(net->psi);
+        htonf(net->alpha);
+        htonf(net->beta);
 
         htonf(net->phidot);
         htonf(net->thetadot);
@@ -315,7 +335,10 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
             net->eng_state[i] = htonl(net->eng_state[i]);
             htonf(net->rpm[i]);
             htonf(net->fuel_flow[i]);
-            htonf(net->EGT[i]);
+            htonf(net->egt[i]);
+            htonf(net->cht[i]);
+            htonf(net->mp_osi[i]);
+            htonf(net->tit[i]);
             htonf(net->oil_temp[i]);
             htonf(net->oil_px[i]);
         }
@@ -338,10 +361,13 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
         htonf(net->visibility);
 
         htonf(net->elevator);
-        htonf(net->flaps);
+        htonf(net->elevator_trim_tab);
+        htonf(net->left_flap);
+        htonf(net->right_flap);
         htonf(net->left_aileron);
         htonf(net->right_aileron);
         htonf(net->rudder);
+        htonf(net->nose_wheel);
         htonf(net->speedbrake);
         htonf(net->spoilers);
     }
@@ -364,6 +390,8 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
         cur_fdm_state->_set_Euler_Angles( net->phi,
                                           net->theta,
                                           net->psi );
+        cur_fdm_state->_set_Alpha( net->alpha );
+        cur_fdm_state->_set_Beta( net->beta );
         cur_fdm_state->_set_Euler_Rates( net->phidot,
                                         net->thetadot,
                                         net->psidot );
@@ -405,7 +433,10 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
 
            node->setDoubleValue( "rpm", net->rpm[i] );
            node->setDoubleValue( "fuel-flow-gph", net->fuel_flow[i] );
-           node->setDoubleValue( "egt-degf", net->EGT[i] );
+           node->setDoubleValue( "egt-degf", net->egt[i] );
+           node->setDoubleValue( "cht-degf", net->cht[i] );
+           node->setDoubleValue( "mp-osi", net->mp_osi[i] );
+           node->setDoubleValue( "tit", net->tit[i] );
            node->setDoubleValue( "oil-temperature-degf", net->oil_temp[i] );
            node->setDoubleValue( "oil-pressure-psi", net->oil_px[i] );         
        }
@@ -436,10 +467,16 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
 
         SGPropertyNode *node = fgGetNode("/surface-positions", true);
         node->setDoubleValue("elevator-pos-norm", net->elevator);
-        node->setDoubleValue("flap-pos-norm", net->flaps);
+        node->setDoubleValue("elevator-trim-tab-pos-norm",
+                             net->elevator_trim_tab);
+       // FIXME: CLO 10/28/04 - This really should be separated out
+       // into 2 values
+        node->setDoubleValue("flap-pos-norm", net->left_flap);
+        node->setDoubleValue("flap-pos-norm", net->right_flap);
         node->setDoubleValue("left-aileron-pos-norm", net->left_aileron);
         node->setDoubleValue("right-aileron-pos-norm", net->right_aileron);
         node->setDoubleValue("rudder-pos-norm", net->rudder);
+        node->setDoubleValue("nose-wheel-pos-norm", net->nose_wheel);
         node->setDoubleValue("speedbrake-pos-norm", net->speedbrake);
         node->setDoubleValue("spoilers-pos-norm", net->spoilers);
     } else {