Added example heptreax
Example heptreax, use of ReaX controller synthesis tool for verification and controller synthesis.
This commit is contained in:
parent
d5ee87b7ed
commit
f720c1844f
3 changed files with 57 additions and 0 deletions
18
examples/heptreax/README
Normal file
18
examples/heptreax/README
Normal file
|
@ -0,0 +1,18 @@
|
|||
Examples of uses of Heptagon with the synthesis tool ReaX.
|
||||
|
||||
- Verification (modes.ept, contract without controllable variable) :
|
||||
|
||||
heptc -target ctrln modes.ept
|
||||
reax -a 'sS:d={P:D}' modes_ctrln/twomodes.ctrln
|
||||
|
||||
- Controller synthesis (twomodes.ept, contract with controllable variable) :
|
||||
|
||||
heptc -hepts -s twomodes -target c -target ctrln modes.ept
|
||||
reax -a 'sS:d={P:D}' --triang modes_ctrln/twomodes.ctrln
|
||||
ctrl2ept -n Modes.twomodes
|
||||
heptc -target c modes_controller.ept
|
||||
gcc -o sim -I/usr/local/lib/heptagon/c -Imodes_c -Imodes_controller_c
|
||||
modes_c/_main.c modes_c/modes.c modes_c/modes_types.c
|
||||
modes_controller_c/modes_controller.c
|
||||
modes_controller_c/modes_controller_types.c
|
||||
|
20
examples/heptreax/modes.ept
Normal file
20
examples/heptreax/modes.ept
Normal file
|
@ -0,0 +1,20 @@
|
|||
node twomodes (v:int) = (o:int)
|
||||
|
||||
contract
|
||||
assume (v <= 1) & (v >= 0)
|
||||
enforce (o <= 10) & (o >= 0)
|
||||
with (c:bool)
|
||||
|
||||
var last y : int = 0;
|
||||
let
|
||||
o = y;
|
||||
automaton
|
||||
state Up
|
||||
do y = last y + v
|
||||
until not c then Down
|
||||
state Down
|
||||
do y = last y - v
|
||||
until not c then Up
|
||||
end
|
||||
tel
|
||||
|
19
examples/heptreax/twomodes.ept
Normal file
19
examples/heptreax/twomodes.ept
Normal file
|
@ -0,0 +1,19 @@
|
|||
node twomodes (v:int) = (o:int)
|
||||
|
||||
contract
|
||||
assume (v <= 1) & (v >= 0)
|
||||
enforce (o <= 10) & (o >= 0)
|
||||
|
||||
var last y : int = 0;
|
||||
let
|
||||
o = y;
|
||||
automaton
|
||||
state Up
|
||||
do y = last y + v
|
||||
until y >= 10 then Down
|
||||
state Down
|
||||
do y = last y - v
|
||||
until y <= 0 then Up
|
||||
end
|
||||
tel
|
||||
|
Loading…
Reference in a new issue