Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
kazoo
Commits
f93aca60
Commit
f93aca60
authored
Sep 05, 2019
by
Maxime Perrotin
Browse files
Use an enumerated type for the floor
parent
085858a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/Demo_ABB/DataView.asn
View file @
f93aca60
...
...
@@ -5,14 +5,16 @@ UpDown ::= ENUMERATED { up (1), down (0) }
OnOff ::= ENUMERATED { on (1), off (0) }
OpenClose ::= ENUMERATED { door-open (1), door-close (0) }
Position ::= REAL (-100 .. 100.0)
Floors ::= INTEGER {
-- don't use an integer, because the GUI needs to have real floor names
Floors ::= ENUMERATED {
floor-0 (0),
floor-1 (10),
floor-2 (20),
floor-3 (30),
floor-4 (40),
floor-5 (50)
}
(0 | 10 | 20 | 30 | 40 | 50)
}
-- Types used for the interfacing with the Simulink model
...
...
test/Demo_ABB/controller/controller.pr
View file @
f93aca60
...
...
@@ -43,7 +43,7 @@ counter := forever : false
brake
on
},
door
:=
door_open
;
/*
CIF
NEXTSTATE
(
281
1
,
438
),
(
74
,
35
)
*/
/*
CIF
NEXTSTATE
(
281
0
,
438
),
(
74
,
35
)
*/
NEXTSTATE
Stopped
;
/*
CIF
ANSWER
(
3104
,
254
),
(
70
,
24
)
*/
(
false
):
...
...
@@ -60,7 +60,7 @@ door := door_open;
};
/*
CIF
ANSWER
(
3184
,
366
),
(
70
,
24
)
*/
(
false
):
/*
CIF
task
(
313
9
,
410
),
(
161
,
120
)
*/
/*
CIF
task
(
313
8
,
410
),
(
161
,
120
)
*/
task
cmd
:=
{
direction
down
,
motor
on
,
...
...
@@ -73,59 +73,59 @@ door := door_open;
enddecision
;
/*
CIF
End
Label
*/
endconnection
;
/*
CIF
state
(
171
8
,
76
),
(
74
,
35
)
*/
/*
CIF
state
(
171
7
,
76
),
(
74
,
35
)
*/
state
Stopped
;
/*
CIF
input
(
127
8
,
131
),
(
196
,
35
)
*/
/*
CIF
input
(
127
7
,
131
),
(
196
,
35
)
*/
input
Floor_Command
(
floor_cmd
)
/*
CIF
comment
(
1495
,
131
),
(
270
,
32
)
*/
comment
'Someone at floor F pressed UP or DOWN'
;
/*
CIF
decision
(
120
9
,
186
),
(
336
,
56
)
*/
/*
CIF
decision
(
120
8
,
186
),
(
336
,
56
)
*/
decision
floor_cmd
=
{
direction
up
,
floor
floor_5
}
or
floor_cmd
=
{
direction
down
,
floor
floor_0
}
/*
CIF
comment
(
1565
,
196
),
(
204
,
35
)
*/
comment
'Discard impossible commands'
;
/*
CIF
ANSWER
(
11
57
,
262
),
(
70
,
24
)
*/
/*
CIF
ANSWER
(
11
39
,
262
),
(
70
,
24
)
*/
(
true
):
/*
CIF
NEXTSTATE
(
11
55
,
306
),
(
74
,
35
)
*/
/*
CIF
NEXTSTATE
(
11
37
,
306
),
(
74
,
35
)
*/
NEXTSTATE
Stopped
;
/*
CIF
ANSWER
(
1547
,
262
),
(
70
,
24
)
*/
(
false
):
/*
CIF
task
(
14
61
,
306
),
(
2
41
,
35
)
*/
task
target_pos
:=
float
(
floor_cmd
.
floor
);
/*
CIF
task
(
14
43
,
306
),
(
2
76
,
35
)
*/
task
target_pos
:=
float
(
num
(
floor_cmd
.
floor
)
)
;
/*
CIF
decision
(
1506
,
356
),
(
151
,
50
)
*/
decision
round
(
sensors
.
pos_x
);
/*
CIF
ANSWER
(
12
39
,
426
),
(
166
,
24
)
*/
(=
float
(
floor_cmd
.
floor
)):
/*
CIF
task
(
124
1
,
470
),
(
163
,
24
)
*/
/*
CIF
ANSWER
(
12
21
,
426
),
(
201
,
24
)
*/
(=
float
(
num
(
floor_cmd
.
floor
))
)
:
/*
CIF
task
(
124
0
,
470
),
(
163
,
24
)
*/
task
cmd
.
door
:=
door_open
/*
CIF
comment
(
1425
,
464
),
(
138
,
40
)
*/
comment
'Lift is there
Just open the door'
;
/*
CIF
task
(
125
5
,
514
),
(
134
,
35
)
*/
/*
CIF
task
(
125
4
,
514
),
(
134
,
35
)
*/
task
door
:=
door_open
;
/*
CIF
NEXTSTATE
(
128
5
,
564
),
(
74
,
35
)
*/
/*
CIF
NEXTSTATE
(
128
4
,
564
),
(
74
,
35
)
*/
NEXTSTATE
Stopped
;
/*
CIF
ANSWER
(
167
6
,
426
),
(
54
,
40
)
*/
/*
CIF
ANSWER
(
167
5
,
426
),
(
54
,
40
)
*/
ELSE
:
/*
CIF
task
(
163
6
,
486
),
(
134
,
35
)
*/
/*
CIF
task
(
163
5
,
486
),
(
134
,
35
)
*/
task
door
:=
door_close
;
/*
CIF
join
(
168
6
,
541
),
(
35
,
35
)
*/
/*
CIF
join
(
168
5
,
541
),
(
35
,
35
)
*/
join
move
;
enddecision
;
enddecision
;
/*
CIF
input
(
200
7
,
132
),
(
200
,
35
)
*/
/*
CIF
input
(
200
6
,
132
),
(
200
,
35
)
*/
input
Cabin_Command
(
cabin_cmd
)
/*
CIF
comment
(
2230
,
132
),
(
239
,
56
)
*/
comment
'Someone selected a target floor
from inside the cabin, or someone
pressed the emergency stop button'
;
/*
CIF
decision
(
203
5
,
187
),
(
145
,
50
)
*/
/*
CIF
decision
(
203
4
,
187
),
(
145
,
50
)
*/
decision
present
(
cabin_cmd
);
/*
CIF
ANSWER
(
1975
,
257
),
(
70
,
24
)
*/
(
floor
):
/*
CIF
decision
(
1896
,
301
),
(
227
,
71
)
*/
decision
round
(
sensors
.
pos_x
)
=
float
(
cabin_cmd
.
floor
);
=
float
(
num
(
cabin_cmd
.
floor
)
)
;
/*
CIF
ANSWER
(
1869
,
396
),
(
70
,
24
)
*/
(
true
):
/*
CIF
task
(
1822
,
435
),
(
163
,
24
)
*/
...
...
@@ -135,23 +135,23 @@ pressed the emergency stop button';
Just open the door'
;
/*
CIF
task
(
1836
,
479
),
(
134
,
35
)
*/
task
door
:=
door_open
;
/*
CIF
NEXTSTATE
(
186
7
,
534
),
(
74
,
35
)
*/
/*
CIF
NEXTSTATE
(
186
6
,
534
),
(
74
,
35
)
*/
NEXTSTATE
Stopped
;
/*
CIF
ANSWER
(
2267
,
396
),
(
70
,
24
)
*/
(
false
):
/*
CIF
task
(
2234
,
440
),
(
134
,
35
)
*/
task
door
:=
door_close
;
/*
CIF
task
(
21
80
,
490
),
(
2
43
,
35
)
*/
task
target_pos
:=
float
(
cabin_cmd
.
floor
);
/*
CIF
task
(
21
62
,
490
),
(
2
79
,
35
)
*/
task
target_pos
:=
float
(
num
(
cabin_cmd
.
floor
)
)
;
/*
CIF
join
(
2284
,
545
),
(
35
,
35
)
*/
join
move
;
enddecision
;
/*
CIF
ANSWER
(
24
37
,
257
),
(
123
,
24
)
*/
/*
CIF
ANSWER
(
24
54
,
257
),
(
123
,
24
)
*/
(
emergency_stop
):
/*
CIF
task
(
24
34
,
301
),
(
129
,
43
)
*/
/*
CIF
task
(
24
51
,
301
),
(
129
,
43
)
*/
task
cmd
.
motor
:=
off
,
cmd
.
brake
:=
on
;
/*
CIF
NEXTSTATE
(
24
61
,
364
),
(
74
,
35
)
*/
/*
CIF
NEXTSTATE
(
24
79
,
364
),
(
74
,
35
)
*/
NEXTSTATE
Stopped
;
enddecision
;
/*
CIF
input
(
846
,
131
),
(
70
,
35
)
*/
...
...
@@ -173,12 +173,12 @@ command';
(
forever
):
/*
CIF
NEXTSTATE
(
750
,
470
),
(
74
,
35
)
*/
NEXTSTATE
Stopped
;
/*
CIF
ANSWER
(
92
2
,
426
),
(
94
,
24
)
*/
/*
CIF
ANSWER
(
92
1
,
426
),
(
94
,
24
)
*/
(
nb_of_cycle
):
/*
CIF
task
(
88
2
,
470
),
(
175
,
40
)
*/
/*
CIF
task
(
88
1
,
470
),
(
175
,
40
)
*/
task
counter
:=
nb_of_cycle
:
counter
.
nb_of_cycle
-
1
;
/*
CIF
decision
(
88
7
,
530
),
(
165
,
50
)
*/
/*
CIF
decision
(
88
6
,
530
),
(
165
,
50
)
*/
decision
counter
.
nb_of_cycle
>
0
;
/*
CIF
ANSWER
(
891
,
600
),
(
70
,
24
)
*/
(
true
):
...
...
@@ -191,18 +191,56 @@ counter.nb_of_cycle - 1;
enddecision
;
enddecision
;
endstate
;
/*
CIF
state
(
317
,
394
),
(
91
,
56
)
*/
/*
CIF
state
(
3593
,
92
),
(
70
,
35
)
*/
state
Moving
;
/*
CIF
input
(
3594
,
147
),
(
67
,
35
)
*/
input
Pulse
;
/*
CIF
PROCEDURECALL
(
3572
,
202
),
(
109
,
40
)
*/
call
Operate_Lift
(
cmd
,
sensors
)
/*
CIF
comment
(
3691
,
198
),
(
123
,
40
)
*/
comment
'Call the Simulink
model'
;
/*
CIF
task
(
3529
,
262
),
(
197
,
35
)
*/
task
hk
:=
{
lift
sensors
,
door
door
};
/*
CIF
output
(
3559
,
317
),
(
135
,
40
)
*/
output
Housekeeping
(
hk
);
/*
CIF
decision
(
3533
,
377
),
(
189
,
50
)
*/
decision
present
(
counter
);
/*
CIF
ANSWER
(
3500
,
447
),
(
68
,
24
)
*/
(
forever
):
/*
CIF
join
(
3517
,
491
),
(
35
,
35
)
*/
join
move
;
/*
CIF
ANSWER
(
3668
,
447
),
(
94
,
24
)
*/
(
nb_of_cycle
):
/*
CIF
task
(
3628
,
491
),
(
175
,
40
)
*/
task
counter
:=
nb_of_cycle
:
counter
.
nb_of_cycle
-
1
;
/*
CIF
decision
(
3633
,
551
),
(
165
,
50
)
*/
decision
counter
.
nb_of_cycle
>
0
;
/*
CIF
ANSWER
(
3633
,
621
),
(
70
,
24
)
*/
(
true
):
/*
CIF
join
(
3650
,
665
),
(
35
,
35
)
*/
join
move
;
/*
CIF
ANSWER
(
3723
,
621
),
(
70
,
24
)
*/
(
false
):
/*
CIF
NEXTSTATE
(
3712
,
665
),
(
90
,
35
)
*/
NEXTSTATE
Power_Off
;
enddecision
;
enddecision
;
endstate
;
/*
CIF
state
(
316
,
394
),
(
91
,
56
)
*/
state
Power_Off
,
Stopped
,
Moving
;
/*
CIF
input
(
15
2
,
470
),
(
122
,
40
)
*/
/*
CIF
input
(
15
1
,
470
),
(
122
,
40
)
*/
input
Start_Controller
(
counter
);
/*
CIF
decision
(
14
9
,
530
),
(
128
,
50
)
*/
/*
CIF
decision
(
14
8
,
530
),
(
128
,
50
)
*/
decision
present
(
counter
);
/*
CIF
ANSWER
(
98
,
600
),
(
73
,
24
)
*/
(
forever
):
/*
CIF
decision
(
7
6
,
644
),
(
118
,
50
)
*/
/*
CIF
decision
(
7
5
,
644
),
(
118
,
50
)
*/
decision
counter
.
forever
;
/*
CIF
ANSWER
(
56
,
714
),
(
70
,
24
)
*/
(
true
):
...
...
@@ -214,17 +252,17 @@ Moving;
NEXTSTATE
Moving
;
/*
CIF
ANSWER
(
101
,
828
),
(
70
,
24
)
*/
(
off
):
/*
CIF
NEXTSTATE
(
9
9
,
872
),
(
74
,
35
)
*/
/*
CIF
NEXTSTATE
(
9
8
,
872
),
(
74
,
35
)
*/
NEXTSTATE
Stopped
;
enddecision
;
/*
CIF
ANSWER
(
191
,
714
),
(
70
,
24
)
*/
(
false
):
/*
CIF
NEXTSTATE
(
18
1
,
758
),
(
90
,
35
)
*/
/*
CIF
NEXTSTATE
(
18
0
,
758
),
(
90
,
35
)
*/
NEXTSTATE
Power_Off
;
enddecision
;
/*
CIF
ANSWER
(
31
2
,
600
),
(
94
,
24
)
*/
/*
CIF
ANSWER
(
31
1
,
600
),
(
94
,
24
)
*/
(
nb_of_cycle
):
/*
CIF
decision
(
31
4
,
644
),
(
90
,
50
)
*/
/*
CIF
decision
(
31
3
,
644
),
(
90
,
50
)
*/
decision
cmd
.
motor
;
/*
CIF
ANSWER
(
281
,
714
),
(
70
,
24
)
*/
(
on
):
...
...
@@ -232,52 +270,14 @@ Moving;
NEXTSTATE
Moving
;
/*
CIF
ANSWER
(
371
,
714
),
(
70
,
24
)
*/
(
off
):
/*
CIF
NEXTSTATE
(
36
9
,
758
),
(
74
,
35
)
*/
/*
CIF
NEXTSTATE
(
36
8
,
758
),
(
74
,
35
)
*/
NEXTSTATE
Stopped
;
enddecision
;
enddecision
;
/*
CIF
input
(
45
3
,
470
),
(
119
,
40
)
*/
/*
CIF
input
(
45
2
,
470
),
(
119
,
40
)
*/
input
Manual_Control
(
cmd
);
/*
CIF
NEXTSTATE
(
47
8
,
530
),
(
70
,
35
)
*/
/*
CIF
NEXTSTATE
(
47
7
,
530
),
(
70
,
35
)
*/
NEXTSTATE
-;
endstate
;
/*
CIF
state
(
3593
,
92
),
(
70
,
35
)
*/
state
Moving
;
/*
CIF
input
(
3594
,
147
),
(
67
,
35
)
*/
input
Pulse
;
/*
CIF
PROCEDURECALL
(
3573
,
202
),
(
109
,
40
)
*/
call
Operate_Lift
(
cmd
,
sensors
)
/*
CIF
comment
(
3691
,
198
),
(
123
,
40
)
*/
comment
'Call the Simulink
model'
;
/*
CIF
task
(
3529
,
262
),
(
197
,
35
)
*/
task
hk
:=
{
lift
sensors
,
door
door
};
/*
CIF
output
(
3560
,
317
),
(
135
,
40
)
*/
output
Housekeeping
(
hk
);
/*
CIF
decision
(
3533
,
377
),
(
189
,
50
)
*/
decision
present
(
counter
);
/*
CIF
ANSWER
(
3501
,
447
),
(
68
,
24
)
*/
(
forever
):
/*
CIF
join
(
3518
,
491
),
(
35
,
35
)
*/
join
move
;
/*
CIF
ANSWER
(
3669
,
447
),
(
94
,
24
)
*/
(
nb_of_cycle
):
/*
CIF
task
(
3629
,
491
),
(
175
,
40
)
*/
task
counter
:=
nb_of_cycle
:
counter
.
nb_of_cycle
-
1
;
/*
CIF
decision
(
3633
,
551
),
(
165
,
50
)
*/
decision
counter
.
nb_of_cycle
>
0
;
/*
CIF
ANSWER
(
3633
,
621
),
(
70
,
24
)
*/
(
true
):
/*
CIF
join
(
3651
,
665
),
(
35
,
35
)
*/
join
move
;
/*
CIF
ANSWER
(
3723
,
621
),
(
70
,
24
)
*/
(
false
):
/*
CIF
NEXTSTATE
(
3713
,
665
),
(
90
,
35
)
*/
NEXTSTATE
Power_Off
;
enddecision
;
enddecision
;
endstate
;
endprocess
Controller
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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