Introduction to Real-Time Systems

Similar documents
Real-Time Systems Hermann Härtig Introduction

Laurea Specialistica in Ingegneria. Ingegneria dell'automazione: Sistemi in Tempo Reale

Outlines. Examples. Hardware Interface. What s Embedded Systems? Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University

Lecture #20 Analog Inputs Embedded System Engineering Philip Koopman Wednesday, 30-March-2016

3.5: Multimedia Operating Systems Resource Management. Resource Management Synchronization. Process Management Multimedia

CIS 480/899 Embedded and Cyber Physical Systems Spring 2009 Introduction to Real-Time Scheduling. Examples of real-time applications

Hello, and welcome to this presentation of the STM32G0 digital-to-analog converter. This block is used to convert digital signals to analog voltages

Trends in Software and Control

CSE 466 Software for Embedded Systems. What is an embedded system?

Hardware-in-the-Loop Simulation

Experimental Evaluation of the MSP430 Microcontroller Power Requirements

Glossary of terms. Short explanation

Next Generation of Adaptive Traffic Signal Control

Lecture 2: Embedded Systems: An Introduction

Modular Performance Analysis

The CPAL programming language. Lean Model-Driven Development through Model-Interpretation

William Milam Ford Motor Co

Residential Load Control with Communications Delays and Constraints

Closing the loop around Sensor Networks

Dependable Wireless Control

EECS 473. Review etc.

Real Time Operating Systems Lecture 29.1

Hardware Platforms and Sensors

Cross-layer model-based framework for multi-objective design of Reconfigurable systems in uncertain hybrid environments

Chapter 2 Implementation of Kalman Filter to Monitor the Level Fluctuations in a Dam Using FPGA

Deadline scheduling: can your mobile device last longer?

Run-time Power Control Scheme Using Software Feedback Loop for Low-Power Real-time Applications

NATIONAL UNIVERSITY OF SINGAPORE. EE3302/EE3302E Industrial Control Systems. E2: PLC Programming for Sequence Control

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

10. BSY-1 Trainer Case Study

COMET DISTRIBUTED ELEVATOR CONTROLLER CASE STUDY

EECS 473. Review etc.

MARITIME. Digital Twins. for Design, Testing and Verification of Autonomous Systems. Ungraded. 13 June 2016 SAFER, SMARTER, GREENER

Unit level 5 Credit value 15. Introduction. Learning Outcomes

Chapter 6: CPU Scheduling

VLSI System Testing. Outline

Embedded System Hardware

Event-Driven Scheduling. (closely following Jane Liu s Book)

Arduino Platform Capabilities in Multitasking. environment.

Networked and Distributed Control Systems Lecture 1. Tamas Keviczky and Nathan van de Wouw

Peripheral Link Driver for ADSP In Embedded Control Application

MECHATRONICS SYSTEM DESIGN

Teaching Embedded Systems to Berkeley Undergraduates

Introduction to Real-time software systems Draft Edition

Arda Gumusalan CS788Term Project 2

CSE 3215 Embedded Systems Laboratory Lab 5 Digital Control System

Hardware Implementation of Automatic Control Systems using FPGAs

DYNAMIC VOLTAGE FREQUENCY SCALING (DVFS) FOR MICROPROCESSORS POWER AND ENERGY REDUCTION

Executive Summary. Chapter 1. Overview of Control

Control Systems Overview REV II

Parallel Computing 2020: Preparing for the Post-Moore Era. Marc Snir

AutoBench 1.1. software benchmark data book.

Model-based Design of Coordinated Traffic Controllers

Fundamentals of Industrial Control

Time Triggered Protocol (TTP/C): A Safety-Critical System Protocol

Arduino STEAM Academy Arduino STEM Academy Art without Engineering is dreaming. Engineering without Art is calculating. - Steven K.

The Evolution of Real-Time Programming

Grundlagen Microcontroller Analog I/O. Günther Gridling Bettina Weiss

REVIEW: Embedded System Hardware

EFFICIENT CONTROL OF LEVEL IN INTERACTING CONICAL TANKS USING REAL TIME CONCEPTS

Embedded Systems Lecture 2: Interfacing with the Environment. Björn Franke University of Edinburgh

An Event-Driven Operating System for Servomotor Control

Sensors and Sensing Motors, Encoders and Motor Control

CSE 237A Winter 2018 Homework 1

FTSP Power Characterization

Center for Hybrid and Embedded Software Systems. Hybrid & Embedded Software Systems

Digital Transformation. A Game Changer. How Does the Digital Transformation Affect Informatics as a Scientific Discipline?

FPGA Based 70MHz Digital Receiver for RADAR Applications

Embedded System Design (10EC74)

A PID Controller for Real-Time DC Motor Speed Control using the C505C Microcontroller

Evolution of DSP Processors. Kartik Kariya EE, IIT Bombay

DESIGN TECHNOLOGY FOR THE TRILLION-DEVICE FUTURE

products PC Control

Energy Efficient Scheduling Techniques For Real-Time Embedded Systems

Nandha Engineering College (Autonomous) Erode Examination -Sep 2018 Department Wise Time Table

UNIT-III LIFE-CYCLE PHASES

4F3 - Predictive Control

The Key to the Internet-of-Things: Conquering Complexity One Step at a Time

Sensors and Sensing Motors, Encoders and Motor Control

Introduction (concepts and definitions)

EMBEDDED SYSTEM DESIGN

Multi-Robot Teamwork Cooperative Multi-Robot Systems

Loop Design. Chapter Introduction

NSF. Hybrid Systems: From Models to Code. Tom Henzinger. UC Berkeley. French Guyana, June 4, 1996 $800 million embedded software failure

WifiBotics. An Arduino Based Robotics Workshop

5. Process and thread scheduling

15 CAN Performance Distributed Embedded Systems Philip Koopman October 21, Copyright , Philip Koopman

WiMAX Basestation: Software Reuse Using a Resource Pool. Arnon Friedmann SW Product Manager

Teaching Mechanical Students to Build and Analyze Motor Controllers

CHAPTER 6 PHASE LOCKED LOOP ARCHITECTURE FOR ADC

Mechatronics. STEAM Clown Production. STEAM Clown & Productions Copyright 2016 STEAM Clown

Embedded Systems. 9. Power and Energy. Lothar Thiele. Computer Engineering and Networks Laboratory

ROBOTICS & IOT. Workshop Module

ROBOTICS & IOT. Workshop Module

INTERFACING WITH INTERRUPTS AND SYNCHRONIZATION TECHNIQUES

Chapter 1 Basic concepts of wireless data networks (cont d.)

Datorstödd Elektronikkonstruktion

An Event-Driven Operating System for Servomotor Control

Fuzzy PID Controllers for Industrial Applications

Scheduling and Communication Synthesis for Distributed Real-Time Systems

Transcription:

Introduction to Real-Time Systems Real-Time Systems, Lecture 1 Martina Maggio and Karl-Erik Årzén 16 January 2018 Lund University, Department of Automatic Control

Content [Real-Time Control System: Chapter 1, 2] 1. Real-Time Systems: Definitions 2. Real-Time Systems: Characteristics 3. Real-Time Systems: Paradigms 1

Real-Time Systems: Definitions

Real-Time Systems Any information processing system which has to responde to externally generated input stimuli within a finite and specified period Real-Time systems are those in which the correctness of the system depends not only on the logical results of the computation but also on the time at which results are produced 2

Definitions A hard real-time system is a system where it is absolutely imperative that the responses occur within the required deadline (for example because in safety-critical applications in aerospace, automotive and so on). A soft real-time system is a system where deadlines are important, but where the system still functions if the deadlines are occasionally missed (for example in multimedia systems, user interfaces and so on). 3

Real-Time and Control Control-Engineering Computer Engineering Real-Time Systems All control systems are real-time systems. Many hard real-time systems are control systems. 4

Control engineers need real-time systems to implement their systems. Computer engineers need control theory to build controllable systems. Interesting research problems in the interface. 5

Hard Real-Time Systems The focus of this course. Many (most?) hard real-time systems are real-time control systems. Most real-time control systems are not hard real-time systems. Many hard real-time systems are safely-critical. Common misconception: Real time equals high-speed computations. This is not true. Real-time systems execute at a speed that makes it possible to fulfill the timing requirements. 6

Real-Time Control Systems Controller Controlled System A/D Sensors Computer Control System Industrial Process Operator Interface Communication D/A Actuators 7

Real-Time Control Systems Two types of real-time control systems: Embedded systems: dedicated control system the computer is an embedded part of some equipment microprocessors, real-time kernels, RTOS aerospace, industrial robots, vehicular systems Industrial control systems: distributed control systems (DCS) programmable logic controllers (PLC) hierarchically organized process industry, manufacturng industry 8

Example 9

Some more 10

Example In a modern car Embedded control systems: brakes, transmission, engine, safety, climate, emissions: 40-100 ECUs in a new car, 2-5 milion lines of code; Networked systems: VOLVO XC 90 has 3 CAN-buses and other buses. 11

Networked Control 12

Networked Control 13

Cyber-Physical Systems Name coined in the US around 2008. Denotes systems with a very tight connection between computing, communication, control and the physical world. Computing Control CPS Physical world Communication 14

CPS Examples Smart/Green/Low-energy buildings: require interaction between architects, mechanical engineers and control engineers; require interaction between a number of subsystems (cooling, lightning, security); Green cars; Smart Power Grids; Server Farms/Data Centers: require interaction between load balancing and energy consumption; Battery-driven computing and communication devices (like smart phones, laptops and sensor networks); Cross-layer design and optimization in networks: in embedded systems resource-aware design. 15

Real-Time Systems: Characteristics

Embedded Control Characteristics Limited computing and communication resources: often mass-market products, like cars CPU time, communication bandwidth, energy, memory Autonomous operation: No human operator in the loop Several use-cases and complex functionality, often large amount of software need for formal guarantees 16

Embedded Control Characteristics Limited Resources = Efficiency Code-size efficiency Run-time efficiency Energy efficiency Weight and size efficiency Cost efficiency Autonomous operations = Dependability Reliability Availability Safety Security Maintainability 17

Example: The Buffer Tanks V L 1 L 0 T Q Raw Material and Heating Goals: Level control: open V when level below L 0, keep the valve open until level above L 1, Temperature control: PI-controller. 18

Typical Characteristics Parallel activities. Timing requirements: more or less hard. Discrete and analog signals. Continuous (time-driven) control and Discrete (event-driven) sequential control. 19

Continuous Time-Driven Control Controller on continuous (analog form) PI controller u(t) = K((y ref (t) y(t))+ 1 t (y ref (τ) y(τ))dτ) T i Can be implemented in several ways, e.g., using analog electronics Here, we will assume that it is implemented using a computer. How, should this be done? 20

Sampling - Control - Actuation Frequently: Sampling of measured signal y(t), Calculation of control signal (software algorithm), Actuation of calculated control signal u(k). In most cases periodically, i.e. driven by a clock (time). 21

Sampled-Data Control Systems u( t ) y ( t ) u( t ) t Process y( t ) t u k Hold u k D-A Computer A-D Sampler y k y k t t 22

Networked Control Systems u(t)...... u(t) Process y(t) y(t) t t D A and Hold Sampler and A D.... u k.. t uk Communication network Computer y k... y k... t 23

Design Approaches Sampled control-design: Discrete-time design, Use a model of the plant that only describes the behaviour at the sampling instants sampling the system. Approximation of a continuous-time design: Design the controller assuming a continuous-time implementation, Approximate this controller by a discrete-time controller. 24

Ideal Controller Timing Control Variable Measured Variable y y(t k 1 ) u u(t k 1 ) y(t k ) u(t k ) y(t k+1 ) t k 1 t k t k+1 Time Computational lag τ Time Output y(t) sampled periodically at time instants t k = kh, Control u(t) generated after short and constant time delay τ. 25

Real Controller Timing τ L k 1 s R k 1 R k R k+1 L k 1 io L k s L k io L k+1 s L k+1 io t y(t) u(t) r k 1 s k 1 f k 1 r k s k f k r k+1 s k+1f k+1 t Control task τ released periodically at time instances r k = kh, Output y(t) sampled after time-varying sampling latency L s, Control u(t) generated after time-varying input-output latency L io. 26

Non-Deterministic Timing Caused by sharing of computing resources: multiple tasks sharing the CPU, preemptions, blocking, priority inversion, varying computation times, and so on. Caused by sharing of network bandwidth: control loops closed over communication networks, network interface delay, queuing delay, transmission delay, propagation delay, resending delay, ACK delay, lost packets. How can we minimize the non-determinism? How does the non-determinism effect control performance? 27

Discrete Event-Driven Control Event-driven: wait for a condition to become true or an event to occur, perform some actions, wait for some new conditions. The event can be a clock-tick. Often modeled using state machine/automata-based formalisms. In many cases implemented using periodic sampling. 28

Events Real-Time systems must respond to events. Periodic events, Non-periodic events, Aperioduc events: unbounded arrival frequency, Sporadic events: bounded arrival frequency. Events can be external or internal. Each event requires a certain amount of processing and has a certain deadline. 29

Parallelism The real world is parallel. Events may occur at the same time. The work that has to be done to service an event is called the task associated with the event. It is often natural to handle the different tasks independently during design. 30

Real-Time Systems: Paradigms

Parallel Multi-Core Programming Design Level Concurrent Tasks CPU CPU Program Program Execution Level CPU Program 31

Sequential Programming Design Level Manual interleaving Cyclic Executive CPU Execution Level Sequential Program 32

Interleaved Code Interleaved temperature and level loops while (true) { while (level above L0) { Measure temperature; Calculate temperature error; Calculate the heater signal with PI-control; Output the heater signal; Wait for h seconds; } Open inlet valve; while (level below L1) { Measure temperature; Calculate temperature error; Calculate the heater signal with PI-control; Output the heater signal; Wait for h seconds; } Close inlet valve; } Complex and non user-friendly code Can often be automated. Sequential programme = static schedule (cyclic executive). 33

Static Sequential Approaches Advantages: determinism, a lot of different constraints can be ensured, simple real-time computing platforms may be used. Disadvantages: inflexible, generation of the sequential process can be a difficult optimization problem. 34

Concurrent Programming Design Level Concurrent Tasks CPU Execution Level Concurrent Processes The CPU is shared between the processes (switches). 35

Real-Time Operating Systems Switches between processes (real-time kernel), Timing primitives and interrupts, Process communication, CPU free to service other tasks. Temperature Loop with Sleep while (true) { Measure temperature; Calculate temperature error; Calculate the heater signal with PI-control; Output the heater signal; Sleep(h); } 36

Non-Real-Time Operating Systems Polling (inefficient). Polling Polled Temperature Loop while (true) { Measure temperature; Calculate temperature error; Calculate the heater signal with PI-control; Output the heater signal; counter = 0; while (counter < hcount) { INC(counter); } } 37

Real-Time Systems Characteristics Timing requirements, Must be deterministic and predictable, Worst-case response times of interest rather than average-case, Large and complex, Distributed, Tight interaction with hardware, Safety critical, Execution is time dependent, Testing is difficult, Operating over long time periods. 38

Real-Time Systems Course In this course, as in most of industry, we will follow the concurrent programming paradigm. Two different environments will be used during the lectures: Java concurrency through Java threads, language used in projects. STORK real-time kernel implemented in Modula-2, close in nature to commercial real-time kernels and real-time operating systems (OS), makes it possible to teach how a real-time kernel is implemented. 39

Java in real-time NO Java was not developed for real-time applications. The just-in-time compilation in Java and the dynamic method dispatching makes Java non-deterministic and slow. The automatic garbage collection makes Java execution non-deterministic. Java lacks many important real-time primitives. 40

Java in real-time YES A nice concurrent programming language. A nice object-oriented language. A nice teaching language. Strong trends towards Real-Time Java. Many of the shortcomings of Java can be handled, e.g., the garbage collection problem. Microsoft s.net and C# (a Java clone) + Google s Android has strongly increased the industrial use of Java. 41