csci1600: embedded and real time software lecture 8: modeling iii: hybrid systems steven reiss, fall...

19
CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Upload: jeffery-lucas

Post on 18-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

CSCI1600: Embedded and Real Time SoftwareLecture 8: Modeling III: Hybrid Systems

Steven Reiss, Fall 2015

Page 2: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Time and Finite State Automata

We’ve added timing to our automata in an ad-hoc fashion Added timer events

Indicated length of time in a state (min/max)

No notion of absolute time, clocks, etc.

In order to prove properties of the system With respect to time

We need a cleaner, more formal representation

Page 3: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Timed Automata Basic idea

Extended finite state machine

Add the notion of timer variables (bounded)

Timer variables can be set explicitly

All timer variables are periodically incremented Can think of this as every k milliseconds

But in general it is considered a tick

Timer variables can be used in conditions

No ad-hoc time constraints

Page 4: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Timed Automata

Page 5: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Another example

Page 6: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Extended timed automata

Page 7: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Modeling and the Real World

Often we want to model both the system and the world The system is a finite automata

The real world is continuous & not just clocks

Problems How to combine the two

What can we do with the combination

Understanding

Proving properties

Page 8: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Modeling in the Real World

Page 9: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Hybrid Automata

State variables reflect the real world Updates done over time automatically

Updates can use continuous modeling Can specify velocity, acceleration rather than position

Can specify rules for doing the update

Page 10: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Bouncing Ball Example

Page 11: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

RC Car

Page 12: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Hybrid Timed Automata

The external (timed) portion is set outside the automata Rules for continuous update

Model the physics of the real world

Page 13: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Why Model the World?

Does the code need to know the state of the real world Either precisely or approximately

Does it need to compute that state Or retrieve it via sensors

How accurate can you model the world? Consider speed control on a car

Proving properties of the program wrt the model Does this prove the system correct

Page 14: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Implementation Approach

Get information from the real world What the actual speed is, change of speed

Actual temperature (and change rate)

Compute the difference between actual and desired This is called the error

Use this to determine the action

This is considered feedback

Page 15: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Control Theory

Why are computers called “digital computers” What is the alternative

What is an analog computer

It turns out that analog computers are easy to build Either mechanically or electronically

Predate digital computers

Page 16: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Analog Computers

Page 17: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Analog Computer

Can do simple math operations

Some complex math operations are easy Integration, differentiation

Page 18: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Controlling Physical Systems Analog computers are designed for this

If you want a car to go in a straight line

Use feedback from left/right to update steering

Use intergrator to determine how much off and to control system

Analog control is all about feedback

We can do the same in digital systems Covered a week from Monday

First we need to cover details for the assignment

And some additional modeling concepts

Page 19: CSCI1600: Embedded and Real Time Software Lecture 8: Modeling III: Hybrid Systems Steven Reiss, Fall 2015

Homework

Read Chapter 7.1