Simulink Design Optimization 1.1
Magnetic Levitation Controller Tuning
This demo shows how to apply numerical optimization or tuning to the controller parameters of a nonlinear system. In this demo, we model a CE 152 Magnetic Levitation system where the controller is used to position a freely levitating ball in a magnetic field. The control structure for this model is fixed and the required controller performance can be specified in terms of an idealized time response.
Contents
Earnshaw's Theorem
Earnshaw's theorem proved that it is not possible to achieve stable levitation using static, macroscopic, classical electromagnetic fields. However the CE 152 system works around this by creating a potential well around the point at which the ball is to be suspended, thereby creating a non-inverse square law force. This is achieved by an inductive coil that generates a time varying electromagnetic field. The electromagnetic field is controlled through the use of feedback to keep the ball at the required location.
maglev_demo
Model Description
The magnetic levitation system is a nonlinear dynamic system with one input and one output. Double-click the Magnetic Levitation Plant Model to open this subsystem. The input voltage is applied to a coil that creates the electromagnetic field. The output voltage is measured by an IR receiver and represents the position of the ball in the magnetic field. The diagram below outlines this system.
The physical system consists of a ball (with mass 0.00837 kg) which is under the influence of three forces:
- The magnetic field produced by an inductive coil. This is modeled by the power amplifier and coil block in the Simulink® model. The input to the inductor is a voltage signal and the output a current. The force from the coil depends on the square of the current, the air-gap between the coil and the ball, and the physical properties of the ball. This produces an upward acting force on the ball.
- The gravitational force acting downwards
- A damping force which acts in a direction opposite to the velocity at any instant of time
These three forces cause the resulting motion of the ball and are modeled in Simulink as shown.
Non-linearities arising from saturation of the coil and changes in dynamics outside the limits of the magnetic field are also modeled in the Simulink Model. As the force from the coil decays according to an inverse square law larger voltages are required the further the ball is from the coil. The control signal is scaled to account for this and the scaling included in the control signal scaling blocks.
Control Problem Description
The requirement for the controller is that it be able to position the ball at any arbitrary location in the magnetic field and that it move the ball from one position to another. These requirements are captured by placing step response bounds on the position measurement voltage. Specifically we require the following constraints on the ball:
- Position constraint: within 20% of the desired position in less than 0.5 seconds
- Settling Time Constraint: within 2% of the desired position within 1.5s
To meet the control requirements we implement a Proportional-Integral-Derivate (PID) controller. For convenience the controller uses a normalized position measurement with a range from 0 to 1, representing the bottom-most and top-most positions of the ball respectively.
Simulink® Design Optimization™ and numerical optimization is ideally suited to tune the PID coefficients because:
- The system dynamics are complex enough to require effort and time for analysis if we approach the problem using conventional control design techniques.
- The controller structure is fixed
- We have knowledge of the step response we require from the system.
Setting Constraint Values
Given the step response characteristic we desire, it is simple to specify the upper and lower bounds of the response. This is done using the Signal Constraint block in the Simulink Design Optimization toolbox. The constraint lines may be moved using the mouse or edited via the constraint table. The constraints are specified in terms of final value, percentage overshoot, percentage settling, settling time, and rise time.
Defining Tuned Parameters
We select the PID controller parameters to tune from the menu item Optimization->Tuned Parameters, as shown below
Running the Optimization
After specifying the optimization parameters and the required step response bounds we start the optimization process by clicking on the Start optimization button in the Position Constraint window. During optimization the Position Constraint window is updated with the position of the ball for each iteration and the black curve shows the final optimized trajectory of the ball (as shown below).
Verifying the Results
Once we complete the optimization, it is important to validate the results against other step sizes. A successful parameter optimization should be able to provide good control for all steps sizes close to the tuned step size of 1. Step sizes from .7 to 1 should be tested to confirm the controller's performance. The following plot demonstrates the response to a step input from 0 to 0.85 at 0.1 seconds.
Conclusion
The verification step shows that controller's performance satisfies the requirements specified and the tuned parameter values are suitable for control. The tuned parameters could be used to provide baseline performance against which other control schemes can be compared, or a baseline for controllers for different operating regions.
bdclose('maglev_demo')
Store