engg4420 --lecture 4 · 2012. 9. 17. · chapter 1 by radu muresan university of guelph page 1 ....

25
GENERALIZED COMPUTER SYSTEM analog-to-digital converters (ADCs), digital-to-analog converters (DACs), digital input and digital output lines, pulse generators (for stepper motors, etc.). Using the example, we see that the monitoring and actuation tasks involve a range of interface devices (control requires calculations) such as: In this course, we will represent these interfaces simply as: input devices and output devices. Each of the various types of devices will require software to operate it and we will represent this software as input tasks and output tasks. Computer Standard Input/Output devices Input Devices Output Devices PLANT Interface ENGG4420 -- LECTURE 4 September-11-12 2:02 PM CHAPTER 1 By Radu Muresan University of Guelph Page 1

Upload: others

Post on 23-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

GENERALIZED COMPUTER SYSTEM

analog-to-digital converters (ADCs),�

digital-to-analog converters (DACs),�

digital input and digital output lines,�

pulse generators (for stepper motors, etc.).�

Using the example, we see that the monitoring and

actuation tasks involve a range of interface devices

(control requires calculations) such as:

In this course, we will represent these interfaces

simply as: input devices and output devices.

Each of the various types of devices will require

software to operate it and we will represent this

software as input tasks and output tasks.

ComputerStandard

Input/Outputdevices

InputDevices

OutputDevices

PLANT

Interface

ENGG4420 -- LECTURE 4September-11-12

2:02 PM

CHAPTER 1 By Radu Muresan University of Guelph Page 1

Page 2: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

COMPUTER Controller Tasks

Input Image

Output Image

Input Tasks

Output Tasks

Input Devices

Output Devices

Plant (external world)

INTERFACE

InternalImage of Plant

GENERALIZED COMPUTER CONTROL SYSTEM

SHOWING HW and SW INTERFACES

The interface boundary is shown inside the

computer block -- this is to show that software is

required to operate the interface devices.

The input image of the plant is a snapshot of the status of

the plant that is partially or fully renewed at specified

intervals.

For external information in analog form a process of

digitization and sampling (conversion of a continuous

measure into a discrete measure) is required.

The input devices plus the input software gather

the information needed to create an INPUT IMAGE

of the plant.

CHAPTER 1 By Radu Muresan University of Guelph Page 2

Page 3: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

The OUTPUT IMAGE represents the current set of

outputs generated by the control calculation

(updated periodically by the controller tasks) -- the

output tasks convey data contained in the output

image to the plant.

The control software within the computer can

thus be considered as operating on an input

image (or model) of the plant to produce the

output image.

plant input tasks; plant output tasks; and control

tasks.

In this simple control model, we divided the

software tasks into three major areas:

COMMUNICATION TASKS. In simple systems, the

communication with the operator is treated as

part of the plant input and output tasks (like in the

example above). However, in many applications,

communication will extend beyond simple

indicators and switches.

CHAPTER 1 By Radu Muresan University of Guelph Page 3

Page 4: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

Controller Tasks

Input Image

Output Image

Input Tasks

Output Tasks

Input Devices

Output Devices

Process Process Process Process Plant

CommunicationTasks

CommunicationInterface

VDU Keyboard LAN PrinterComputer ControlSystem, ShowingCommunicationTasks

IN COMPEX SYSTEMS the plant engineers, plant

managers, pilots, air traffic controllers, drivers, and

machine operators, for example, will require detailed

information on all aspects of the operation of the

plant, aircraft, car, radar system, etc. Control of the

system may be shared between several computers, not

necessarily on the same site. As a result, information

may have to be transmitted between computers.

CHAPTER 1 By Radu Muresan University of Guelph Page 4

Page 5: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

SPECIFICATION DOCUMENT -- SYSTEM EXAMPLE

A. Introduction

The system is composed of several hot-air

blowers arranged along a conveyor belt. Several

different configurations may be used with a

minimum of 6 blowers and a maximum of 12.

B. Plant Interface

B.1. Input from plant

Outlet temperature: analog signal, range 0 – 10 V,

corresponding to 20 Co to 64 Co, linear

relationship.

B.2. Output to plant

Heater control: analog 0 V - 10 V, corresponding

to full heat (10 V) and no heat (0 V), linear

relationship.

C. Control

The controller parameters are to be variable,

entered from the keyboard and expressed to

the user in standard analog form, that is

proportional gain, integral action time, and

derivative action time.

The set point is to be entered from the

keyboard.

A PID controller with a minimum sampling interval

of 40 ms is to be used.

