None Lab_5

Challenge

Using the workstation and the encoders on the motor, you will control the velocity for two configurations of the electromechanical system using closed-loop control.

  • Motor alone
  • Motor with load connected with a compliant shaft (spring)

Implementing a Controller for the "Motor Alone" Configuration

Model Construction: Motor Alone

Even though your quite new to trying to designing a closed-loop controller, you have already seen that you will need a plant transfer function in order to design a closed loop control system. Therefore, you will need to experimentally establish suitable plant transfer functions for the motor alone configuration you will control in this lab.

As you did in Lab 4, you will fit a dynamic model to the data. However, in this assignment, you won't need to determine the physical parameters (e.g. $J_m$, $b_m$, etc) because we will FIX THE SYSTEM SO IT WILL NOT CHANGE between the time we establish the plant behavior and the time we control the system.

Because we can expect the parameters to be constant, you can characterize the plant's behavior directly in terms in the transfer function's numerical characteristics (e.g. steady state gain, time constant, damping ratio, and natural frequency, as appropriate).

To establish the plant response, you will first record an OPEN LOOP step response, because this represents how the system acts without closed loop control.

Make a copy of your Arduino code from Lab 4 to provide a step input for the motor-alone configuration (REMOVE THE FLEX COUPLER CONNECTING THE MOTOR TO THE LOAD INERTIA).

  • Develop your transfer functions in the OCTAVE cells below for the motor alone configuration.
  • Plot your data and your fitted model on one set of axes properly labeled.
  • Make sure to display your plant transfer function:
In [1]:
% YOUR CODE HERE
error('No Answer Given!')
error: No Answer Given!

Controller Design: Motor Alone

Use the plant transfer functions you developed from your data to design a propritional controller. Using the characteristic equation of the CLOSED LOOP transfer function, set the closed loop time constant to be 0.033 sec and report the gain required to achieve that performance.

Perform all the calculations in the OCTAVE cells below and clearly display your calculated gain.

In [2]:
% YOUR CODE HERE
error('No Answer Given!')
error: No Answer Given!

Controller Validation: Motor Alone

To assess the usefulness of your controller, you can compare your predicted responses to actual measured responses while the system is under closed loop control. However, to perform the experiment you will need to modify your Arduino code so it implements your closed loop controller design.

SAVE THE CODE YOU USED TO GENERATE YOUR OPEN LOOP RESPONSE in the section above. Then, in a new file, modify the code to implement closed-loop control:

  • Use the potentiometers to set the desired angular velocity before and after a step input (instead of motor voltage).
  • Similar to lab 4, POT1 will set an initial angular velocity. When BTN1 is pressed, a step in angular velocity will be added based on the value of POT2. The maximum requested angular velocity should be limited to 45 rad/s.
  • Display the initial velocity on the first line of the LCD display and the step change in velocity on the second line. AS IN LAB 4 DO NOT DISPLAY TO THE LCD WHILE IN RUN MODE. The display slows down the program considerably and will affect your controller's ability to respond to changes in the speed of the motor.

In Block 4:

  • Calculate the error between the current desired angular velocity and the measured angular velocity
  • Calculate the voltage input to the motor based on your controller design
  • Send the controller determined voltage to the H-Bridge in the form of a PWM value.
  • Do not print to the LCD while the controller is running. Delays are the enemy of closed loop control. Make sure that any Serial prints you employ use a baud rate of 115200, and that you have no artificial (added) delays in your code.

Provide your Arduino code with the proper formatting in the markdown cell below:

YOUR ANSWER HERE

Capture the response to a step input to the desired velocity and, in the OCTAVE cell below, graph the model predictions vs the actual data for your closed loop response on the same axes.

In [3]:
% YOUR CODE HERE
error('No Answer Given!')
error: No Answer Given!

It is important that your control signal does not "saturate". This occurs when you request a voltager HIGHER than you can deliver. To confirm you aren't saturating, Plot the PWM values sent to the motor for the same time span as the data above to show that the applied PWM signal does not reach 255 at any time during the response.

