In this assignment you will be extending the work in the prelab, to apply position control on the motor.
Before attempting this assignment, make sure you go through the Prelab 8 first.
MATLAB v 2016b or higher, with Control System Toolbox
You will work within a single MATLAB Live Script file, add your comments and code within it and submit only a single *.mlx file + a single pdf exported from the Live Script (From Live Editor Tab, click on the save drop down menu and select Export as PDF).
With the closed-loop velocity control system we have already, we can wrap another control loop around it for position control, as shown on Figure 1. If velocity controller, produces a good velocity response (stable, good transient response with zero steady-state error), the outer-loop controller can be a simple proportional controller. Practically, the position controller will scale the position error to produce a desired reference velocity.
Cascaded Position Control
Simulate the position control loop below to a step input, using a proportional controller for .
You already have for the velocity control system, you only need to add an integrator and produce a new and then simulate using step()
Numerical Integration Simulation
Within the numerical integration simulation setup, augment the model of the motor to include position. You will need to add another (fourth state) representing position. Then keeping the PID velocity controller in place, add the position controller (proportional control). Your new reference input is now position, the old velocity reference input is now calculated as an output from your position controller.
The output of the position controller:
,
where represents position, and is what is applied into the velocity PID controller.ز
We are here assuming both position control and velocity control occur at the same rate. In practice, the velocity control loop is usually executed at a higher rate than the position control loop.