Challenge

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

Implementation of problem

To start the project coding we need the states with their respective functions.

Here we are using the switch states, Direction of valves with respect to gear.

STATE DIAGRAM:

The above State diagram coding program is creating

three different files.

1.Main.c

2.Airplane.c

3.Airplane.h

AIRPLANE.h FILE EXPLANANTION:

Step1: .h file contain functions and structures and Enum definitions and state tables.

Step2: whenever enter following created function into the array of 6 element to access the function based on requirement. In the name of static table.

Step4: Creating the four Enum functions for this project for the inputs given above

1.State types

2.Switch status-limit switch and squat switch

3.Pilots_lever

4.Hydraulic pump status.

Step5: create the object name for the Enum structures to use the input value In the project and mentioned in name static and Volatile because these inputs use anywhere and input values are changing the every stage of the program.

Step6: creating the structure

Structure name: state_table.

Structure Object name: state_machine.

In this program structure members arranged in array structure having 6 different types of output as per state table.

In main program to access the structure member from state table using dot(.) operator.

AIRPLANE.c FILE EXPLANANTION:

Six State functions:

IN THE GEAR DOWN FUNCTION

Step 1: pilot give inputs as raising and squat switch on ie: raising=0 and switch on=0; current state is gear down to changing the state as checking before take off

All other inputs possible status(0,1 or 1,0 or 1,1) state is geardown.

Output:

The Finite State Machine is Intialized and current the program is: GearDown State

The Finite State Machine is Intialized and current state Light is:Green

Enter the status of pilot's lever and squat switch:0 1

present state is: Geardown

Enter the status of pilot's lever and squat switch:1 0

present state is: Geardown

Enter the status of pilot's lever and squat switch:1 1

present state is: Geardown

Enter the status of pilot's lever and squat switch:0 0

current state:CheckingBeforeTakeOFF

Light is :Green

STEP2: IN THE CHECKING BEFORE TAKEOFF FUNCTION:

1.pilot lever give inputs as falling and squat switch off : raising=1 and switch on=1; current state is checking before take-off gear down to changing the state as gear down.

Output:

Enter the status of pilot's lever and squat switch:1 1

present state is: Geardown

  1. pilot lever give inputs as raising and squat switch on and hp start I e: raising=0 and switch on= 0;

Output:

Enter the status of pilot's lever and squat switch and hydraulic pump:0 0

Current State:RaisingGear

Light is:Red

Status of Direction valve:Up

STEP3: IN THE RAISING GEAR FUNCTION:

1.pilot lever give inputs as falling and limit switch on: falling=1 and limit switch on=0; current state is Raising gear to changing the state as checking before landing

Output:

Enter the status of pilot's lever and limit switch:1 0

Current State:CheckBeforeLanding

Light is:Red

Landing Gear Hydraulic Control:Enabled

  1. pilot lever give inputs as Raising and limit switch off : Raising=0 and limit switch on=1; current state is Raising gear to changing the state as Gear Up.

Output:

Enter the status of pilot's lever and limit switch:0 1

Current State:GearUp

Light is:Off

Landing Gear Hydraulic Control:Disbled

Enter the status of pilot's lever:

  1. All other inputs possible status(0,0 or 1,1) state is Raising Gear.

Output:

Enter the status of pilot's lever and limit switch:0 0

present state is: Raising Gear

STEP4: IN THE GEAR UP FUNCTION:

1.pilot lever give inputs as falling: falling=1 current state is gear up to changing the state as checking before landing

Output:

Enter the status of pilot's lever:1

Current State:CheckBeforeLanding

Light is:Red

Landing Gear Hydraulic Control:Enabled

1.pilot lever give inputs as falling: falling=0 current state is gear up

Output:

Enter the status of pilot's lever:0

present state is: Gear Up

STEP5: IN THE CHECKING BEFORE LANDING FUNCTION:

1.pilot lever give inputs as falling: falling=1 current state is gear up to changing the state as checking before landing

Output:

Enter the status of pilot's lever and hydraulic pump status:1

0

Current State:LoweringGear

Light is:Green

Status of Direction valve:Down

1.pilot lever give inputs as Raising: Raising =0 current state is check before landing

Output:

Enter the status of pilot's lever and hydraulic pump status:0

0

present state is: Check before landing

STEP6: IN THE LOWERING GEAR FUNCTION:

1.pilot lever give inputs as falling and limit switch on: falling=1 and limit switch on=0; current state is Lowering Gear 1to changing the state as checking before take off

Output:

Enter the status of pilot's lever and limit switch:1 0

Current State:CheckingBeforeTakeOFF

Light is:Green

  1. pilot lever give inputs as raising and limit switch off: raising=0 and switch off= 1;

Output:

Enter the status of pilot's lever and limit switch:0 1

Current State:GearDown

Light is:Green

Landing Gear Hydraulic Control:Enabled

FULL PROGRAM OUTPUT:

The Finite State Machine is Intialized and current the program is: GearDown State

The Finite State Machine is Intialized and current state Light is:Green

Enter the status of pilot's lever and squat switch:0 0

current state:CheckingBeforeTakeOFF

Light is :Green

Enter the status of pilot's lever and squat switch and hydraulic pump:0 0

wait for 3 secs

Current State:RaisingGear

Light is:Red

Status of Direction valve:Up

Enter the status of pilot's lever and limit switch:0 1

Current State:GearUp

Light is:Off

Landing Gear Hydraulic Control:Disabled

Enter the status of pilot's lever:1

Current State:CheckBeforeLanding

Light is:Red

Landing Gear Hydraulic Control:Enabled

Enter the status of pilot's lever and hydraulic pump status:1 1

Current State:LoweringGear

Light is:Green

Status of Direction valve:Down

Status of gas pressurised Spring System:EP@

Enter the status of pilot's lever and limit switch:0 1

Current State:GearDown

Light is:Green

Landing Gear Hydraulic Control:Enabled

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.