18
Testing Embedded Control Systems Testing Embedded Control Systems combining combining Hardware Hardware - - in in - - the the - - loop Simulation and loop Simulation and Temporal Logic Temporal Logic Marco Aurelio Antonio Sanvido

Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

  • Upload
    lydiep

  • View
    226

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

Testing Embedded Control Systems Testing Embedded Control Systems combiningcombining

HardwareHardware--inin--thethe--loop Simulation andloop Simulation andTemporal LogicTemporal Logic

Marco Aurelio Antonio Sanvido

Page 2: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

OutlineOutline

• Motivation: ECS Testing• ECS Properties• HIL Simulation for ECS

• HIL Simulation• Fault Specification Language (Fausel)

• Testing with Fausel• A small Example

• Conclusion & Some Demos

Page 3: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

Embedded Control SystemEmbedded Control System

ECSECS

SensorsSensors

ActuatorsActuators

Physical P

rocess

• Timeliness• Concurrency• Liveness• Reactivity• Safety

Unique Properties ofUnique Properties ofECS Software:ECS Software:

Page 4: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

HardwareHardware--inin--thethe--loop Simulationloop Simulation

ECSECS

SensorsSensors

ActuatorsActuators

Sim

ulated Process

Hardware InterfaceAnalog or Digital

1. The simulated process can be operated with the real control hardware

2. The simulated process replaces either fully or partially the controlled process consisting of actuators, physical process and sensors.

(Isermann et al. ‘99)

Page 5: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

ECS ECS DevelopmentDevelopmentSystem

Identification

Control

RapidPrototype

HILSimulator

EmbeddedSystem

SoftwareSimulator

Test

Test

Test

Model

A/SLa

b Te

stin

g Val

idat

ion

Fiel

d Te

stin

g

ARX, ARMAX, ...

LQR, MPC ...

Auto Code Gen, Manually

Manually

Control Softwareis less then 20%of the final system

Page 6: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

Olga CrashOlga Crash

OLGA helicopter crash

Page 7: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

HardwareHardware--inin--thethe--loop Simulationloop Simulation

Why do we need HIL Simulation?Why do we need HIL Simulation?

• Allows testing dangerous situations• Ensure a correct implementation, reducing the gap

between design and implementation• Allows repeating the same test

again and again deterministically

Page 8: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

The HIL Simulation The HIL Simulation

Hardware

Interf

ace

Fausel

Real -

time

Simula

tion

Sche

duler

Numerical

Simulation

• Simple implementation of the mathematical formulas of the simulated process.

• Generalized signal acquisition and generation.

• Real-time simulation scheduler.

• Generic fault generation/verification engine (Fausel).

Page 9: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

FauselFausel (FAUlt SpEcification Language)(FAUlt SpEcification Language)

The HIL generates fault sequences:The HIL generates fault sequences:• Deterministic, non-deterministic, configurable• Logically interconnected,

e.g. Fault B can start only if Fault A has happened onceThe HIL tests the ECS response specification:The HIL tests the ECS response specification:• Tests for temporal behavior (using LTL)• Tested during simulation time

regression tests, documentation on the real system are possible

Page 10: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

ECS Testing with FauselECS Testing with Fausel

Fausel goals:Fausel goals:• ECS correctness ≠ checking the final answer

• ECS correctness = stream of partial answers

ECSECS FauselFausel

Page 11: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

ECS Testing ECS Testing Integrated into the HILIntegrated into the HIL

ECSECS

SensorsSensors

ActuatorsActuators

Sim

ulated Feedback

FauselFausel

SIMULATE Helicopter;

FAULT Wind0 IS Wind(w:=10.0);START (pitch > 0.1);STOP firsttime + 10.0;PERIOD 0.5;SPECF[5,10](yaw = startyaw);

END Wind0;

END Helicopter.

Fausel compiler does not have access to the state of the ECS directly,i.e. ECS is a black-box

Page 12: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

A Small Example of FauselA Small Example of Fausel

How can I test that during an autoHow can I test that during an auto--piloted flight a windpiloted flight a windgust is gust is correctlycorrectly handled?handled?

Correctly could mean:

1. the quadratic yaw error E is in a tolerable value Tbetween x and y seconds. F[x,y](E<T)

2. The system reaches the goal in x seconds and holds it. F[0,x]G(E=0)

3. The error is never bigger than T betweenx and y seconds. G[x,y](E<T)

Page 13: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

A Small Example of FauselA Small Example of FauselSIMULATE Helicopter;

FAULT WindGust IS Helis.WindGust(wind := -0.2; windtime := 2.0);

START (pitch < -0.05);

STOP firststart + 30.0;

PERIOD 0.5;

SPEC

F[5,10]((yaw - startyaw)*(yaw - startyaw)<= 0.1)

END WindGust;

END Helicopter.

Example of a forward and backward maneuver,with error generation (and testing)

START (pitch < -0.05);

STOP firststart + 30.0;

PERIOD 0.5;

F[5,10]((yaw - startyaw)*(yaw - startyaw)< 0.1)

PlaySimulation

Helis.WindGust(wind := 0.2; windtime := 2.0);

Page 14: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

A Small Example of FauselA Small Example of Fausel

F[5,10] p

c : = 0

(c<10)

(c>= 5) & (c<=10) & p

where p = (error*error < 0.1)

is transformed to aTimed Büchi Automaton(Alur-Dill Automaton)

(TRUE)

TRUE

Page 15: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

A Small Example of FauselA Small Example of Fausel

F[0,5]G p

c : = 0 (c<5)

p & (c>=0) & (c<=5)

TRUE

p

p

c : = 0

Page 16: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

A Small Example of FauselA Small Example of Fausel

G[5,10] p

c : = 0

(c<5) | p

(c> 10)

where p = (error*error < 0.1)

is transformed to aTimed Büchi Automaton(Alur-Dill Automaton)

(TRUE)

TRUE

Page 17: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

Test ClassesTest ClassesWhat are we able to test?What are we able to test?

1. We are only able to test expected faults!

2. We are only able to generate errors on theModel, Sensor and Actuators

3. We are NOT able to check ECS states(only possible via online-debug or extrapolation)

4. The Temporal Logic is reasonably expressive, but not complete. E.g. “p must be TRUE even times”

5. Test sequences are finite, but a specification could be infinite,e.g. G p => use constrained temporal logic (MTL)

Page 18: Testing Embedded Control Systems combining Hardware …osq.cs.berkeley.edu/retreat02/Sanvido-Testing.pdf · Testing Embedded Control Systems combining Hardware-in-the-loop ... •

Conclusions and OutlookConclusions and Outlook

Framework Extensions:Framework Extensions:1. Java implementation is available (Demo) 2. Matlab interface (Demo …)3. Integrating Temporal Specification Testing

into Junit (Open Project!!!)

Has been applied to:Has been applied to:1. Barrage Simulation (Simplified Demo)2. OLGA Helicopter Main Rotor Controller3. OLGA Helicopter Hovering Controller (Video)