X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FUIUCModel%2Fuiuc_wrapper.cpp;h=fd3fcf8ea4dda17acb42bde5c793394b216a7cf7;hb=dc04fc2294d13e197971a2239ce0794b6a33e5b7;hp=a91c62904b8f445096d1cc93e8ec9a73af1f1c06;hpb=d26c1202d4a09b03765bb7d4357a4a831b7643b0;p=flightgear.git diff --git a/src/FDM/UIUCModel/uiuc_wrapper.cpp b/src/FDM/UIUCModel/uiuc_wrapper.cpp index a91c62904..fd3fcf8ea 100644 --- a/src/FDM/UIUCModel/uiuc_wrapper.cpp +++ b/src/FDM/UIUCModel/uiuc_wrapper.cpp @@ -20,13 +20,13 @@ HISTORY: 01/26/2000 initial release 03/09/2001 (DPM) added support for gear 06/18/2001 (RD) Made uiuc_recorder its own routine. - 07/19/2001 (RD) Added uiuc_vel_init() to initialize - the velocities. - 08/27/2001 (RD) Added uiuc_initial_init() to help - in starting an A/C at an initial condition - 02/24/2002 (GD) Added uiuc_network_routine() - 03/27/2002 (RD) Changed how forces are calculated when - body-axis is used + 07/19/2001 (RD) Added uiuc_vel_init() to initialize + the velocities. + 08/27/2001 (RD) Added uiuc_initial_init() to help + in starting an A/C at an initial condition + 02/24/2002 (GD) Added uiuc_network_routine() + 03/27/2002 (RD) Changed how forces are calculated when + body-axis is used 12/11/2002 (RD) Divided uiuc_network_routine into uiuc_network_recv_routine and uiuc_network_send_routine @@ -36,7 +36,7 @@ AUTHOR(S): Bipin Sehgal Robert Deters - Glen Dimock + Glen Dimock David Megginson ---------------------------------------------------------------------- @@ -71,25 +71,25 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - USA or view http://www.gnu.org/copyleft/gpl.html. - + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + **********************************************************************/ #ifdef HAVE_CONFIG_H # include #endif +#include +#include + #include #include -#include #include
#include "uiuc_aircraft.h" -#include "uiuc_aircraftdir.h" #include "uiuc_coefficients.h" #include "uiuc_getwind.h" #include "uiuc_engine.h" @@ -104,9 +104,6 @@ //#include "uiuc_network.h" #include "uiuc_get_flapper.h" -SG_USING_STD(cout); -SG_USING_STD(endl); - extern "C" void uiuc_initial_init (); extern "C" void uiuc_defaults_inits (); extern "C" void uiuc_vel_init (); @@ -119,8 +116,7 @@ extern "C" void uiuc_record_routine(double dt); extern "C" void uiuc_network_recv_routine(); extern "C" void uiuc_network_send_routine(); -AIRCRAFT *aircraft_ = new AIRCRAFT; -AIRCRAFTDIR *aircraftdir_ = new AIRCRAFTDIR; +AIRCRAFT *aircraft_ = 0; // SendArray testarray(4950); @@ -134,9 +130,11 @@ AIRCRAFTDIR *aircraftdir_ = new AIRCRAFTDIR; void uiuc_initial_init () { - // This function called from both ls_step and ls_model(uiuc model side). - // Apply brute force initializations, which override ls_step and ls_aux values - // for the first time step. + // This function is called from uiuc_init_2_wrapper (uiuc_aero.c in LaRCsim) + // which is called from ls_step and ls_model. + // Apply brute force initializations, which override unwanted changes + // performed by LaRCsim. + // Used during initialization (while Simtime=0). if (P_body_init_true) P_body = P_body_init; if (Q_body_init_true) @@ -161,7 +159,10 @@ void uiuc_initial_init () void uiuc_defaults_inits () { - // set defaults and initialize (called from ls_step.c at Simtime=0) + if (aircraft_ == 0) + aircraft_ = new AIRCRAFT; + + // set defaults and initialize (called once from uiuc_init_2_wrapper) //fog inits fog_field = 0; @@ -193,7 +194,6 @@ void uiuc_defaults_inits () W_body_init_true = false; trim_case_2 = false; use_uiuc_network = false; - old_flap_routine = false; icing_demo = false; outside_control = false; set_Long_trim = false; @@ -268,7 +268,9 @@ void uiuc_defaults_inits () demo_eps_pitch_input = false; tactilefadef = false; demo_ap_pah_on = false; - demo_ap_Theta_ref_deg = false; + demo_ap_alh_on = false; + demo_ap_Theta_ref = false; + demo_ap_alt_ref = false; demo_tactile = false; demo_ice_tail = false; demo_ice_left = false; @@ -276,11 +278,20 @@ void uiuc_defaults_inits () flapper_model = false; ignore_unknown_keywords = false; pilot_throttle_no = false; + Dx_cg = 0.0; + Dy_cg = 0.0; + Dz_cg = 0.0; + ap_pah_on = 0; + ap_alh_on = 0; } void uiuc_vel_init () { + // Calculates the local velocity (V_north, V_east, V_down) from the body + // velocities. + // Called from uiuc_local_vel_init which is called from ls_step. + // Used during initialization (while Simtime=0) if (U_body_init_true && V_body_init_true && W_body_init_true) { double det_T_l_to_b, cof11, cof12, cof13, cof21, cof22, cof23, cof31, cof32, cof33; @@ -306,10 +317,11 @@ void uiuc_vel_init () void uiuc_init_aeromodel () { - SGPath path(globals->get_fg_root()); - path.append(aircraft_dir); + // Initializes the UIUC aircraft model. + // Called once from uiuc_init_2_wrapper + SGPath path(fgGetString("/sim/aircraft-dir")); path.append("aircraft.dat"); - cout << "We are using "<< path.str() << endl; + std::cout << "We are using "<< path.str() << std::endl; uiuc_initializemaps(); // Initialize the maps uiuc_menu(path.str()); // Read the specified aircraft file } @@ -367,6 +379,10 @@ void uiuc_force_moment(double dt) if (I_zz_appMass_ratio) M_n_aero += -(I_zz_appMass_ratio * I_zz) * R_dot_body; + // adding in apparent mass in body axis X direction + // F_X_aero += -(0.05 * Mass) * U_dot_body; + + if (Mass_appMass) F_Z_aero += -Mass_appMass * W_dot_body; if (I_xx_appMass) @@ -467,12 +483,12 @@ void uiuc_record_routine(double dt) void uiuc_network_recv_routine() { //if (use_uiuc_network) - //uiuc_network(1); + // uiuc_network(1); } void uiuc_network_send_routine() { //if (use_uiuc_network) - //uiuc_network(2); + // uiuc_network(2); } //end uiuc_wrapper.cpp