From: curt Date: Tue, 29 Sep 1998 02:02:40 +0000 (+0000) Subject: Added a rate of climb calculation. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=156e61d3676e3b467e96b2e13e16c245adaed531;p=flightgear.git Added a rate of climb calculation. --- diff --git a/FDM/flight.c b/FDM/flight.c index abb1321a2..d2bad6d42 100644 --- a/FDM/flight.c +++ b/FDM/flight.c @@ -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 diff --git a/FDM/flight.h b/FDM/flight.h index 6535a1ab7..4c0f9e7ef 100644 --- a/FDM/flight.h +++ b/FDM/flight.h @@ -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