CHAPTER 1 By Radu Muresan University of Guelph Page 5

Page 6: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

D. OPERATOR COMMUNICATION

D.1. Display -- set as below with values on the

display being updated every 5 seconds

General Settings Controller settings

Set temperature :nn.n C Proportional gain :nn.n

Actual temperature :nn.n C Integral action :nn.nn s

Error :nn.n C Derivative action :nn.nn s

Heater output :nn% FS Sampling interval :nn ms

Other settings

Date :dd/mm/yyyy Time :hh.mm

D.2. OPERATOR INPUT

At any time, a new set point or new values for

the control parameters can be entered by

pressing the ‘ESC’ key => a menu is shown on the

bottom of the display screen:

1. Set temperature = nn.n 2. Proportional gain = nn.n3. Integral action = nn.nn 4. Derivative action = nn.nn5. Sampling interval = nn 6. Management information7. Accept entriesSelect menu number to change

In response to the number entered, the present

value of the item will be deleted from the display

and a new input value can be introduced. The

process is repeated until item 7 is selected.

CHAPTER 1 By Radu Muresan University of Guelph Page 6

Page 7: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

E. MANAGEMENT INFORMATION

Selecting item 6 of the operator menu a

management summary of the performance of

the plant over the previous 24 hours will be

given. The summary should provide the

following information:

(a) Average error in Co in 24 hour period.

(b) Average heat demand %FS (full scale) in 24

hour period.

(i) Average demanded temperature;

(ii) Average error; and

(iii) Average heat demand

(c) For each 15 minute period:

(d) Date and time of output.

F. GENERAL INFORMATION

There will be a requirement for a maximum of 12

control units. A single display and entry keyboard

which can be switched between the units is

adequate.

CHAPTER 1 By Radu Muresan University of Guelph Page 7

Page 8: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

HARDWARE DESIGN

single computer with multi-channel ADC and

DAC boards (e.g., NI boards or others);

separate general purpose computers on each

unit;

separate embedded microcontrollers on each

unit linked to a single general purpose

computer.

There are many different arrangement possibilities

for the hardware structure such as:

Option 1: given that the specification calls for

the system to be able to run with a sample

interval for the control loop of 40 ms, can this

be met with 12 units sharing one processor?

Option 2: Is putting a processor that includes a

display and keyboard on each unit an expensive

solution? Will communication between

processors be required?

Option 3: What sort of communication network

should be used? A shared high-speed bus? A

local-area network? Where should the

microcontrollers be located? At each blower

unit or together in a central location?

Each of the configurations needs to be analyzed

and evaluated:

CHAPTER 1 By Radu Muresan University of Guelph Page 8

Page 9: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

SOFTWARE DESIGN -- examining the

specification shows that the software has to

perform several different functions: 1) DDC for

temperature and blower control; 2) operator

display; 3) operator input; 4) provision of

management information; 5) system start-up

and shut-down; and 6) clock/calendar function.

Event

Event/cyclic

Cyclic

Soft timeconstraint

Hard time

constraint(cyclic)

Control

Clock/calendar

Operatordisplay

Operatorinput

Managementinformation

Interactive Start up

Shareddata

CHAPTER 1 By Radu Muresan University of Guelph Page 9

Page 10: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

CONSTRAINTS ANALYSIS

The control module has a hard constraint in that it

must run every 40 ms. In practice, this constraint

may be relaxed to, say, 40 ms ± 1 ms with an

average value over 1 minute of, say, 40 ms ± 0.5

ms. We can relax further to allow for example one

sample in 100 to be missed.

An average response time of 1 second with a

maximum interval between reading the counter

of 5 seconds.

The clock/calendar module must run every 20 ms

in order not to miss a clock pulse. This constraint

can be changed into a soft constraint if the clock

can be connected to an internal hardware timer:

The operator display as specified has a hard

constraint in that an update interval of 5 seconds is

given. We can change this to an average time of 5

seconds. However, a maximum time would also

have to be specified say, 10 seconds.

Soft constraints are adequate for operator input

and management info.

The start-up module does not have to operate in

real-time and hence can be considered as a

standard interactive module.

CHAPTER 1 By Radu Muresan University of Guelph Page 10

Page 11: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

SYSTEM IMPLEMENTATION APPROACH

Different activities can be divided into sub-

problems.

The sub-problems will have to share a certain

amount of information.

single program;•

foreground/background system; and•

multi-tasking.•

How the sharing is done depends on the

implementation type chosen:

CHAPTER 1 By Radu Muresan University of Guelph Page 11

Page 12: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

SINGLE PROGRAM APPROACH

