Top Banner
CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015
21

CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Jan 21, 2016

Download

Documents

Linette Burns
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

CSCI1600: Embedded and Real Time SoftwareLecture 6: Modeling I: Continuous Systems

Steven Reiss, Fall 2015

Page 2: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Why ModelingSpecifying system behavior

Understanding what the system should do In response to external events

In response to internal events

Designing the systemRequirements, specifications

Understanding odd conditions

Page 3: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Why Modeling Proving properties of the system

Proving a system is “safe”What does safety mean

Show the system fits this meaning

Can be done in terms of models

Also can be done in terms of code

Performance propertiesTiming requirements

Page 4: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Proving PropertiesProve heat and cold never on within 5

minutes of each otherCan do this by looking at the code

How complex is the code, how difficult

Easier to prove a high-level model satisfies the propertyAnd then show the code meets the model

Page 5: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

The Real World

Embedded systems exist in contextThat context is the real world

Is the real world continuous or discrete?

Page 6: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Physical Systems

If we embed into a physical systemWhat is the effect

What do we want to happen

Will we achieve the effect

Need to model the physical system

Page 7: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Modeling

Why bother with modelingWhy not just implement what we want

What do you wantHow do you know what will work

Page 8: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Consider a RC Car What are you concerned with

Position of the car

Relative or absolute

What are your controls Accelerate or not

Binary or can you control

How does this affect the position

Turn left/right Binary or can you control

How does this affect the position

Page 9: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

RC CarWhat accelerate means

How much acceleration

Maximum speed

Slowdown when not accelerating

What does turn meanHow fast does the wheel turn

Maximum amount of turn

Page 10: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

RC Car

Suppose you want to track a lineCan tell left/right by amount

What should you do?

Page 11: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Modeling

This is one reason to modelUnderstanding what your options might

be and what your system should think about doing

Is there another?

Page 12: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Simulation Suppose our RC car were breakable

E.g. helicopter, drone, …

Suppose it had real effects E.g. real car, X-ray machine

Pin ball machine

Suppose it were expensive Or not yet built

How would you create the embedded program

Page 13: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Simulation Environment Create a simulation environment

Simulate the physical world

Let your program run as part of the simulation

This requires modeling the real world Physical details

Gravity, motion, etc.

Can be chemical, heat, …

Page 14: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Simulation Small time stepTrack position, velocity, orientation

Of each object

Or subobject (e.g. wheels of RC car)Compute next state

Next position, velocity, orientation

Page 15: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Simulation

Can be expressed in modeling languageMatlab (Simulink), LabView provide a

graphical interface

Actor model described in text

Page 16: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Simulation Concerns Fidelity

How accurate does it model the real world

How important is this accuracy

Speed Does it operate in real time

Does it operate on the time scale of your system

Debugging Can you debug you program using it

Page 17: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Feedback

In general, your system doesn’t try to compute the next step

Instead it uses feedback to control the system

We’ll get into this next week

Page 18: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

RT/Embedded SW Architecture

Break the problem into tasksEach task has its own requirements

How often to run

How much time it takes

How critical it is

What are the tasks for a problem?

Page 19: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Task Types Control-oriented tasks

Managing state, handling sequential actions

Timer-oriented tasks Something needs to be done periodically

Data-oriented tasks If multiple tasks acces a data structure

Have a task in charge of that structure

Device-oriented tasks Single task to handle a device

Page 20: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Modeling the System

First modeling the individual tasksInteractions with the physical world

Interactions based on time

Then modeling their interactionWith each other

Page 21: CSCI1600: Embedded and Real Time Software Lecture 6: Modeling I: Continuous Systems Steven Reiss, Fall 2015.

Homework

Read Chapter 3.1-3.5