The goal of this practicum is to design a proportional control system that will provide your robot with the ability to track desired depths and meet transient response specifications.
You will use the simulator that you used in LabVIEW in practicum 1B to validate your control system. Instead of controlling the simulated robot motor with a PWM signal (like you did in P1B), you will control the motor with a P control system. As you will find out below, this will all be integrated into the block diagram of your LabVIEW simulator.
Additionally, we will be making some final preparations for putting your robot in the WATER!
Adding feedback into LabVIEW model
N/A
P control, block diagrams and corresponding equations
Save VI’s after completing Section 5
Turn in Submission Sheet (found on Sakai)
VDSim_PWM.vi
DoubleIntegration.vi
AccelCalc.vi
1xThermistor
You will need your LabVIEW simulator (VDSim_PWM.vi) from the library you modified in Practicum 1C. If you do not have your VDSim_PWM.vi, you can use the library on Sakai located under “Resources/Practicums/LabView Code” and called "E79_F19_PostP1C.llb". Recall that the simulator allows a user to input the robot’s mass, buoyancy force, and drag coefficient as model parameters (see Figure 4.1). The simulator also allows a user to set the motor thrust PWM signal in real time to drive the robot up and down.
Create a copy of VDSim_PWM.vi called VDSim_Control.vi in your library.
For the simulations you will conduct in this practicum, use your robot specific parameters for
Mass (found in practicum 1C from the force measurement stand)
Buoyancy force (also found in practicum 1C from the force measurement stand. Remember that the buoyancy force should approximately cancel out the gravitational force for a neutrally buoyant robot)
Drag coefficient (calculated in problem set 3B based on step response of your robot from practicum 2D).
The magnitude of all these numbers should be positive going into the simulator. Your acceleration equation in the VI already takes care of signs.
If you've misplaced the values for your robot, check with a prof or proctor. Type these values into the vi front panel and save the file. Do not run the vi until you have these values set.
Figure 4.1: The Simulator VDSim_PWM.vi.
Add logging to your simulation. To make this work, you will need to modify a few settings and make sure the signals being logged (position, velocity, acceleration) are the correct data type. If you can’t find any of the functions listed below, right click on the block diagram, and click the search button.
In the block diagram, add a Write To Measurement File function block (see Figure 4.2). To see where this part of the block diagram fits into the Complete Practicum 5A block diagram, please see Figure 4.3.
Right click the Write To Measurement File function and set the properties according to Figure 4.4.
A few data type conversions need to happen since the Write block only accepts merged Dynamic Data types as Signal inputs.
Take the acceleration, velocity and position signals and convert them to arrays using the Build Array function blocks (look under Programming/Array). See Figure 4.2, leftmost blocks.
Convert the arrays to dynamic data using the Convert To Dynamic Data function blocks (1D array of scalars – single channel). See Figure 4.2, second column of blocks from the left.
Merge the signals using a Merge Signals function block. Initially, the Merge Signals function block may have two inputs and one output. Expand the block vertically to increase the inputs to three. See Figure 4.2, block in the center before the write to measurement file block.
NOTE: If the search button is not working for you, the necessary functions for converting and merging are under "Express > Signal Manipulation". Arrays and data writing are under "Programming".
Run and stop the simulator. Make sure you can find the file that was just written, and that it has 4 columns of data – time, acceleration, velocity, position. If your result isn't making sense, you may want to check your acceleration block by double clicking it and going to the block diagram. Make sure the equation is what you found in practicum 1B.
Figure 4.2: Block diagram with functions for logging.
Figure 4.3: Complete practicum 5A block diagram with P control.
Figure 4.4: Adding a Write To Measurement File Function.
REMINDER: When closing a VI, a window may pop up prompting you to save the VI and any lower level VI’s used within it, even if you didn’t make any changes. This will happen with any VI from a library that was just downloaded onto the computer, such as from Sakai or Google Drive. When that window pops up, just click the “save all” option, then it shouldn’t pop up again for that VI as long as it stays on the computer. If you need to re-download a library, then this window will pop up when closing the VI’s from that library, and you will need to save them once again so the window won't pop up anymore.
In your VDSim_Control.vi front panel, change the label of your PWM Vertical Point Slide (Thrust) control to be “Desired Position.” See Figure 5.1.
Change the scale on your “Desired Position” slide control to range from 0 to 10. See Figure 5.1.
Add a digital display to your “Desired Position” slide control by right clicking on the slide control, selecting Visible Items, and then Digital Display. See Figure 5.1.
Add an additional Vertical Pointer Slide control, and name it “K_P”. This control will allow users to set the proportional control gain. See Fig. 5.1.
Change the scale on your “K_P” slide control to range from -100 to 1000.
Add a digital display to your “K_P” slide control by right clicking on the slide control, selecting Visible Items, and then Digital Display. See Figure 5.1.
Figure 5.1: Modifying the front panel to include control.
In your block diagram, use a Subtract Function block, Multiply Function block, and Feedback Node to create a proportional (P) feedback control system that will allow you to track a desired position (i.e. depth). Recall that the key to P control is to set the control signal f(t) (i.e. throttle in this case) to be proportional to error:
See Fig. 5.2 below for an example of a LabVIEW block diagram of the P control system. This is the same figure as the one shown in Figure 4.2.
Figure 5.2: Complete practicum 5A block diagram with P control.
Determine the natural frequency ωn and damping ratio ζ as functions of KP for the new closed loop system. To do this, you will need to start with your governing equation that you derived based on lumped element mechanical modeling.
In this case, fB is the buoyancy force that should cancel out the mg term. One way to determine the natural frequency and damping ratio is to substitute your control law into the governing equation, take the Laplace transform, and find the transfer function relating Z(s) to Zdes(s). The result should be a second order transfer function from which you can extract the natural frequency and damping ratio.
Predict the step response of the system for three different values of KP and fill in the “predicted” columns of the Table 5.1 on the next page. Calculate the percent overshoot and rise time as functions of natural frequency and damping ratio. Recall (from Module 2 videos 10 & 11) that the maximum percent overshoot MP can be calculated from as:
and the rise time tr as:
The arctangent can be calculated with Excel using the atan2 function, rather than the atan function.
NOTE: atan2 takes two arguments (atan2(x,y) where atan2(x,y) = atan(y/x)). Also the denominator (x) should be the negative term to get positive results. A negative numerator (y) goes clockwise on the radian circle.
If you are using other software, be sure to use a version of the arctangent function that produces an output like that of atan2 so that the calculations will be correct.
Validate the step response predictions of the system for three different values of KP (shown in Table 5.1). For each KP, run your simulator (we suggest stepping between 0 and 10 m), open and analyze the data in your Write to Measurement file, and fill in Table 5.1 on the next page. Add a completed Table 5.1 to your submission sheet.
Design a system, i.e. select a proportional control gain KP, that minimizes the rise time of the system while ensuring MP is less than 20%. Have an instructor check your gain and simulated step response.
Write your gain on your submission sheet. Plot the response and add it to your submission sheet.
SAVE YOUR VI’s! You will need these files in a future practicum!
Save your write to measurement files that were generated in the last few steps. Take a screenshot of your underdamped transient response from the last few steps and record the mass, drag coefficient, and buoyancy force used for the simulation.
You will be needing data from practicum to extract ζ from your MP in an upcoming problem set and compare it with theory.
In the final practicum of the semester, you will need your PCB to be fully functional: your thruster, pressure sensor and temperature sensor need to work simultaneously.
To make sure that all of these systems operate at the same time, dry test your robot at one of the dry test stations (using the instructions on Reference Page). In addition to the previous dry test, be sure that the temperature curve on the VI changes when you heat up your thermistor. If you have not yet added your thermistor to your umbilical, do so now using the umbilical assembly instructions.
If any part of your dry test doesn't work, then test the failing subsystem independently:
To test your thruster, repeat the steps in Section 5 of Practicum 4B manual.
To test your pressure sensor, repeat Section 7 of Practicum 2D manual.
To test your thermistor, repeat Section 4.2 of Practicum 4A .
If you find that your board is not operational and you aren't able to debug it, then notify a proctor or professor. It is important to debug your PCB before deployments in the next few weeks. Demonstrate to a proctor or professor that your thruster, pressure sensor, and temperature sensor are all operational at a dry test rig, including the ability to get the motor to flip directions in P control mode.
Tools Per Station
Laptop computer with LabVIEW
Power Supply
Function Generator
Oscilloscope
Practicum 2C Cable
2 x H20 Bath
Thermometer
Tubing
Graduated Cylinder
Meter stick
Software
VDSim.vi
DoubleIntegration.vi
AccelCalc.vi
Materials Per Kit
1 x Thermistor
1 x Main PCB
1 x Breakout PCB
1x Motor
1 x Pressure sensor