1 /**********************************************************************
3 FILENAME: uiuc_recorder.cpp
5 ----------------------------------------------------------------------
7 DESCRIPTION: outputs variables specified in input file to recorder
10 ----------------------------------------------------------------------
14 ----------------------------------------------------------------------
16 REFERENCES: Liberty, Jesse. "Sam's Teach Yourself C++ in 21 Days,"
19 ----------------------------------------------------------------------
21 HISTORY: 01/31/2000 initial release
22 03/02/2000 (JS) added record options for 1D and 2D
23 interpolated variables
24 04/01/2000 (JS) added throttle, longitudinal, lateral,
25 and rudder inputs to record map
26 04/24/2000 (JS) added rest of variables in
29 ----------------------------------------------------------------------
31 AUTHOR(S): Jeff Scott <jscott@mail.com>
33 ----------------------------------------------------------------------
37 ----------------------------------------------------------------------
41 ----------------------------------------------------------------------
43 OUTPUTS: -variables recorded in uiuc_recorder.dat
45 ----------------------------------------------------------------------
47 CALLED BY: uiuc_wrapper.cpp
49 ----------------------------------------------------------------------
53 ----------------------------------------------------------------------
55 COPYRIGHT: (C) 2000 by Michael Selig
57 This program is free software; you can redistribute it and/or
58 modify it under the terms of the GNU General Public License
59 as published by the Free Software Foundation.
61 This program is distributed in the hope that it will be useful,
62 but WITHOUT ANY WARRANTY; without even the implied warranty of
63 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64 GNU General Public License for more details.
66 You should have received a copy of the GNU General Public License
67 along with this program; if not, write to the Free Software
68 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
69 USA or view http://www.gnu.org/copyleft/gpl.html.
71 **********************************************************************/
73 #include "uiuc_recorder.h"
75 SG_USING_STD(endl); // -dw
77 void uiuc_recorder( double dt )
82 static int recordStep = 0;
83 string record_variables = "# ";
85 int modulus = recordStep % recordRate;
87 if ((recordStep % recordRate) == 0)
89 command_list = recordParts->getCommands();
93 for (command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
94 record_variables += recordParts->getToken(*command_line,2) + " ";
96 fout << record_variables << endl;
97 for (command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
99 linetoken = recordParts->getToken(*command_line, 2);
101 switch(record_map[linetoken])
103 /************************* Time ************************/
106 fout << Simtime << " ";
115 /************************* Mass ************************/
118 fout << Weight << " ";
147 /*********************** Geometry **********************/
148 case Dx_pilot_record:
150 fout << Dx_pilot << " ";
153 case Dy_pilot_record:
155 fout << Dy_pilot << " ";
158 case Dz_pilot_record:
160 fout << Dz_pilot << " ";
165 fout << Dx_cg << " ";
170 fout << Dy_cg << " ";
175 fout << Dz_cg << " ";
179 /********************** Positions **********************/
180 case Lat_geocentric_record:
182 fout << Lat_geocentric << " ";
185 case Lon_geocentric_record:
187 fout << Lon_geocentric << " ";
190 case Radius_to_vehicle_record:
192 fout << Radius_to_vehicle << " ";
195 case Latitude_record:
197 fout << Latitude << " ";
200 case Longitude_record:
202 fout << Longitude << " ";
205 case Altitude_record:
207 fout << Altitude << " ";
217 fout << Theta << " ";
226 /******************** Accelerations ********************/
227 case V_dot_north_record:
229 fout << V_dot_north << " ";
232 case V_dot_east_record:
234 fout << V_dot_east << " ";
237 case V_dot_down_record:
239 fout << V_dot_down << " ";
242 case U_dot_body_record:
244 fout << U_dot_body << " ";
247 case V_dot_body_record:
249 fout << V_dot_body << " ";
252 case W_dot_body_record:
254 fout << W_dot_body << " ";
257 case A_X_pilot_record:
259 fout << A_X_pilot << " ";
262 case A_Y_pilot_record:
264 fout << A_Y_pilot << " ";
267 case A_Z_pilot_record:
269 fout << A_Z_pilot << " ";
274 fout << A_X_cg << " ";
279 fout << A_Y_cg << " ";
284 fout << A_Z_cg << " ";
287 case N_X_pilot_record:
289 fout << N_X_pilot << " ";
292 case N_Y_pilot_record:
294 fout << N_Y_pilot << " ";
297 case N_Z_pilot_record:
299 fout << N_Z_pilot << " ";
304 fout << N_X_cg << " ";
309 fout << N_Y_cg << " ";
314 fout << N_Z_cg << " ";
317 case P_dot_body_record:
319 fout << P_dot_body << " ";
322 case Q_dot_body_record:
324 fout << Q_dot_body << " ";
327 case R_dot_body_record:
329 fout << R_dot_body << " ";
333 /********************** Velocities *********************/
336 fout << V_north << " ";
341 fout << V_east << " ";
346 fout << V_down << " ";
349 case V_north_rel_ground_record:
351 fout << V_north_rel_ground << " ";
354 case V_east_rel_ground_record:
356 fout << V_east_rel_ground << " ";
359 case V_down_rel_ground_record:
361 fout << V_down_rel_ground << " ";
364 case V_north_airmass_record:
366 fout << V_north_airmass << " ";
369 case V_east_airmass_record:
371 fout << V_east_airmass << " ";
374 case V_down_airmass_record:
376 fout << V_down_airmass << " ";
379 case V_north_rel_airmass_record:
381 fout << V_north_rel_airmass << " ";
384 case V_east_rel_airmass_record:
386 fout << V_east_rel_airmass << " ";
389 case V_down_rel_airmass_record:
391 fout << V_down_rel_airmass << " ";
396 fout << U_gust << " ";
401 fout << V_gust << " ";
406 fout << W_gust << " ";
411 fout << U_body << " ";
416 fout << V_body << " ";
421 fout << W_body << " ";
424 case V_rel_wind_record:
426 fout << V_rel_wind << " ";
429 case V_true_kts_record:
431 fout << V_true_kts << " ";
434 case V_rel_ground_record:
436 fout << V_rel_ground << " ";
439 case V_inertial_record:
441 fout << V_inertial << " ";
444 case V_ground_speed_record:
446 fout << V_ground_speed << " ";
451 fout << V_equiv << " ";
454 case V_equiv_kts_record:
456 fout << V_equiv_kts << " ";
459 case V_calibrated_record:
461 fout << V_calibrated << " ";
464 case V_calibrated_kts_record:
466 fout << V_calibrated_kts << " ";
471 fout << P_local << " ";
476 fout << Q_local << " ";
481 fout << R_local << " ";
486 fout << P_body << " ";
491 fout << Q_body << " ";
496 fout << R_body << " ";
501 fout << P_total << " ";
506 fout << Q_total << " ";
511 fout << R_total << " ";
516 fout << Phi_dot << " ";
519 case Theta_dot_record:
521 fout << Theta_dot << " ";
526 fout << Psi_dot << " ";
529 case Latitude_dot_record:
531 fout << Latitude_dot << " ";
534 case Longitude_dot_record:
536 fout << Longitude_dot << " ";
539 case Radius_dot_record:
541 fout << Radius_dot << " ";
545 /************************ Angles ***********************/
548 fout << Alpha << " ";
551 case Alpha_deg_record:
553 fout << Alpha * RAD_TO_DEG << " ";
556 case Alpha_dot_record:
558 fout << Alpha_dot << " ";
561 case Alpha_dot_deg_record:
563 fout << Alpha_dot * RAD_TO_DEG << " ";
571 case Beta_deg_record:
573 fout << Beta * RAD_TO_DEG << " ";
576 case Beta_dot_record:
578 fout << Beta_dot << " ";
581 case Beta_dot_deg_record:
583 fout << Beta_dot * RAD_TO_DEG << " ";
586 case Gamma_vert_record:
588 fout << Gamma_vert_rad << " ";
591 case Gamma_vert_deg_record:
593 fout << Gamma_vert_rad * RAD_TO_DEG << " ";
596 case Gamma_horiz_record:
598 fout << Gamma_horiz_rad << " ";
601 case Gamma_horiz_deg_record:
603 fout << Gamma_horiz_rad * RAD_TO_DEG << " ";
607 /**************** Atmospheric Properties ***************/
610 fout << Density << " ";
615 fout << V_sound << " ";
618 case Mach_number_record:
620 fout << Mach_number << " ";
623 case Static_pressure_record:
625 fout << Static_pressure << " ";
628 case Total_pressure_record:
630 fout << Total_pressure << " ";
633 case Impact_pressure_record:
635 fout << Impact_pressure << " ";
638 case Dynamic_pressure_record:
640 fout << Dynamic_pressure << " ";
643 case Static_temperature_record:
645 fout << Static_temperature << " ";
648 case Total_temperature_record:
650 fout << Total_temperature << " ";
654 /******************** Earth Properties *****************/
657 fout << Gravity << " ";
660 case Sea_level_radius_record:
662 fout << Sea_level_radius << " ";
665 case Earth_position_angle_record:
667 fout << Earth_position_angle << " ";
670 case Runway_altitude_record:
672 fout << Runway_altitude << " ";
675 case Runway_latitude_record:
677 fout << Runway_latitude << " ";
680 case Runway_longitude_record:
682 fout << Runway_longitude << " ";
685 case Runway_heading_record:
687 fout << Runway_heading << " ";
690 case Radius_to_rwy_record:
692 fout << Radius_to_rwy << " ";
695 case D_pilot_north_of_rwy_record:
697 fout << D_pilot_north_of_rwy << " ";
700 case D_pilot_east_of_rwy_record:
702 fout << D_pilot_east_of_rwy << " ";
705 case D_pilot_above_rwy_record:
707 fout << D_pilot_above_rwy << " ";
710 case X_pilot_rwy_record:
712 fout << X_pilot_rwy << " ";
715 case Y_pilot_rwy_record:
717 fout << Y_pilot_rwy << " ";
720 case H_pilot_rwy_record:
722 fout << H_pilot_rwy << " ";
725 case D_cg_north_of_rwy_record:
727 fout << D_cg_north_of_rwy << " ";
730 case D_cg_east_of_rwy_record:
732 fout << D_cg_east_of_rwy << " ";
735 case D_cg_above_rwy_record:
737 fout << D_cg_above_rwy << " ";
740 case X_cg_rwy_record:
742 fout << X_cg_rwy << " ";
745 case Y_cg_rwy_record:
747 fout << Y_cg_rwy << " ";
750 case H_cg_rwy_record:
752 fout << H_cg_rwy << " ";
756 /********************* Engine Inputs *******************/
757 case Throttle_3_record:
759 fout << Throttle[3] << " ";
762 case Throttle_pct_record:
764 fout << Throttle_pct << " ";
768 /******************** Control Inputs *******************/
769 case Long_control_record:
771 fout << Long_control << " ";
774 case Long_trim_record:
776 fout << Long_trim << " ";
779 case Long_trim_deg_record:
781 fout << Long_trim * RAD_TO_DEG << " ";
784 case elevator_record:
786 fout << elevator << " ";
789 case elevator_deg_record:
791 fout << elevator * RAD_TO_DEG << " ";
794 case Lat_control_record:
796 fout << Long_control << " ";
801 fout << aileron << " ";
804 case aileron_deg_record:
806 fout << aileron * RAD_TO_DEG << " ";
809 case Rudder_pedal_record:
811 fout << Long_control << " ";
816 fout << rudder << " ";
819 case rudder_deg_record:
821 fout << rudder * RAD_TO_DEG << " ";
824 case Flap_handle_record:
834 case flap_deg_record:
836 fout << flap * RAD_TO_DEG << " ";
840 /****************** Aero Coefficients ******************/
848 fout << CDfaI << " ";
853 fout << CDfCLI << " ";
858 fout << CDfadeI << " ";
863 fout << CDfdfI << " ";
868 fout << CDfadfI << " ";
883 fout << CLfaI << " ";
888 fout << CLfadeI << " ";
893 fout << CLfdfI << " ";
898 fout << CLfadfI << " ";
913 fout << CmfaI << " ";
918 fout << CmfadeI << " ";
923 fout << CmfdfI << " ";
928 fout << CmfadfI << " ";
938 fout << CYfadaI << " ";
941 case CYfbetadrI_record:
943 fout << CYfbetadrI << " ";
953 fout << ClfadaI << " ";
956 case ClfbetadrI_record:
958 fout << ClfbetadrI << " ";
968 fout << CnfadaI << " ";
971 case CnfbetadrI_record:
973 fout << CnfbetadrI << " ";
977 /******************** Ice Detection ********************/
978 case CLclean_wing_record:
980 fout << CLclean_wing << " ";
983 case CLiced_wing_record:
985 fout << CLiced_wing << " ";
988 case CLclean_tail_record:
990 fout << CLclean_tail << " ";
993 case CLiced_tail_record:
995 fout << CLiced_tail << " ";
998 case Lift_clean_wing_record:
1000 fout << Lift_clean_wing << " ";
1003 case Lift_iced_wing_record:
1005 fout << Lift_iced_wing << " ";
1008 case Lift_clean_tail_record:
1010 fout << Lift_clean_tail << " ";
1013 case Lift_iced_tail_record:
1015 fout << Lift_iced_tail << " ";
1018 case Gamma_clean_wing_record:
1020 fout << Gamma_clean_wing << " ";
1023 case Gamma_iced_wing_record:
1025 fout << Gamma_iced_wing << " ";
1028 case Gamma_clean_tail_record:
1030 fout << Gamma_clean_tail << " ";
1033 case Gamma_iced_tail_record:
1035 fout << Gamma_iced_tail << " ";
1038 case w_clean_wing_record:
1040 fout << w_clean_wing << " ";
1043 case w_iced_wing_record:
1045 fout << w_iced_wing << " ";
1048 case w_clean_tail_record:
1050 fout << w_clean_tail << " ";
1053 case w_iced_tail_record:
1055 fout << w_iced_tail << " ";
1058 case V_total_clean_wing_record:
1060 fout << V_total_clean_wing << " ";
1063 case V_total_iced_wing_record:
1065 fout << V_total_iced_wing << " ";
1068 case V_total_clean_tail_record:
1070 fout << V_total_clean_tail << " ";
1073 case V_total_iced_tail_record:
1075 fout << V_total_iced_tail << " ";
1078 case beta_flow_clean_wing_record:
1080 fout << beta_flow_clean_wing << " ";
1083 case beta_flow_clean_wing_deg_record:
1085 fout << beta_flow_clean_wing * RAD_TO_DEG << " ";
1088 case beta_flow_iced_wing_record:
1090 fout << beta_flow_iced_wing << " ";
1093 case beta_flow_iced_wing_deg_record:
1095 fout << beta_flow_iced_wing * RAD_TO_DEG << " ";
1098 case beta_flow_clean_tail_record:
1100 fout << beta_flow_clean_tail << " ";
1103 case beta_flow_clean_tail_deg_record:
1105 fout << beta_flow_clean_tail * RAD_TO_DEG << " ";
1108 case beta_flow_iced_tail_record:
1110 fout << beta_flow_iced_tail << " ";
1113 case beta_flow_iced_tail_deg_record:
1115 fout << beta_flow_iced_tail * RAD_TO_DEG << " ";
1118 case Dbeta_flow_wing_record:
1120 fout << Dbeta_flow_wing << " ";
1123 case Dbeta_flow_wing_deg_record:
1125 fout << Dbeta_flow_wing * RAD_TO_DEG << " ";
1128 case Dbeta_flow_tail_record:
1130 fout << Dbeta_flow_tail << " ";
1133 case Dbeta_flow_tail_deg_record:
1135 fout << Dbeta_flow_tail * RAD_TO_DEG << " ";
1138 case pct_beta_flow_wing_record:
1140 fout << pct_beta_flow_wing << " ";
1143 case pct_beta_flow_tail_record:
1145 fout << pct_beta_flow_tail << " ";
1149 /************************ Forces ***********************/
1150 case F_X_wind_record:
1152 fout << F_X_wind << " ";
1155 case F_Y_wind_record:
1157 fout << F_Y_wind << " ";
1160 case F_Z_wind_record:
1162 fout << F_Z_wind << " ";
1165 case F_X_aero_record:
1167 fout << F_X_aero << " ";
1170 case F_Y_aero_record:
1172 fout << F_Y_aero << " ";
1175 case F_Z_aero_record:
1177 fout << F_Z_aero << " ";
1180 case F_X_engine_record:
1182 fout << F_X_engine << " ";
1185 case F_Y_engine_record:
1187 fout << F_Y_engine << " ";
1190 case F_Z_engine_record:
1192 fout << F_Z_engine << " ";
1195 case F_X_gear_record:
1197 fout << F_X_gear << " ";
1200 case F_Y_gear_record:
1202 fout << F_Y_gear << " ";
1205 case F_Z_gear_record:
1207 fout << F_Z_gear << " ";
1225 case F_north_record:
1227 fout << F_north << " ";
1232 fout << F_east << " ";
1237 fout << F_down << " ";
1241 /*********************** Moments ***********************/
1242 case M_l_aero_record:
1244 fout << M_l_aero << " ";
1247 case M_m_aero_record:
1249 fout << M_m_aero << " ";
1252 case M_n_aero_record:
1254 fout << M_n_aero << " ";
1257 case M_l_engine_record:
1259 fout << M_l_engine << " ";
1262 case M_m_engine_record:
1264 fout << M_m_engine << " ";
1267 case M_n_engine_record:
1269 fout << M_n_engine << " ";
1272 case M_l_gear_record:
1274 fout << M_l_gear << " ";
1277 case M_m_gear_record:
1279 fout << M_m_gear << " ";
1282 case M_n_gear_record:
1284 fout << M_n_gear << " ";
1289 fout << M_l_rp << " ";
1294 fout << M_m_rp << " ";
1299 fout << M_n_rp << " ";
1308 // end uiuc_recorder.cpp