. .
.
Control of Inverted Pendulum System (Real Time)
.
.

 

Procedure:ROTPENT Simple Modeling

 

 

Objectives

 

Investigate various physical principles of the rotary pendulum and experimentally determine its moment of inertia

 

Method

 

  • Measure the friction of the system.
  • Examine the coupling effect.
  • Find the pendulum moment of inertia.

 

 

 

Friction

 

  1. In the Signal Generator section set:
    • Signal Type = 'square wave'
    • Amplitude = 0.00 V
    • Frequency = 0.25 Hz
    • Offset = 0.00 V
  2. Enable the signal generator by clicking on the Start Generator button.
  3. Change the Offset in steps of 0.10 V until the pendulum begins moving. Record the voltage at which the pendulum moved.
  4. Repeat Step 3 above for steps of  0.10 V.

 

 

Coupling

 

  1. Enable the signal generator by clicking on the Start Generator button.
  2. In the Signal Generator section set:
    • Signal Type = 'square wave'
    • Amplitude = 1.00 V
    • Frequency = 0.25 Hz
    • Offset = 0.00 V
  3. Slowly increase the Amplitude until the arm begins moving back and forth. When it begins moving, click on Pause Plots to freeze the scopes and then click on Stop Control to cut off the voltage being applied to the motor.
  4. What do you observe between the Arm Angle (deg) and the Pendulum (deg) in the paused Angle (deg) scope?
  5. Click on the Start Display button to un-pause the scopes.

 

 

Moment of Inertia

 

  1. Disable the signal generator by clicking on the Stop Generator button.
  2. In the Pendulum Assembly Properties section, enter the correct values for: Mp1, Mp2, Lp1, and Lp2.
  3. Click on the Calculate button to evaluate the composite center of mass, lp, and the moment of inertia calculated analytically, Jp, found in the Calculated Pendulum Parameters section.
  4. In the Auto-Model Parameters section, set cycle to 10.
  5. Click on the Disturbance toggle switch to perturb the pendulum and click on the Modeling OFF button to activate procedure that detects the frequency of the pendulum automatically.
  6. Examine the Status message when performing the auto-model procedure. How does it calculate the frequency and the moment of inertia?
  7. Compare the moment of inertia calculated analytically, Jp in Calculated Pendulum Parameters section, and the moment of inertia found experimentally, Jp in Auto-Model Results section. Is there a large discrepancy between them?
  8. Vary cycles in Auto-Model Parameters and repeat Step 4-7.

 

 

 

 

 Procedure: ROTPENT Swing-Up Control

 

 

Objectives

 

To learn about balance control of an inverted pendulum, energy control of a pendulum, and a hybrid swing-up controller that integrates the two together.

 

 

Method

 

  • Run default balance control.
  • Design and implement your own balance controller.
  • Add friction compensation to the balance control.
  • Run the energy-based controller.
  • Run the hybrid swing-up control.

 

 

Default Balance Control

 

  1. Activate the control by clicking on the Start Control button.
  2. In the Signal Generator section set:
    • Signal Type = 'square wave'
    • Amplitude = 0.0 deg
    • Frequency = 0.10 Hz
    • Offset =  0.0 deg
  3. In the Control Parameters section set:
    • kp_theta = -2.65 V/rad
    • kp_alpha = 40.0 V/rad
       
    • kd_theta = -1.29 V/(rad/s)
    • kd_alpha = 6.46 V/(rad/s)
    • mu = 375 m/s^2/J
    • Er = 20.0 mJ
    • Activate Swing-Up = OFF (de-pressed)
  4. Click on Update Control in the Control Parameters section to ensure this controller is implemented.
  5. Adjust the Angle/Energy (deg/mJ) scope scales to see between -200 and 200 .
  6. Manually rotate the pendulum in the upright position until the In Range? LED in the Control Indicators section turns bright green. Ensure the encoder cable does not interfere with the pendulum arm motion.
  7. Observe what occurs to Offset in the Signal Generator section when the balance controller is activated.
  8. Vary Offset and observe the Arm Angle (deg) response in the Angle/Energy (deg/mJ) scope. Do not set the Offset too high or the encoder cable will interfere with the pendulum arm motion.
  9. As the pendulum is being balanced, examine the red Arm Angle (deg) and blue Pendulum Angle (deg) responses in the Angle/Energy (deg/mJ) scope.
     
  10. In the Signal Generator section set:
    • Signal Type = 'square wave'
    • Amplitude = 40.0 deg
    • Frequency = 0.10 Hz
    • Offset =  0.0 deg
       
  11. Adjust the Angle/Energy (deg/mJ) scope scales to see between -100 and 100 
  12. Observe the behaviour of the system when a square wave command is given to the arm angle. Why does the arm initially move in the wrong direction?
  13.  Click on Stop Control to disable the balance controller.

 

 

