CREST A Continuous, REactive SysTems DSL Stefan Klikovits Alban - - PowerPoint PPT Presentation
CREST A Continuous, REactive SysTems DSL Stefan Klikovits Alban - - PowerPoint PPT Presentation
CREST A Continuous, REactive SysTems DSL Stefan Klikovits Alban Linard Didier Buchs University of Geneva, Switzerland Growing plants CREST 2 a Klikovits et. al. CREST DSL stefan.klikovits@unige.ch Growing plants CREST 2 a (c) Debra
CREST a
2
Growing plants
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
2
Growing plants
(c) Debra Roby https://www.flickr.com/photos/darinhercules/ Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
3
CREST diagrams
+δt
≪Growing lamp≫
On Off room temperature: 22 (Celsius) switch:
- ff (Switch)
electricity: 0 (Watt) light: 0 (Lumen) temperature: 22 (Celsius)
- n time:
0 (Time) switch = on ∧ electricity = 100 switch = off ∨ electricity < 100 800 room temp. room temperature + 4 Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
3
CREST diagrams
+δt
≪Growing lamp≫
On Off room temperature: 22 (Celsius) switch:
- ff (Switch)
electricity: 0 (Watt) light: 0 (Lumen) temperature: 22 (Celsius)
- n time:
0 (Time) switch = on ∧ electricity = 100 switch = off ∨ electricity < 100 800 room temp. room temperature + 4 Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
3
CREST diagrams
+δt
≪Growing lamp≫
On Off room temperature: 22 (Celsius) switch:
- ff (Switch)
electricity: 0 (Watt) light: 0 (Lumen) temperature: 22 (Celsius)
- n time:
0 (Time) switch = on ∧ electricity = 100 switch = off ∨ electricity < 100 800 room temp. room temperature + 4 Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
3
CREST diagrams
+δt
≪Growing lamp≫
On Off room temperature: 22 (Celsius) switch:
- ff (Switch)
electricity: 0 (Watt) light: 0 (Lumen) temperature: 22 (Celsius)
- n time:
0 (Time) switch = on ∧ electricity = 100 switch = off ∨ electricity < 100 800 room temp. room temperature + 4 Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
3
CREST diagrams
+δt
≪Growing lamp≫
On Off room temperature: 22 (Celsius) switch:
- ff (Switch)
electricity: 0 (Watt) light: 0 (Lumen) temperature: 22 (Celsius)
- n time:
0 (Time) switch = on ∧ electricity = 100 switch = off ∨ electricity < 100 800 room temp. room temperature + 4 Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
4
Composition
≪Plant growing system≫
≪Growing lamp≫ room temperature 22 (Celsius) switch
- ff (Switch)
electricity 0 (Watt) temperature 22 (Celsius) light 0 (Lumen) ≪Plant≫ light 0 (Lux) temperature 22 (Celcius) SPLIT MAX SPLIT MAX room temperature 22 (Celsius) switch
- ff (Switch)
electricity 0 (Watt) light 0 (lux) ADD Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
4
Composition
≪Plant growing system≫
≪Growing lamp≫ room temperature 22 (Celsius) switch
- ff (Switch)
electricity 0 (Watt) temperature 22 (Celsius) light 0 (Lumen) ≪Plant≫ light 0 (Lux) temperature 22 (Celcius) SPLIT MAX SPLIT MAX room temperature 22 (Celsius) switch
- ff (Switch)
electricity 0 (Watt) light 0 (lux) ADD Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
4
Composition
≪Plant growing system≫
≪Growing lamp≫ room temperature 22 (Celsius) switch
- ff (Switch)
electricity 0 (Watt) temperature 22 (Celsius) light 0 (Lumen) ≪Plant≫ light 0 (Lux) temperature 22 (Celcius) SPLIT MAX SPLIT MAX room temperature 22 (Celsius) switch
- ff (Switch)
electricity 0 (Watt) light 0 (lux) ADD Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
4
Composition
≪Plant growing system≫
≪Growing lamp≫ room temperature 22 (Celsius) switch
- ff (Switch)
electricity 0 (Watt) temperature 22 (Celsius) light 0 (Lumen) ≪Plant≫ light 0 (Lux) temperature 22 (Celcius) ≪ADD≫ lamp 0 (Lumen) external 0 (Lux) light 0 (Lux) add lamp/0.25 +external SPLIT MAX SPLIT MAX room temperature 22 (Celsius) switch
- ff (Switch)
electricity 0 (Watt) light 0 (lux) Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
5
Language Realization
class GrowingLamp (Entity): electricity = Input(resource=res_electricity , init=0) light = Output(resource=res_light_lumen , init=0)
- n = current = State ()
- ff = State ()
- ff_to_on = Transition (source=off , target=on ,
guard=(lambda lamp: lamp.switch.value == "on" and
- lamp. electricity .value >= 100)
) @update(state=on) def set_light_on (lamp , dt=0): lamp.light.value = 800
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
5
Language Realization
class GrowingLamp (Entity): electricity = Input(resource=res_electricity , init=0) light = Output(resource=res_light_lumen , init=0)
- n = current = State ()
- ff = State ()
- ff_to_on = Transition (source=off , target=on ,
guard=(lambda lamp: lamp.switch.value == "on" and
- lamp. electricity .value >= 100)
) @update(state=on) def set_light_on (lamp , dt=0): lamp.light.value = 800
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
5
Language Realization
class GrowingLamp (Entity): electricity = Input(resource=res_electricity , init=0) light = Output(resource=res_light_lumen , init=0)
- n = current = State ()
- ff = State ()
- ff_to_on = Transition (source=off , target=on ,
guard=(lambda lamp: lamp.switch.value == "on" and
- lamp. electricity .value >= 100)
) @update(state=on) def set_light_on (lamp , dt=0): lamp.light.value = 800
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
5
Language Realization
class GrowingLamp (Entity): electricity = Input(resource=res_electricity , init=0) light = Output(resource=res_light_lumen , init=0)
- n = current = State ()
- ff = State ()
- ff_to_on = Transition (source=off , target=on ,
guard=(lambda lamp: lamp.switch.value == "on" and
- lamp. electricity .value >= 100)
) @update(state=on) def set_light_on (lamp , dt=0): lamp.light.value = 800
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
5
Language Realization
class GrowingLamp (Entity): electricity = Input(resource=res_electricity , init=0) light = Output(resource=res_light_lumen , init=0)
- n = current = State ()
- ff = State ()
- ff_to_on = Transition (source=off , target=on ,
guard=(lambda lamp: lamp.switch.value == "on" and
- lamp. electricity .value >= 100)
) @update(state=on) def set_light_on (lamp , dt=0): lamp.light.value = 800
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
6
Why not «formalism-XYZ»?
◮ powerful, but complex ◮ too generic ◮ feature workarounds ◮ architecture and behaviour
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
7
One DSL to rule them all?
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
8
CREST Formalization
T, R, E, e e = Pe, resourcee, TSe, Ue, entitiese, Infe Pe = Ie ⊔ Oe ⊔ Le TS = Se, →e; →e⊆ Se × Se × Ge . . .
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
8
CREST Formalization
T, R, E, e e = Pe, resourcee, TSe, Ue, entitiese, Infe Pe = Ie ⊔ Oe ⊔ Le TS = Se, →e; →e⊆ Se × Se × Ge . . . it’s in the paper
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
9
How to design a simulator
◮ advance time in constant steps? ◮ transition time calculation ◮ generate CREST diagrams
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
9
How to design a simulator
◮ advance time in constant steps? ◮ transition time calculation ◮ generate CREST diagrams
not full full fill level full-signal fill-level < 10 fill-level = 10 flow-rate: 0.5 per time step 4.35 t fill-level 10 0,0 10 Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
9
How to design a simulator
◮ advance time in constant steps? ◮ transition time calculation ◮ generate CREST diagrams
not full full fill level full-signal fill-level < 10 fill-level = 10 flow-rate: 0.5 per time step 4.35 t fill-level 10 0,0 10 Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
9
How to design a simulator
◮ advance time in constant steps? ◮ transition time calculation ◮ generate CREST diagrams
not full full fill level full-signal fill-level < 10 fill-level = 10 flow-rate: 0.5 per time step 4.35 11.3 t fill-level 10 0,0 10 Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
10
Verification
◮ state space exploration ◮ zone/region-based verification
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
10
Verification
◮ state space exploration ◮ zone/region-based verification
http://www-i2.informatik.rwth-aachen.de/ sri/Slides/sri-zonebased.pdf Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
10
Verification
◮ state space exploration ◮ zone/region-based verification ◮ requirements language
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
11
Controller synthesis
◮ planning + optimization + simulation ◮ changing parameters ◮ changing (sub-)systems
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
12
Applications
plant growing home automation job scheduling
- ffice automation
https://cs.wikipedia.org/wiki/Roomba#/media/File:IRobot_Roomba_780.jpg Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
13
Conclusion
CREST
◮ architecture & behaviour ◮ continuous & reactive ◮ formal basis
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST
A Continuous, REactive SysTems DSL
Stefan Klikovits Alban Linard Didier Buchs
University of Geneva, Switzerland
CREST a
14
Meta-Model
subentity * source target
- bserve
write source target Entity Port Input Output Local State Transition Guard Update Influence Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
15
Complex Ports
A
Out Req-In
B
In Req-Out
Requestable Resources
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
15
Complex Ports
A A
Out Req-In
B B
In Req-Out Out In
Requestable Resources
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
15
Complex Ports
A A
Out Req-In
B B
In Req-Out Out In Out In
Requestable Resources
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
15
Complex Ports
A A
Out Req-In
B B
In Req-Out Out In Out In
Requestable Resources
in Splitter in split
- ut1
- ut2
combined input & splitter
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch
CREST a
15
Complex Ports
A A
Out Req-In
B B
In Req-Out Out In Out In
Requestable Resources
in Splitter in split
- ut1
- ut2
in in SPLIT
combined input & splitter
Klikovits et. al. CREST DSL stefan.klikovits@unige.ch