07.01.2013 Views

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

13 Real-Time and Hybrid Systems Test<strong>in</strong>g 377<br />

on, respectively off. The switch from one state to another one is triggered by<br />

events on and off that are sent by the controller’s hybrid automaton, i. e. the<br />

two automata synchronize over these events.<br />

x=20<br />

Off<br />

x < 20/on<br />

On<br />

˙x =-0.1x ˙x = 5 - 0.1x<br />

x � 20<br />

x > 22/off<br />

x � 22<br />

Fig. 13.8. Hybrid automaton for the thermostat controller<br />

For comparison, we look at the same controller as a HybridUML model.<br />

The structure of the thermostat is modeled as an agent <strong>in</strong> Figure 13.9. The<br />

thermostat consists of a heater and a controller that communicate via signals<br />

on and off . Temperature x is measured by the controller and is also visible <strong>in</strong><br />

the thermostat itself, e.g. to monitor the temperature from the environment.<br />

Therefore x is a shared variable. Send<strong>in</strong>g of a signal, respectively write access<br />

to a shared variable, is shown as a black-filled box, while receiv<strong>in</strong>g a signal,<br />

respectively read access to a shared variable, is shown as a white-filled box.<br />

These boxes are connected to visualize communication structures.<br />

class Thermostat(20,22)<br />

{x =data.θ} {data.h = 5}<br />

{t =0} {data.K = 0.1}<br />

{data.θ =20}<br />

:Heater<br />

on()<br />

off()<br />

: Controller<br />

on()<br />

off()<br />

{x =data.θ}<br />

Fig. 13.9. Composite structure diagram for the thermostat agent<br />

In the upper left corner, parameters m and M are set to 20, respectively<br />

22. Both values are given as parameters for better reusability of the thermostat<br />

model. Furthermore, variables and constants of the thermostat must be <strong>in</strong>itialized.<br />

Constants K , h, andθ are all <strong>in</strong>cluded <strong>in</strong> structure data and are set to 5,<br />

0.1, and 20. Shared variable x that measures the temperature is set to the <strong>in</strong>itial<br />

value θ <strong>in</strong> both the thermostat and the controller. At last, t is a global clock<br />

that must be set to 0 <strong>in</strong> the beg<strong>in</strong>n<strong>in</strong>g.<br />

The behavior of the controller is visualized <strong>in</strong> Figure 13.10, similar to the<br />

hybrid automaton modeled above, i.e. states and transitions co<strong>in</strong>cide <strong>in</strong> both<br />

variants of the thermostat example. Here, flows and <strong>in</strong>variants are marked explicitly<br />

with keywords flow, respectively <strong>in</strong>v. Jump conditions of transitions are<br />

given <strong>in</strong> brackets while events are given after a slash.<br />

As we have seen, hybrid automata offer the possibility to model time-discrete<br />

and time-cont<strong>in</strong>uous behavior. As they are based on well-known automata, they<br />

x<br />

x

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!