Date post: | 10-Feb-2017 |
Category: |
Software |
Upload: | takeoutweight |
View: | 93 times |
Download: | 0 times |
Hybrid Automataand the
Continuous LifeNathan Sorenson
sparkfund.co@takeoutweight
• 2008 Surrey
• 2011 Downtown Vancouver
• 2015 East Van• 1996 Hybrid Automata
• thermostats
• communication networks
• biochemical reactions• Hybrid Automata
• based on an Actual Thing
• handles edge cases
• nice properties compose
• deterministic logical concurrency
• hybrid-expression
Dw = -1
w
timeDw = +1
w
dw dtw'ẇ
time
w
Dw=-1 Dw=+1
w<2
w>8
w ≥1
w ≤ 9
“control mode”
“flow condition”
“jump condition”
“invariant
condition”
x
x
y
y
Dy=+1Dx=-1
Dy=0Dx=0
Dx=0.2×x
t1
xt2
Dx=0.2×x
t1
xt2
x := x+1
x := x -1
xt := xt-δ -1
x=0.003×x
t1
xt2
x := x+1
x := x -1
ΔD
Hybrid Automata Features• motion in a control mode via derivatives• nondeterministic jumps (not= “random”)• interaction between variables• we can mutate variables via jumps• time can be continuous or discrete
pcba
$110
$108
$112
Dp=-1Da=+1 Db=+1
Dp=-1
a ≥108
Dc=+1Dp=-1
b ≥110 c ≥112
0
p ≤ 0
p
cba
Dc=2/6Dp=-3/6
Db=1/6Da=3/6
Dp=-6/6
Db=1/6Dc=2/6 Dc=2/6
Dp=-2/6
0
p
cb
a
Da=2/6Dp=-2/6
Da=2/6Dp=-3/6
Db=1/6Da=2/6Dp=-6/6
Db=1/6Dc=3/6
0
hybrid-expression• Algebraic Calculi for Hybrid Systems
Peter Hoefner 2009• Differential dynamic logic for hybrid
systems Platzer 2008
update-offsetupdate-flowuntil
sequencerepeatlazy-parstrict-par
Atomic expressions Combinators
x := x+1
update-offset : (Offset → Offset) → HExpr
(update-offset #(update % :x inc))
{:x 300} : Offset
!
update-flow : (Flow → Flow) → HExpr
(update-flow #(assoc % :p -1/6 :a 1/6))
{:p -1/6, :a 1/6, :x (he/* 0.3 :x)} : Flow
Dp=-1/6Da=1/6
Dp :=-1/6Da :=1/6
:x (he/* 0.3 :x)
!
w ≥ 8w <8
(until {:w (he/>= 8)})
until : OffsetPredicate → HExpr
A B
A⋅B
sequence : List<HExpr> → HExpr(sequence [A B])
A
Aω
repeat : HExpr → HExpr
(repeat A)
AB
lazy-par : List<HExpr> → HExpr
(lazy-par [A B])
∨
A B∨
||
!
AB
∧
A B∧
||
!
strict-par : List<HExpr> → HExpr
(strict-par [A B])
AB
(strict-par [A B])
A B∧
||
update-offsetupdate-flowuntil
sequencerepeatlazy-parstrict-par
Atomic expressions Combinators
p
cb
a
Da=2/6Dp=-2/6
Da=2/6Dp=-3/6
Db=1/6Da=2/6Dp=-6/6
Db=1/6Dc=3/6
0
a ≥10 b ≥12
(sequence [
(until {:p (he/<= 0)}) ])
a ≥10
Da=2/6Dp=-2/6
Da=2/6Dp=-3/6
Db=1/6Da=2/6Dp=-6/6
Db=1/6Dc=3/6
0
(update-flow (fn [fl] (-> fl (update :p #(- % 2/6)) (update :a #(+ % 2/6)))))
b ≥12
(update-flow [_] {:a 0 :p 0})
(sequence [(update-offset (fn [_] {:a 0 :b 0 :c 0 :p 50}))
])
(defn pay [v rate] (sequence [(update-flow (fn [fl] (-> fl (update :p #(- % rate)) (update v #(+ % rate))))) (until {:p (he/<= 0)}) (update-flow [_] {v 0 :p 0})]))
a ≥10
Da=2/6Dp=-2/6
Da=2/6Dp=-3/6
Db=1/6Da=2/6Dp=-6/6
Db=1/6
b ≥12
(strict-par [(pay :a 2/6) (sequence [(until {:a (he/>= 10)}) (pay :b 1/6)]) (sequence [(until {:b (he/>= 12)}) (pay :c 3/6)])])
Evaluating hybrid expressions
steady-state : HState → HState
HState = [Offset, Flow, other-stuff]
init : HExpr → HState
run : HState, Number → HState
(-> (steady-state))
(init waterfall)
FRPHybridAutomata
fast, accurate results
compose “processes”(not “time-varying values”)
• based on an Actual Thing
• handles edge cases
• nice properties compose
• deterministic logical concurrency
github.com/SparkFund• hybrid-expressio
n
Nathan Sorenson@takeoutweight