Challenge

Project 2 - Implement the Code for controlling the retraction and extension of Airplane’s landing gear

1.

The objective of this project is to control extension and retraction of an airplane's Landing Gear using Finite State Machine(FSM).FSM is a computation model which can be implemented using hardware or software.It can be used to simulate sequential logic and some computer programs.In fact, FSMs find wide use in many fields of human activity such as gaming,mathematics,linguistics,AI etc.

A system where particular inputs cause particular changes in state can be represented using Finite State Machine.In the present case in order to solve the problem pertaining to airplane's Landing Gear we need the states with their respective functions.Here we are using switch states and direction of valves with respect to Landing Gear.

Annexure I_Proj2 attached herewith shows a list of Tables (A,B,C,D,E,F) indicating the various conditions/states for Landing Gear.

Annexure II_Proj2 shows the various states (six states in total) through which the mechanism of extension and retraction of Landing Gear of an airplane can pass.

The C code has been developed based on the detailed logic outlined in Annexure I_Proj2 as well as in Annexure II_Proj2.The same is enclosed herewith as the word document Airplane_ LG.

A brief explanation of the code is as under.

At first, we have created seven functions on the basis of the conditions given.Next, six functions are entered in a six element array.This was done to use the functions as & when required.After this step Enum type sturucures are created for carrying out comparison.In the program four such structures have been created.Next object names for the four Enum structures are created.Then a structure is created for controlling Landing Gear on the basis of different operating conditions of the airplane.This has been named as State_Table.In the function main() a 'while' loop is used.Prior to entering the 'while' loop the State_Machine is initialized.GearDown is activated and 'Green' lamp is displayed.In the 'while' loop we have the function statetable with the argument of current_state.

When we enter pilot's lever and Squat Switch both as 0,0 current state will be Checking_Before_TakeOFF and light will be Green.Two possibilities in this case are: A. Pilot's lever is falling & Gear is down,B.Pilot's lever is raising and the Gear is up.Red light indication will be there and the Direction Valve will be up.Also hydraulic control is Enabled.If the pilot's lever is falling and hydraulic mechanism is not working then it shows the Gas Pressure System.If we get input as pilot's lever falling and limit switch is 'on' then state is checking before landing.If on the other hand, we are getting pilot's lever is raising and limit switch is 'off' then gear will be in down position.

The developed code was tested using onlinegdb and a screenshot of the result is enclosed as Airplane_LG.PNG.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.