This example shows how to tune a PID controller block contained in a referenced model.
When you launch the PID Tuner from a PID controller block in a model that is referenced in one or more open models, the software prompts you to specify which open model is the top-level model for linearization and tuning. The referenced model must be in normal mode.
For more information about model referencing, see Overview of Model Referencing in the Simulink® documentation.
Open the model.
The block Inner Loop is a referenced model that contains the PID Controller block to tune.
Double-click Inner Loop to open the referenced model.
The referenced model innerloop contains a PID controller block, PID.
Double-click the PID controller block PID to open the block dialog box.
Click Tune in the block dialog box.
The software prompts you to select which open model is the top-level model for linearization and tuning.
Note: The software only identifies open models containing the model reference. The PID Tuner does not detect models that contain the model reference but are not open.
Selecting innerloop causes the PID Tuner to disregard model_ref_pid. Instead, the PID 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 PID 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 (1+G_Outer*Gain)*G_Inner.
Select the desired top-level model, and click OK.
The PID Tuner linearizes the selected model and launches. Proceed with analyzing and adjusting the tuned response as described in Design Controllers with the PID Tuner.