In Simulink®, you can include one model inside another using model referencing (see Model Reference Basics). When using PID Tuner or Frequency Response Based PID Tuner to tune a PID controller block in a referenced model, there are some constraints to be aware of.
In general, you can tune a PID controller block in a referenced model using either
PID Tuner or Frequency Response Based PID Tuner. When you open either
tuner, the software prompts you to specify which model to use as the top-level model for
linearization and tuning (PID Tuner) or estimation and tuning (Frequency
Response Based PID Tuner). For example, consider the model
Inner Loop is a referenced model that contains the controller
block to tune. Open the referenced model.
Inner Loop contains a PID controller block,
PID. Open that block. In the Select Tuning Method
drop-down list, select
Transfer Function Based (PID Tuner App), and
click Tune to open PID Tuner. The software prompts you to
select which open model is the top-level model for linearization and tuning. (Selecting
Frequency Response Based to open Frequency Response Based
PID Tuner results in a similar prompt.)
The available choices for top-level model include the referenced model itself, plus any open model in which the referenced model:
Appears exactly once, and
Is configured for normal simulation mode.
The tuning tools do not detect models that contain the model reference but are not open.
innerloop causes the tuner to disregard
model_ref_pid. Instead, the tuner tunes the PID Controller
block for the plant
G_Inner alone, as if there were no outer loop.
Alternatively, you can select
model_ref_pid as the top-level model.
When you do so, the tuner considers the dynamics of both the inner and outer loops, and tunes
with both loops closed. In this case, PID controller sees the effective plant
Select the desired top-level model, and click OK. The tuner you selected with the Select Tuning Method opens for tuning the specified top-level model.
Sometimes, tuning can proceed when the referenced model appears multiple times in an open model. If the following conditions are met, you can tune the PID controller block, using the referenced model as the top-level model:
The only open models that contain the model reference have multiple instances of it, and
At least one of these instances is in normal mode.
When this condition occurs, the software issues a warning. In this case, because the tuner can only tune with respect to the referenced model, you cannot specify a top-level model.
If there is no normal mode instance of the referenced model in any open model, tuning cannot proceed. In this case, the software issues an error. To tune the PID controller block, convert some instance of the referenced model in an open model to normal simulation mode.