e Cee 4638 Manual

Embed Size (px)

Citation preview

  • 7/31/2019 e Cee 4638 Manual

    1/34

    University of Colorado

    Electrical, Computer, and Energy Engineering

    ECEE4638 Control Systems LabManual

    Author:Shalom D. Ruben

    Postdoctoral Scholar

    Co-Advisors:Prof. Jason R. Marden

    Prof. Lucy Y. Pao

    August 21, 2011

  • 7/31/2019 e Cee 4638 Manual

    2/34

    Contents

    Preface ii

    1 Preliminaries 11.1 Why Feedback Control? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Why The 3-disk Torsional System? . . . . . . . . . . . . . . . . . . . . . . . 2

    2 Hardware 32.1 Plant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 Actuation and Hardware Gain kh . . . . . . . . . . . . . . . . . . . . . . . . 92.3 Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.4 Hardware Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    2.4.1 Simulation and Implementation Method I . . . . . . . . . . . . . . . 192.4.2 Simulation and Implementation Method II . . . . . . . . . . . . . . . 19

    2.5 System Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.6 Disturbances and Nonlinearities . . . . . . . . . . . . . . . . . . . . . . . . . 20

    3 Software 213.1 Main LabVIEW Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.2 Main FPGA Code (instructor access only) . . . . . . . . . . . . . . . . . . . 243.3 Encoder Count FPGA Code (instructor access only) . . . . . . . . . . . . . . 263.4 Stiffness Data Acquisition (for System Identification, instructor access only) 263.5 Free Response Data Acquisition (for System Identification) . . . . . . . . . . 28

    A Safety Hardware Warnings! 29

    i

  • 7/31/2019 e Cee 4638 Manual

    3/34

    Preface

    Welcome to the Control Systems Lab course! This course was developed by Prof. ToddMurphey with the help of Prof. Lucy Pao who developed a similar lab during her tenure atNorthwestern University. This lab and this manual are constantly changing in the attemptto improve the course so suggestions are encouraged.

    It is assumed that you have or are currently taking the theory course (ECEE 4138 Con-

    trol Systems Analysis). This lab course requires learning Mathworks Matlab (which youwill already be learning in the theory course) and National Instruments LabVIEW soft-ware. Although there will be some simulation in LabVIEW, in an attempt to aid in learningLabVIEW, for the most part it sufficient to simulate in Matlab so as to be consistent with thetools used in the theory course. LabVIEW, for the most part, will be used in implementingcontrol algorithm and collecting data in lab experiments.

    This manual described both the hardware and software, in some detail, that will be usedthrough out this course. It is my hope that both the students and future instructors willneed only look to this manual for most of their hardware and software questions.

    Id like to acknowledge that the majority of the LabVIEW code described in this manualwas written or supervised by Prof. Todd Murphey [1]. Marian Chaffe edited the LabVIEWTutorial (Lab 0) and made many useful suggestions. Darren McSweeney, Application Engi-neer at the ITLL, speaks LabVIEW better than he speaks english and is a great help to thiscourse.

    ii

  • 7/31/2019 e Cee 4638 Manual

    4/34

  • 7/31/2019 e Cee 4638 Manual

    5/34

    CFB

    CFF

    P

    uFB

    uFF

    ur

    r

    e y

    y

    Figure 1.3: Feedback/FeedForward Control Diagram

    The combined Feedforward/Feedback combines the best of both world but will not be cov-ered in this course. An illustration of the benefit of the combined structure versus feedback-only on an atomic force microscope can be found in Figure 4. of this paper [2].

    Now back to the question of the benefits of feedback:1.) Can Stabilize a system while feedforward cannot change the dynamics of the plant

    2.) Can improve robustness to un-modelled plant dynamics while feedforward depends onan excellent model

    3.) Rejection of un-modelled disturbances

    For interesting, yet not so rigorous, explanations of control theory, I point you to thisbook [3]

    1.2 Why The 3-disk Torsional System?

    More details to come, but the main points are as follows:

    1. It is a non-trivial system

    2. Although non-trivial, the system can be modeled as coupled second order systems

    3. Able to show the difficulties of controlling a system with a non-collocated actuator andsensor (will see this in the Root Locus lab)

    4. Visualize 3 distinct mode shapes (more relevant for a vibration course but interestingnon the less)

    2

  • 7/31/2019 e Cee 4638 Manual

    6/34

    Chapter 2

    Hardware

    2.1 Plant

    The experimental test bed used in this course, designed and built by Educational ControlProducts (ECP), is the Model 205 Torsional Disk System (TDS) shown in Figure 2.1.

    Figure 2.1: Model 205 Torsional Disk System (TDS)

    The following pages come from the ECP Model 205 TDS Manual and describe the possibleconfigurations of this model and other useful directions.

    3

  • 7/31/2019 e Cee 4638 Manual

    7/34

    ecp !"#$%&'()*((+,-%&.(/&-0'1$%123(4(5$&'#%136(73-%'80%123- !

    1991-1999 Educational Control Products. All rights reserved.!!

    "#!

    (

    )*)( 9:&0%'2.&0"#310#:(;:#3%(

    !

    $%$%&! '()*+,!'()-.*/0*1,!

    23(! /45,06! )317,! *,! 8*+9.(! $%$:&6! -1,)*)0)! 1;! 071! (4! $?@A! 1.! 03.((! (4! $?@5A! >*)B)!

    )9//1.0(>!CD!5!01.)*1,544D!;4(E*C4(!)35;0!73*-3!*)!)9)/(,>(>!F(.0*-544D!1,!5,0*:;.*-0*1,!C544!C(5.*,+)%!!

    23(! )35;0! *)! >.*F(,! CD! 5! C.9)34())! )(.F1! G101.! -1,,(-0(>! F*5! 5! .*+*>! C(40! !/944(D!)D)0(G!7*03!5!"H&!)/((>!.(>9-0*1,!.50*1%!!I,!(,-1>(.!41-50(>!1,!03(!C5)(!1;!

    03(!)35;0!G(5)9.()!03(!5,+945.!>*)/45-(G(,06! &!1;!03(!;*.)0!>*)B6!J&%!!23(!)(-1,>!>*)B!*)!-1,,(-0(>!

    01!*0)!(,-1>(.!CD!5!.*+*>!C(40!K!/944(D!7*03!5!&H&!)/((>!.50*1%!!I)!)317,!*,!8*+9.(!$%$:$5!03*)!>*)B!

    5,>!(,-1>(.!G5D!C(!G1F(>!;.1G!03(!9//(.!)35;0!41-50*1,!01!03(!G*>>4(!41-50*1,!;1.!=1>(4!$?@%!!

    81.!=1>(4!$?@56!03(.(!*)!5,!(,-1>(.!50!(5-3!>*)B!41-50*1,!! CD! (5-3! G1>(4%!

    =503(G50*-54!G1>(4*,+!5,>!/5.5G(0(.!*>(,0*;*-50*1,!1;!03()(!/45,0)!5.(!+*F(,!*,!M35/0(.)!@!5,>!#%!

    !

    mm

    4 Movable

    masses

    each disk

    m

    Rigid belt drive

    Brushless

    Servo

    Motor

    B&! NO&

    PJ

    B$! N

    O$

    PJ

    m m

    m m

    Encoder #1< & A

    Encoder #2< A$

    Encoder #3< "A

    Third encoder/disk

    for Model 205a only

  • 7/31/2019 e Cee 4638 Manual

    8/34

    ecp !"#$%&'()*((+,-%&.(/&-0'1$%123(4(5$&'#%136(73-%'80%123- !

    1991-1999 Educational Control Products. All rights reserved.!

    !

    "#!

    !

    !

    5

  • 7/31/2019 e Cee 4638 Manual

    9/34

    ecp !"#$%&'()*((+,-%&.(/&-0'1$%123(4(5$&'#%136(73-%'80%123- !

    1991-1999 Educational Control Products. All rights reserved.!

    !

    "#!

    !

    6

  • 7/31/2019 e Cee 4638 Manual

    10/34

  • 7/31/2019 e Cee 4638 Manual

    11/34

    ecp !"#$%&'()*((+,-%&.(/&-0'1$%123(4(5$&'#%136(73-%'80%123- !

    1991-1999 Educational Control Products. All rights reserved.!!

    "#!

    $%&! '(&)! (%*'+,!-&)./0! 1%21! 1%&!,.(3(4! 5&+1(4! 26,! 7'++&0(! 2)&!7)*7&)+0! 2+.86&,! 26,! (&9')&,!26,!

    )*121&!/)&&+0!7).*)!1*!*7&)21.*6:!!!

    ;*)!!?=!,.(3!*6+0@!1%&!(&9*6,!,.(3!.(!6*A.62++0!+*921&,!21!1%&!'77&)!(%2/1!7*(.1.*6:!!B/!

    1%&! ,.(3! .(! A*-&,! 1*! 1%&! A.,,+&! 7*(.1.*64! 1%&! &69*,&)!C.++! 5&! *).&61&,! '7(.,&! ,*C6! 26,! 1%&!7*+2).10!*/!.1(!(.862+!C.++!5&!)&-&)(&,:!!D!6&821.-&!'6.10!82.6!.6!1%&!&69*,&)!/&&,5293!5)269%!?&:8:!

    !"#$4!%"#$4!*)!&"#$@!A'(1!5&!,*C6+*2,&,!-.2!1%&!8&6&)2+!/*)A!1*!7)*-.,&!(125+&!?6&821.-&!/&&,5293@!

    9+*(&,!+**7!9*61)*+:!!$%.(!A'(1!5&!,*6&!&-&)0!1.A&!2!9*61)*++&)!.6-*+-.68!&69*,&)!E=!?21!1%&!A.,F

    (%2/1!+*921.*6@!.(!.A7+&A&61&,:!!;*)!2!6*!7*+2).10!9*))&91.*6!.(!6&9&((2)0:!

    !

    !

    =:=:G! $%&!H71.*62+!I.(1')5269&!I).-&!

    $%&!,).-&!.(!92+.5)21&,!21!1%&!/291*)0!1*!*'17'1!277)*J.A21&+0!K:=!LFAMN!2(!277+.&,!1*!1%&!.6&)1.2!

    26,!A20'!5&!(7&9./.&,!-.2!1%&!&J&9'1.-&!

    7)*8)2A4!*)!277+.&,!&J1&)62++0!.6!1%&!92(&!1%&!'(&)!.(!('77+30.68!9*61)*+!%2),C2)&!.67'1(!?&:8:!1%&!

    O!

    P%&6! 1%&! ,).-&! .(! ,).-&6! .6! )&(7*6(&! 1*! 1%&! A*1.*6! 21! 2! (7&9./.9! ,.(3! !!

    @!!A*,&(!! 1%&!A*1.*6!.(!(&6(&,!-.2! 1%&!&69*,&)!21! 1%&!

    2,Q29&61!,.(3:!! $%&!72)1.9'+2)!,.(3!A'(1!5&! (7&9./.&,!.6! 1%&!Disturbance Configuration!,.2+*8!5*J:!!

    .(!277+.&,!2(!2!1*)R'&!?A*1*)!9'))&61@!7)*7*)1.*62+!1*! 26,!.6!1%&!*77*(.1&!

    ,.)&91.*6!*/!1%&!)21&!2(!A&2(')&,!-.2!1%&!&69*,&)!21!1%&!(7&9./.&,!.6&)1.2!,.(3:@!

    B6(1)'91.*6(!/*)!7*(.1.*6.684!2,Q'(1.684!26,!(1*C.68!1%&!,).-&!2)&!8.-&6!.6!;.8')&!=:=F":!

    !

    !

    8

  • 7/31/2019 e Cee 4638 Manual

    12/34

    2.2 Actuation and Hardware Gain kh

    Actuation of the system , from the command desired torque in the computer to actualtorque applied, is a combination of the parts shown in Figure 2.2. First a desired torque

    Digital toAnalog

    Converter

    (DAC)

    Amp Motor Pulley

    TorqueCounts Volts Current Torque Torque

    Figure 2.2: Amplifier, Motor, DAC, and Pulley

    from the software is sent, in counts to the digital to analog converter (DAC) which outputsa proportional voltage (10 volts per 32767 counts for a 16 Bit DAC) to the current amplifierwhich then send current to the motor which applies a torque that is finally magnified by a

    pulley before torque is applied to the system.We neglect any dynamics by the amplifier, motor, and pulley and assume constant gains

    as shown in Figure 2.3. To simplify the system identification, we combine these three gainsas shown in Figure 2.3 and call this the hardware gain kh. You will calculate this gainexperimentally in Lab 3.

    kdac =10

    32,767 ka km kp

    Torque

    Counts Volts Current Torque Torque

    kh

    Figure 2.3: Hardware Gain kh = kakmkp

    The motor in this system is known as a Brushless DC motors which has 3 current inputs(3 phases or coils) to produce the torque (notice in Figure 2.2 that Current is bold faceto signify a vector). The algorithm that the amplifier implements, of converting a desiredtorque (or proportional voltage) to 3 currents, is known as Commutation. More detail aboutthe commutation and current feedback implemented by the amplifier can be found in thefollow pages which were taken for the ECP manual. The main point to keep in mind is that

    due to the low-resolution commutation, implemented by this amplifier, a source of torqueerror (actual torque versus desired torque/voltage command) of up to 13% occurs. Thiserror oscillates and therefore is known as Torque Ripple and the reduction of Torque Ripplecan be found in many research papers.

    9

  • 7/31/2019 e Cee 4638 Manual

    13/34

  • 7/31/2019 e Cee 4638 Manual

    14/34

    ecp !"#$%&'()*((+, -%./&(!01%'0,(2/$,&/&1%#%.01 !

    1991-1999 Educational Control Products. All rights reserved.!!

    ""!

    #$%!#$&%%!'$()%)!#*!())+&%!(,-*)#!./)#(/#(/%*+)!&%)'*/)%!*0!#$%!(1#+(,!2./3./4!1+&&%/#!0*,,*2./4!

    (/5! 1*--(/3%3! 1+&&%/#! 1$(/4%)6! ! 7$%! #$.&3! '$()%! 3*%)! /*#! &%8+.&%! (! 1+&&%/#! 0%%39(1:! ,**'!

    9%1(+)%! ;()!'%&!!#$%!1+&&%/#! ./!#$%!#$.&3!'$()%! .)!#$%!/%4(#.?%! *0!#$%!)+-!*0!#$%!

    1+&&%/#!./!#$%!*#$%&!#2*!'$()%)6!

    !

    Figure 4.3-2 Simplified Schematic of Hall-effect Commutated DC Brushless MotorDrive System(

    !

    @%! ())+-%! #$(#A!3+%! #*! #$%!&%,(#.?%,5!$.4$! 9(/32.3#$!*0! #$%!1+&&%/#! ,**')A!/%(&,5!./)#(/#(/%*+)!

    -(#1$./4!*0!#$%!1*--(/3%3!1+&&%/#!;#*&8+%>!(/3!#$%!(1#+(,!1+&&%/#!*11+&)6B!!@.#$!#$%!&%1#(/4+,(&!

    3&.?%!)1$%-%!)$*2/!./!C.4+&%!D6EFE9A!(#!(/5!'*).#.*/!*/,5!#2*!*0!#$%!#$&%%!'$()%)!(&%!*'%&(#.*/(,!

    )*!#$(#!#$%!1+&&%/#!./!#$%!#$.&3!'$()%!.)!G%&*6!!H*/).3%&!(!"I!%,%1#&.1(,!3%4&%%!./#%&?(,!I! ! ! !"I6!!

    7$%!#*&8+%!./'+#!0&*-!'$()%!J!.)!

    ! 7J!K!!

    (/3!!

    ! LJ!K!FL7!2.#$!LM!K!I!

    2$%&%!

  • 7/31/2019 e Cee 4638 Manual

    15/34

    ecp !"#$%&'()*((+, -%./&(!01%'0,(2/$,&/&1%#%.01 !

    1991-1999 Educational Control Products. All rights reserved.!!

    "#!

    (Figure 4.3-3 Hall-effect Commutation Timing Diagram(

    $%!&'%()*+!&%,-.-/+!.%'0)+1!.2+!34)5!(+6,-.7!8),.!9+!6+:;.-/+!3%'!&2;,+!$,++!?-:)'+!@ IJ@KC! >@KN

  • 7/31/2019 e Cee 4638 Manual

    16/34

    ecp !"#$%&'()*((+, -%./&(!01%'0,(2/$,&/&1%#%.01 !

    1991-1999 Educational Control Products. All rights reserved.!!

    "#!

    (!$%&%'!!()*+,-)./0!1-22+3/3)-* (4-5!/!2-3-5!6)37!,)*+,-)./008!6-+*.!,3/3-5!9-)0,!37:!/)5!;/!.:*,)3):,!/5:?!!! @A!B!@

    ! @(!B!@

    !J7:5:! @AK! @(K! /*.! @I! /5:! 37:!

    !! NA!B!N

    ! N(!B!N

    !45-2!:R+/3)-*!$%&H$!/*.!$%&HQK!37:!)*,3/*3/*:-+,!3-5R+:!P:)*;!

    ! B!&T'!S 3!N

    VR+/3)-*!$%&HU!,7-6,!37/3!W

    $%&%&!!O5-6:! /,,+2:! 37/3! 37:!

  • 7/31/2019 e Cee 4638 Manual

    17/34

    ecp !"#$%&'()*((+, -%./&(!01%'0,(2/$,&/&1%#%.01 !

    1991-1999 Educational Control Products. All rights reserved.!!

    "#!

    !"!#$

    $

    %&'(

    v

    -

    ic

    1

    T!%

    Motor Admittance

    io

    PI Control Phase Winding

    &

    !Figure 4.3-4 Simplified Block Diagram of Analog PI Controller (applies to each motor winding phase)(

    )*+&!+&!,!&-./01!/21-2!&3&4-5!6+4*!4*-!42,0&7-2!780.4+/0!

    ! !

    #'9&:

    #(9&:!!;!

    !"?@A#:!

    ,01!1,5G+0D!2,4+/!

    ! !; *!"'+

    = !#)*! 9>?@AB:!

    H3!.*//&+0D!4*-!,GG2/G2+,4-!C,E8-&!7/2!!"!,01!!#I!C-23!*+D*!J,016+14*&!7/2!.E/&-1!E//G!.822-04!

    94/2F8-:!2-&G/0&-!5,3!J-!,.*+-C-1!9KLMM!NO:?!!P0!./5G,2+&/0!4/!4*-!,.*+-C,JE-!J,016+14*&!7/2!

    4*-!/84-2!C-E/.+43!,01

  • 7/31/2019 e Cee 4638 Manual

    18/34

    2.3 Sensors

    The sensor in this system, known as a Quadrature Encoder, is a digital encoder and thereforedoes not need a analog-to-digital converter (ADC). The encoder sends two channels of digital(High/Low) feedback to the controller. Using the A and B channel phasing, which are 90

    degrees phase shifted, to decode direction and detects the rising and falling edge of eachto generate 4x resolution. This added resolution can be seen in Figure 2.4 by analyzingone period of the A and B channel and noticing that it is possible to read four regions(High/High, Low/High, Low/Low, and High/Low).

    Figure 2.4: Quadrature Encoder A and B channel outputs

    Our encoders have 4000 Lines per revolution making the disk resolution 16000 encodercounts per revolution due to the 4x magnification and define this encoder gain as kenc. Formore details see the following pages which come from the ECP manual and the encoderFPGA code in the following chapter.

    15

  • 7/31/2019 e Cee 4638 Manual

    19/34

    ecp !"#$%&'()*((+, -%./&(!01%'0,(2/$,&/&1%#%.01 !

    1991-1999 Educational Control Products. All rights reserved.!!

    "#!

    $%&! '()*&+',(-!./)00102! ')34!%)3!'%&! '%1(5!%12%&3'!.(1,(1'-!)05!13!3&(61+&5!)'! )!7)81797!()'&!,:!

    ;""!!!! ! C%&0&6&(! )! 0&?! '()*&+',(-! 13! (&D91(&5! E1>&>! '%&! +9((&0'!

    '()*&+',(-!13!0&)(!1'3!+,7./&'1,0F!'%13!')34!13!&8&+9'&5>!!$%&!/,?&(!.(1,(1'-!')343!)(&!3-3'&7!%,93&!4&&.102!(,9'10&3!10+/95102!3):&'-!+%&+43G!10'&(:)+&!)05!)981/1)(-!)0)/,2!,9'.9'>!!

    !

    Table 4.4-1 The Multi-Tasking Priority Scheme of the Real-Time Controller!

    3'.0'.%4( 5#67(8&69'.$%.01( :&';.9&(H!M!!$%13!79/'1A')34102!3+%&7&!13!(&)/1=&5!@-!!)!(&)/A'17&!+/,+4!?%1+%!2&0&()'&3!.(,+&33,(!

    10'&((9.'3>!

    !

    !

    !

    )*?( :&160'6!

    $%&(&!)(&!'?,!10+(&7&0')/!(,')(-!3%):'!&0+,5&(3!93&5!10!'%&!T,5&/!N#U>!!V)+%!%)3!)!(&3,/9'1,0!,:!

    W###!.9/3&3!.&(!(&6,/9'1,0>!!$%&3&!&0+,5&(3!7&)39(&!'%&!10+(&7&0')/!513./)+&7&0'!,:!'%&!7,',(!

    )05!'%&!/,)5!3%):'>!

    !

    $%&!&0+,5&(3!)(&!)0!,.'1+)/!'-.&!?%,3&!.(10+1./&!,:!,.&()'1,0!13!5&.1+'&5!10!X129(&!W>UAH>!!R!/,?!

    .,?&(! /12%'! 3,9(+&! 13! 93&5! ',! 2&0&()'&! '?,! Y#! 5&2(&&3!,9'! ,:! .%)3&! 31093,15)/! 3120)/3!,0! '%&!

    5&'&+',(3!)3!'%&!7,6102!./)'&!(,')'&3!?1'%!(&3.&+'!',!'%&!3')'1,0)(-!./)'&>!!$%&3&!3120)/3!)(&!'%&0!

    3D9)(&5!9.!)05!)7./1:1&5!10!,(5&(!',!2&0&()'&!D9)5()'&!/,21+!/&6&/!3120)/3!391')@/&!:,(!10.9'!',! '%&!

    .(,2()77)@/&!2)'&!)(()-!,0! '%&! (&)/A'17&!B,0'(,//&(>! !$%&!2)'&! )(()-!93&3!'%&!R!)05!P! +%)00&/!

    .%)3102! ',! 5&+,5&! 51(&+'1,0! )05! 5&'&+'3! '%&! (13102! )05! :)//102! &52&! ,:! &)+%! ',! 2&0&()'&! W8!

    (&3,/9'1,0!!3&&!X129(&!W>UAN>H!!$%&!.9/3&3!)(&!)++979/)'&5!+,0'109,93/-!?1'%10!NWA@1'!+,90'&(3!

    E%)(5?)(&!(&213'&(3F>! ! $%&!+,0'&0'3!,:! '%&! +,90'&(3!)(&! (&)5!@-! '%&!SIO!,0+&!&6&(-!3&(6,! E,(!

    +,779')'1,0F! +-+/&! '17&! )05! &8'&05&5! ',! WZA@1'! ?,(5! /&02'%! :,(! %12%! .(&+131,0! 097&(1+)/!

    .(,+&33102>!!$%93!'%&!)++979/)'1,0!,:!&0+,5&(!.9/3&3!.(,615&3!)0!)029/)(!.,31'1,0!7&)39(&7&0'!

    E3120)/F!:,(!'%&!3&(6,!(,9'10&3>!

    !

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!HQ>&>!'%&!5134!&0+,5&(!(&3,/9'1,0!&::&+'16&/-!@&+,7&3!H[G###!+,90'3!.&(!(&6,/9'1,0>!

    16

  • 7/31/2019 e Cee 4638 Manual

    20/34

    ecp !"#$%&'()*((+, -%./&(!01%'0,(2/$,&/&1%#%.01 !

    1991-1999 Educational Control Products. All rights reserved.!

    !

    "#!

    !

    Figure 4.5-1 The Operation Principle of Optical Incremental Encoders((!

    !

    !

    Figure 4.5-2. Optical Encoder Output((!

    !

    !

    17

  • 7/31/2019 e Cee 4638 Manual

    21/34

    ecp !"#$%&'()*((+, -%./&(!01%'0,(2/$,&/&1%#%.01 !

    1991-1999 Educational Control Products. All rights reserved.!!

    "#!

    )*3( 456.,.#'7(41#,08(95%$5%(:;7

  • 7/31/2019 e Cee 4638 Manual

    22/34

    2.4 Hardware Loop

    Now combining a controller block along with all that was described in the previous sectionswe get the hardware loop in Figure 2.5.

    C kdac kh P kencr e u v u y y

    yP

    Figure 2.5: Hardware Loop

    The notation hat refers to the variable in the software such the variable y, angle,would be in radians but after it has entered the computer through the encoder it be-comes y in encoder counts. Also notice that the command u, torque, is the output of

    the amp/motor/pulley (kh) while u is the desired command from the controller in torquecounts before it inters the DAC. When implementing the algorithm, C needs to be codedin the computer. There are two recommended methods to simulating the system and thenimplementing and are described as follows:

    2.4.1 Simulation and Implementation Method I

    The real plant P (toque to radians) can be combined with the other gains, as shown inFigure 2.5, to form P (torque counts to encoder counts) giving the loop shown in Figure 2.6.

    C Pr e uy

    y

    Figure 2.6: Simulation and Implementation Method I

    It is now easy to design, simulate, and implement directly C.

    2.4.2 Simulation and Implementation Method II

    The second method is to design a controller C based on the real plant P as shown inFigure 2.7.

    After design and simulation, the controller C, must be converted to C before coding intothe computer by:

    C =C

    kdackhkenc

    19

  • 7/31/2019 e Cee 4638 Manual

    23/34

    C Pr e u y

    y

    Figure 2.7: Simulation and Implementation Method II

    2.5 System Specifications

    The following data was inlcuded in the ECP Model 205 Documentation listing the valuesfor the system parameters described in this chapter. The class will spend time verifying orestimating these parameters and it is important to note that many of these parameters willchange:

    Parameter Value

    Disk Inertia (each) 0.0019 kg-m

    2

    Motor/Drive Inertia 0.005 kg-m2

    Weights (each) 0.5 kgSpring Constant (each half) 2.7 Nm/rad

    Pulley Magnification kp 3 Nm/NmDrive Motor Torque Constant km 0.086 Nm/A

    Drive Motor Amplifier Current Gain ka 1.5 A/VEncoder Resolution kenc 4000 lines per Rev (or 16000 counts/rev)

    DAC Resolution kdac 10 Volts per 32767 counts

    Table 2.1: Values of system parameters described in the previous sections of this chapter

    2.6 Disturbances and Nonlinearities

    The hardware system can be modeled as an ideal system of coupled second order systemsbut we will find through out this course that we are making certain assumptions. Here area few disturbances/nonlinearities that will present themselves in the experiments:

    1. Friction in the motor and pulleys

    2. Amplifier nonlinearities

    3. The commutation of the brushless motor has a Torque Ripple of up to 13%

    4. vibration

    5. sensor noise

    6. actuator/amplifier saturation

    20

  • 7/31/2019 e Cee 4638 Manual

    24/34

    Chapter 3

    Software

    The implementation of the controller is a combination of two sources of code and both arewritten in LabVIEW. The main control algorithm is written in a Simulation Loop onthe computer while the calculation of the encoder counts (from the A and B channels as

    described in the previous chapter) and the output to the DAC is performed by the FieldProgrammable Gate Array (FPGA). In our case, think of the FPGA as a processor thatperforms simple tasks very fast. Note (especially instructor) that the control loop runningon the computer, running windows, is not a real-time task and will deteriorate the controldue to jitter as the sampling rate increases. At a rate of 100 Hz it is not necessary to runthis control algorithm on a real-time processor, but if fast rates are desired in the futurethan acquiring hardware (such as the SB-RIO) which has both an FPGA and a real-timeprocessor would be advised.

    The following sections describe both the environment where the controller will be coded,running on windows, the FPGA code (although students have no access to this code since

    communication between hardware and computer need not be altered unless hardware changes),and some programs used in system identification.

    3.1 Main LabVIEW Interface

    The main LabVIEW code where the controller is added is shown in Figure 3.1. Notice thatthere are 3 parts that make up this this code:

    1. FPGA Initialization

    2. Control Loop

    3. Close FPGA

    The following figures take a closer look at each of the three parts, starting with Figure 3.2.The important code segments are labeled with capital letters and their uses are described inthe following list.

    21

  • 7/31/2019 e Cee 4638 Manual

    25/34

    Figure 3.1: Main LabVIEW Interface Code for the TDS

    Figure 3.2: Part 1 of Main Interface Code

    A.) The name of the FPGA

    B.) Open the FPGA compiled file

    22

  • 7/31/2019 e Cee 4638 Manual

    26/34

    C.) Download onto the FPGA

    D.) Start the FPGA

    E.) Set the Encoders to zero

    The second part, of which the controller is coded, is shown in Figure 3.3. The important

    Figure 3.3: Part 2 of Main Interface Code

    code segments are labeled with capital letters and their uses are described in the continuedlist.

    F.) Define the sampling rate of 100 Hz (see Figure 3.1)

    G.) The space where the control code will be place, in between the encoder outputs (Feed-back) and the voltage input (Controller command)

    H.) You should always stop the simulation loop using the ABORT button

    I.) The program stops if the angle between the 1st and 2nd disk or the 2nd and 3rd is toolarge (defined value shown is 650 counts)

    Make notice of location G where the controller will be coded.Finally the FPGA is closed and a voltage of 0 is sent to the DAC, all of which are

    implemented in the last part of the code (Figure 3.4) and the list continues.

    J.) When the program is ABORTED, by the user, or KILLED, due to the relative anglerestriction, the voltage output is set to zero counts

    K.) Close FPGA file

    23

  • 7/31/2019 e Cee 4638 Manual

    27/34

  • 7/31/2019 e Cee 4638 Manual

    28/34

    The main code behind the interface in Figure 3.5 is shown in Figure 3.6.

    Figure 3.6: FPGA Main Code

    The code portions are labeled with capital letters and the descriptions are listed as:

    A.) The A and B channel of each encoder are read in to the FPGA

    B.) The encoder counts are calculated using the A and B channels (see following section forcode)

    C.) The results of the encoder counts are stored into the variables

    D.) Deflection Limit and Motor Voltage variables are read

    E.) The motor voltage is multiplied a negative so that positive Motor Voltage producespositive torque (could swap wires to get the same affect) and then sent to the DAC

    25

  • 7/31/2019 e Cee 4638 Manual

    29/34

    3.3 Encoder Count FPGA Code (instructor access only)

    Item B of Figure 3.6 is a function that calculates the encoder counts. The code for thisfunction is shown in Figure 3.7.

    Figure 3.7: FPGA Encoder Code

    The details are itemized here:

    A.) This is the main logic section of the code where +1 or -1 are added to the previousencoder count value.

    B.) This code is a bit mysterious but it is believed that it is intended to prevent count errorswhen the system is stopped and is oscillating at an edge of the A or B channel.

    3.4 Stiffness Data Acquisition (for System Identifica-tion, instructor access only)

    The code shown in Figure 3.8 is used to produce a angle versus voltage (proportional totorque by kh) to compare to the stiffness of the torsional spring.

    If the stiffness is known, then kh can be calculated using this plot. Notice also that thisloop is not a simulation loop but a standard while loop. Omitted from the code is the firstand third parts of the main LabVIEW interface code which are necessary to open the FPGAcode and close the FPGA coed. The code is labeled and described by the following list:

    26

  • 7/31/2019 e Cee 4638 Manual

    30/34

    Figure 3.8: Code to collect stiffness data

    A.) A vector of command voltage to the amplifier is defined between 2000 counts (thisvalue makes sure that the command is less than 1 Volt command to the amplifier)

    B.) The ith element of the array is sent to the DAC

    C.) Wait 3 seconds so system is at steady-state

    D.) Record encoder count

    E.) Plot

    F.) Save to array and save to file

    27

  • 7/31/2019 e Cee 4638 Manual

    31/34

    3.5 Free Response Data Acquisition (for System Iden-

    tification)

    The code shown in Figure 3.9 collects response data when a student rotates disk 1 or 3 (whiledisk 2 is clamped) for parameter identification.

    Figure 3.9: Code to collect free response data

    The following list describes the code:

    A.) Scales the x-axis of the plot to match time

    B.) Voltage to the motor is set to zero

    C.) Set the length of record time in samples

    D.) Set sampling rate (using wait function) to 100 Hz

    E.) Save to array and save to file

    28

  • 7/31/2019 e Cee 4638 Manual

    32/34

    Appendix A

    Safety Hardware Warnings!

    The following safety points come mainly from the ECP Model 205 manual found in thefollowing page.

    1. Never turn on the amplifier without a lab member holding a finger on the amplifierOFF switch

    2. Never turn on the amplifier while the middle disk is clamped

    3. The peak rating of10 Volts to the amplifier should not be exceeded (need to have asaturation block in code)

    4. RMS amplifier current command should not be more than 3.5 Volts

    5. At stand-still (motor stalled) the RMS amplifier current command should be limitedto 1 Volt

    6. Make sure that weights are securely fastened before powering amplifier

    7. Keep clear of torsional system during experiments so clothing and or hair doesnt getcaught

    8. Always use the ABORT button rather than stopping the LabVIEW code so thatthe output voltage to the motor gets set to ZERO. If you STOP the code, than thelast commanded voltage will stay and the system will spin out-of-control! (hence alabmates finger on the amplifier OFF switch)

    29

  • 7/31/2019 e Cee 4638 Manual

    33/34

    1

    This document provides the pertinent information of Model 205 (2 Disk Torsional) and Model

    205a ( 3 Disk Torsional) apparatus when shipped as "plant only" without the ECP Controller.

    The following points should be carefully read and understood prior to operating the mechanism:

    1. It is the user's responsibility to provide the +/- 10 volts current Command Signal(s) to the

    motor amplifier. This signal should be brought into the Control Box through the inputs

    marked "DAC". Connect the return signal to the input marked "DAC/". For systems with

    Model 205-d option DAC1 is the Drive Motor input and DAC2 is the Disturbance Motor

    input.

    2. It is the user's responsibility to adhere to the amplifier(s) current rating by limiting the current

    Command signal to +/- 10.0 volts peak. The peak rating should not be exceeded for morethan 1 seconds in a period of 60 seconds. The RMS current command should not be more

    than +/- 3.5 volts. At stand- still (motor stalled) the RMS current command should be

    limited to +/- 1.0 volts

    3. It is the users responsibility to provide the +5 volts power to the encoders and accept the

    standard A QUAD B signals from each encoder.

    4. Make sure that the clamps on the disks are removed prior to motor actuation.

    5. Do not twist one end of the flexible shaft (torsion rod) more than 40 degrees with respect to

    the other end.

    6. Please read the WARNING notes below and pay attention to the CAUTION note on the

    mechanism.

    FUSES:

    There is a 3 A slow blow fuse inside the fuse holder at the back side of the amplifier box. In

    addition, another 3 A slow blow fuse is installed on the amplifier chassis.

    WARNING #1: To replace either of the fuses you MUST positively DISCONNECT the power

    cord from the amplifier box. To avoid electric shock, the power cord must not be attached to

    the Amplifier Box whenever its cover is removed.

    WARNING #2: DO NOT apply power to the amplifier box (i.e. supply power to motor) unless

    you have made sure that the weights are securely fastened. This check must be made every timethe mechanism is to be activated.

    WARNING #3: When power is applied to the motorstay well clear of the mechanism at all

    time and make sure that loose clothing and hair are kept well clear of the mechanism.

    ECP Model 205 With A51 Plant Only-NI Documentation

    1993-2006 Educational Control Products. All Rights Reserved

    30

  • 7/31/2019 e Cee 4638 Manual

    34/34

    Bibliography

    [1] T.D. Murphey and J. Falcon. Programming from the ground up in controls laboratoriesusing graphical programming. In Proceedings of the IFAC Advances in Control Education(ACE), 2006.

    [2] L.Y. Pao, J.A. Butterworth, and D.Y. Abramovitch. Combined feedforward/feedbackcontrol of atomic force microscopes. In American Control Conference, 2007. ACC 07,pages 3509 3515, july 2007.

    [3] Iven Mareels Pedro Albertos. Feedback and Control for Everyone. SpringerBerlin Heidelberg, 2010. Note: From CU this book can be accessed athttp://www.springerlink.com/content/978-3-642-03445-9/contents/.