Commit e0e990af authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Simplify Trafficlight model

parent 72d63e1d
...@@ -11,6 +11,6 @@ project controller is ...@@ -11,6 +11,6 @@ project controller is
package Compiler is package Compiler is
for Driver ("SDL") use "opengeode"; for Driver ("SDL") use "opengeode";
for Object_File_Suffix ("SDL") use ".adb"; for Object_File_Suffix ("SDL") use ".adb";
for Leading_Required_Switches ("SDL") use ("--toAda", "../system_structure.pr"); for Leading_Required_Switches ("SDL") use ("--toAda");
end Compiler; end Compiler;
end controller; end controller;
\ No newline at end of file
/* CIF PROCESS (250, 150), (150, 75) */ /* CIF PROCESS (250, 150), (150, 75) */
process Controller; process Controller;
state Green;
substructure
in (short);
out (Go_Orange);
/* CIF START (343, 131), (70, 35) */
START;
/* CIF NEXTSTATE (331, 186), (93, 35) */
NEXTSTATE First_Delay;
/* CIF START (604, 136), (70, 35) */
START short ;
/* CIF NEXTSTATE (584, 191), (110, 35) */
NEXTSTATE Second_Delay;
/* CIF state (331, 186), (93, 35) */
state First_Delay;
/* CIF input (251, 241), (70, 35) */
input Clock;
/* CIF PROCEDURECALL (200, 296), (171, 35) */
call Set_Timer (5000, Clock);
/* CIF NEXTSTATE (230, 351), (111, 35) */
NEXTSTATE Second_Delay;
/* CIF input (435, 241), (64, 35) */
input Button;
/* CIF PROCEDURECALL (382, 296), (171, 35) */
call Set_Timer (5000, Clock);
/* CIF NEXTSTATE (409, 346), (117, 35) */
NEXTSTATE Second_Delay;
endstate;
/* CIF state (584, 191), (110, 35) */
state Second_Delay;
/* CIF input (604, 246), (70, 35) */
input Clock;
/* CIF return (621, 301), (35, 35) */
return Go_Orange;
endstate;
endsubstructure;
state Red; state Red;
substructure substructure
out (Go_Green); out (Go_Green);
...@@ -13,8 +48,8 @@ process Controller; ...@@ -13,8 +48,8 @@ process Controller;
input Clock; input Clock;
/* CIF return (391, 226), (35, 35) */ /* CIF return (391, 226), (35, 35) */
return Go_Green; return Go_Green;
/* CIF input (477, 171), (123, 35) */ /* CIF input (506, 171), (64, 35) */
input Button (cmd); input Button;
/* CIF task (453, 226), (172, 35) */ /* CIF task (453, 226), (172, 35) */
task Walk_Requested := True; task Walk_Requested := True;
/* CIF NEXTSTATE (504, 281), (70, 35) */ /* CIF NEXTSTATE (504, 281), (70, 35) */
...@@ -45,41 +80,6 @@ process Controller; ...@@ -45,41 +80,6 @@ process Controller;
NEXTSTATE Walking; NEXTSTATE Walking;
endstate; endstate;
endsubstructure; endsubstructure;
state Green;
substructure
in (short);
out (Go_Orange);
/* CIF START (604, 136), (70, 35) */
START short ;
/* CIF NEXTSTATE (583, 191), (110, 35) */
NEXTSTATE Second_Delay;
/* CIF START (343, 131), (70, 35) */
START;
/* CIF NEXTSTATE (331, 186), (93, 35) */
NEXTSTATE First_Delay;
/* CIF state (583, 191), (110, 35) */
state Second_Delay;
/* CIF input (604, 246), (70, 35) */
input Clock;
/* CIF return (621, 301), (35, 35) */
return Go_Orange;
endstate;
/* CIF state (331, 186), (93, 35) */
state First_Delay;
/* CIF input (206, 241), (70, 35) */
input Clock;
/* CIF PROCEDURECALL (155, 296), (171, 35) */
call Set_Timer (5000, Clock);
/* CIF NEXTSTATE (185, 351), (111, 35) */
NEXTSTATE Second_Delay;
/* CIF input (361, 241), (123, 35) */
input Button (cmd);
/* CIF PROCEDURECALL (336, 296), (171, 35) */
call Set_Timer (5000, Clock);
/* CIF NEXTSTATE (364, 346), (117, 35) */
NEXTSTATE Second_Delay;
endstate;
endsubstructure;
/* CIF TEXT (939, 61), (282, 152) */ /* CIF TEXT (939, 61), (282, 152) */
timer clock; timer clock;
...@@ -87,41 +87,23 @@ process Controller; ...@@ -87,41 +87,23 @@ process Controller;
dcl Walk_Requested T_Boolean := False; dcl Walk_Requested T_Boolean := False;
dcl Cmd Command; dcl Cmd Command := request_passage;
/* CIF ENDTEXT */ /* CIF ENDTEXT */
/* CIF START (155, 40), (70, 33) */ /* CIF START (155, 40), (70, 33) */
START; START;
/* CIF NEXTSTATE (152, 90), (75, 35) */ /* CIF NEXTSTATE (152, 90), (75, 35) */
NEXTSTATE Off; NEXTSTATE Off;
/* CIF state (443, 49), (70, 35) */ /* CIF state (152, 90), (75, 35) */
state Red; state Off;
/* CIF connect (478, 104), (0, 35) */ /* CIF input (121, 145), (134, 35) */
connect Go_Green; input Initialize;
/* CIF PROCEDURECALL (389, 159), (178, 35) */ /* CIF PROCEDURECALL (99, 200), (178, 35) */
call Set_Timer (5000, Clock);
/* CIF output (424, 214), (106, 35) */
output Color (Green);
/* CIF decision (415, 264), (124, 50) */
decision Walk_requested;
/* CIF ANSWER (364, 334), (70, 24) */
(True):
/* CIF NEXTSTATE (339, 378), (119, 35) */
NEXTSTATE Green via Short;
/* CIF ANSWER (533, 334), (68, 24) */
(False):
/* CIF NEXTSTATE (530, 378), (74, 35) */
NEXTSTATE Green;
enddecision;
endstate;
/* CIF state (686, 61), (70, 35) */
state Orange;
/* CIF input (686, 116), (70, 35) */
input Clock;
/* CIF PROCEDURECALL (632, 171), (178, 35) */
call Set_Timer (1000, Clock); call Set_Timer (1000, Clock);
/* CIF output (674, 226), (92, 35) */ /* CIF output (142, 255), (92, 35) */
output Color (Red); output Color (Red);
/* CIF NEXTSTATE (686, 276), (70, 35) */ /* CIF output (126, 310), (124, 35) */
output Info_User (Wait);
/* CIF NEXTSTATE (157, 360), (61, 35) */
NEXTSTATE Red; NEXTSTATE Red;
endstate; endstate;
/* CIF state (828, 314), (70, 35) */ /* CIF state (828, 314), (70, 35) */
...@@ -130,22 +112,40 @@ process Controller; ...@@ -130,22 +112,40 @@ process Controller;
connect Go_Orange; connect Go_Orange;
/* CIF PROCEDURECALL (762, 419), (201, 35) */ /* CIF PROCEDURECALL (762, 419), (201, 35) */
call Set_Timer (2000, Clock); call Set_Timer (2000, Clock);
/* CIF output (805, 474), (114, 35) */ /* CIF output (806, 474), (114, 35) */
output Color (Orange); output Color (Orange);
/* CIF NEXTSTATE (828, 524), (70, 35) */ /* CIF NEXTSTATE (828, 524), (70, 35) */
NEXTSTATE Orange; NEXTSTATE Orange;
endstate; endstate;
/* CIF state (152, 90), (75, 35) */ /* CIF state (686, 61), (70, 35) */
state Off; state Orange;
/* CIF input (121, 145), (134, 35) */ /* CIF input (686, 116), (70, 35) */
input Initialize (dummy); input Clock;
/* CIF PROCEDURECALL (100, 200), (178, 35) */ /* CIF PROCEDURECALL (632, 171), (178, 35) */
call Set_Timer (1000, Clock); call Set_Timer (1000, Clock);
/* CIF output (142, 255), (92, 35) */ /* CIF output (675, 226), (92, 35) */
output Color (Red); output Color (Red);
/* CIF output (126, 310), (124, 35) */ /* CIF NEXTSTATE (686, 276), (70, 35) */
output Info_User (Wait);
/* CIF NEXTSTATE (158, 360), (61, 35) */
NEXTSTATE Red; NEXTSTATE Red;
endstate; endstate;
/* CIF state (443, 49), (70, 35) */
state Red;
/* CIF connect (478, 104), (0, 35) */
connect Go_Green;
/* CIF PROCEDURECALL (389, 159), (178, 35) */
call Set_Timer (5000, Clock);
/* CIF output (425, 214), (106, 35) */
output Color (Green);
/* CIF decision (416, 264), (124, 50) */
decision Walk_requested;
/* CIF ANSWER (364, 334), (70, 24) */
(True):
/* CIF NEXTSTATE (339, 378), (119, 35) */
NEXTSTATE Green via Short;
/* CIF ANSWER (533, 334), (68, 24) */
(False):
/* CIF NEXTSTATE (530, 378), (74, 35) */
NEXTSTATE Green;
enddecision;
endstate;
endprocess Controller; endprocess Controller;
\ No newline at end of file
...@@ -16,9 +16,9 @@ use Datamodel; ...@@ -16,9 +16,9 @@ use Datamodel;
system Controller; system Controller;
/* CIF Keep Specific Geode PARAMNAMES req */ /* CIF Keep Specific Geode PARAMNAMES req */
signal Button (Command); signal Button;
/* CIF Keep Specific Geode PARAMNAMES a */ /* CIF Keep Specific Geode PARAMNAMES a */
signal Initialize (T_Boolean); signal Initialize;
; ;
/* CIF Keep Specific Geode PARAMNAMES current_color */ /* CIF Keep Specific Geode PARAMNAMES current_color */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment