- Automatic tuning of PID, gain-scheduled, and arbitrary SISO and MIMO control systems in Simulink
^{®} - PID autotuning algorithm deployable to embedded software
- Operating-point calculation (trimming) and model linearization
- Frequency response estimation from simulation data
- Batch linearization for varying parameters and operating points
- Numerical optimization of compensators to meet time-domain and frequency-domain requirements (with Simulink Design Optimization™)

Simulink Control Design provides automatic gain-tuning capabilities for PID controllers. The product provides two methods for tuning PID controllers in Simulink: the transfer-function-based method and the frequency-response-based method.

The transfer-function-based method accomplishes the initial tuning of a Simulink PID Controller block with a single click. The product linearizes a Simulink model to obtain a linear plant model. The product then uses the linear plant model and a proprietary tuning method to compute the PID gains based on the closed-loop performance that you desire. An initial controller is suggested based on an analysis of your system dynamics. You can then interactively adjust the response time and transient behavior in the PID Tuner app. The PID Tuner app also provides several plots you can use to analyze the controller behavior. For example, you can use a step reference tracking plot and an open-loop Bode plot to compare the performance of the current design with the design corresponding to initial gain values.

The transfer-function-based method relies on a parametric linear plant model. If a Simulink model linearizes to zero due to discontinuities such as pulse-width modulation (PWM), you can create a linear plant model from simulation input-output data using system identification (requires System Identification Toolbox™).

Design a PID controller for a DC motor modeled in Simulink . Create a closed-loop system by using the PID Controller block, then tune the gains of PID Controller block using the PID Tuner.

Design a PID controller for a model that cannot be linearized. Use system identification to identify a plant model from simulation input-output data.

Alternatively, you can use a frequency-response-based method. This method estimates a few points of the plant frequency response from simulation data and uses this frequency response to automatically compute PID gains.

Simulink Control Design provides a Control System Designer app for tuning SISO control loops directly in Simulink using the graphical and automated tuning capabilities of Control System Toolbox™. You can use any control architecture you build in Simulink that is linearizable. Tunable Simulink blocks include Gain, Transfer Function, Zero-Pole, State-Space, and PID Controller. Simulink Control Design automatically identifies the relevant control loops for the tuned blocks and launches a preconfigured session of the Control System Designer app.

Tune two cascaded feedback loops.

You can use the Control System Designer app to:

- Graphically tune multiple, continuous, or discrete SISO loops
- Observe loop interactions and coupling effects while tuning parameters
- Compute compensator designs using systematic design algorithms such as the proprietary Robust Response Time PID tuning, Ziegler-Nichols PID tuning, IMC design, or LQG design
- Optimize the control loops to meet time-domain and frequency-domain design requirements (requires Simulink Design Optimization™)
- Directly tune Simulink block parameters, including PID gains, zero-pole-gain representations, and masked blocks
- Examine the closed-loop response, such as a reference trajectory, or the ability of a control system to reject a disturbance at any portion of a model
- Write the tuned parameter values back to your Simulink model for verification with the full nonlinear system

In addition to the Control System Designer app, you can use the Control System Tuner app to tune SISO controllers modeled in Simulink. The Control System Tuner app automatically tunes controller parameters to meet time-domain and frequency-domain requirements.

Simulink Control Design lets you automatically tune decentralized controllers modeled in Simulink using the Control System Tuner app. You can use the toolbox to automatically compute and store a linearization of your Simulink model. Simulink Control Design automatically creates a tunable model of the control architecture specified in a Simulink model. You can:

- Specify Simulink model blocks that should be tuned
- Specify tuning requirements
- Automatically tune specified blocks to satisfy the must-have requirements (design constraints) and to best meet the remaining requirements (objectives)
- Validate your design by running nonlinear simulations

Using this approach, you can automatically tune complex multivariable controllers that are modeled using Simulink blocks. For example, you can automatically tune inner-loop and outer-loop PID controllers in a multi-loop control system without changing the control system architecture.

Design a decoupling controller for a distillation column with Simulink Control Design.

Gain scheduling is a linear technique for controlling nonlinear or time-varying plants. It involves computing linear approximations of the plant at various operating conditions, tuning controller gains at the operating condition, and scheduling controller gains as the plant changes operating conditions. Simulink Control Design provides tools for automatically computing gain schedules for fixed-structure control systems. You can:

- Automatically trim and linearize Simulink models at multiple operating conditions
- Parameterize controller gain surfaces as functions of scheduling variables
- Construct a linear parameter-varying (LPV) model representing the system throughout its operating range
- Specify tuning requirements such as tracking and disturbance rejection
- Automatically tune gain surface coefficients to satisfy tuning requirements at all operating conditions
- Update parameters of the Simulink Lookup Table, Interpolation, or MATLAB
^{®}Function blocks implementing the controller with tuned gain values

Generate smooth gain schedules for a three-loop autopilot.

Simulink Control Design provides an Online PID Tuner block to tune a PID controller in real time against a physical plant. This block lets you tune a PID controller to achieve a specified bandwidth and phase margin without a parametric plant model or an initial controller design. The block automates the process of collecting the input-output data from the hardware and identifying system dynamics. The algorithm is designed to work with asymptotically stable plants but otherwise does not require a model of plant dynamics.

To achieve model-free tuning, the Online PID Tuner block:

- Opens the feedback loop and injects a test signal into the plant at the nominal operating point to collect plant input-output data in real time. The feedback loop is closed at the end of the experiment.
- Tunes PID Controller gains based on the frequency response estimated from input-output data to achieve the desired bandwidth and phase margin.
- Updates the PID Controller block or other PID controllers with the tuned parameters enabling you to validate closed-loop performance in real time.

You can configure the experiment settings such as sine and step amplitudes and trigger the starting and stopping of the tuning process.

Using Simulink Coder™, you can generate C code to implement the tuning algorithm in embedded software, letting you tune with or without Simulink in the loop. For embedded deployment, it is recommended that the algorithm be used with caution and that you design and implement safety logic to prevent unsafe conditions.

In addition to the embedded deployment scenario described above, you can use the Online PID Tuner block for prototyping workflow, where you control the application running on the target using external mode, for example, when working with Simulink Real-Time™ or when running Simulink models on Arduino^{®} or other low-cost hardware. When using Simulink external mode, you can choose to generate code only for the portion of the algorithm that conducts an open-loop experiment and estimates plant frequency response. The memory-intensive PID gain calculation can be run on the host computer. Using external mode you can also interactively control the start and stop of the experiment and save computed PID gains into the MATLAB workspace.

Linear control design typically requires you to consider multiple operating points to account for the various set points of a nonlinear model. Simulink Control Design provides a graphical interface to determine model operating points. You can:

- Calculate operating points from user-defined set points using numerical optimization
- Take operating point snapshots at specific times or events during simulation

You can use these operating points to initialize a simulation at steady state or as a basis for linearization and control design.

Trim and linearize a nonlinear aircraft model and use the resulting linear model to design a pitch rate damper controller.

With Simulink Control Design you can linearize continuous, discrete, and multirate Simulink models. Using graphical signal annotations to specify loop opening and linearization inputs and outputs, you can linearize the whole model, a portion of the model, or a single block or subsystem. The signal annotations can be used for open-loop and closed-loop analysis. The annotations and analysis are nonintrusive and do not affect your model's simulation behavior.

Simulink Control Design automatically computes the linearized model and lets you visualize the results in a step-response plot or Bode diagram. A Linearization Advisor is provided to analyze the impact of each block in your Simulink model on the linearization and troubleshoot linearization issues. You can fine-tune your results by specifying the linear behavior of any number of blocks in your model. The linear behavior can be specified as a matrix gain or LTI model, giving you flexibility to linearize Simulink models containing discontinuities or event-based components, such as Stateflow^{®} charts or PWM signal-based systems.

When working with Robust Control Toolbox™, you can compute an uncertain linear model by specifying uncertain values for transfer functions and gains directly in the model. The resulting uncertain linear model can be used to study the impact of uncertainty on the stability and performance of your control system.

All of these tools have a command-line API to write scripts for batch-mode trimming and linearization. You can write these scripts yourself or automatically create MATLAB code from the graphical interface. You can use batch-mode trimming and linearization to compute a linear approximation of a Simulink model across a range of plant or controller parameter values. For example, you can linearize your system at multiple values of plant coefficients, controller gains, or controller sample times.

Create a script to do batch mode trimming and linearization of Simulink models.

Simulink Control Design provides tools for the simulation-based computation of a model’s frequency response. You can use these tools to:

- Verify the results of a linearization
- Compute the model’s frequency response when linearization techniques are not appropriate, such as with models described by strong discontinuities or event-based dynamics
- Study the effects of excitation signal amplitude on a nonlinear system’s gain and phase characteristics

Simulink Control Design helps you construct the excitation signals, such as sine sweeps or chirp signals; run the simulations; collect the data; and calculate and plot the model’s frequency response. The algorithms used to compute the frequency response are designed to minimize the simulation time and support the Accelerator and Rapid Accelerator modes in Simulink to speed up the overall computation.

Estimate the frequency response of a Simulink model using simulation.