Skip to navigation


Flight model: ApplyFlightModel (Part 4 of 7)

Name: ApplyFlightModel (Part 4 of 7) [Show more] Type: Subroutine Category: Flight model Summary: Calculate the dxTurn and xLinear vectors, and the slipRate Deep dive: The flight model
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file

This part does the following: * Call the ApplyTurnAndThrust routine to: * Set the dxTurn vector as follows: [ dxTurn ] [ xMomentsSc ] [ xControlsSc ] [ dyTurn ] = [ yMomentsSc ] + [ yControlsSc ] [ dzTurn ] [ zMomentsSc ] [ zControlsSc ] [ yGravity ] [ 0 ] + [ 0 ] - [ 0 ] [ 0 ] [ zSlipMoment ] * Set the xLinear vector, depending on the turning moments and the forces from the engine: If zVelocityPHi >= 48 (so forward speed >= 500 mph), we calculate: [ xLinear ] [ 0 ] [ xLiftDragSc ] [ yLinear ] = [ yFlapsLiftSc ] - [ yLiftDragSc ] [ zLinear ] [ 0 ] [ (&EA zLinearLo) ] If zVelocityPHi < 48 (so forward speed < 500 mph), we calculate: [ xLinear ] [ 0 ] [ xLiftDragSc ] [ 0 ] [ yLinear ] = [ yFlapsLiftSc ] - [ yLiftDragSc ] + [ 0 ] [ zLinear ] [ 0 ] [ zLiftDragSc ] [ zEngine ] where zEngine is 0 if the engine is off, or the following if the engine is on: zEngine = max(0, thrustScaled - (max(0, zVelocityP) / 16)) * airDensity / 512 and: airDensity = ~yPlaneHi * 2 and thrustScaled is the thrust in (thrustHi thrustLo), but: * Doubled if thrust >= 1024 * Doubled if zVelocity is in the range 512 to 1023 * Retract the flaps if we are going too fast. * Set the slip rate shown on the slip indicator as follows: slipRate = -int(xLinear / 256)
.fmod3 JSR ApplyTurnAndThrust \ Set the dxTurn and xLinear vectors, depending on \ the turning moments and the forces from the engine LDA xLinearLo \ Set the C flag to bit 7 of xLinearLo, flipped, to EOR #%10000000 \ round the slip rate in the following calculation to ASL A \ the nearest integer LDA #0 \ Set slipRate = 0 - xLinearHi - (1 - C) SBC xLinearHi \ = -int(xLinear / 256) STA slipRate