Labsheet Inverted Pendulum System

23
UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering __________________________________________________________________ DEPARTMENT OF ENGINEERING MECHANICS CONTROL LABORATORY LAPORAN MAKMAL/LABORATORY REPORT Kod M/Pelajaran/ Subject Code ENGINEERING LABORATORY VI BDA 37101 Kod & Tajuk Ujikaji/ Code & Title of Experiment Kod Kursus/ Course Code Seksyen /Section Kumpulan/Group No. K.P / I.C No. Nama Pelajar/Name of Student No. Matrik Lecturer/Instructor/Tutor’s Name 1. 2. Nama Ahli Kumpulan/ Group Members No. Matrik Penilaian / Assesment 1. Teori / Theory 10 % 2. Keputusan / Results 15 % 3. Pemerhatian /Observation 20 % 4. Pengiraan / Calculation 10 % 5. Perbincangan / Discussions 25 % Tarikh Ujikaji / Date of Experiment Kesimpulan / Conclusion 15 % Tarikh Hantar / Date of Submission Rujukan / References 5 % JUMLAH / TOTAL 100% COP DITERIMA/APPROVED STAMP ULASAN PEMERIKSA/COMMENTS

description

LABSHEET INVERTED PENDULUM

Transcript of Labsheet Inverted Pendulum System

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    DEPARTMENT OF ENGINEERING MECHANICS

    CONTROL LABORATORY

    LAPORAN MAKMAL/LABORATORY REPORT

    Kod M/Pelajaran/ Subject Code

    ENGINEERING LABORATORY VI BDA 37101

    Kod & Tajuk Ujikaji/ Code & Title of Experiment

    Kod Kursus/ Course Code

    Seksyen /Section

    Kumpulan/Group No. K.P / I.C No. Nama Pelajar/Name of Student

    No. Matrik

    Lecturer/Instructor/Tutors Name

    1. 2.

    Nama Ahli Kumpulan/ Group Members

    No. Matrik Penilaian / Assesment

    1. Teori / Theory 10 %

    2. Keputusan / Results 15 %

    3. Pemerhatian /Observation 20 %

    4. Pengiraan / Calculation 10 %

    5. Perbincangan / Discussions 25 %

    Tarikh Ujikaji / Date of Experiment

    Kesimpulan / Conclusion 15 %

    Tarikh Hantar / Date of Submission

    Rujukan / References 5 %

    JUMLAH / TOTAL 100%

    COP DITERIMA/APPROVED STAMP

    ULASAN PEMERIKSA/COMMENTS

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    2

    COURSE INFORMATION

    COURSE TITLE: ENGINEERING LABORATORY VI (BDA 37101) TOPIC 1: PV POSITION CONTROL (INVERTED PENDULUM SYSTEM) 1. INTRODUCTION

    The IP02 consist of a precisely machined solid aluminium cart driven by a high quality DC Motor equipped with a planetary gearbox. The cart slides along a stainless steel shaft using linear bearings. The cart is driven via rack and pinion mechanism. In the case of IP02, the cart position is sensed by a ten-turn potentiometer. This cart is also equipped with rotary joint with ball bearings to which a free turning erected rod can be attached and it can acts as an inverted pendulum.

    2. OBJECTIVES The objective of this experiment is to control the position of IP02 linear motion servo plant. At the end of the session, student should know the following;

    i) To simulate with a Simulink the IP02 model and to close the servo loop by implementing a Proportional-plus-Velocity (PV) position controller.

    ii) To change, during the simulation, the two gains, Kp and Kv, of the PV controller and observe the effect on the position response.

    iii) To implement with Wincon the previously designed PV position controller in order to command your IP02 servo plant.

    iv) To run the simulation simultaneously at every sampling period in order to compare the actual and simulated response.

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    3

    3. LEARNING OUTCOMES At the end of this experiment, students should be able to understand the modeling of the IP02 control system plant, simulate the system and control it using PV controller scheme by simulation and in real time mode. 4. THEORY

    The IP02 plant system input is the commanded voltage to the DC Motor. Since we want to control the carts position, the plant output is selected to be the carts linear position on the rack as in Figure 1;

    Figure 1: The IP01 / IP02 Plant Input and Output

    Thus the open loop transfer function for the IP02 system which is called G(s), can be written as; Head could be defined as :

    )()()(sV

    sxsGm

    .(1)

    Where mV : Motor voltage x : Carts position

    The mathematical modeling of the IP02 servo plant will provide the above mentioned open loop transfer function, which in turns will be used to design an appropriate controller. The simplified mathematical modeling is given in Equation 2 below. Complete derivation of the transfer function of the IP02 servo plant is given in Reference [1].

    srRBKKKsMrR

    KKrsG

    mpmeqmtmGGmpm

    tmGGmp

    )()( 222

    (2)

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    4

    Where

    mpr : motor pinion radius M : Total mass of the carts system (i.e moving parts)

    G : Planetary gearbox efficiency mK : back electro-motive force (EMF) constant

    GK : Planetary gearbox gear ratio eqB : equivalent viscous damping coefficient

    m : motor efficiency mR : motor armature resistance

    tK : motor torque constant 4.1 POSITION CONTROLLER DESIGN The PV controller design in this laboratory for the IP02 servo plant is based on corrective terms actions done by this controller. The PV controller scheme introduces two corrective terms ; one is proportional (by pK ) to the position error and the other is proportional (by VK ) to the velocity (or the derivative of the actual position) of the plant. Equation 3 below expresses the PV control law, where dx is the reference signal (i.e the desired position to track).

    dt

    tdxKtxtxKtV Vdpm )()( ..(3)

    Figure 2 below depicts the block diagram of the PV control scheme as it will be implemented in this lab session.

    Figure 2: Block diagram of the PV Control scheme

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    5

    4.1 ADDITIONAL THEORY

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    6

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    7

    5. EQUIPMENTS To setup this experiment, the following hardware and software are required:

    i. Power Module: Quanser UPM 1503/2405, or equivalent. ii. Data Acquisition Board: Quanser MultiQ PCI / MQ3, or equivalent. iii. Linear Motion Servo Plant: Quanser IP02. iv. Real-Time Control Software:The WinCon-Simulink-RTX configuration,

    as detailed in the Reference [5], or equivalent. v. PC equipped with licensed MATLAB Simulink connected to item (i), (ii),

    (iii) and (iv).

    For a complete and detailed description of the main components comprising this setup, please refer to the manuals corresponding to available configuration. 6. PROCEDURES 6.1 CONTROLLER DESIGN SPECIFICATIONS

    In the present laboratory (i.e. the pre-lab and in-lab sessions), student will design and implement a control strategy based on the Proportional-Velocity (PV) control scheme, in order for the IP02 closed-loop system to satisfy the following performance requirements (which are time-domain specifications):

    i. The Percent Overshoot (i.e. PO) should be less than 10% (PO 10 %), i.e. = 0.59

    ii. The time to first peak (tp) should be 150 ms, i.e ; tp = 0.15 s From these specifications, the corresponding gains for proportional (Kp) and velocity (Kv) controller are as follows ; Kp = 274.62 V/m Kv = 5.53 Vs/m 6.2 IP02 CONFIGURATION This experiment is designed for an IP02 cart without the extra weight on it. However, once a working controller has been tested, the additional mass can be mounted on top the cart in order to see its effect on the response of the system. As an extension to the lab, the first PV controller design could be modified in order to account for the additional weight. In this lab, it requires student to design a Proportional-plus-Velocity (PV) controller to control the position of IP02 cart with the performance specifications as stated in Section 6.0

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    8

    6.3 CHECK WIRING AND CONNECTION The first task upon entering the lab is to ensure that the complete system is wired as fully describe in Reference [2]. You should be familiar with the complete wiring and connections of the IP02 system during the preparatory session described in Reference [1]. If still unsure of the wiring, please ask for assistance from the Teaching Assistant assigned to the lab. When you are confident with your connections, you can power up the UPM. You are now ready to begin the lab. 6.4 PART 1: SIMULATION OF THE SERVO PLANT WITH PV

    CONTROLLER Start-up Matlab and follow the steps described below: Step1. In Simulink, open a model called s_position_pv_ip01_2.mdl. This

    diagram should be similar to the one shown in Fig.3. It includes a subsystem containing IP02 modeled plant, as well as the PV controller two feedback loops. In order to be conveniently changed on-the-fly, the two controller gains Kp and Kv are both set by slider gains. Check that the signal generator block properties are properly set to output a square wave signal, of amplitude 1 and of frequency 2/3 Hz.

    Step 2. Before begin, student must run the Matlab script called setup_lab_ip01_2_position_pv.m.This file initializes all the IP02 system parameters and configuration variables used by the Simulink diagrams.

    Step 3. Ensure that the Simulink simulation mode is set to Normal. Click on Simulation |Start from the Simulink menu bar, and bring up the Position Response (m) scope. As student monitor the position response, adjust Kqqp and Kv using the slider gains, as depicted in Fig.4 and Fig.5. Try a variety of combinations, and note the effects of varying each gain (one at a time) on the system response. Also bring up the Position Error (m) as well as the Vm (V): Control Signal scopes.

    Step 4. To specifically include in the laComplete the Table 1 which describe the changes in the system response, characteristics tp and PO with respect to changes in Kp and Kv. *Note: Hold one gain constant while changing the other within the preset range. Provide at least 3 suitable plots of the response described in Table 1.

    Step 5. Now that student is familiar with the effects of each one of the two controller gains, enter in the designed Kp and Kv as provided in Section 3.0 to meet the system requirements.

    *Note: the values should fall within the slider limits. Step 6. After running the simulation with the gains set to their calculated

    values, complete the Observation questions on Section 8.0.

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    9

    Step 7 If the simulated response is as expected, you can move to the next part

    in order to implementa real time controller. If your response is close to meeting the set requirements, try fine- tuning the controller gains to achieve the desired response. If the system response is far from the specifications, then re-iterate your design process and recalculate your controller gains Kp and Kv.

    Figure 3 Simulink Diagram used for the simulation of the PV control system

    Figure 4: Slider gain for Kp Figure 5: Slider gain for Kv 6.5 PART 2: REAL TIME IMPLEMENTATION OF THE PV

    CONTROLLER

    After having designed the PV Controller, calculated its two gains satisfying the desired time requirements, and checked the position response of the obtained closed loop system through simulation, students are now ready to implement the designed controller in real time and observe its effect on the actual IP02 Plant.

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    10

    Step 1: Open only one of the following Simulink models:

    q_position_pv_mqpci_ip02.mdl. The student should obtain a similar diagram as shown in Figure 6. The model has two parallel and independents control loops: one runs a pure simulations of PV controller connected to the same plant model as the one developed in the previous lab experiment on the simulation part. The other loop directly interfaces with the hardware and runs the actual IP02 plant.Open both subsystems to familiarize with their composing blocks and take note the I/O connections. Check that the model manual switch for the position set point generation correctly selects the signal coming from the signal generator block, called Square Wave. Also check that the signal generator block properties are properly set to output a square wave signal, of amplitude 1 and of frequency 2/3 Hz. Moreover, the sampling time should be set to 1ms.

    Step2: Before compiling the diagram and running it in real time with WinCon,

    student must enter the previously designed values of Kp and Kv in the MATLAB Workspace. To assign Kp and Kv, type their value in the MATLAB command window. Now students are ready to build the real time code corresponding to the diagram by using the Wincon | Build option from the Simulink menu bar. This command will generate the real time code and will be compiled to the Wincon server. Manually move the IP02 Cart to the middle of the track and make sure that it is free to move on both sides. To start the real time controller, click on the START/STOP button of the Wincon server window. The cart should be tracking the desired setpoint.

    Step3: Open the sink Meas.(0) and Sim.(2) Resp. in a Wincon scope. Students

    can now be able to monitor on-line, as the cart moves, the actual position as it tracks the predefined reference input and compare it to the simulation result produced by IP02 model. Click on the scope button of the Wincon server to open the scope and choose the display that students want to open (e.g Meas.(1) and Sim.(2) resp.) from the selection list.

    Step4: Once the results are in agreement with the desired design requirements

    and the response looks similar to the one displayed in Figure 7, students can move and begin writing report for this experiment. Remember there is no such things as a perfect model, and that the calculated controller gains Kp and Kv, were based on a theoretical and ideal plant model.

    Step5: However, in order to perfectly meet the chosen design requirements of

    the closed loop system, any controller design will usually involve some-form of fine tuning. At this point student should be manually fine-tuning the Kp and Kv based on the previous experimental observations in order to ensure the response matches perfectly the system requirements.

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    11

    Figure 6: Diagram used for the Real-Time Implementation of the PV Controller

    Figure 7: Actual and Simulated Position Responses to a Square Wave Set point

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    12

    7. RESULTS

    a. Complete the Table 1 which describe the changes in the system response, characteristics tp and PO with respect to changes in Kp and Kv

    Table 1: Variation of resulting response due to variety of combinations of Kp and

    Kv. Kp (V/m) =

    Kp (V/m)= Kp (V/m)=

    Kv (Vs/m) tp (s)

    PO (%)

    Kv (Vs/m) tp (s)

    PO (%)

    Kv (Vs/m) tp (s)

    PO (%)

    Kv (Vs/m) =

    Kv (Vs/m)= Kv (Vs/m) =

    Kp (V/m) tp (s)

    PO (%)

    Kp (V/m) tp (s)

    PO (%)

    Kp (V/m) tp (s)

    PO (%)

    b. Show the calculation.(if any) c. Provide at least 3 suitable plots of the response described in Table 1 for

    Part 1 of this experiment. d. Provide at least 3 best plots of the response as in Figure 7 for Part 2 of this

    experiment

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    13

    7.1 CALCULATION

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    14

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    15

    8. OBSERVATIONS 8.1 PART 1 : SIMULATION OF THE SERVO PLANT WITH PV

    CONTROLLER

    After running the simulation with the gains set to their calculated values, specify in your lab reports the following observations;

    i) In simulation mode, does the system response looks like what you had

    expected? ii) Do they match the design requirements?

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    16

    8.2 PART 2 : REAL TIME IMPLEMENTATION OF THE PV

    CONTROLLER i) How does the IP02 carts actual position compare to the simulated

    response? ii) Is there any discrepancy in the results? If so, find some of the possible

    reasons.

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    17

    9. DISCUSSIONS 9.1 PART 1: SIMULATION OF THE SERVO PLANT WITH PV

    CONTROLLER i) Based on the simplified dynamic modeling of the IP02 servo plant, derive

    a block diagram to represent such a transfer function as in equation 10. Represents it in the form of basic mechanical and electrical equations that is being used to determine G(s). The resulting block diagram should have an overall closed loop transfer as in Equation 2.

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    18

    ii) Finally, using the IP02 model parameter values listed in Reference [2],

    evaluate the IP02s open loop transfer function, G(s) that is supplied in this experiment. Determine the plants pole(s), zero(s) and DC gain

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    19

    9.2 PART 2 : REAL TIME IMPLEMENTATION OF THE PV

    CONTROLLER i) From the plot of the actual cart position, measure the final system peak

    time and percent overshoot. Are the values in agreement with the design specifications? You must calculate for each of the plot.

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    20

    ii) During the course of this experiment, were there any problems or

    limitations encountered? If so, what were they and how were you be able to overcome them?

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    21

    iii) Most controllers of this form also introduce integral action into the system

    (PID). Do you see any benefits to introducing an integral gain in this experiment?

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    22

    10. CONCLUSION Deduce conclusions from the experiment. Please comment on your experimental work in terms of achievement, problems faced throughout the experiment and suggest recommendation for improvements.

  • UNIVERSITI TUN HUSSEIN ONN MALAYSIA Faculty of Mechanical and Manufacturing Engineering

    __________________________________________________________________

    BDA37101-Edition III/2011

    23

    11. REFERENCES