36
Automated Formal Synthesis of Digital Controllers for State-Space Physical Plants CAV 2017 Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas Cordeiro, Cristina David, Pascal Kesseli, Daniel Kroening and Elizabeth Polgreen Diffblue Ltd., University of Oxford, Federal University of Amazonas Consistent * C o mplete * Well D ocumented * E asy to Reu se * * Eval u at ed * CAV * A r tif a c t * AEC

Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

Automated Formal Synthesis of Digital Controllersfor State-Space Physical Plants

CAV 2017

Alessandro Abate, Iury Bessa, Dario Cattaruzza,Lucas Cordeiro, Cristina David, Pascal Kesseli,

Daniel Kroening and Elizabeth Polgreen

Diffblue Ltd.,University of Oxford,

Federal University of Amazonas

Consist

ent *Complete *

Well D

ocumented*Easyt

oR

euse* *

Evaluated

*CAV*Ar

tifact *

AEC

Page 2: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Motivation

Automatically synthesise feedback digital controllers that ensurestability and safety

2 of 11

Page 3: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Motivation

Automatically synthesise feedback digital controllers that ensurestability and safety

2 of 11

Page 4: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

State-feedback architecture

Continuous-discrete system

• Plant: x(t) = Ax(t) + Bu(t), t ∈ R+0 , x(0) = initial state

• State-feedback controller: uk = rk − Cxk

3 of 11

Page 5: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

State-feedback architecture

Continuous-discrete system

• Plant: x(t) = Ax(t) + Bu(t), t ∈ R+0 , x(0) = initial state

• State-feedback controller: uk = −Cxk

3 of 11

Page 6: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Our approach

4 of 11

Page 7: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

State-feedback architecture

Continuous-discrete system

• Plant: x(t) = Ax(t) + Bu(t), t ∈ R+0 , x(0) = initial state

• State-feedback controller: uk = −Cxk

• Finite precision

5 of 11

Page 8: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

State-feedback architecture

Time and value domain discretization

• Plant: xk+1 = Axk + Buk , k ∈ N, x0 = initial state

• State-feedback controller: uk = −Cxk• Finite precision

5 of 11

Page 9: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Numerical errors

• Truncation and rounding on the plant

• Truncation on the converters

• Rounding on the controller

6 of 11

Page 10: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Numerical errors

• Truncation and rounding on the plant

• Truncation on the converters

• Rounding on the controller

6 of 11

Page 11: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Numerical errors

• Truncation and rounding on the plant

• Truncation on the converters

• Rounding on the controller

6 of 11

Page 12: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Stability

A system xk+1 = Axk + Buk , uk = −Cxk is asymptotically stable if its

executions converge to an equilibrium point.

7 of 11

Page 13: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Stability

A system xk+1 = Axk + Buk , uk = −Cxk is asymptotically stable if its

executions converge to an equilibrium point.

7 of 11

Page 14: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Stability

A system xk+1 = Axk + Buk , uk = −Cxk is asymptotically stable if its

executions converge to an equilibrium point.

7 of 11

Page 15: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Stability

A system xk+1 = Axk + Buk , uk = −Cxk is asymptotically stable if its

executions converge to an equilibrium point.

7 of 11

Page 16: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Stability

A system xk+1 = Axk + Buk , uk = −Cxk is asymptotically stable if its

executions converge to an equilibrium point.

7 of 11

Page 17: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Stability and safety

A system xk+1 = Axk + Buk , uk = −Cxk is asymptotically stable if its

executions converge to an equilibrium point.

7 of 11

Page 18: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize

Verify

2.Safety 3.Precision 4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

8 of 11

Page 19: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize1.Synthesize

Verify

2.Safety 3.Precision 4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Find a controller for given {x0} and k=6such that the system is stable and safe

synthesize1: Input: x0, k .2: Output: C .3: C=nondet;4: assume(STABLE(A,B,C ));5: assume(SAFE(x0));6: i = 0;7: while i < k do8: xi+1 = xi (A− BC )9: assume(SAFE(xi+1));

10: i = i + 1;11: end while12: assert(false);

8 of 11

Page 20: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize1.Synthesize

Verify

2.Safety 3.Precision 4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Find a controller for given {x0} and k=6such that the system is stable and safe

synthesize

1: Input: x0, k.

2: Output: C .3: C=nondet;4: assume(STABLE(A,B,C ));5: assume(SAFE(x0));6: i = 0;7: while i < k do8: xi+1 = xi (A− BC )9: assume(SAFE(xi+1));

10: i = i + 1;11: end while12: assert(false);

8 of 11

Page 21: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize1.Synthesize

Verify

2.Safety 3.Precision 4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Find a controller for given {x0} and k=6such that the system is stable and safe

synthesize1: Input: x0, k .2: Output: C .3: C=nondet;

4: assume(STABLE(A,B,C ));

