# PID Tuning

How to use the PID Tuning tool to automatically tune model parameters for PID controller performance

The PID Tuning tool is used to optimize the parameters of one or more PID blocks to better track a reference signal. If you select multiple PID blocks at once, they are all tuned together.

#### PID Blocks

Choose one or more PID blocks from your model that you want to be tuned. Each block's Kp, Ki, and Kd parameters will be optimized and updated at the end of the optimization process.

#### Reference Signal

Choose a signal from your model that you want the PID controller output to track. The PID output(s) will be subtracted from this signal to generate an error signal to be minimized.

#### Stochastic Parameters

These are parameters that you want to vary according to a random distribution in order to make extra certain that your optimized design parameter values are robust with respect to varied initial conditions. A simple example would be to randomly vary the starting angle of a pendulum for which you are optimizing a steady state controller.

For each parameter, you can specify the following values:

**Distribution:**The options here are`Normal`

,`Uniform`

, and`LogNormal`

. Normal varies the values around a central value, Uniform varies the values completely randomly within the specified range, and LogNormal is similar to Normal, but the values are restricted to positive only.**Minimum:**The minimum value, if any, that the parameter can reasonably have. Leave it blank (-inf) if there is no minimum.**Maximum:**The maximum value, if any, that the parameter can reasonably have. Leave it blank (+inf) if there is not maximum.**Number of batches:**Typically this kind of optimization is run in batches of simulations to better manage the complexity of multiple variables. For each batch, a single new random value will be generated for this parameter.**Batch size:**The number of simulations per batch. For example, if you specify 10 batches with a batch size of 10, then at least 100 simulations will be run.

#### Algorithm

Please see the Optimization Algorithms page for details on specific algorithms.

Last updated