ctr448899

  • Upload
    makroum

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

  • 7/25/2019 ctr448899

    1/24

    Control Systems Lab SC4070

    Lecture 4, February 20, 2012

    dr.ir. Alessandro Abate

    Delft Center for Systems and Control

    Delft University of Technology

    The Netherlands

    e-mail: [email protected]

    tel: 015 27 85606

    (slides modified from the original, drafted by Robert Babuska)

  • 7/25/2019 ctr448899

    2/24

    Lecture outline

    Mitigating influence of nonlinearity over linearized control.

    Real-time software.Simulink and Matlab issues.

    Final tips.

  • 7/25/2019 ctr448899

    3/24

    Influence of nonlinearity

    Let us assume that a linear controller has stabilized the system

    under study

    However, some effects of the nonlinearity may still be visible

    process nonlinearity

    friction, stiction

    You may try to improve the linear controller

  • 7/25/2019 ctr448899

    4/24

    Influence of nonlinearity: helicopter example

    u

    y

    10 15 20 25 30 35 40 45 50-0.2

    0

    0.2

    0.4

  • 7/25/2019 ctr448899

    5/24

    Nonlinear feedforward control

    ux

    Nonlinearfunction

    Observer

    Process-L

    uc

    y

  • 7/25/2019 ctr448899

    6/24

    Nonlinear feedforward control: helicopter

    0 50 100 1500.4

    0.3

    0.2

    0.1

    0

    0.1

    0.2

    0.3

    0.4

    time [s]

    [

    rad]

  • 7/25/2019 ctr448899

    7/24

    Effect of stiction in inv. pend.: linear control

    0 10 20 30 40 50 600.5

    0

    0.5

    time [s]

    c

    artposition[m]

    0 10 20 30 40 50 600.2

    0.1

    0

    0.1

    0.2

    time [s]

    an

    gle[rad]

    0 10 20 30 40 50 601

    0.5

    0

    0.5

    1

    time [s]

    controlinput[]

  • 7/25/2019 ctr448899

    8/24

  • 7/25/2019 ctr448899

    9/24

    Real-Time Programming Issues

    off-line vs. on-line vs. real-time

    single process, multiple parallel processes

    single-processor, multi-processor, distributed

    time slicing, scheduling (priorities)

    synchronization, communication

    wait loop vs. interrupt driven

  • 7/25/2019 ctr448899

    10/24

    Wait loop vs. interrupt driven

    Interrupt handler

    Code:A-D Conversion

    Compute control variableD-A conversion

    Wait for tick

    Clock

    Code:A-D Conversion

    Compute control variableD-A conversion

  • 7/25/2019 ctr448899

    11/24

    Real-Time Toolbox for MATLAB

    PC

    MatlabUser

    Driver

    Real-time toolbox

    Real-time kernel(Windows)

    Driver

    Physical processto be controlled

    Driver

    Joystick A/D - D/ACard

    Port Signal

    conditioningPort

  • 7/25/2019 ctr448899

    12/24

    Real-time Simulink templates

    Check the version of Matlab installed (and stick to it)

    Each setup has a Simulink template:

    D:\Opstellingen\Pendulum1D:\Opstellingen\Pendulum2

    . . .

    D:\Opstellingen\Helicopter

    Files:

    ...template.mdl(Simulink file)hwinit.mdl(Matlab script SW/HW definitions)

    Copy all files to your own directory, remove read-only attribute

  • 7/25/2019 ctr448899

    13/24

    More about the templates

    Create your own files through menu: File / Save As ...

    Scopes are configured to export data to Matlabs workspace

    You may change the name through the Parameters icon

    Save data in workspace by the command line command:

    save filename

    (for identification and model validation, presentation and re-

    port)

    To export data you can also use the To Workspace or To File

    blocks

  • 7/25/2019 ctr448899

    14/24

    Procedure

    Switch off the setups electronics box

    Reboot the computer (not absolutely necessary)

    Start Matlab, change to your working directoryOpen your real-time Simulink file

    (first time in the lab: open the template)

    Switch on the setups electronics box

    (with pendulum and wedge: first move the cart by hand to the

    rightmost position and hold it there while switching the box on)Define in Matlabs workspace the sampling time, e.g.:

    h = 0.1

    Start experimenting (small amplitude input signals first)

  • 7/25/2019 ctr448899

    15/24

    Running real-time experiments

    Define suitable duration of experiment through the menu:

    Simulation / Simulation Parameters / Stop time

    Do not change the simulation methodStart simulation by thePlayarrow or pressCtrl-T

    Do not click the mouse or drag windows around during experi-

    ment

    If the computer hangs . . .

    first switch off the setups electronics box, then restart computer

    If only Matlab terminates . . .

    start Matlab again (do not restart the computer)

    type: rtclear all; rtunload;

  • 7/25/2019 ctr448899

    16/24

    Common Matlab and Simulink problems

    Pole placement:place(A,B,P) . . . P must contain poles (not the polynomial)

    do not define poles directly in discrete time

    do not mix continuous and discrete time

  • 7/25/2019 ctr448899

    17/24

    Common Matlab and Simulink problems

    Pole placement:place(A,B,P) . . . P must contain poles (not the polynomial)

    do not define poles directly in discrete time

    do not mix continuous and discrete time

    Vector dimensions mismatch in Simulink:

    check Gain blocks (element-wise vs. vector)not all blocks can be vectorized

    show vector dimensions, disconnect loops temporarily

  • 7/25/2019 ctr448899

    18/24

    Common Matlab and Simulink problems

    Pole placement:place(A,B,P) . . . P must contain poles (not the polynomial)

    do not define poles directly in discrete time

    do not mix continuous and discrete time

    Vector dimensions mismatch in Simulink:

    check Gain blocks (element-wise vs. vector)not all blocks can be vectorized

    show vector dimensions, disconnect loops temporarily

    Stability problems in RT experiments:check the order of states in RT and simulation model

    run model in parallel with the process

    make sure equilibrium coordinates properly defined

  • 7/25/2019 ctr448899

    19/24

    Models linearization:

    index number of the integrators changes usingtrimandlinmod.

    alternative is using operpoint and linearize

    1. in a Simulink modelsystem.mdl, set the state-values of the

    desired equilibrium point as initial values of the integrators

    2.op = operpoint(system) to extract the state informa-

    tion linsys = linearize(system, op) to obtain a lin-

    ear state-space model of your system

  • 7/25/2019 ctr448899

    20/24

    Tips for presentations

    Do not explain mathematical models in detail, do explain whatis measured and actuated.

    Compare simulation and real-time results, evaluate critically.

    Motivate all choices made (e.g., sampling, design parameters).

    Stress own experience, inventions, discoveries, lessons learnt.

    Be visual.

    Max time to be decided.

    Be prepared for questions.

  • 7/25/2019 ctr448899

    21/24

    Tips for reports

    Max 10 pages.

    Include Table of content, Introduction and Conclusions.

    Write concisely, do not include theoretical background.Stress own experience, inventions, lessons learnt. State contri-

    butions of each team member.

    Motivate all choices made (e.g., sampling, design parameters).

    Compare simulation and real-time results, evaluate critically.

    Plots:

    use colors in presentations, but not in reports (use line types)

    use the Matlab function plot, do not paste Simulink scopes

    label axes (variables and units), provide figure captions

  • 7/25/2019 ctr448899

    22/24

    Be rigorous with notations.

    LaTeX preferred to Office Word.

  • 7/25/2019 ctr448899

    23/24

    Literature, on-line resources

    Do not hesitate to lookup articles relevant to your setup

    TU Delft library

    http://www.library.tudelft.nl/

    IEEE Transactions and conference proceedings

    http://ieeexplore.ieee.org/

    Elsevier journals and conference proceedings

    http://www.sciencedirect.com/

    Use keyword search

  • 7/25/2019 ctr448899

    24/24

    Questions ?