< Day Day Up > |
9.8 and 9.9: Questions and Answers to Self-Test
| Develop a skeleton C++ program that implements the algorithm shown in the flowchart of Figure 9.3. In this initial version, just use comments to indicate where the Initialize, Update, I/O, and real-time clock-related operations would take place. | |
| Integrate the C++ fixed-point controller code developed in Chapter 8 self-test problem 5 into the code from problem 1 above. This code provides the implementations of the Initialize and Update blocks in Figure 9.3. Note that the sampling interval for this system is 10 milliseconds. | |
| Implement a MATLAB model of the inverted pendulum as shown in Chapter 7 self-test problem 1. Modify the model's C matrix so that its output is y = [θ x]T, then augment the model to pass its input as an additional output at the end of the output vector. The resulting output vector should be y = [θ x F]T. Execute write_cpp_model() to convert the model to C++ with a first-order hold and a 10-millisecond step time. | |
|
| |
| You now have a complete simulation of the plant and controller. Execute the simulation to produce the output file. Load the output file into MATLAB and plot each of the signals. Compare this plot to Figure 7.12. Explain any differences. | |
| The simulation developed in the previous problems used a simplified linear model of the cart and the pendulum. Describe some limitations of this simulation and how you could make the simulation more realistic and useful for testing controller performance. | |
| Assume you have a prototype cart and inverted pendulum system and a complete implementation of a control system for it. Describe a set of operational tests that will assess the performance of this system under a variety of operational conditions. Indicate how you could use the results of these tests for validating the simulation. |
Answers
| The following skeleton program implements the structure of Figure 9.1.
|
| This program adds the inverted pendulum fixed-point controller class to the program and calls its Initialize() and Update() member functions.
|
| The following sequence of steps creates the inverted pendulum model and writes it to a C++ file named pend_model.cpp.
|
| The following C++ program combines the results of problem 4a through 4c.
|
| The following MATLAB script reads the file created by the C++ program shown above and plots the controller and plant outputs with the plot() command.
The plot created by the above sequence of commands is shown in Figure 9.7. One difference from Figure 7.12 is that the x state does not converge to precisely 1 because of quantization. Figure 9.7: Plot of controller and plant outputs. |
| This plant model is a linear approximation of a nonlinear system. For pendulum angles more than about 5° from the vertical, this assumption becomes less and less reasonable. The angles reached in Figure 9.6 are far outside this limit. A better approach for testing this controller in a simulated environment would be to replace the linear plant model with a nonlinear model that accurately represents the dynamic behavior of the plant for both small and large pendulum angles. Other relevant aspects of the system also should be modeled in the simulation, such as sensor and actuator noise, drive motor dynamics, and friction in the drive system. System simulations commonly grow in complexity with the addition of more realistic models as the system design matures and validation test data becomes available. |
| The following list of tests might be appropriate for a system of this type.
To perform simulation validation, set up and execute simulation tests that duplicate the test scenarios described above. Compare the results of the simulation tests to the results of the operational tests. Identify cases where the differences between the results are caused by significant limitations of the simulation. Improve the simulation models to more accurately represent the behavior of the actual system. |
No comments:
Post a Comment