5: assume(SAFE(x0));6: i = 0;7: while i < k do8: xi+1 = xi (A− BC )9: assume(SAFE(xi+1));

10: i = i + 1;11: end while12: assert(false);

8 of 11

Page 22: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize1.Synthesize

Verify

2.Safety 3.Precision 4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Find a controller for given {x0} and k=6such that the system is stable and safe

synthesize1: Input: x0, k .2: Output: C .3: C=nondet;4: assume(STABLE(A,B,C ));

5: assume(SAFE(x0));

6: i = 0 ;

7: while i < k do

8: xi+1 = xi (A− BC )

9: assume(SAFE(xi+1));

10: i = i + 1;11: end while12: assert(false);

8 of 11

Page 23: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize1.Synthesize

Verify

2.Safety 3.Precision 4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Find a controller for given {x0} and k=6such that the system is stable and safe

synthesize1: Input: x0, k .2: Output: C .3: C=nondet;4: assume(STABLE(A,B,C ));5: assume(SAFE(x0));6: i = 0;7: while i < k do8: xi+1 = xi (A− BC )9: assume(SAFE(xi+1));

10: i = i + 1;11: end while12: assert(false);

8 of 11

Page 24: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize1.Synthesize

Verify

2.Safety 3.Precision 4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Find a controller for given {x0} and k=6such that the system is stable and safe

8 of 11

Page 25: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize

Verify

2.Safety2.Safety 3.Precision 4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Find an initial state for which the systemis unsafe

8 of 11

Page 26: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize

Verify

2.Safety2.Safety 3.Precision 4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Find an initial state for which the systemis unsafe

8 of 11

Page 27: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize1.Synthesize

Verify

2.Safety 3.Precision 4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Find a controller for {x0, x ′0} and k=6such that the system is stable and safe

8 of 11

Page 28: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize1.Synthesize

Verify

2.Safety 3.Precision 4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Find a controller for {x0, x ′0} and k=6such that the system is stable and safe

8 of 11

Page 29: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize

Verify

2.Safety2.Safety 3.Precision 4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Find an initial state for which the systemis unsafe

8 of 11

Page 30: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize

Verify

2.Safety 3.Precision3.Precision 4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Check that the plant precision is sufficient

8 of 11

Page 31: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize

Verify

2.Safety 3.Precision 4.Complete4.Complete Done

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Check that k is sufficient

8 of 11

Page 32: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Controller synthesis

1.Synthesize

Verify

2.Safety 3.Precision 4.Complete DoneDone

C

C-ex

PASS

Increase Precision

Increase Unfolding Bound

Controller found

8 of 11

Page 33: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Experimental results

# Benchmark Dimension Completeness threshold〈Ip ,Fp〉 Time

1 Cruise Control 1 8,16 7.44 s2 DC Motor 2 8,16 7.76 s3 Helicopter 3 8,16 12.13 s4 Inverted Pendulum 4 8,16 8.82 s5 Magnetic Pointer 2 8,16 10.31 s6 Magnetic Suspension 2 12,20 21.55 s7 Pendulum 2 8,16 9.08 s8 Suspension 2 8,16 17.18 s9 Tape Driver 3 8,16 8.05 s

10 Satellite 2 8,16 8.76 s

Synthesis phases: Synthesize 52%, verify 48%

Consist

ent *Complete *

Well D

ocumented*Easyt

oR

euse* *

Evaluated

*CAV*Ar

tifact *

AEC

Automated Formal Synthesis of DigitalControllers for State-Space Physical Plants?

Alessandro Abate1, Iury Bessa2, Dario Cattaruzza1, Lucas Cordeiro1,2,Cristina David1, Pascal Kesseli1, Daniel Kroening1, and Elizabeth Polgreen1

1 University of Oxford, UK2 Federal University of Amazonas, Manaus, Brazil

Abstract. We present a sound and automated approach to synthesizesafe digital feedback controllers for physical plants represented as linear,time-invariant models. Models are given as dynamical equations withinputs, evolving over a continuous state space and accounting for errorsdue to the digitization of signals by the controller. Our counterexampleguided inductive synthesis (CEGIS) approach has two phases: We syn-thesize a static feedback controller that stabilizes the system but thatmay not be safe for all initial conditions. Safety is then verified eithervia BMC or abstract acceleration; if the verification step fails, a coun-terexample is provided to the synthesis engine and the process iteratesuntil a safe controller is obtained. We demonstrate the practical value ofthis approach by automatically synthesizing safe controllers for intricatephysical plant models from the digital control literature.

1 Introduction

