## The autopilot initialization routine APMODE

APMODE is used to specify the symmetrical and asymmetrical autopilot-modes for autopilot simulation models APILOT1, APILOT2, or APILOT3. The block Mode Controller within the autopilot simulation model uses data from APMODE to define the initial autopilot mode, and to find out what switch criteria need to be monitored. The block Reference Signals uses data from APMODE to specify the reference values of theta, phi, H, Hdot, or psi. In the current versions of the autopilot simulations, only step-inputs at t=0 are possible, but it is relatively easy to insert other reference signals in this block if required. It is also possible to insert a From Workspace block in place of the block Reference Signals, e.g. in order to insert reference values which were actually measured in a flight-test.

APMODE will create the vectors ymod1S, ymod2S, ymod1A, ymod2A, yrefS, and yrefA in the workspace. S = symmetrical autopilot mode, A = asymmetrical autopilot mode. The vectors ymod contain mode-switches, the vectors yref contain reference values. 1 is the initial mode, 2 is used for a possible second mode for control laws which have separate 'Armed' and 'Coupled' phases. Examine the blocks Mode Controller and Reference Signals and the source-code of APMODE.M in the FDC directory APILOT for more details.

APMODE can be started by typing `apmode` at the Matlab command-line, or by double-clicking the APMODE button in the autopilot simulation systems. Depending upon the selected autopilot modes it may be necessary to enter some values at the Matlab command-line.

Note: APMODE does not initialize the aircraft model, actuator and cable models, radio-navigation models, and initial flight-condition! Those values must be defined separately, which can be done with the utility APINIT.