The crazy fly Timothy Bourke 1 , 2 Marc Pouzet 3 , 2 , 1 1. INRIA - - PowerPoint PPT Presentation

the crazy fly
SMART_READER_LITE
LIVE PREVIEW

The crazy fly Timothy Bourke 1 , 2 Marc Pouzet 3 , 2 , 1 1. INRIA - - PowerPoint PPT Presentation

The crazy fly Timothy Bourke 1 , 2 Marc Pouzet 3 , 2 , 1 1. INRIA Paris-Rocquencourt 2. cole normale suprieure (DI) 3. Universit Pierre et Marie Curie http://www.di.ens.fr/ParkasTeam.html Synchron 2013, November 19, Daghstuhl, Germany A


slide-1
SLIDE 1 The crazy fly Timothy Bourke1,2 Marc Pouzet3,2,1
  • 1. INRIA Paris-Rocquencourt
  • 2. École normale supérieure (DI)
  • 3. Université Pierre et Marie Curie
http://www.di.ens.fr/ParkasTeam.html Synchron 2013, November 19, Daghstuhl, Germany
slide-2
SLIDE 2 A very fast fly
slide-3
SLIDE 3 A very fast fly Barcelona 100km Girona
slide-4
SLIDE 4 A very fast fly Barcelona 100km Girona car1 = 50km/hr
slide-5
SLIDE 5 A very fast fly Barcelona 100km Girona car1 = 50km/hr car2 = -50km/hr
slide-6
SLIDE 6 A very fast fly Barcelona 100km Girona car1 = 50km/hr car2 = -50km/hr fly = 80km/hr changes direction whenever it reaches a car
slide-7
SLIDE 7 A very fast fly The usual questions
  • 1. How far has the fly traveled when the two cars meet?
  • 2. How many zig-zags does the fly do during this period?
slide-8
SLIDE 8 A very fast fly The usual questions
  • 1. How far has the fly traveled when the two cars meet?
  • 2. How many zig-zags does the fly do during this period?
Extra credit (Thanks to Rafel Cases and Jordi Cortadella)
  • 1. Where will the fly be when the two cars reach their destinations?
slide-9
SLIDE 9 Simulink model travelled last(fly velocity) fly position 1 s fly >= carB >= 0 fly >= carA >= 0 fly <= carB >= 0 fly <= carA >= 0 distance 100 direction changes 5 carA <= carB >= 0 Zerocrossings −u −u simout Hit Crossing: fly − carB Hit Crossing: fly − carA 80 |u| carA carB
slide-10
SLIDE 10 Simulink model travelled last(fly velocity) fly position 1 s fly >= carB >= 0 fly >= carA >= 0 fly <= carB >= 0 fly <= carA >= 0 distance 100 direction changes 5 carA <= carB >= 0 Zerocrossings −u −u simout Hit Crossing: fly − carB Hit Crossing: fly − carA 80 |u| carA carB
slide-11
SLIDE 11 Simulink model travelled last(fly velocity) fly position 1 s fly >= carB >= 0 fly >= carA >= 0 fly <= carB >= 0 fly <= carA >= 0 distance 100 direction changes 5 carA <= carB >= 0 Zerocrossings −u −u simout Hit Crossing: fly − carB Hit Crossing: fly − carA 80 |u| carA carB zigzags?
slide-12
SLIDE 12 Simulink Results 20 40 60 80 100 0.5 1 1.5 2 distance (kilometres) time (hours) Barcelona Girona (Simulink R2012a: ode45, relative tolerance = 1e-3)
slide-13
SLIDE 13 Simulink model travelled last(fly velocity) fly position 1 s fly >= carB >= 0 fly >= carA >= 0 fly <= carB >= 0 fly <= carA >= 0 distance 100 direction changes 5 carA <= carB >= 0 Zerocrossings −u −u simout Hit Crossing: fly − carB Hit Crossing: fly − carA 80 |u| carA carB zigzags
slide-14
SLIDE 14 Simulink model (with more zero-crossings) travelled last(fly velocity) fly position 1 s fly >= carB >= 0 fly >= carA >= 0 fly <= carB >= 0 fly <= carA >= 0 distance 100 direction changes 42 carA <= carB >= 0 Zerocrossings −u −u simout Hit Crossing: fly − carB Hit Crossing: fly − carA 80 |u| carA carB zigzags?
slide-15
SLIDE 15 Simulink Results (with more zero-crossings) 20 40 60 80 100 0.5 1 1.5 2 distance (kilometres) time (hours) Barcelona Girona (Simulink R2012a: ode45, relative tolerance = 1e-3)
slide-16
SLIDE 16 Simulink Results (with more zero-crossings) 20 40 60 80 100 0.5 1 1.5 2 distance (kilometres) time (hours) Barcelona Girona distance (kilometres) time (hours) [0.9999999999999:1.0000000000001] (Simulink R2012a: ode45, relative tolerance = 1e-3)
slide-17
SLIDE 17 Simulink model (with more zero-crossings) travelled last(fly velocity) fly position 1 s fly >= carB >= 0 fly >= carA >= 0 fly <= carB >= 0 fly <= carA >= 0 distance 100 direction changes 42 carA <= carB >= 0 Zerocrossings −u −u simout Hit Crossing: fly − carB Hit Crossing: fly − carA 80 |u| carA carB zigzags
slide-18
SLIDE 18

