Added a rate of climb calculation.
This commit is contained in:
parent
94d4bbdd09
commit
156e61d367
2 changed files with 21 additions and 5 deletions
16
FDM/flight.c
16
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
|
||||
|
|
10
FDM/flight.h
10
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
|
||||
|
|
Loading…
Add table
Reference in a new issue