Balance Control Design and Implementation

 

  1. Ensure the control is enabled by clicking on the Start Control button.
  2. In the Signal Generator section set:
    • Signal Type = 'square wave'
    • Amplitude = 0.0 deg
    • Frequency = 0.10 Hz
    • Offset =  0.0 deg
  3. Select the Open-loop Analysis tab.
  4. Click on the Update Model/Design button in the Model Parameters section.
  5. This shows the linear state-space model and pole-zero plot of the open-loop inverted pendulum system. What do you notice about the location of the open-loop poles?
  6. Optional: In the Model Parameters section, enter the pendulum moment of inertia, Jp, determined in the Moment of Inertia method of the ROTPEN: Simple Modeling experiment and click on Update Model/Design.
  7. Select the Control Design tab.
  8. In the LQR Weighting Matrices section set:
    • Q(1,1) = 4, i.e. set first element of Q matrix to 4.
    • R = 1.00
  9. Click on Update Model/Design in the Model Parameters section to generate the gains in the LQR Gain section of the Control Design tab.
  10. This shows the linear state-space model and pole-zero plot of the closed-loop inverted pendulum system. What do you notice about the location of the closed-loop poles compared to the open-loop poles?
  11. Select the Time Analysis tab and click on the on Update Model/Design in the Model Parameters section.
  12. Examine the Step Response plot.
  13. Click on Set Desired to copy the calculated gains to the Control Parameters section and click on Update Control to implement your balance controller.
  14. Select the Scopes tab
  15. Manually rotate the pendulum in the upright position until the In Range? LED in the Control Indicators section turns bright green. Ensure the encoder cable does not interfere with the pendulum arm motion.
  16. In the Signal Generator section, click on the Disturbance toggle switch. Add disturbances of different lengths by varying how long Disturbance is pressed down.
  17. How does the balance controller handle disturbances?
  18. Design a balance controller that handles disturbances well by performing steps 8-16 for different values of the Q matrix. Begin by changing the first element of Q and then change the diagonal elements of the Q matrix.
  19. Examine how different elements in Q effect the gains being generated and how those gains effect the system response (use the Step Response simulation).
  20. Click on Stop Control to disable the balance controller.

 

 

 

Balance Control with Friction Compensation

 

  1. Go through steps 1-6 in the Default Balance Control.
  2. In the Signal Generator section set:
    • Signal Type = 'square wave'
    • Amplitude = 0.0 deg
    • Frequency = 0.10 Hz
    • Offset =  0.0 deg
     
  3. In the Dither Signal section set:
    • Amplitude = 0.00 V
    • Frequency = 5.00 Hz
    • Offset = 0.00 V
       
     
  4. Observe the behaviour of Arm Angle (deg) in the Angle/Energy (deg/mJ) scope. Intuitively speaking, can you find some reasons why the arm is oscillating?
  5. Increase the Amplitude in the Dither Signal section by steps of 0.05 V until you notice a change in the arm angle response.
  6. From the Voltage (V) scope and the pendulum motion, what is the Dither signal doing? Compare the response of the arm with and without the Dither signal.
     
  7. Increase the Frequency in the Dither Signal section by steps of 0.50 Hz.
     
  8. How does this effect the pendulum arm response?
     
  9. Optional: Set the Dither Signal properties according to the friction measured in the Friction method of the ROTPEN: Simple Modeling experiment. How does this effect the pendulum arm response?
     
  10. Click on Stop Control to disable the balance controller.

 

 

 

