Challenge

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

Overview of the Project:

In this project, controlling the retraction and extension of Airplane’s landing gear can be implemented using Finite State Machine (FSM). FSM is the most efficient algorithm which is mathematical model of computation.

Goals:

  • Sensing the status of landing gear lever, squat switch and limit switch
  • Controlling the direction of Valve based on the sensed data (here it directly given)
  • Controlling the retraction and extension of Airplane’s landing gear.
  • Displaying the status of gear through gear indication lights

Key Highlights of the Project:

  • User choose the present condition of aircraft.
  • Position of the direction valve determines the upwaard or downward movement of gear.
  • A direction valve is controlled by the software to allow the hydraulic pressure to either raise or lower the landing gear.
  • Squat switch status, limit switch status and gear lever status uses for controlling direction valve.

Deliverables of this project:

Implementing the control for the retraction and extension of Airplane’s landing gear using the Finite state machine with the knowledge of various states of switch and gear.

Expected Outcomes:

The student will be getting the Knowledge of Finite State Machine algorithm which is used to achieve the control over the retraction and extension of Airplane’s landing gear using the switch and gear states of Airplane.

There are three conditions of Aircraft which user has to select

1. Take-off

  • Gear will be down and squat switch will be closed and gear indication light will be GREEN.
  • After take-off, squat switch will open
  • control for direction valve activates
  • user has to shift UP the landing gear lever
  • direction valve changes to UP and gear will start rising and gear indication light will be RED
  • If gear is UP, limit switch will close and gear indication light turn OFF.

2. Landing

  • Gear will be UP
  • User has to shift DOWN the landing gear lever.
  • Direction valve changes to DOWN
  • Gear started lowering and gear indication light become RED
  • Limit switch opened, Gear is DOWN and light become GREEN
  • After touch down of nospin wheel, squat switch will get closed.

3. Parking

  • Squat switch will be closed
  • Limit switch will be open
  • Direction valve will be in DOWN
  • Gear will be DOWN
  • Gear indication light will be GREEN

Code

#include <stdio.h>
#include <stdlib.h>


void dv(int i)                      //function for checking status of direction valve
{
    if (i==0)
    {
            printf("\nDirection Valve is DOWN");
            printf("\t\t\t\tDirection Valve= '%d'", i);
    }
    else if (i==1)
    {
            printf("\nDirection Valve is UP");
            printf("\t\t\t\tDirection Valve= '%d'", i);
    }
}

void limit_switch(int k)            //function for checking status of limit switch and Landing Gear
{
    if (k==0)
    {
            printf("\nLimit Switch OPENED");
            printf("\t\t\t\tLimit Switch= '%d'", k);
            printf("\nGear is DOWN");
    }
    else if(k==1)
    {
            printf("\nLimit Switch CLOSED");
            printf("\t\t\t\tLimit Switch= '%d'", k);
            printf("\nGear is UP");
    }
}

void gear_light(int j)              //function for checking status of landing gear indication light
{
	if(j==0)
    {
            printf("\nGear light is OFF");
            printf("\t\t\t\tGear Light= '%d'", j);
    }
	else if(j==1)
	{
            printf("\nGear light is GREEN");
            printf("\t\t\t\tGear Light= '%d'", j);
	}
	else if(j==2)
	{
            printf("\nGear is transiting and Gear light is RED");
            printf("\tGear Light= '%d'", j);
    }
}

int main()                          //main function
{
	int gear_lever, condition, squat_switch;    //declaring variable

    printf("1. Take-OFF\n2. Approaching\n3. Landed or Parked\nChoose the Aircraft condition: \n");
    scanf("%d", &condition);        //choose the aircraft condition
    fflush(stdout);

    switch (condition)              //switch case based on aircraft condition
    {
        case 1:                     //case-1 for Take-off of aircraft
            printf("\nAircraft Take-OFF.........\n");
            printf("Squat Switch OPENED");
            squat_switch=0;         //status of squat switch
            printf("\t\t\t\tSquat Switch= '%d'", squat_switch);
            printf("\nGears Unlocked, Press '1' to UP the gear: \n");
            scanf("%d", &gear_lever);           //status of gear lever
            printf("\nGear Lever shifted Up");  //Raising Gear(Taking Off)
            printf("\t\t\t\tGear Lever= '%d'", gear_lever);
            dv(1);                  //calling function of direction valve status
            gear_light(2);          //calling function of gear indication light status
            limit_switch(1);        //calling function of limit switch status
            gear_light(0);          //calling function of gear indication light status
            break;

        case 2:                     //case-2 for landing of aircraft
            printf("\nAircraft is approaching runway, Press '0' to DOWN the gear: \n");
            scanf("%d", &gear_lever);               //status of gear lever
            printf("\nGear Lever shifted Down");    //(Gear Down)
            printf("\t\t\t\tGear Lever= '%d'", gear_lever);
            dv(0);                  //calling function of direction valve status
            gear_light(2);          //calling function of gear indication light status
            limit_switch(0);        //calling function of limit switch status
            gear_light(1);          //calling function of gear indication light status
            squat_switch=1;         //status of squat switch
            printf("\nSquat Switch CLOSED");
            printf("\t\t\t\tSquat Switch= '%d'", squat_switch);
            printf("\nAircraft Landed..........\n");
            break;

        case 3:                     //case-3 for parking of aircraft
            printf("\nAircraft is Landed or Parked");
            gear_lever=0;
            printf("\t\t\tGear Lever= '%d'", gear_lever);
            squat_switch=1;         //status of squat switch
            printf("\nGears are Locked");
            printf("\t\t\t\tSquat Switch= '%d'", squat_switch);
            limit_switch(0);        //calling function of limit switch status
            dv(0);                  //calling function of direction valve status
            gear_light(1);          //calling function of gear indication light status
            exit(0);

    }
    return 0;
}

Output

1. Take-OFF

2. Landing

3. Parking

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.