In [4]:
% YOUR CODE HERE
error('No Answer Given!')
error: No Answer Given!

Examining your results, list below any questions you have regarding the comparison of the data to the models. If you have no questions, list your conclusions.

YOUR ANSWER HERE

Implementing a Controller for the "Motor-Spring-Load" Configuration

In Lab 4, you may have determined that both the motor alone and the motor-rigid shaft-load have a roughly first order response. However, if a spring connects the motor and the load, they are now independent energy storing elements. With the spring it means that a 3rd order model will be required to captured the dynamics. As before, expecting the physical elements of this system WILL NOT change so we will establish the transfer function without using a physics based lumped parameter model.

Since we don't have experience with 3rd order systems, we'll use our knowledge of superposition to allow us to use transfer function forms we are familiar with. Specifically, the 3rd order response can be modeled as the combination of a response of a 1st order system to a step and the response of a 2nd order system to an impulse. This represents a total 3rd order response with two zeros after the transfer functions are combined, but separating the system into constituent parts allows us to fit the first and second order behavior in two separate steps.

This is shown graphically below:

image.png

Model Construction: Motor-Spring-Load

To find the 3rd order transfer function, first you need to find the transfer function that best approximates a first order step response that passes through the 3rd order response. Then, you can subtract the 1st order response from the 3rd order data to extract the 2nd order "impulse portion" of the real system's response. With the first and second order behavior separated, you can establish a transfer function for each by estimating the time constant, steady state, natural frequency, and the damping ratio as you have done before.

Once you have fit each part of the system's behavior, you can combine the two simpler transfer functions to form the total tranfer function for the 3rd order plant.

$ G_{3rd \, Order} = \frac{A}{s+a} + \frac{B \omega_n^2 s}{s^2 + 2 \zeta \omega_n s + \omega_n^2} $

Install the Motor-Spring-Load configuration of your load inertia module and record an OPEN LOOP STEP RESPONSE by providing the Motor-Spring-Load a step change in VOLTAGE. Capture this step response and plot your data and your fit on one set of axes. Then, display your plant transfer function. For clarity, display the plant model as a combination of individual first and second order transfer functions as shown above:

In [5]:
% YOUR CODE HERE
error('No Answer Given!')
error: No Answer Given!

Controller Design: Motor-Spring-Load

Since you don't yet have tools to do the design of a proportional controller for a higher order system, we'll use model order reduction to proceed. "Model order reduction" is the act of representing a higher-order system as a lower-order one. In this case, you will use only the "First order portion" of your plant model in order to design your controller. For the purposes of controller design, you will ignore the "second order part" entirely during the design process.

Once you complete your design using the simplified plant model, you will have determined a "suitable" proportional gain for the system. This will allow you to see if your first order plant model is of sufficient fidelty to predict the actual behavior of the closed loop system during the controller validation step.

Determine the $k_p$ that will achieve a closed-loop time constant of 0.25 sec if we assume that the open loop system's response is modeled adequately by the first order part of the plant transfer function. Place your calculations in the code cell below.

In [6]:
% YOUR CODE HERE
error('No Answer Given!')
error: No Answer Given!

Controller Validation: Motor-Spring-Load

Implement your closed loop controller on the real system and compare the measured response to the predicted response for a step input of a magnitude you choose. Although you could not use the full third order model to design a controller, you can use the transfer function to predict how the system will respond to a known gain. Therefore, compute predicted responses using both the reduced order model AND the third order model using a closed-loop proportional controller you designed. Make sure the signal sent to the motor does not saturate during your closed loop step response tests.

You will need to replace the rigid connection between the mass and motor with a compliant spring coupling. Instructions on how to properly assemble your system can be found in the hardware resource.

image.png

Note: The photographs taken without the shield for clarity. The shield does not have to be removed to install the mass or the spring shaft.

In [7]:
% YOUR CODE HERE
error('No Answer Given!')
error: No Answer Given!

Discuss the impact of the proportional control on the actual system response. Since this is a higher order system, are there changes in the system response beyond the time constant?

YOUR ANSWER HERE