]> git.mxchange.org Git - flightgear.git/commitdiff
Added a rate of climb calculation.
authorcurt <curt>
Tue, 29 Sep 1998 02:02:40 +0000 (02:02 +0000)
committercurt <curt>
Tue, 29 Sep 1998 02:02:40 +0000 (02:02 +0000)
FDM/flight.c
FDM/flight.h

index abb1321a27f884e90bc4bde4e5fc2fb992b8d4bc..d2bad6d42f3099ba5859c119c718ad11180e9fa5 100644 (file)
@@ -73,10 +73,13 @@ int fgFlightModelInit(int model, fgFLIGHT *f, double dt) {
 
 /* Run multiloop iterations of the flight model */
 int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop) {
+    double time_step, start_elev, end_elev;
     int result;
-
     // printf("Altitude = %.2f\n", FG_Altitude * 0.3048);
 
+    time_step = (1.0 / DEFAULT_MODEL_HZ) * multiloop;
+    start_elev = FG_Altitude;
+
     if ( model == FG_SLEW ) {
        // fgSlewUpdate(f, multiloop);
     } else if ( model == FG_LARCSIM ) {
@@ -86,6 +89,10 @@ int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop) {
                  "Unimplemented flight model == %d\n", model );
     }
 
+    end_elev = FG_Altitude;
+
+    FG_Climb_Rate = (end_elev - start_elev) / time_step;  /* feet per second */
+
     result = 1;
 
     return(result);
@@ -113,9 +120,12 @@ int fgFlightModelSetAltitude(int model, fgFLIGHT *f, double alt_meters) {
 
 
 /* $Log$
-/* Revision 1.17  1998/08/24 20:09:07  curt
-/* .
+/* Revision 1.18  1998/09/29 02:02:40  curt
+/* Added a rate of climb calculation.
 /*
+ * Revision 1.17  1998/08/24 20:09:07  curt
+ * .
+ *
  * Revision 1.16  1998/08/22  14:49:55  curt
  * Attempting to iron out seg faults and crashes.
  * Did some shuffling to fix a initialization order problem between view
index 6535a1ab745d2b2467d16ddea24ce4c22297bacf..4c0f9e7ef4bcc0871cf96fcb591da3bf69eb9909 100644 (file)
@@ -387,6 +387,9 @@ typedef struct {
 #define FG_Y_pilot_rwy             f->d_pilot_rwy_rwy_v[1]
 #define FG_H_pilot_rwy             f->d_pilot_rwy_rwy_v[2]
 
+    double        climb_rate;           /* in feet per second */
+#define FG_Climb_Rate              f->climb_rate
+
 } fgFLIGHT, *pfgFlight;
 
 
@@ -414,9 +417,12 @@ int fgFlightModelSetAltitude(int model, fgFLIGHT *f, double alt_meters);
 
 
 /* $Log$
-/* Revision 1.18  1998/07/30 23:44:36  curt
-/* Beginning to add support for multiple flight models.
+/* Revision 1.19  1998/09/29 02:02:41  curt
+/* Added a rate of climb calculation.
 /*
+ * Revision 1.18  1998/07/30 23:44:36  curt
+ * Beginning to add support for multiple flight models.
+ *
  * Revision 1.17  1998/07/12 03:08:28  curt
  * Added fgFlightModelSetAltitude() to force the altitude to something
  * other than the current altitude.  LaRCsim doesn't let you do this by just