PD Controller Implement in Simulink. It is very simple model so that if I forget how to build a PID controller system, I can use this model to build a simple PID controller system.
PID Pseudo Code
The parameters Kp, Ki and Kd can be calculated by Simulink.
In this guide, We implement a PD Controller, so we only need concentrate on Kp and Kd
PD model in Simulink
Here is the model in Simulink. you can find every block in Simulink and add it to model. The block Zere-Order Hold and Intergrator are only used to get the measured position, so in Robot model, these two blocks are not really exist.
Then we must unify the sample time. (The block Delay, PD controller and Zero-Order Hold)
The feedback signal is position. As for Velocity feedback, it is the derivative of position and generated in PD controller block.
Here is the Signal Builder which generates the simulation signal for desired position.
Here is the configuration of PD controller
‘Controller’ is selected as PD. ‘Sample time’ is set as 0.001. Then you need click ‘Apply’ button so that you can click ‘Tune…’ button for next interface.
Here is the PID Tuner.
In this interface, you can set proper ‘Respose Time’ and click ‘Update Block’ button if you are satisfied with the curve. By the way, you can click ‘Show Parameters’ button to see the parameters here and of course you can see the parameters in PD controller configuration.
##Simulation Result
The 1st diagram is the Disired position
The 2nd diagram is the Measured position
The 3rd diagram is the Velocity
THe 4th diagram is the Velocity error
Not Tested Code
|
|