In this implementation, the requirement is that

the clock/calendar module must run every 20 ms

(for the lab see lab specifications).

t1t2

t3

t4

t5

t1 + max(t2,t3,t4,t5) < 20 ms

YES

YES

YES

YES

CONTROL

DISPLAYUPDATE

OPERATORINPUT

MANAGEMENTOUTPUT

MANAGE-MENT

REQUEST?

OPERATORINPUT?

TIMEFOR

DISPLAY?

TIMEFOR

CONTROL?

UPDATECLOCK ANDCALENDAR

20 msELAPSED

READ CLOCKINPUT LINE

START UP

START

FT

NO

NO

NO

NO

CHAPTER 1 By Radu Muresan University of Guelph Page 12

Page 13: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

SINGLE PROGRAM ANALYSIS

For the system to work the clock/calendar

module and any one of the other modules

must complete their operations within 20 ms.

If t1, t2, t3, t4, and t5 are the maximum

completion times for modules: clock/calendar,

control, operator display, operator input, and

management output, respectively, then the

above equation must be met.

The control module provides control

computations for each of the 12 units.

The times t1, t2, t3, t4, and t5 must include the

time required to carry the tests and t1 must

include the time required to read the module.

CHAPTER 1 By Radu Muresan University of Guelph Page 13

Page 14: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

FOREGROUND/BACKGROUND SYSTEM

t1

t2

t1 + t2 < 20ms

INTERRUPT

INTERRUPTHANDLER

START

CLOCK/CALENDAR

TIMEFOR

CONTROL

CONTROL

RTI

NO

YES

FOREGROUND

CHAPTER 1 By Radu Muresan University of Guelph Page 14

Page 15: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

FOREGROUND TASK

There are obvious advantages (i.e., less

module interaction, less tight time constraints)

if the modules with hard time constraints can

be separated from, and handled independently

of, the modules with soft time constraints or

no time constraints.

The modules with hard time constraints are

run in the so-called ‘foreground’ and the

modules with soft constraints (or no

constraints) are run in the 'background'. The

foreground modules, or ‘tasks’ as they are

usually termed, have a higher priority than the

background tasks and a foreground task must

be able to interrupt a background task.

The foreground tasks must meet the

requirement specified in the equation above

to work. Where t1 is the maximum execution

time for clock/calendar module and t2 is the

maximum execution time for the control

module.

CHAPTER 1 By Radu Muresan University of Guelph Page 15

Page 16: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

1. max(t3,t4,t5) < 10s;2. display runs on average every 5s3. operator input responds in < 10s

START

START UP

DISPLAY UPDATE

TIMEFOR

DISPLAY

OPERATORINPUT

OPERATORINPUT

MANAGEMENTINFORMATION

MANAGE-MENT?

NO

NO

NO

YES

YES

YES

BACKGROUND

BACKGROUND TASK

CHAPTER 1 By Radu Muresan University of Guelph Page 16

Page 17: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

BACKGROUND TASK

The partitioning into foreground and

background usually requires the support of a

real-time operating system, for example

uC/OS-II/III.

The foreground task is written as an

interrupt routine and the background task

as a standard program.

It is possible to adapt many standard

operating systems, to give simple

foreground/background operation if the

hardware supports interrupts.

A requirement for the background task to

work is given by conditions 1, 2, and 3 in the

previous page.

Although the time constraints have been

relaxed, the measurements to be made in

order to check the performance are more

complicated than in the single-program case

and hence the evaluation of the

performance of the system has been made

more difficult.

CHAPTER 1 By Radu Muresan University of Guelph Page 17

Page 18: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

Background

Foreground

Clock/Calendar

DataStorage

Control

Display

Operatorinput

Managementinformation

SOFTWARE MODULES FOR FOREGROUND

/BACKGROUND SYSTEM SHOWING DATA STORAGE

Although the foreground/background approach

separates the control structure of the

foreground and background tasks, the modules

in the foreground/background approach are

still linked through the data structure.

CHAPTER 1 By Radu Muresan University of Guelph Page 18

Page 19: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

FOREGROUND/BACKGROUND TASKS

COMMUNICATION

For example, in the hot-air blower system:

the control task, the display task and the

operator input task all require access to the

controller parameters.

The linkage between foreground/background

occurs because they store data variables:

The communication between these modules

must be synchronized (subject of the next

topic).

In this example, the variable can be shared

between the control, display and operator input

modules without any difficulty since only one

module writes to any given variable. The

operator input module writes the controller

parameters and set point variables, the

clock/calendar modules writes to the date and

time variables and the control module writes to

