G1 g2 green light control signals y1 y2 yellow light

Info icon This preview shows pages 2–4. Sign up to view the full content.

View Full Document Right Arrow Icon
G1, G2 - GREEN light control signals Y1, Y2 - YELLOW light control signals YB1, YB2 - YELLOW blinking light control signals (caution lights) R1, R2 - RED light control signals t >= Tr1 R1=OFF;Y2=ON; t=0 t >= Ty1 Y2=OFF; G2=ON; t=0 ((t >= TGMin1) AND D1==OFF) OR t>=TGMax1 G1=OFF; Y1=ON; t=0 G1=G2=Y1=Y2=R1=R2=OFF; YB1=YB2=ON; t=0 Init Caution RedRed1 Yellow1 t >= Tc1 YB1=YB2=OFF; R1=R2=ON; t=0 Green1 Yellow1a t >= Tr1 R1=OFF; Y1=ON; t=0 t >= Ty1 Y1=OFF; G1=ON; t=0 t >= Ty1 Y1=OFF; R1=ON; t=0 ((t >= TGMin2) AND D2==OFF) OR t>=TGMax2 G2=OFF; Y2=ON; t=0 RedRed2 Yellow2 Green2 Yellow2a t >= Ty1 Y2=OFF; R2=ON; t=0
Image of page 2

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
FSA implementation: /* System states */ #define Init 0 #define Caution 1 #define RedRed1 2 #define Yellow1 3 #define Green1 4 #define Yellow1a 5 #define RedRed2 6 #define Yellow2 7 #define Green2 8 #define Yellow2a 9 void main (void) { state=Init; /* state = INITIALIZE */ while (TRUE) { switch (state) { case Init: Init(); /* initialize the system */ G1=G2=Y1=Y2=R1=R2=OFF; YB1=YB2=ON; t=0; state=Caution; break; case Caution: wait(Tc1); /* wait Tc1 */ YB1=YB2=OFF; R1=R2=ON; state=RedRed1; break; case RedRed1: wait(Tr1); R1=OFF; Y1=ON; state=Yellow1; break; case Yellow1: wait(Ty1); Y1=OFF; G1=ON; state=Green1; break; case Green1: /* remain between TGMin1 and TGMax1, depending on D1 */ wait(TGMin1); t=TGMin1; while ((t<TGMax1) AND (D1==ON)) { } R1=OFF; Y1=ON; state=Yellow1a; break; case Yellow1a: wait(Ty1); Y1=OFF; R2=ON; state=RedRed2; break; case RedRed2: wait(Tr1); R1=OFF; Y2=ON; state=Yellow2; break; case Yellow2: wait(Ty1); Y2=OFF; G2=ON; state=Green2; break; case Green2: /* remain between TGMin2 and TGMax2, depending on D2 */ wait(TGMin2); t=TGMin2; while ((t<TGMax2) AND (D2==ON)) { } state=Yellow2a; break; case Yellow2a: wait(Ty1); Y2=OFF; R1=ON;
Image of page 3
state=RedRed1; break; } } }
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern