constructing and verifying cyber physical...

37
Marcus Völp Constructing and Verifying Cyber Physical Systems Coordinating Networked CPS

Upload: others

Post on 10-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Marcus Völp

Constructing and Verifying Cyber Physical Systems

Coordinating Networked CPS

Page 2: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

So far …

control

more stable driving

cruise control

navigation / autonomous driving

autonomous drivingSource: ardupilot.com

Page 3: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Now …

distance keeping

driving

Page 4: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Now…

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 212

Page 5: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 213

Overview

Math

FeedbackControl

RTOS

Verification

Physics

Introduction

Mathematical Foundations (Differential Equations and Laplace Transformation)

Control and Feedback

Transfer Functions and State Space Models

Poles, Zeros / PID Control

Stability, Root Locust Method, Digital Control

Mixed-Criticality Scheduling and Real-Time Operating Systems (RTOS)

Coordinating Networked Cyber-Physical Systems

Program Verification

Differential Dynamic Logic and KeYmaera X

Differential Invariants

CPS

Page 6: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 214

Overview

Driving Maneuvers

Swarm Models

A Flock of Cars - Intersection Crossing

A Simple Swarm

Page 7: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 215

A simple swarm

𝑢𝑖 = 𝐹𝑖𝑣𝑖

𝑥𝑖 = 𝑣𝑖

𝑣𝑖 = 𝑢𝑖

Page 8: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 216

A simple swarm

𝑙𝑖0, 𝐷𝑖

Page 9: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 217

A simple swarm

𝑙𝑖 , 𝐷𝑖

𝐹𝑧 = 𝐷𝑖∆𝑙𝑖

Page 10: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 218

A simple swarm

𝑙𝑖 , 𝐷𝑖

𝐹𝑧 = 𝐷𝑖∆𝑙𝑖

Page 11: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 219

A simple swarm

𝑙𝑖 , 𝐷𝑖

𝐹𝑧 = 𝐷𝑖∆𝑙𝑖

Page 12: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 220

Driving Maneuvers

distance keeping

driving

rigit platoon leader

Page 13: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 221

Driving Maneuvers

leader

Intersection crossing

Page 14: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 222

Driving ManeuversIntersection crossing

leader

split

join

Page 15: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 223

Driving Maneuvers

leader

Intersection crossing

split

rejoin

Page 16: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 224

Driving Maneuvers

leader

Obstacle avoidance

Page 17: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 225

Driving Maneuvers

leader

Obstacle avoidance

Page 18: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 226

Driving Maneuvers

leader

Obstacle avoidance

Page 19: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 227

Driving Maneuvers

leader

Obstacle avoidance

Page 20: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 228

Driving Maneuvers

leader

Diverging goals

Page 21: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 229

Modeling TrafficLighthill, Whitham ‘55: On Kinematic Waves. II. A Theory of Traffic Flow on Long Crowded Roads

time to pass: 𝜕𝑡𝑖measure passing cars over long time 𝜏

Flow: 𝑞 =𝑛

𝜏

𝜕𝑥

Concentration: 𝑘 = 𝑖=1𝑚 𝜕𝑡𝑖

𝜏𝜕𝑥

Fluid Model

Concentration: 𝑘

flo

w: 𝑞

radius vector: slope give average vehicle velocity

tangent: slope gives wave velocity

Page 22: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 230

Swarm ModelsParticle swarm optimization

Source: blog.globalforestwatch.org

Page 23: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 231

Swarm ModelsParticle swarm optimization

Source: blog.globalforestwatch.org

Page 24: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 232

Swarm ModelsParticle swarm optimization

Source: blog.globalforestwatch.org

Page 25: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 233

Swarm ModelsParticle swarm optimization

Source: blog.globalforestwatch.org

Page 26: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 234

Swarm ModelsParticle swarm optimization

Initialize swarm by placing particles uniformly distributed in the search space: 𝑥𝑖~𝑈(𝑏𝑙𝑜, 𝑏ℎ𝑖)Initialize particle’s best known position to its own position: 𝑝𝑖 ← 𝑥𝑖Evaluate particle fitness and assign best swarm position to best known particle position: 𝑔 ← 𝑝𝑖where 𝑓(𝑝𝑖) > 𝑓(𝑝𝑗), 𝑖 ≠ 𝑗

Initialize partible velocity to some random value: 𝑥𝑖~𝑈 − 𝑏ℎ𝑖 − 𝑏𝑙𝑜 , 𝑏ℎ𝑖 − 𝑏𝑙𝑜

Until the termination criterion is met:update particle velocity: 𝑣𝑖 ← 𝜔 𝑣𝑖 + 𝜑𝑝 𝑟𝑝 𝑝𝑖 − 𝑥𝑖 + 𝜑𝑔 𝑟𝑔 𝑔 − 𝑥𝑖

update particle position: 𝑥𝑖 ← 𝑥𝑖 + 𝑣𝑖update particle’s and swarm’s best known position

g holds the best found solution.

parameters for tuning

random influence (between 0,1)

Page 27: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 235

Swarm ModelsAnt Colony Optimization

Ants move randomly unless they find pheromones on the routeFollow pheromones with certain probability

If they are sucessfull, mark path taken with pheromones

*

*

*

Page 28: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 236

Flock of Birds called <add favorite Car>Lamia Iftekhar, Reza Olfati-Saber: Autonomous Driving for Vehicular Networks with Nonlinear Dynamics

(if you read the paper: we use qi=xi, pi=vi)

𝑥𝑖 = 𝑣𝑖

𝑣𝑖 = 𝑢𝑖

𝛼-Agent

dynamic graph: 𝐺 𝑥1, 𝑥2, … , 𝑥𝑛 = 𝐺 𝑥 = 𝑉, 𝐸 𝑥

𝐸(𝑥) = 𝑖, 𝑗 𝑥𝑗 − 𝑥𝑖 < 𝑟}

Page 29: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 237

Flock of Birds called <add favorite Car>

Source: Walter Baxter (CC-BY-SA 2.0)

share common objective

avoid collisions

separation / rejoin

approximately same distance

Page 30: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 238

Flock of Birds called <add favorite Car>

Definition Flocking:A group of 𝛼–agents with trajectory (𝑥(. ), 𝑣(. )) performflocking behavior over a time interval [𝑡0, 𝑡𝑓 ) with 𝑛𝑐 ≥ 1

components of 𝐺(𝑥(𝑡)), if every agent 𝑖 only communicateswith its neighbors 𝑁𝑖 on the component it belongs to andthe trajectories of the agents satisfy the following propertiesover the period [𝑡0, 𝑡𝑓 ) :

1) Cohesion: ∃𝜌 > 0. 𝑥𝑖 𝑡 −1

𝑛𝑘 𝑗=1𝑛𝑘 𝑥𝑗 𝑡 < 𝜌,

for the kth component with 𝑛𝑘 neighboring agents;

2) Self-assembly: into a quasi alpha-lattice after some finite time;

3) Self-alignment: a relatively small velocity mismatch.

∃ 0 < 𝜖 ≪ 1. 𝐾 𝑣 =1

2

𝑖,𝑗 ∈𝐸 𝑥

𝑣𝑗 𝑡 − 𝑣𝑖 𝑡2< 𝜖

x

𝛾-Agent

𝛼-Agents

Page 31: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 239

Flock of Birds called <add favorite Car>

Definition Flocking:A group of 𝛼–agents with trajectory (𝑥(. ), 𝑣(. )) performflocking behavior over a time interval [𝑡0, 𝑡𝑓 ) with 𝑛𝑐 ≥ 1

components of 𝐺(𝑥(𝑡)), if every agent 𝑖 only communicateswith its neighbors 𝑁𝑖 on the component it belongs to andthe trajectories of the agents satisfy the following propertiesover the period [𝑡0, 𝑡𝑓 ) :

1) Cohesion: ∃𝜌 > 0. 𝑥𝑖 𝑡 −1

𝑛𝑘 𝑗=1𝑛𝑘 𝑥𝑗 𝑡 < 𝜌,

for the kth component with 𝑛𝑘 neighboring agents;

2) Self-assembly: into a quasi alpha-lattice after some finite time;

3) Self-alignment: a relatively small velocity mismatch.

∃ 0 < 𝜖 ≪ 1. 𝐾 𝑣 =1

2

𝑖,𝑗 ∈𝐸 𝑥

𝑣𝑗 𝑡 − 𝑣𝑖 𝑡2< 𝜖

d

∃ 𝜖, 𝑑. −𝜖 ≤ 𝑥𝑗 𝑡 − 𝑥𝑖 𝑡 − 𝑑 ≤ 𝜖, ∀𝑗 ∈ 𝑁𝑖 𝑥

approximately the same distance to all neighbors

𝛼-Agents

𝛾-Agent

Page 32: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

𝛾-Agent

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 240

Flock of Birds called <add favorite Car>

Definition Flocking:A group of 𝛼–agents with trajectory (𝑥(. ), 𝑣(. )) performflocking behavior over a time interval [𝑡0, 𝑡𝑓 ) with 𝑛𝑐 ≥ 1

components of 𝐺(𝑥(𝑡)), if every agent 𝑖 only communicateswith its neighbors 𝑁𝑖 on the component it belongs to andthe trajectories of the agents satisfy the following propertiesover the period [𝑡0, 𝑡𝑓 ) :

1) Cohesion: ∃𝜌 > 0. 𝑥𝑖 𝑡 −1

𝑛𝑘 𝑗=1𝑛𝑘 𝑥𝑗 𝑡 < 𝜌,

for the kth component with 𝑛𝑘 neighboring agents;

2) Self-assembly: into a quasi alpha-lattice after some finite time;

3) Self-alignment: a relatively small velocity mismatch.

∃ 0 < 𝜖 ≪ 1. 𝐾 𝑣 =1

2

𝑖,𝑗 ∈𝐸 𝑥

𝑣𝑗 𝑡 − 𝑣𝑖 𝑡2< 𝜖

d

𝛼-Agents

Page 33: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 241

Flock of Cars

Page 34: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 242

Flock of Cars – Lane Change

discrete jump 𝜑-agent1. 𝛾-agent jumps to second lane2. 𝜑-agent follows 𝛾-agent

(using aggressive maneuvers)3. 𝛼-agent follows 𝜑 -agent

Page 35: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 243

Flock of Cars – Lane Change

Page 36: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 244

Overview

Driving Maneuvers

Swarm Models

A Flock of Cars - Intersection Crossing

A Simple Swarm

Page 37: Constructing and Verifying Cyber Physical Systemsos.inf.tu-dresden.de/Studium/CPS/SS2015/07-Networked.pdfA group of 𝛼–agents with trajectory Ὄ𝑥Ὄ.Ὅ, Ὄ.ὍὍperform

Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 245

Overview

Math

FeedbackControl

RTOS

Verification

Physics

Introduction

Mathematical Foundations (Differential Equations and Laplace Transformation)

Control and Feedback

Transfer Functions and State Space Models

Poles, Zeros / PID Control

Stability, Root Locust Method, Digital Control

Mixed-Criticality Scheduling and Real-Time Operating Systems (RTOS)

Coordinating Networked Cyber-Physical Systems

Program Verification

Differential Dynamic Logic and KeYmaera X

Differential Invariants

CPS