<< Chapter < Page Chapter >> Page >
This module provides an introduction to real-time control of the ECP Model 210 Rectilinear Plant using LabVIEW Real-Time. Students open and execute a simple control algorithm to become familiar with the software environment and lab hardware that will be used in future labs.

Introduction to lab hardware and labview implementation

Objectives

  • Become familiar with how the lab hardware works
  • Understand how the LabVIEW control loop block diagram executes
  • Gain experience in interacting with the VI front panel

Pre-lab

1. In your own words, describe how the implementation VI's block diagram executes. More specifically,explain the execution when the system is idle and when a reference trajectory is commanded.

Lab procedure

Using the model 210 rectilinear plant

  • Connect the drive motor and encoder feedback cables to the Model 210 plant.
  • Unclamp the first mass carriage and remove any springs that may be connected to it. Be sure to position the stop bumpers toallow maximum range of motion for the carriage. Load four 0:5kg brass weights onto the carriage. In this configuration the carriageacts as a rigid-body system.
  • Clamp the other two mass carriages by moving the stop bumpers inward so they constrain the motion of the carriage. You will needto use a 1/4 inch spacer nut between the mass carriage and stop bumpers so as to not engage the limit switches.
  • Power on the PXI by pressing the rectangular button located at the bottom left corner of its front face. Wait approximately 30seconds for the system to boot up.
  • Run LabVIEW on your host PC.
  • Target the PXI real-time embedded controller by selecting RT Target: 146.6.105.x
    (the IP address of your PXI system) from the Execution Target drop-down menu on the LabVIEW startup screen. Wait for LabVIEW to establish a connection.
  • Now click the Open button on the LabVIEW startup screen and locate the file named Lab 1 - Intro to Lab Hardware.vi. The VIfront panel should look like the one in Fig. 1.

Labview

