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. In this project we control the Airplane landing gear by verifying the various parameters for the safety reason. This procudure are follow for proper landing and take off
Goals
- Controlling the direction of Valve.
System directly controll the valve and contol the direction of the wheel by verifiying the other system
- Controlling the retraction and extension of Airplane’s landing gear.
Retraction and extension of Airplane is control by the lever and its check proper hight for landing or takeoff.
A direction valve is controlled by the software to allow the hydraulic pressure to either raise or lower the landing gear.
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.
#include
#include
/* variables */
int take_f_state=0;
int lan_f_state=0;
int f_hight=250;
int f_wheel=1;
char name_1[]="take_off";
char name_2[]="landing";
/*functon prototype*/
void take__off();
void landing();
int main()
{
char pro[10];// local variable
printf("enter the process :");
scanf("%s",pro);// get input from user
if((strcmp(pro,name_1))==0)// check the condition
{
while (1)// rut until the process is end
{
take__off();
if(take_f_state==5)// check the condition
{
take_f_state=0;
break;
}
}
}
if((strcmp(pro,name_2))==0)// check the condition
{
while (1)// rut until the process is end
{
landing();
if(lan_f_state==5)// check the condition
{
lan_f_state=0;
break;
}
}
}
}
void landing()// function defination
{
switch (lan_f_state)
{
case 0:
printf("extended process start..,\n");// first state
lan_f_state=1;
break;
case 1:
if(f_hight>200)// check the hight
{
printf("proper hight is reached \n");
lan_f_state=2;
}
else// else wait for hight is reached
{
printf("waiting for proper hight to reach...");
}
break;
case 3:
printf("lever is activated\n");// activated the lever
printf("hydralic pump value is changed\n");// change the value
lan_f_state=4;
break;
case 4:
if (f_wheel==1)// check the wheel position
{
printf("wheel is properly get out\n");
printf("extended process is complete");
lan_f_state=5;
}
else// wait for wheel get in
{
printf("wait for wheel get out...");
}
break;
case 2:
printf("door open\n");// close the door
lan_f_state=3;
break;
}
}
void take__off()// function defination
{
switch (take_f_state)
{
case 0:
printf("retracted process start..,\n");// first state
take_f_state=1;
break;
case 1:
if(f_hight>200)// check the hight
{
printf("proper hight is reached \n");
take_f_state=2;
}
else// else wait for hight is reached
{
printf("waiting for proper hight to reach...");
}
break;
case 2:
printf("lever is activated\n");// activated the lever
printf("hydralic pump value is changed\n");// change the value
take_f_state=3;
break;
case 3:
if (f_wheel==1)// check the wheel position
{
printf("wheel is properly get in\n");
take_f_state=4;
}
else// wait for wheel get in
{
printf("wait for wheel get in...");
}
break;
case 4:
printf("door closed\n");// close the door
printf("retracted process is completed");// process is complete
take_f_state=5;
break;
}
}