the plant data variables (error and output

temperature). However, the input from the

operator must be buffered and only transferred

to the shared storage when it has been verified.

CHAPTER 1 By Radu Muresan University of Guelph Page 19

Page 20: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

MULTI-TASKING APPROACH

The design and programming of large real-time

systems is eased if the foreground/background

partitioning can be extended into multiple

partitions to allow the concept of many active tasks

(or processes).

Create separate tasks;○

Schedule running of the tasks, usually on a

priority basis;

Share data between tasks;○

Synchronize tasks with each other and with

external events;

Prevent tasks corrupting each other; and○

Control the starting and stopping of tasks.○

The implementation of multi-tasking systems

requires the ability to:

The support to perform the above actions are

typically provided by a real-time operating system

(RTOS) or a combination of RTOS and a real-time

programming language.

CHAPTER 1 By Radu Muresan University of Guelph Page 20

Page 21: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

SUMMARY

Important to divide the operations into tasks•

Process, plant: the physical system that is to be

controlled;

Program: the complete software package used

to provide the control;

Module: a subdivision of the program;○

Task: a subdivision of the program (or a module

of the program) whose execution can be

separately scheduled from other parts of the

program.

Definitions:•

A program or a module may be divided into several

tasks that have the potential to run concurrently.

Single program; foreground/background; and

multi-tasking.

There are 3 models on which the implementation

of real-time software can be based. These are:

For small, simple system the first two models are

suitable or using a small footprint RTOS.

For complex systems multi-tasking is suitable --

intercommunication and synchronization problems

appear.

CHAPTER 1 By Radu Muresan University of Guelph Page 21

Page 22: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

SECTION 1.2. DYNAMIC MODELS

A dynamic model is a mathematical description of

the process to be controlled. Specifically, a set of

differential equations that describe the dynamic

behaviour of the process.

By using principles of the underlying physics;○

By testing a prototype of the device, measuring

its response to inputs, and using the data to

construct an analytical model -- called system

identification method.

Obtaining the dynamic model: •

HEAT AND FLUID-FLOW MODELS

For the purpose of generating dynamic models for

use in control systems, the most important aspect

of the physics is to represent the dynamic

interaction between variables.

Experiments are usually required to determine the

actual values of the parameters and thus to

complete the dynamic model for purpose of

control systems design.

ENGG4420 -- LECTURE 5September-16-12

11:23 PM

CHAPTER 1 By Radu Muresan University of Guelph Page 22

Page 23: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

HEAT FLOW EQUATIONS

Many control systems involve the regulation of

temperature -- the dynamic models of

temperature control systems involve the flow and

storage of heat energy.

Heat energy flows through substances at a rate

proportional to the temperature difference across

the substance:

q = heat energy flow, joules per second [J/sec];○

R = thermal resistance, [oC/J*sec];○

T = temperature, [oC].○

Where:•

The net heat-energy flow into a substance affects

the temperature of the substance according to

the relation:

C is the thermal (or heat) capacity.○

qnet is the sum of heat flows obeying Eq. (1). Note

that all heat flow paths into and out of the

substance must be considered.

Where:

CHAPTER 1 By Radu Muresan University of Guelph Page 23

Page 24: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

EXAMPLE -- Equations for Heat Flow

A room with all but two sides insulated is shown

in figure below. Find the differential equations

that determine the temperature in the room.

SOLUTION.

Application of Eq.

(1) and (2) yields:

To = temperature outside.○

TI = temperature inside.○

R2 = thermal resistance of the room ceiling.○

R1 = thermal resistance of the room wall.○

Where: Ci = thermal capacity of air within the room

CHAPTER 1 By Radu Muresan University of Guelph Page 24

Page 25: ENGG4420 --LECTURE 4 · 2012. 9. 17. · CHAPTER 1 By Radu Muresan University of Guelph Page 1 . COMPUTER Controller Tasks Input Image Output Image Input Tasks Output Tasks Input

SPECIFIC HEAT, THERMAL CONDUCTIVITY

Specific heat cv at constant volume that is

converted to heat (thermal) capacity by:

a.

Where, m is the mass of the substance.

Thermal conductivity k which is related to

thermal resistance R by:

b.

Normally the material properties are given in tables

as indicated below:

Where A is the cross sectional area and l is the

length of the heat-flow path.

In addition to flow due to transfer as described by

Eq. (1), heat can also flow due to warmer mass

flowing into a cooler mass, or vice versa:

Where w is the mass flow rate of the fluid at T1

flowing into the reservoir at T2.

CHAPTER 1 By Radu Muresan University of Guelph Page 25