Contents

Tune PID Controller Within Model Reference

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.

  1. Open the model.

    open('model_ref_pid');
    

    The block Inner Loop is a referenced model that contains the PID Controller block to tune.

  2. Double-click Inner Loop to open the referenced model.

    The referenced model innerloop contains a PID controller block, PID.

  3. Double-click the PID controller block PID to open the block dialog box.

  4. 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.

  5. 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 Open the PID Tuner.

Was this topic helpful?