After simulating the system in simulink (outlined in the simulation section), the designed controller was implemented on the real world system. Data was acquired and processed using LabVIEW 7.1. It should be noted that the continuous time design was implemented. It was assumed that data was acquired and processed fast enough in LabVIEW such that the implemented system approzimated the continuous time model. With sampling times under 10 ms, this appeared to hold true. The front panel of the LabVIEW VI is shown below.
From here the operator can set the angle to command the pendulum to and set the constants such as gamma and the PD constants used. The control signal, model response, and system response are plotted together in the top right corner. The error is plotted below this graph. The two smaller graphs show the values of the adaptive parameters Theta1 and Theta2. The back panel is shown below.
While the LabVIEW back panel appears a jumbled mess, being able to follow this example isnt as important as understanding principles in simulating differential equations in discrete time. The green block is the reference model. The blue and purple blocks are the filters applied to the plant input and output before they are multiplied by gamma and the error. In simulating differential equations such as these, the first question that arises is,"How are the states computed?" The solution is simple.
If given a system, often the highest order dynamics are derrived from some physcial equation. For example, systems obeying newtonian motion often start with an equation for acceleration (or force). When evaluating this in discrete time, the value of this state should be computed first. Once the current value of the highest order state are known, the next values of the lower order states can be calculated. The equation is:
f(t+T) = f(t) + f'(t)T T = sampling time
Simply put, the next value of "f" is equal to the current value plus the change in "f" times the change in time. Should you need the derrivative of a signal, it is:
df/dt = (f(t) - f(t - T)) / T
The derivative is the change in f divided by the change in time. And finally, the integral:
int(f(t)) = f(t) + f(t - T)
The integral is the summation of all the values over time. With these fundamentals you should be able to construct any system. Be wary with any of these calculations, however, as they are not as precise as directly measuring states. The derivative in particular becomes unusably noisey as the noise of the measured state increases.
The experimental results are shown below. Click the pictures to view the videos (WARNING!! Each video is approximately a 5 mB mpg).