1. Following is the code for an elevator control. Draw an optimized Finite State Machine for this code. And describe why your FSM is optimized from the regular FSM of the code. #define IDLE O #define...


1. Following is the code for an elevator control. Draw an optimized Finite State Machine for this code. And describe<br>why your FSM is optimized from the regular FSM of the code.<br>#define IDLE O<br>#define GOINGUP 1<br>#define GOINGDN 2<br>#define DOOROPEN 3<br>void UnitControl()<br>{<br>int state = IDLE;<br>while (1) {<br>switch (state) {<br>IDLE: up=0; down=0; open=1; timer_start=0;<br>if (req==floor) {state = IDLE;}<br>if (req > floor) {state = GOINGUP;}<br>if (req < floor) {state = GOINGDN;}<br>break;<br>GOINGUP: up=1; down=0; open=0; timer_start=0;<br>if (req > floor) {state = GOINGUP;}<br>if (!(req>floor)) {state = DOOROPEN;}<br>break;<br>GOINGDN: up=1; down=0; open=0; timer_start=0;<br>if (req > floor) {state = GOINGDN;}<br>if (!(req>floor)) {state = DOOROPEN;}<br>break;<br>DOOROPEN: up=0; down=D0; open=1; timer_start=1;<br>if (timer < 10) {state = DOOROPEN;}<br>if (!(timer<10)){state = IDLE;}<br>break;<br>}<br>}<br>

Extracted text: 1. Following is the code for an elevator control. Draw an optimized Finite State Machine for this code. And describe why your FSM is optimized from the regular FSM of the code. #define IDLE O #define GOINGUP 1 #define GOINGDN 2 #define DOOROPEN 3 void UnitControl() { int state = IDLE; while (1) { switch (state) { IDLE: up=0; down=0; open=1; timer_start=0; if (req==floor) {state = IDLE;} if (req > floor) {state = GOINGUP;} if (req < floor)="" {state="GOINGDN;}" break;="" goingup:="" up="1;" down="0;" open="0;" timer_start="0;" if="" (req=""> floor) {state = GOINGUP;} if (!(req>floor)) {state = DOOROPEN;} break; GOINGDN: up=1; down=0; open=0; timer_start=0; if (req > floor) {state = GOINGDN;} if (!(req>floor)) {state = DOOROPEN;} break; DOOROPEN: up=0; down=D0; open=1; timer_start=1; if (timer < 10)="" {state="DOOROPEN;}" if=""><10)){state =="" idle;}="" break;="" }="">

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here