Inverted Pendulum

Team: Reed Cao, Robert Herkenham, Ryan Meredith, and Stan Smith

 

 

 

 

 

Progress Report #2

1)

Our team has continued along the same plan since the last progress report without any major problems. For the last two weeks of class, we plan to collect data from our system at a wide range of sampling frequencies and plot something resembling a system response of the model as a function of the sampling frequency.

One of our main project goals is to incorporate an interactive feature into the project website that would allow the user to alter the parameters of the model to see how the response of the system is affected. At first we developed a script in VPython that allowed us to simulate our inverted pendulum, with hopes of being able to embed this into our website. Unfortunately for various reasons, we found that this VPython simulation was not suitable for our website, and are shifting our focus to creating a GUI in Matlab. This GUI will allow the user to easily change the sampling parameter of the inverted pendulum, to show how varying sampling rates affects our system. In addition the user will be able to modify the gains of the PID controller. For now, the plan is to try to determine how to best embed this GUI onto the project website.

2)

We are incorporating pole-zero plots into our project that represent our PID controller. The discrete PID controller block that we are using in Simulink has a predefined transfer function and Z-transform. Using some other commands, we were able to create a pole zero plot of this controller, however we are unsure if our results are correct at the moment. We will continue to investigate this in the last weeks. Since the PID controller Z transform is a function of its gains and sampling rate, we are planning to show how the pole-zero plot of the controller changes as the controller parameters vary. This is currently shown clearly in our GUI. We will use this feature to discover how the poles and zeros of the controller move and thus how the stability of the system changes as the sampling frequency of the controller varies.

3)

Not required for undergraduate teams.

4)

Our “coolest moment” was being able to visualize the data we created with the Simulink model with the VPython script. We could make changes to the model, such as change the sampling rate or PID controller tunings, and easily see how these changes affected the system.

We also generated c code from our Matlab Simulink file. In order to do this, we had to eliminate some algebraic loops in our simulink model. Algebraic loops occur when the input of one block depends on the output of the same block (either directly or through other blocks). This means that the output, say y[z], cannot be calculated unless y[z] itself is known. So we might end up with something like y[z] = 2*x[z] + 0.5*y[z], which requires algebra to solve (hence the name). These loops preclude code generation. In order to fix this, we added a time delay block to get something like y[z] = 2*x[z] + 0.5*y[z-1], which makes y[z] possible to calculate in c code in real time.

After finishing the basic implementation for the GUI of our model, it is much easier to quickly change the parameters of the system to see how the response changes by looking at the output graphs.