Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
kazoo
Commits
ff289649
Commit
ff289649
authored
May 03, 2021
by
Maxime Perrotin
Browse files
Update observer example
parent
cbd2b0a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/iterators/work/simulation/observer/observer.pr
View file @
ff289649
system my_observer;
system my_observer;
/* CIF TEXT (145, 177), (
483
, 168) */
/* CIF TEXT (145, 177), (
507
, 168) */
use datamodel comment 'observer.asn';
use datamodel comment 'observer.asn';
exported procedure observe;
exported procedure observe;
...
@@ -8,17 +8,23 @@ system my_observer;
...
@@ -8,17 +8,23 @@ system my_observer;
referenced;
referenced;
signal pre_in_orchestrator_pulse (t_int) renames input pulse to orchestrator;
signal pre_in_orchestrator_pulse (t_int) renames input pulse to orchestrator;
signal foo renames input pulse to orchestrator;
/* CIF ENDTEXT */
/* CIF ENDTEXT */
channel c
channel c
from env to my_observer with observe;
from env to my_observer with observe,
pre_in_orchestrator_pulse,
foo;
endchannel;
endchannel;
block my_observer;
block my_observer;
signalroute r
signalroute r
from env to my_observer with observe;
from env to my_observer with observe,
pre_in_orchestrator_pulse,
foo;
connect c and r;
connect c and r;
/* CIF PROCESS (250, 87), (150, 75) */
/* CIF PROCESS (250, 87), (150, 75) */
process my_observer;
process my_observer;
/* CIF TEXT (
46
, 57), (256, 184) */
/* CIF TEXT (
0
, 57), (256, 184) */
monitor st System_State;
monitor st System_State;
monitor event Observable_Event;
monitor event Observable_Event;
...
@@ -31,23 +37,23 @@ system my_observer;
...
@@ -31,23 +37,23 @@ system my_observer;
dcl p1 T_Int;
dcl p1 T_Int;
/* CIF ENDTEXT */
/* CIF ENDTEXT */
/* CIF procedure (
1794
, 152), (70, 35) */
/* CIF procedure (
2060
, 152), (70, 35) */
procedure observe;
procedure observe;
/* CIF TEXT (1
32
, 48), (313, 120) */
/* CIF TEXT (1
40
, 48), (313, 120) */
-- this procedure could be generated automatically,
-- this procedure could be generated automatically,
-- and be read-only.
-- and be read-only.
fpar in/out model System_State,
fpar in/out model System_State,
in/out last_event Observable_Event;
in/out last_event Observable_Event;
/* CIF ENDTEXT */
/* CIF ENDTEXT */
/* CIF START (4
5
6, 153), (70, 35) */
/* CIF START (46
4
, 153), (70, 35) */
START;
START;
/* CIF task (4
22
, 208), (137, 40) */
/* CIF task (4
30
, 208), (137, 40) */
task st := model,
task st := model,
Event := Last_Event;
Event := Last_Event;
/* CIF PROCEDURECALL (3
37
, 268), (308, 35) */
/* CIF PROCEDURECALL (3
45
, 268), (308, 35) */
call writeln('[observer] Event: ', present(event));
call writeln('[observer] Event: ', present(event));
/* CIF decision (4
3
4, 323), (113, 50) */
/* CIF decision (44
2
, 323), (113, 50) */
decision present(event);
decision present(event);
/* CIF ANSWER (97, 393), (93, 24) */
/* CIF ANSWER (97, 393), (93, 24) */
(input_event):
(input_event):
...
@@ -70,111 +76,124 @@ Event := Last_Event;
...
@@ -70,111 +76,124 @@ Event := Last_Event;
/* CIF PROCEDURECALL (780, 437), (169, 35) */
/* CIF PROCEDURECALL (780, 437), (169, 35) */
call writeln('no_event');
call writeln('no_event');
enddecision;
enddecision;
/* CIF return (4
73
, 543), (35, 35) */
/* CIF return (4
81
, 543), (35, 35) */
return ;
return ;
endprocedure;
endprocedure;
/* CIF START (
440
, 86), (70, 35) */
/* CIF START (
683
, 86), (70, 35) */
START;
START;
/* CIF PROCEDURECALL (
395
, 141), (159, 35) */
/* CIF PROCEDURECALL (
638
, 141), (159, 35) */
call writeln ('observer init');
call writeln ('observer init');
/* CIF NEXTSTATE (
433
, 191), (83, 35) */
/* CIF NEXTSTATE (
676
, 191), (83, 35) */
NEXTSTATE first_state;
NEXTSTATE first_state;
/* CIF state (
299
, 43
0
), (101, 34) */
/* CIF state (
662
, 43
4
), (101, 34) */
state second_state;
state second_state;
/* CIF provided (
230
, 48
5
), (239, 45) */
/* CIF provided (
594
, 48
9
), (239, 45) */
provided st.orchestrator.magic_number = 42;
provided st.orchestrator.magic_number = 42;
/* CIF NEXTSTATE (
299
, 55
0
), (101, 35) */
/* CIF NEXTSTATE (
663
, 55
4
), (101, 35) */
NEXTSTATE third_state;
NEXTSTATE third_state;
endstate;
endstate;
/* CIF state (
299
, 32
0
), (101, 35) */
/* CIF state (
663
, 32
4
), (101, 35) */
state Wait_count;
state Wait_count;
/* CIF provided (
307
, 37
5
), (85, 35) */
/* CIF provided (
671
, 37
9
), (85, 35) */
provided count = 3
provided count = 3
/* CIF comment (
416
, 37
2
), (104, 40) */
/* CIF comment (
780
, 37
6
), (104, 40) */
comment 'Called AFTER
comment 'Called AFTER
the input';
the input';
/* CIF NEXTSTATE (
299
, 43
0
), (101, 34) */
/* CIF NEXTSTATE (
662
, 43
4
), (101, 34) */
NEXTSTATE second_state;
NEXTSTATE second_state;
endstate;
endstate;
/* CIF state (
433
, 191), (83, 35) */
/* CIF state (
676
, 191), (83, 35) */
state first_state;
state first_state;
/* CIF provided (
280
, 24
6
), (139, 5
4
) */
/* CIF provided (
644
, 24
8
), (139, 5
6
) */
provided input pulse
provided input pulse
to orchestrator
to orchestrator
/* CIF comment (
446
, 25
3
), (111, 40) */
/* CIF comment (
810
, 25
6
), (111, 40) */
comment 'Called BEFORE
comment 'Called BEFORE
the input';
the input';
/* CIF NEXTSTATE (
299
, 32
0
), (101, 35) */
/* CIF NEXTSTATE (
663
, 32
4
), (101, 35) */
NEXTSTATE Wait_count;
NEXTSTATE Wait_count;
/* CIF input (568, 246), (70, 35) */
input d;
endstate;
endstate;
/* CIF state (
844
, 237), (97, 40) */
/* CIF state (
992
, 237), (97, 40) */
state fourth_state;
state fourth_state;
/* CIF provided (
795
, 297), (193, 79) */
/* CIF provided (
943
, 297), (193, 79) */
provided output do_something(p)
provided output do_something(p)
from orchestrator
from orchestrator
to another_function
to another_function
/* CIF comment (1
011
, 308), (146, 56) */
/* CIF comment (1
159
, 308), (146, 56) */
comment 'intercept the output
comment 'intercept the output
and modify the value
and modify the value
of the parameter';
of the parameter';
/* CIF decision (
856
, 396), (70, 50) */
/* CIF decision (
1005
, 396), (70, 50) */
decision p = 42;
decision p = 42;
/* CIF ANSWER (
791
, 466), (70, 24) */
/* CIF ANSWER (
939
, 466), (70, 24) */
(true):
(true):
/* CIF task (
791
, 510), (70, 35) */
/* CIF task (
939
, 510), (70, 35) */
task p := 99;
task p := 99;
/* CIF NEXTSTATE (
783
, 565), (85, 35) */
/* CIF NEXTSTATE (
932
, 565), (85, 35) */
NEXTSTATE fifth_state;
NEXTSTATE fifth_state;
/* CIF ANSWER (
891
, 466), (70, 24) */
/* CIF ANSWER (
1039
, 466), (70, 24) */
(false):
(false):
/* CIF NEXTSTATE (
880
, 510), (92, 35) */
/* CIF NEXTSTATE (
1028
, 510), (92, 35) */
NEXTSTATE unexpected;
NEXTSTATE unexpected;
enddecision;
enddecision;
endstate;
endstate;
/* CIF state (
845
, 90), (88, 35) */
/* CIF state (
1286
, 90), (88, 35) */
state third_state;
state third_state;
/* CIF provided (
806
, 145), (173, 72) */
/* CIF provided (
954
, 145), (173, 72) */
provided output paramesstogui
provided output paramesstogui
from orchestrator;
from orchestrator;
/* CIF NEXTSTATE (
844
, 237), (97, 40) */
/* CIF NEXTSTATE (
992
, 237), (97, 40) */
NEXTSTATE fourth_state;
NEXTSTATE fourth_state;
/* CIF input (1317, 145), (218, 49) */
input pre_in_orchestrator_pulse(toto)
/* CIF comment (1555, 152), (127, 56) */
comment 'alias for
input pulse to
orchestrator';
/* CIF decision (1391, 214), (70, 50) */
decision toto;
/* CIF ANSWER (1335, 284), (70, 24) */
(1):
/* CIF ANSWER (1425, 284), (70, 24) */
else:
enddecision;
/* CIF NEXTSTATE (1391, 324), (70, 35) */
NEXTSTATE -;
endstate;
endstate;
/* CIF state (
0
, 262), (95, 35) */
/* CIF state (
154
, 262), (95, 35) */
state end_success;
state end_success;
endstate;
endstate;
/* CIF state (
3
, 314), (92, 35) */
/* CIF state (
157
, 314), (92, 35) */
state unexpected;
state unexpected;
endstate;
endstate;
/* CIF state (1
279
, 437), (87, 35) */
/* CIF state (1
710
, 437), (87, 35) */
state sixth_state;
state sixth_state;
/* CIF provided (1
263
, 492), (121, 50) */
/* CIF provided (1
694
, 492), (121, 50) */
provided actual_val = 100;
provided actual_val = 100;
/* CIF NEXTSTATE (1
2
76, 562), (95, 35) */
/* CIF NEXTSTATE (17
0
6, 562), (95, 35) */
NEXTSTATE end_success;
NEXTSTATE end_success;
endstate;
endstate;
/* CIF state (1
297
, 88), (145, 57) */
/* CIF state (1
728
, 88), (145, 57) */
state fifth_state;
state fifth_state;
/* CIF provided (1
277
, 165), (184, 68) */
/* CIF provided (1
708
, 165), (184, 68) */
provided input do_something(val)
provided input do_something(val)
to another_function
to another_function
/* CIF comment (1
484
, 163), (134, 72) */
/* CIF comment (1
915
, 163), (134, 72) */
comment 'intercept the input
comment 'intercept the input
before execution
before execution
(=post-output)
(=post-output)
alter it again';
alter it again';
/* CIF decision (1
319
, 253), (99, 68) */
/* CIF decision (1
750
, 253), (99, 68) */
decision val = 99;
decision val = 99;
/* CIF ANSWER (1
292
, 343), (62, 24) */
/* CIF ANSWER (1
723
, 343), (62, 24) */
(true):
(true):
/* CIF task (1
276
, 387), (93, 35) */
/* CIF task (1
707
, 387), (93, 35) */
task val := val + 1;
task val := val + 1;
/* CIF NEXTSTATE (1
279
, 437), (87, 35) */
/* CIF NEXTSTATE (1
710
, 437), (87, 35) */
NEXTSTATE sixth_state;
NEXTSTATE sixth_state;
/* CIF ANSWER (1
408
, 343), (70, 24) */
/* CIF ANSWER (1
839
, 343), (70, 24) */
(false):
(false):
/* CIF NEXTSTATE (1
39
7, 387), (92, 35) */
/* CIF NEXTSTATE (1
82
7, 387), (92, 35) */
NEXTSTATE unexpected;
NEXTSTATE unexpected;
enddecision;
enddecision;
endstate;
endstate;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment