Laboratory of Embedded Control Systems Course Presentation Teacher Luigi Palopoli AA. 2011/2012
Aim of the course The aim of this course it to introduce the student (you :=) ) to model based design of embedded control systems This will be done with theoretical lectures (few) and lab experiences (many) The course is a laboratory course. What we expect is that you deliver a complete working project You will organise yourself in groups of two students Please start searching for your mate and let me know in the next class
The project The project will be developed in different phases At the end of each phase, you will produce a different artefact (e.g., a piece of code or a model), which has to be documented by a report There is a specific date for each delivery Those of you who do not attend the class can deliver the project all at once, but I warmly recommend not to (is possible) We will do most of the work together in the class, but you may need to work on your own to complete the different phase
What this course is not... It is not a Signals and System course It is not a Real-Time Operating Systems course It is not an automatic control or a digital control course......but you will need a little bit of all of this and we will help you...
What this course is... In this course you will be offered a comprehensive look on the entire model based development methodology In detail, you will learn how to 1. Formulate design specifications 4. Design a controller for the system that fulfils your goals 2. Construct a model of the system that you want to control (plant) 3. Identify the physical parameters of the system 5. Simulate the closed loop system and asses its performance 6. Generate a Software implementation for your controller
A plant The objective of this course is to control a system that we define a plant A plant is a continuous time system described by a set of differential equations Example (Spring + Damper)
Model of the Plant Very often we will use the transfer function (Laplace Transform) to express the plant in a mathematically tractable way In our example:
Model We can easily translate this equation into a scicos model Double-clicking on the transfer function block we can insert the physical parameters and simulate the system
Simulation Step Response
Physical Parameters The behaviour of the system is obviously much different if we change the physical parameters
Non-idealities To make our model more realistic, we can refine our model inserting blocks that model non-idealities For instance, actuators are not able to produce any input value an utility car is different from a Formula 1 racing car we can model this by inserting in the model a saturation block The system is no longer linear (why?) but we can consider its behaviour as linear ad long as we do not exceed the bound of the saturation
Saturation Non-idealities
Performance Specs Once we have a model for our system we can formulate performance specification (e.g., related to the step response) Overshoot Settling time Rise time
Physical Parameters Essential to our purpose is to determine the choice of parameters whereby our model best fits the model To do this we can measure the physical quantities if easy/possible Carry out the identification procedure Identification: carry out a large set of experiments and collect data find the set of parameters that minimise the distance between our system and the model
Control Design At this point, we are in condition to design a feedback controller that fulfils the specs. If we make a feedback connection of a plant P(s) with a controller C(s), we get a new transfer function given by: The presence of the controller at the denominator moves the poles and changes the dynamics
Feedback Control + r e C(s) u - P(s)
Digital Implementation The controller we have designed in this way is a continuous time system (a differential equation) If we want to implement it in a digital computer, we need to transform it into a numeric algorithm Instrumental to this goal is the introduction of a sampling mechanism for the sensors and of a Zero order Hold (ZoH) for the actuators
Feedback Control + r Sampler C(z) ZoH - P(s)
What is the digital implementation C(z)? Assume that our controller is given by In terms of differential equations:
Digital Implementation If we sample periodically, the derivative can be approximated by the backward difference (we will see better approximations.)
Z-transform notation It is useful to express the difference equation in terms of the Z- transform It plays the same role in discrete time as the Laplace transform plays in continuous time The one step forward operator in the time domain corresponds to multiplication by z in the Z domain and the one step delay operator to multiplication by 1/z The controller equation becomes:
Digital approximation We can account for the digital approximation in our scheme and simulate the system
and finally. Once we are happy with the simulations, we can write a real time task (implemented in a RTOS) that translates the algorithm into code double e_1, u_1;! void task () {!!double u, e;!!e = get_from_sensor();!!u = u_1 + kp (e-e_1)+ki*e;!!output(u);!!e_1 = e:!!u_1 = u;! }!
Schedule Lecture 1: Introduction Methodology Introduction to Scicoslab Lecture II: Scicoslab Matrix computation Scripts and functions Plotting data Modelling and simulating a CT system with Scicos
Schedule Lecture III: Recap on Laplace transform Lecture IV: Using Scicos to represent dynamical systems (Examples)
Schedule Lecture V: Modelling a second order system (The motor) non linearities Lecture VI: First experience with the Lego Mindstrom
Schedule Lecture VII: collecting data from lego mindstorm Lecture VIII: System Identification
Schedule Lecture IX identification of Lego Motors Lecture X: Identification of Lego Motors
Lecture XI: Control of SISO system Schedule root locus [DELIVERY] Lecture XII: Control of SISO systems Filtering Identification
Schedule Lecture XIII: Control design for the motor Lecutre XIV: Control design for the motors
Lecture XV: Digital implementation Schedule Lecture XVI: Digital Implementation (application to the example)
Schedule Lecture XVII: Digital Implementation of controllers practical application for the motor (SCICOSLAB) Lecture XVIII: Digital implementation of controllers
Schedule Lecture XIX: Modelling and simulation of the larger system (Kinematic Control) [Delivery Motor Control] Lecture XX: Kinematic control design
Schedule Lecture XXI: Kinematic control Design Application on the comprehensivemodel Lecture XXII: Kinematic control Design
Schedule Lecture XXIII: Implementation of digital controller for the whole system Multitask implementation Lecture XXIV: Implementation of the digital controller After One week delivery