Linear Time Invariant (LTI) models represent a broad class of dynamical sys-tems with significant impact in numerous application areas such as life sciences,robotics, and engineering [2, 11]. The synthesis of controllers for LTI modelsis well understood, however the use of digital control architectures adds newchallenges due to the effects of finite-precision arithmetic, time discretization,and quantization noise, which is typically introduced by Analogue-to-Digital(ADC) and Digital-to-Analogue (DAC) conversion. While research on digitalcontrol is well developed [2], automated and sound control synthesis is challenging,particularly when the synthesis objective goes beyond classical stability. Thereare recent methods for verifying reachability properties of a given controller [13].However, these methods have not been generalized to control synthesis. Notethat a synthesis algorithm that guarantees stability does not ensure safety: thesystem might transitively visit an unsafe state resulting in unrecoverable failure.

We propose a novel algorithm for the synthesis of control algorithms forLTI models that are guaranteed to be safe, considering both the continuousdynamics of the plant and the finite-precision discrete dynamics of the controller,

? Supported by EPSRC grant EP/J012564/1, ERC project 280053 (CPROVER) andthe H2020 FET OPEN 712689 SC2.

Check abstract acceleration based approach in the paper!

9 of 11

Page 34: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Experimental results

# Benchmark Dimension Completeness threshold〈Ip ,Fp〉 Time

1 Cruise Control 1 8,16 7.44 s2 DC Motor 2 8,16 7.76 s3 Helicopter 3 8,16 12.13 s4 Inverted Pendulum 4 8,16 8.82 s5 Magnetic Pointer 2 8,16 10.31 s6 Magnetic Suspension 2 12,20 21.55 s7 Pendulum 2 8,16 9.08 s8 Suspension 2 8,16 17.18 s9 Tape Driver 3 8,16 8.05 s

10 Satellite 2 8,16 8.76 s

Synthesis phases: Synthesize 52%, verify 48%

Consist

ent *Complete *

Well D

ocumented*Easyt

oR

euse* *

Evaluated

*CAV*Ar

tifact *

AEC

Automated Formal Synthesis of DigitalControllers for State-Space Physical Plants?

Alessandro Abate1, Iury Bessa2, Dario Cattaruzza1, Lucas Cordeiro1,2,Cristina David1, Pascal Kesseli1, Daniel Kroening1, and Elizabeth Polgreen1

1 University of Oxford, UK2 Federal University of Amazonas, Manaus, Brazil

Abstract. We present a sound and automated approach to synthesizesafe digital feedback controllers for physical plants represented as linear,time-invariant models. Models are given as dynamical equations withinputs, evolving over a continuous state space and accounting for errorsdue to the digitization of signals by the controller. Our counterexampleguided inductive synthesis (CEGIS) approach has two phases: We syn-thesize a static feedback controller that stabilizes the system but thatmay not be safe for all initial conditions. Safety is then verified eithervia BMC or abstract acceleration; if the verification step fails, a coun-terexample is provided to the synthesis engine and the process iteratesuntil a safe controller is obtained. We demonstrate the practical value ofthis approach by automatically synthesizing safe controllers for intricatephysical plant models from the digital control literature.

1 Introduction

Linear Time Invariant (LTI) models represent a broad class of dynamical sys-tems with significant impact in numerous application areas such as life sciences,robotics, and engineering [2, 11]. The synthesis of controllers for LTI modelsis well understood, however the use of digital control architectures adds newchallenges due to the effects of finite-precision arithmetic, time discretization,and quantization noise, which is typically introduced by Analogue-to-Digital(ADC) and Digital-to-Analogue (DAC) conversion. While research on digitalcontrol is well developed [2], automated and sound control synthesis is challenging,particularly when the synthesis objective goes beyond classical stability. Thereare recent methods for verifying reachability properties of a given controller [13].However, these methods have not been generalized to control synthesis. Notethat a synthesis algorithm that guarantees stability does not ensure safety: thesystem might transitively visit an unsafe state resulting in unrecoverable failure.

We propose a novel algorithm for the synthesis of control algorithms forLTI models that are guaranteed to be safe, considering both the continuousdynamics of the plant and the finite-precision discrete dynamics of the controller,

? Supported by EPSRC grant EP/J012564/1, ERC project 280053 (CPROVER) andthe H2020 FET OPEN 712689 SC2.

Check abstract acceleration based approach in the paper!

9 of 11

Page 35: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Conclusions

• Automated synthesizer for digital state-feedback controllersthat ensures stability and safety

• Evaluated the errors due to the controller’s implementationand plant’s modeling

DSSynth Matlab toolbox:www.cprover.org/DSSynth/dssynth-toolbox-1.0.0.zip

10 of 11

Page 36: Alessandro Abate, Iury Bessa, Dario Cattaruzza, Lucas ... · ou Experimental results # Benchmark Dimension Completeness threshold hIp;Fpi Time 1 Cruise Control 1 8,16 7.44s 2 DC Motor

ou

Conclusions

• Automated synthesizer for digital state-feedback controllersthat ensures stability and safety

• Evaluated the errors due to the controller’s implementationand plant’s modeling

DSSynth Matlab toolbox:www.cprover.org/DSSynth/dssynth-toolbox-1.0.0.zip

10 of 11