Energy Control

 

 

  1. Ensure the Start Control button is not pushed down to de-activate the balance controller.
  2. In the Control Parameters section ensure the following parameters are set:
    • kp_theta = -2.65 V/rad
    • kp_alpha = 40.0 V/rad
       
    • kd_theta = -1.29 V/(rad/s)
    • kd_alpha = 6.46 V/(rad/s)
    • mu = 375 m/s^2/J
    • Er = 0.0 mJ
    • Activate Swing-Up = OFF (de-pressed)
    •  
       
  3. Click on Update Control in the Control Parameters section to ensure this controller is implemented.
  4. Adjust the Angle/Energy (deg/mJ) scope scales to see between -200 and 200 
  5. Manually rotate the pendulum at different levels and examine the blue Pendulum Angle (deg) and the green Pendulum Energy (mJ) in the Angle/Energy (deg/mJ) scope. The pendulum energy is also displayed numerically in the Control Indicators section.
  6. Observe the energy read when the pendulum is fully inverted (i.e. in the upright vertical position).
  7. Bring the pendulum down to the gantry position.
  8. Click on the Start Control button and in the Control Parameters set the Activate Swing-Up = ON (pressed) switch.
  9. If the pendulum is stationary, click on the Disturbance button in the Signal Generator section to perturb the pendulum.
  10. In Control Parameters, change the reference energy Er between 5.0 mJ and 50.0 mJ. As it is varied, examine the control signal in the Voltage (V) scope as well as the blue Pendulum Angle (deg) and the red Pendulum Energy (mJ) in the Angle/Energy (deg/mJ) scope.
  11. In Control Parameters fix Er to 20.0 mJ and vary the swing-up control gain mu. Examine the performance of the energy control.
  12. Click on Stop Control to disable the energy and balance controllers.

 

 

 

Hybrid Swing-Up Control

 

 

  1. Ensure the control is enabled by clicking on the Start Control button
  2. In the Control Parameters section verify the following parameters are set:
    • kp_theta = -2.65 V/rad
    • kp_alpha = 40.0 V/rad
       
    • kd_theta = -1.29 V/(rad/s)
    • kd_alpha = 6.46 V/(rad/s)
    • mu = 375 m/s^2/J
    • Er = 0.0 mJ
    • Activate Swing-Up = OFF (de-pressed)
    •  
  3. Click on Update Control in the Control Parameters section to ensure this controller is implemented.
  4. Adjust the Angle/Energy (deg/mJ) scope scales to see between -200 and 200
  5. Set reference energy Er in the Control Parameters section to the energy read when the pendulum is vertically upwards (see the Energy Control method).
     
  6. Make sure the pendulum is hanging down motionless and the encoder cable is not interfering with the pendulum.
     
     
  7. Set the Activate Swing-Up = ON (pressed) switch in the Control Parameters.
     
     
  8. Click on the Disturbance button in the Signal Generator section to perturb the pendulum. The pendulum should swing-up to the inverted position in a few swings. Turn off the Active Swing-Up switch if the pendulum goes unstable, i.e. if the encoder cable interferes with the pendulum arm motion.
     
     
  9. Click on the Stop Control button and in the Control Parameters set Activate Swing-Up = OFF (de-pressed) switch to disable the energy and balance controllers .
     
     
  10. Click on Start Control and repeat the swing-up, steps 6-9, with different swing-up control gains, mu. Examine the performance of the energy control.
     
     
  11. Click on Stop Control to disable the energy and balance controllers.
     

 

 

 

 

 

 

 

 

 

 

 

 

Cite this Simulator:

.....
..... .....

Copyright @ 2024 Under the NME ICT initiative of MHRD

 Powered by AmritaVirtual Lab Collaborative Platform [ Ver 00.13. ]