Challenge

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

Answer:

In this project, the controlling of Airplane landing gear (retraction and extension ) will be implemented using Finite State Machine (FSM). FSM is the most efficient algorithm which is mathematical model of computation. The FSM can change from one state to another in response to some. The change from one state to another is called a transition. An FSM is defined by a list of its states, its initial state, and the inputs that trigger each transition.

Implementation of problem

In oder to carry out this problem, all states with their respective finctions have to be decleared.Here we are using the switch states,Direction of valves with respect to gear.

-The plane has 3 gears

-Nose Gear

-Left Gear

-Right Gear

This gears are controled by a limit switch and squat switch as shown below.

- A direction valve is controlled by the software to allow the hydraulic pressure to either raise or lower the landing gear.

- Every gear has one light. According to the state of the gear,color of light is changing.

* The below conditions are important for the retraction and extension of the gear.

- When the airplane is parked at the bay and nose gear is down, then the nose gear is always experiencing a pressure on it due to airplane weight, weight of luggage and weight of passengers boarding on the airplane. Hydraulic mechanism is monitoring the pressure exerted on the nose gear and to neutralize that pressure its applying a pressure on the opposite direction.

• Hydraulic Control can detect the rising edge and falling edge of pilot’s lever.


• In case of Hydraulic system failure,there are two gas pressurized springs by which gears can be extended.


• The case of failure of Squat Switch is ignored.

Coding:

-For the FSM we have to define the variouse fucntion for the various states and an array to access each and every of the functions as shown below.

- An enum structure is created for the various switches signals, light state and valves, objects are also created for the enums. This objects are created as static so they could be used anywhere in the program and volatile so thier values could be used.

- A structure where we are giving the different condition where how to control the landing gears is created.

-The state matchin condition and logic is also created as shown below.

-In the main function the endles loop to control the FSM is called using the while(1) fucntion.

- Initial state function:

-Gear down function:

-Checking before Taking off function:

- Raising Gear function:

-Gear Up function:

-Checking before Laning gearfunction:

-Gear Up function:

- Lowering Gear

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.