VI Front Panel
  • Enter a loop time of 0.005 seconds then run the VI by clicking on the arrow button at the top-left corner of the frontpanel (because of the way that the VI's block diagram is written, you must enter the loop time before running the VI. If you wish tochange the loop time, you must stop the VI, enter the new loop time, and then run the VI again). At this time, the VI code will bedownloaded from the host PC to the PXI. When downloading is complete, the VI will automatically begin executing on the RTsystem. At this time, the control loop is being run solely on the PXI's real-time embedded controller, not your host PC. However, acommunications loop is running between the two systems to allow the user to interact with front panel activities.
    The communications loop is part of the LabVIEW Real-Time Development system. You do not see its code anywhere in the VI
  • Manually displace the first mass carriage and observe the position measure- ment being shown by the Encoder 1 indicator onthe front panel. Notice that even when the amplifier box is powered off, the encoders still make measurements. The Encoder 2 andEncoder 3 indicators correspond to the second and third mass carriages, respectively. The Encoder 4 indicator is for thependulum accessory and will be used later in the course.
  • Whenever you wish to set the encoder readings to zero, simply press the Reset Encoders control located on the front panel. Trythis now.
  • Now manually displace the first mass carriage until you engage one of the limit switches. Notice how the System Errorindicator lights up. At this point, if any voltage were being output to the drive motor, it would be set to zero and remain thereuntil you press the Clear Error control on the front panel. Press this control now and observe how the System Error indicator lightturns off.
  • You are now going to send a commanded trajectory to the plant. First, power on the amplifier box by pressing the blackbutton. Also, center the first mass carriage between the two stop bumpers and then reset the encoders.
  • Now press the Command Trajectory control on the front panel. The front panel for the Test Signals.vi subVI will pop open. Clickthrough the different types of test signals you can command the system with, and notice the different parameters that you canchange for each signal. Choose one of the signals and enter values for its parameters. Then click on the Preview Trajectory controland observe the signal on the graph indicator. Notice the effect of selecting the Bidirectional Inputs control on signals for which youspecify more than one repetition.
  • Choose a sinusoidal signal with an amplitude of 1640 counts. This amplitude corresponds to an input of 0.5 Volts to the drivemotor and 2.6 Newtons to the mass carriage, nominally. You will learn how to calculate these exact values in the next lab. Set thefrequency to 2Hz, and repeat the signal 8 times. Preview the trajectory to check that it is what you expected (it is always goodpractice to preview the test signal before you execute it to make sure you know exactly what will be commanded).
  • Once you have confirmed that the commanded trajectory is correct, press the Execute Trajectory control. The Test Signals.vifront panel will close and the Executing Trajectory indicator on the main VI's front panel will light up. During this time you willsee the plant responding to the command. When the trajectory is complete, the plot data will be computed, as shown by the ComputingPlot Data indicator. Once complete, you may choose which trajectories you wish to view by selecting the corresponding checkbox. If necessary, use the zoom features for the graph indicator to get a better view of the data. Also, select the cursor tool anddrag the cursor over the response plot.
  • Notice that time and amplitude data is shown in the cursor legend. This feature will become useful for performing calculationsin later labs. Take a look at the response of the first mass carriage which you just commanded. Since no control algorithm wasimplemented, you are looking at the open-loop response of the system.
  • If you wish to save the data to a spreadsheet file, enter a filename in the file path box and press the Save Raw Data control.Note that this only saves the time, reference trajectory, control effort, and encoder data, not the velocity or acceleration. Thefile will be saved to the hard drive on the PXI. You can use an FTP client to download the file to your host PC. The file can beimported by any application that can handle spreadsheets such as Excel or Matlab.
  • Also, you can save the response plot for later viewing or inserting into a report. The easiest way to do this is to simplyright click on the plot and choose the Copy Data option (this option will be under the Data Operations menu if the VI is notrunning). Then just paste the figure into an image editing program (such as Paint) or a word processing application that can handleembedded images. Unchecking the Autoscale Y Axis option will help ensure that the pasted image will look the same as it does on theVI front panel. Save the plot of the reference trajectory and response of the first mass carriage that you just commanded andhand it in with the rest of your work.
  • You are now finished with the introduction to using LabVIEW with the Model 210 plant. Press the Abort Control button on thefront panel and turn off the amplifier. At this time take a few minutes to connect the springs and dashpot to the mass carriages soyou will be familiar with this process in future labs. The springs are available in three stiffnesses that you will determine in thenext lab. The damping provided by the dashpot can be varied by turning the knob located at the end. Turning it counterclockwisedecreases the damping while turning it clockwise increases the damping. For a given dashpot setting, you can determine the dampingcoefficient experimentally, as you will see in the next lab.
  • When you are finished turn off the amplifier box. 4.3.2 Using the Model 205 Torsional Plant
  • Connect the drive motor and encoder feedback cables to the Model 205 plant.
  • Mount disks to all three locations. When mounting a disk at the uppermost location, always be sure that you mount the disk onthe underside of the center mounting hub. The bottom and middle disks should be mounted on top of the mounting hub. You shouldmount the disks so that the side with the concentric circles is facing up.
  • Load two 0:5kg brass weights onto the second disk so they both lie on the diameter line of the disk (i.e. 180o apart). Placethe center of each weight 9:0cm from the center of the disk. You can determine this by looking at the concentric circles that havebeen cut into the disks. The inner most circle is 2:0cm from the center, and each successive circle occurs at 1:0cm intervals.
    Whenever mounting weights onto the disks, the threaded locking nut needs to be positioned so that it falls into the groove on the underside of the disk. This helps prevent the weights from jittering around on the disk. The same should be done when clamping the disks as well.
  • Now clamp the upper disk so that it cannot rotate.
  • Take a look at the VI's block diagram. At the far left you will notice that the FPGA code we are referencing is that of theModel 210 (the reference is being established by the pink icon that says ECP 210 on it). However, the FPGA codes of the Model 210 andModel 205 are slightly different, so we wish to change this reference to that of the Model 205. Right click on the icon andchoose Select Target VI. Then locate and select the ECP Timed (FPGA) sync 205.vi file. Once LabVIEW has established thereference, you will see the text on the icon change from ECP 210 to ECP 205. As a final step, right click the icon again and chooseRefresh.
  • Now save the VI by using the File drop-down menu (or alternately by pressing Ctrl + S on your keyboard). Then run theVI.
  • Manually displace the first and second disks and observe the encoder measurements on the front panel. Notice that the encodersmake positive measurements in the counterclockwise direction (with respect to a top view reference position). You will need toremember this for the future when you derive the torsional plant's equations of motion. When you are finished, reset theencoders.
  • Now turn on the amplifier box.
  • Suppose we wish to acquire and view the natural response of the system for a particular set of initial conditions. You canaccomplish this by executing a step with zero amplitude (hence zero control effort is being input to the plant). Select a dwell time of4000ms. This will cause the system to acquire 8 seconds of data. To see why this is true, preview a step input with a nonzero amplitudeand observe how the dwell time is defined for this type of input.
  • Now execute the zero amplitude step and manually displace the first disk by approximately 45o, then release it. Wait for the VIto finish acquiring the data, and then plot the measurements from encoder 1 and 2. Try a different set of initial conditions (e.g.displace the two disks in opposing directions) and observe the response.
  • Reset the encoders and execute a sine sweep with a 500 count amplitude (again, you will learn how to compute the drive motorvoltage and torque corresponding to this amplitude in the next lab). Enter 0:1Hz and 10Hz as your start and end frequencies,respectively. Input a sweep time of 30 seconds and set the sweep method to logarithmic. When the sweep is complete, select to viewthe frequency response from the control on the front panel. This is a 2DOF spring, mass, damper system. Does the response lookfamiliar? Save the plot of the disk 1 and 2 frequency responses and hand it in with the rest of your work.
  • You are now finished with you introduction to the Model 205 plant. Stop the VI by hitting the Abort Control button and turn offthe amplifier box.
  • Close all VI windows and exit LabVIEW. Then turn off the PXI.
  • Return all plant materials to the instructor.

Post-lab

  • Consider a controller Gc(s) in series with a plant G(s) with unity negative feedback. Denote the reference input, trackingerror, control effort, and output by R(s), E(s), U(s), and Y (s), respectively. Draw the block diagram for this system making sure tolabel all the signals.
  • Now consider the hardware we have in the lab. Instead of having just Gc(s), G(s), etc, draw a diagram that shows each pieceof lab hardware and which signal(s) it sends and/or receives. Your diagram should include at least the following:
    • mass carriages or torsion disks (choose either one)
    • amplifier box
    • PXI Reconfigurable I/O module
    • Encoders
    • drive motor
    • PXI embedded controller
  • Be sure to label all forces/torques, displacements, and signals that occur in the system.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Control systems laboratory. OpenStax CNX. Oct 20, 2005 Download for free at http://cnx.org/content/col10302/1.5
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Control systems laboratory' conversation and receive update notifications?

Ask