42!

slide-19
SLIDE 19 Let us try Zélus...
slide-20
SLIDE 20 Zélus model 1 let barcelona = 0.0 let girona = 100.0 let fly_velocity = 80.0 let car_velocity = 50.0 let hybrid model () = (car1, car2, fly, zigzag, zeros) where rec der car1 = car_velocity init barcelona and der car2 = −. car_velocity init girona and der fly = dir ∗. fly_velocity init barcelona and automaton | Above → (∗ the line above the fly ∗) do car_above = car2 and car_below = car1 until up(car1 −. car2) then Below | Below → (∗ the line below ∗) do car_above = car1 and car_below = car2 done end and present up (car_below −. fly) | up(fly −. car_above) → (∗ the fly changes her direction ∗) (∗ when she crosses the line below or the line above ∗) do dir = −. (last dir) and zeros = last zeros + 1 and emit zigzag = () done and init dir = 1.0 and init zeros = 0
slide-21
SLIDE 21 Zélus model 1 let barcelona = 0.0 let girona = 100.0 let fly_velocity = 80.0 let car_velocity = 50.0 let hybrid model () = (car1, car2, fly, zigzag, zeros) where rec der car1 = car_velocity init barcelona and der car2 = −. car_velocity init girona and der fly = dir ∗. fly_velocity init barcelona and automaton | Above → (∗ the line above the fly ∗) do car_above = car2 and car_below = car1 until up(car1 −. car2) then Below | Below → (∗ the line below ∗) do car_above = car1 and car_below = car2 done end and present up (car_below −. fly) | up(fly −. car_above) → (∗ the fly changes her direction ∗) (∗ when she crosses the line below or the line above ∗) do dir = −. (last dir) and zeros = last zeros + 1 and emit zigzag = () done and init dir = 1.0 and init zeros = 0
slide-22
SLIDE 22 Zélus model 1 let barcelona = 0.0 let girona = 100.0 let fly_velocity = 80.0 let car_velocity = 50.0 let hybrid model () = (car1, car2, fly, zigzag, zeros) where rec der car1 = car_velocity init barcelona and der car2 = −. car_velocity init girona and der fly = dir ∗. fly_velocity init barcelona and automaton | Above → (∗ the line above the fly ∗) do car_above = car2 and car_below = car1 until up(car1 −. car2) then Below | Below → (∗ the line below ∗) do car_above = car1 and car_below = car2 done end and present up (car_below −. fly) | up(fly −. car_above) → (∗ the fly changes her direction ∗) (∗ when she crosses the line below or the line above ∗) do dir = −. (last dir) and zeros = last zeros + 1 and emit zigzag = () done and init dir = 1.0 and init zeros = 0 zigzags=48 1zelus.di.ens.fr
slide-23
SLIDE 23 Zélus Results 20 40 60 80 100 0.5 1 1.5 2 distance (kilometres) time (hours) Barcelona Girona (Sundials CVODE with our custom Illinois implementation)
slide-24
SLIDE 24 Zélus Results 20 40 60 80 100 0.5 1 1.5 2 distance (kilometres) time (hours) Barcelona Girona distance (kilometres) time (hours) [0.999999999999995:1.000000000000005] (Sundials CVODE with our custom Illinois implementation)
slide-25
SLIDE 25 Concluding remarks Simulink 42 is the answer to “The Ultimate Question of Life, the Universe and Everything” 2. Trop fort! Well... ◮ All very well, but the problem is mathematically not well posed. ◮ The system is not well defined at the instant the cars pass each other. Question: should a hybrid modeler ◮ statically detect and reject such programs? ◮ stop with an error at runtime?3 (Thanks to Rafel Cases, Jordi Cortadella, and Gérard Berry.) 2cf Douglas Adams, The Hitchhiker’s Guide to the Galaxy. 3In the same way variable-step integration fails when reaching a minimal horizon.