• Non ci sono risultati.

Formal Method Mod. 2 (Model Checking) Laboratory 12 Giuseppe Spallitta giuseppe.spallitta@unitn.it

N/A
N/A
Protected

Academic year: 2021

Condividi "Formal Method Mod. 2 (Model Checking) Laboratory 12 Giuseppe Spallitta giuseppe.spallitta@unitn.it"

Copied!
16
0
0

Testo completo

(1)

Formal Method Mod. 2 (Model Checking)

Laboratory 12

Giuseppe Spallitta

giuseppe.spallitta@unitn.it

(2)

Hybrid systems

Cyber-physical systems

I Discrete controller with some modes: (in)finite state automaton; e.g. electronic controller.

I

continuous

variables with some behaviour w.r.t. time, physical phenomena e.g. braking car, water pump, temperature.

I in general model checking on hybrid systems is

undecidable.

I many sub-classes

- decidable: rectangular, singular ;

- undecidable: linear ;

discrete

time

Giuseppe Spallitta 1/12

(3)

Hybrid systems: representation

Hybrid Automata

I Explicit graph representation of discrete states/modes (nodes) and transitions (edges);

I Symbolic representation of linear temporal aspects via polytopes (N dimensional polyhedron);

I location invariants, I transition guards,

I flow: derivative w.r.t time.

x ≥ 18

˙

x < −0.1x

˙

x > −0.2x

x ≤ 22

˙

x = 5 − 0.1x x < 19

x > 21

off on

(4)

Outline

1. HyComp

2. Example

3. Exercises

(5)

HyComp introduction

I HyComp has been developed in Embedded Systems (FBK) as part of Sergio Mover’s PhD.

I Supports the modelling and verification of a network of hybrid automata;

I Supports invariant and LTL properties;

I It encodes the Hybrid model into a “standard” nuXmv model.

(6)

HyComp: input language [1/3]

The input language of HyComp is called HyDi (Hybrid automata with Discrete interaction).

Overview

I

main

module contains description of the network of automata:

processes are

MODULE

instances;

I

main

module contains synchronization constraints:

EVENT

; I Symbolic description of infinite transition system using:

INIT

,

INVAR

and

TRANS

to specify initial, invariant and transition conditions.

I

continuous

type variables with

FLOW

conditions,

Giuseppe Spallitta 1. HyComp

4/12

(7)

HyComp: input language [2/3]

HyComp adds

I

continuous

variable type;

I all

continuous

vars increase accordingly to their

FLOW

conditions in timed transitions;

I

time

: built-in

continuous

symbol with flow condition:

der(time) = 1

, can not be used in properties;

I

URGENT

: freeze time: when one of the

URGENT

conditions is

satisfied only discrete transitions are allowed;

(8)

HyComp: input language [3/3]

HyComp updates

I

TRANS

constrain the discrete behaviour only,

I

INVAR

:

continuous

allowed in invariants with shape:

no_continuous_expr -> convex_continuous_expr

.

Giuseppe Spallitta 1. HyComp

6/12

(9)

HyComp: commands

read and rewrite model 1.

hycomp_read_model

2.

hycomp_compile_model

3.

hycomp_untime_network

4.

hycomp_async2sync_network

5.

hycomp_net2mono

check specifications

I

hycomp_check_invar_*

I

hycomp_check_ltl*

(10)

Outline

1. HyComp

2. Example

3. Exercises

(11)

Example: stopwatch [1/3]

I write a HyDi model that represents the hybrid automaton in the picture.

I add an asynchronous process that controls the stop-watch using the

toggle

and

reset

commands.

˙

x = 0 x = 1˙ x := 0

reset toggle

toggle

off on

(12)

Example: stopwatch [2/3]

Stopwatch module

MODULE StopWatch DEFINE

on := mode = _on;

off := mode = _off;

VAR

mode : {_on, _off};

c : continuous;

EVENT toggle, reset;

FLOW on -> der(c) = 1;

FLOW off -> der(c) = 0;

TRANS EVENT = reset -> next(c) = 0;

TRANS EVENT != reset -> next(c) = c;

TRANS EVENT = toggle -> next(mode) != mode;

Giuseppe Spallitta 2. Example

9/12

(13)

Example: stopwatch [3/3]

Controller module

MODULE Controller EVENT toggle, reset;

main module

MODULE main VAR

stopWatch : StopWatch;

controller : Controller;

SYNC controller, stopWatch EVENTS toggle, toggle;

SYNC controller, stopWatch EVENTS reset, reset;

(14)

Outline

1. HyComp

2. Example

3. Exercises

(15)

Bouncing ball

I A ball is initially at height 10.

I We let the ball fall and bounce.

I Every time the ball bounces half its speed is lost.

I The gravitational acceleration is 9.8.

(16)

Timed thermostat

I a thermostat has 2 states: on and off ;

I if the temperature is below 18 degrees the thermostat switches on.

I if the temperature is above 18 degrees the thermostat switches off.

I Every time the thermostat misure the temperature in the room, the temperature increases (if on) or decreases (if off ) by dt (with respect to the previous check);

I the thermostat measures the temperature at most (<) every max _dt time units.

I the temperature initially is in [18 − max_dt; 18 + max_dt].

Verify that the temperature is always in [18 − 2max _dt; 18 + 2max _dt]

Giuseppe Spallitta 3. Exercises

12/12

Riferimenti

Documenti correlati

Once you create your file using the TPTP format, you can feed it to the theorem prover using the command ./eprover –auto -s file.p:.. I If a proof is found, then the output string

I NEGATION is represented as (not &lt;var&gt;) I OR is represented as (or &lt;var1&gt; &lt;var2&gt;) I AND is represented as (and &lt;var1&gt; &lt;var2&gt;) I IF is represented

I To easily retrieve the solution when the solver returns SAT, we can create an additional variable to store the value of y once we reached the end of the loop... Checking

A vertex-cover set of an undirected graph is a subset of vertices such that if an edge belongs to the graph, then at least one of the two nodes linked by this edges belong to

specifies a constraint on the values that a variable can assume in the next state, given the value of variables in the current state. next(&lt;variable&gt;)

I verification: properties must hold only on fair paths I Currently, compassion constraints have some limitations.. (are supported only for BDD-based LTL

I initial state: all animals are on the right side I goal state: all animals are on the left side I rules:. I the ferryman can cross the river with at most one passenger on

I if the robot is in “pos” 0 and the budget is smaller than 100, then the next state is “CHARGE”. I if the budget is 0, then the next state