Automatically and sequentially tune multiple PID control loops in fieldoriented control application
Motor Control Blockset / Controls / Controllers
The Field Oriented Control Autotuner block allows you to automatically tune PID control loops in your fieldoriented control (FOC) application in real time. For more information on fieldoriented control, see FieldOriented Control (FOC).
You can automatically tune PID controllers associated with the following loops:
Directaxis (daxis) current loop
Quadratureaxis (qaxis) current loop
Speed loop
Flux loop
For each loop the block tunes, the Field Oriented Control Autotuner block performs the autotuning experiment in closedloop without a parametric model associated with that loop. The block allows you to specify the order in which the control loops are tuned. When the tuning experiment is running for one loop, the block has no effect on the other loops. During the experiment, the block:
Injects a test signal into the plant associated with that loop to collect plant inputoutput data and estimate frequency response in real time. The test signal is combination of sinusoidal perturbation signals added on top of the plant input.
At the end of the experiment, tunes PID controller parameters based on estimated plant frequency responses near the target bandwidth.
Writes updated PID gains at the block output, allowing you to transfer the new gains to existing controllers and validate the closedloop performance.
You can use the Field Oriented Control Autotuner block to tune the existing PID controllers in your FOC structure. If you do not have the initial PID controllers, you can use the Estimate Control Gains from Motor Parameters workflow to obtain them. You can then use the Field Oriented Control Autotuner block for refinement or retuning.
If you have a codegeneration product such as Simulink^{®} Coder™, you can generate code that implements the tuning algorithm on hardware, letting you tune in real time, using or without using Simulink to manage the autotuning process.
If you have a machine modeled in Simulink with Motor Control Blockset™ and an initial FOC structure with PID controllers, you can perform closedloop PID autotuning against the modeled machine. Doing so lets you preview the plant response and adjust the settings for PID autotuning before tuning the controller in real time.
The block supports code generation with Simulink Coder, Embedded Coder^{®}, and Simulink PLC Coder™. It does not support code generation with HDL Coder™. For realtime applications, deploy the generated code on a rapid prototyping hardware such as Speedgoat realtime target machine.
For more information about using the Field Oriented Control Autotuner block, see How to Use Field Oriented Control Autotuner Block.
This block requires Simulink Control Design™ software.
PIDout_daxis
— Signal from directaxis current controller This port accepts the output of the daxis controller
PID_daxis
, which is the output of PID controller
that regulates the daxis current of the motor. The controller generates
the daxis voltage reference Vd_ref
, while the FOC
autotuner block generates perturbations used during the tuning
experiment for the daxis current loop.
To enable this port, select Tune Daxis current loop.
Data Types: single
 double
measured feedback_daxis
— Measured directaxis current This port accepts the daxis current obtained from the measured (sensed or estimated) motor currents.
To enable this port, select Tune Daxis current loop.
Data Types: single
 double
PIDout_qaxis
— Signal from quadratureaxis current controller This port accepts the output of the qaxis controller
PID_qaxis
, which is the output of PID controller
that regulates the qaxis current of the motor. The controller generates
the qaxis voltage reference Vq_ref
, while the FOC
autotuner block generates perturbations used during the tuning
experiment for the qaxis current loop.
To enable this port, select Tune Qaxis current loop.
Data Types: single
 double
measured feedback_qaxis
— Measured quadratureaxis currentThis port accepts the qaxis current obtained from the measured (sensed or estimated) motor currents.
To enable this port, select Tune Qaxis current loop.
Data Types: single
 double
PIDout_spd
— Signal from speed controller This port accepts the output of the speed controller PID_speed
, which
is the output of PID controller that regulates the speed of the motor.
The controller generates the qaxis current reference
Iq_ref
, while the FOC autotuner block generates
perturbations used during the tuning experiment for the speed
loop.
To enable this port, select Tune speed loop.
Data Types: single
 double
measured feedback_spd
— Measured speedThis port accepts the measured (sensed or estimated) speed from the motor.
To enable this port, select Tune speed loop.
Data Types: single
 double
PIDout_flux
— Signal from flux controller This port accepts the output of the flux controller PID_flux
, which
is the output of PID controller that regulates the flux of the motor.
The controller generates the daxis current reference
Id_ref
, while the FOC autotuner block generates
perturbations used during the tuning experiment for the flux
loop.
For a permanent magnet synchronous motor (PMSM), there is no flux loop controller as the
rotor flux is fixed and Id_ref
is set to zero. In
some applications you can provide a negative Id_ref
value to implement fieldweakening control and achieve higher rotor
speeds at the cost of a higher current.
To enable this port, select Tune flux loop.
Data Types: single
 double
measured feedback_flux
— Measured fluxThis port accepts the measured (sensed or estimated) flux from the motor.
To enable this port, select Tune flux loop.
Data Types: single
 double
start/stop
— Start and stop autotuning experimentTo externally start and stop the autotuning process, provide a signal at the
start/stop
port and the
ActiveLoop
port.
The experiment starts when the value of the signal changes from negative or zero to positive.
The experiment stops when the value of the signal changes from positive to negative or zero.
For the duration of the experiment, for each loop, the block injects sinusoidal perturbations at the plant input associated with the loop, near the nominal operating point, to collect inputoutput data and estimate frequency response. When the experiment stops, the block computes PID gains based on the plant frequency responses estimated near the target bandwidth.
When the experiment is not running, the block does not inject any perturbations at the plant inputs. In this state, the block has no impact on plant or controller behavior.
Typically, you can use a signal that changes from 0 to 1 to start the
experiment, and from 1 to 0 to stop it. Consider the following when you
configure the start/stop
signal.
Start the experiment when the motor is at the desired equilibrium operating point. Use the initial controller to drive the motor to the operating point.
Avoid any input or output disturbance on the motor during the experiment. If your existing closedloop system has good disturbance rejection, then the experiment can handle small disturbances. Otherwise, large disturbances can distort the plant output and reduce the accuracy of the frequencyresponse estimation.
Let the experiment run long enough for the algorithm to collect sufficient data for a good estimate at all frequencies it probes. There are two ways to determine when to stop the experiment:
Determine the experiment duration in advance. A conservative estimate for the experiment duration is 200/ω_{c}, where ω_{c} is your target bandwidth.
Observe the signal at the
convergence
output, and stop
the experiment when the signal stabilizes near 100%.
When you stop the experiment, the block computes tuned PID
gains and updates the signal at the pid
gains
port.
You can configure any logic appropriate for your application to
control the start and stop times of the experiment. The
start/stop
signal is specified along with
ActiveLoop
. ActiveLoop
takes
integer values 1 to 4 and specifies which loop to tune.
Alternatively, if you are tuning in simulation or external mode, you can specify the tuning experiment sequence, start time and duration in the block parameters.
To enable this port, on the Block tab under Parameters Source, select Use external source for start/stop of experiment.
Data Types: single
 double
ActiveLoop
— Specify active loop for autotuning experiment Set the ActiveLoop
value to specify which loop to
tune when providing an external source for the start and stop times of
the tuning experiment.
ActiveLoop Value  Loop to Tune 

1  Daxis current loop 
2  Qaxis current loop 
3  Speed loop 
4  Flux loop 
You can configure any logic appropriate for your application along
with the start/stop
port to control the sequence and
the time at which the loop tuning experiment runs.
ActiveLoop
takes integer values from 1 to 4 and
specifies which loop to tune. Any other number will result in no tuning
taking place regardless of the start/stop
signal. For
example, when you supply a constant value 2 at
ActiveLoop
and the signal at
start/stop
rises, the block starts the tuning
experiment for the qaxis current loop.
Alternatively, you can specify the tuning experiment sequence, start time, and duration in the block parameters.
To enable this port, on the Block tab under Parameters Source, select Use external source for start/stop of experiment.
Data Types: single
 double
bandwidth
— Target bandwidth for tuningSupply the values for the Target bandwidth (rad/sec)
parameter for
each loop to be tuned. If you are tuning multiple loops, you can specify
the bandwidth as a vector or bus, entries of which correspond to the
target bandwidth for the loops in this order:
Daxis current loop
Qaxis current loop
Speed loop
Flux loop
The vector signal must be specified as a Nby1 or 1byN signal or if specified as a bus must have N elements, where N is the number of loops to be tuned. For instance, if you are tuning the qaxis current loop and the speed loop, and you specify a vector [5000, 200] at this port, the block tunes the qaxis current controller with the target bandwidth 5000 rad/sec and the speed loop controller with the target bandwidth 200 rad/sec.
If you are tuning multiple loops and specify a scalar value at this port, then the block uses the same target bandwidth to tune all the controllers. For effective cascade control, the inner control loops (daxis and qaxis) must respond much faster than the outer control loops (flux and speed). Therefore, you must supply the target bandwidth as a vector or bus signal when tuning multiple loops.
Alternatively, you can specify target bandwidth for individual loops in block parameters. For more information on how to choose a bandwidth, see that parameter description.
To enable this port, on the Block tab under Parameters Source, select Use external source for bandwidth.
Data Types: single
 double
target PM
— Target phase margin for tuningSupply a value for the Target phase margin (degrees)
parameter for
each loop to be tuned. If you are tuning multiple loops, you can specify
target PM
as a vector or bus, entries of which
correspond to the target phase margin for the loops in this
order:
Daxis current loop
Qaxis current loop
Speed loop
Flux loop
The vector signal must be specified as a Nby1 or 1byN signal or if specified as a bus must have N elements, where N is the number of loops to be tuned. For instance, if you are tuning qaxis current loop and speed loop, and you specify a vector [60, 45] at this port, the block tunes qaxis current controller with target phase margin 60 degrees and speed loop controller with target phase margin 45 degrees.
If you are tuning multiple loops and specify a scalar value at this port, then the block uses the same target phase margin to tune all the controllers.
Alternatively, you can specify target phase margin for individual loops in block parameters. For more information on how to choose a target phase margin, see that parameter description.
To enable this port, on the Block tab under Parameters Source, select Use external source for target phase margin.
Data Types: single
 double
sine Amp
— Amplitudes of injected sinusoidal perturbation signalsSupply a value for the Sine Amplitudes
parameter for each loop to
be tuned. Specify one of the following:
Vector of length 5 to specify a different amplitude at each of [1/10, 1/3, 1, 3, 10]ω_{c} , where ω_{c} is the target bandwidth for tuning.
Nby5 matrix, where N is the number of loops to be tuned. Each row entry must of length 5 to specify a different amplitude at each of [1/10, 1/3, 1, 3, 10]ω_{c} .
If you are tuning multiple loops and specify a vector of length 5 at this port, then the block uses the specified amplitude for all the loops at each of [1/10, 1/3, 1, 3, 10]ω_{c} corresponding to that loop.
Alternatively, you can specify the sinusoidal perturbation amplitude for individual loops in block parameters. For more information, see the parameter description.
To enable this port, on the Block tab under Parameters Source, select Use external source for sine amplitudes.
Data Types: single
 double
perturbation_daxis
— Directaxis current input perturbationPerturbation signal input used for estimating the frequencyresponse data model associated with the daxis current control loop. Inject the perturbation signal from this port by using a sum block to the output of the PID controller that regulates the daxis current.
When the experiment is running, the block generates perturbation signals at this port.
When the experiment is not running, the signal at this port is zero. In this state, the block has no effect on the plant.
To enable this port, select Tune Daxis current loop.
Data Types: single
 double
perturbation_qaxis
— Quadratureaxis current input perturbationPerturbation signal input used for estimating the frequencyresponse data model associated with the qaxis current control loop. Inject this perturbation signal from this port by using a sum block to the output of the PID controller that regulates the qaxis current.
When the experiment is running, the block generates perturbation signals at this port.
When the experiment is not running, the signal at this port is zero. In this state, the block has no effect on the plant.
To enable this port, select Tune Qaxis current loop.
Data Types: single
 double
perturbation_spd
— Speed input perturbationPerturbation signal input used for estimating the frequencyresponse data model associated with the motor speed control loop. Inject this perturbation signal from this port by using a sum block with the output of the PID controller that regulates the speed of the motor.
When the experiment is running, the block generates perturbation signals at this port.
When the experiment is not running, the signal at this port is zero. In this state, the block has no effect on the plant.
To enable this port, select Tune speed loop.
Data Types: single
 double
perturbation_flux
— Flux input perturbationPerturbation signal input used for estimating the frequencyresponse data model associated with the motor flux control loop. Inject this perturbation signal from this port by using a sum block to the output of the PID controller that regulates the flux linkage of the motor.
When the experiment is running, the block generates perturbation signals at this port.
When the experiment is not running, the signal at this port is zero. In this state, the block has no effect on the plant.
To enable this port, select Tune flux loop.
Data Types: single
 double
pid gains
— Tuned PID coefficientsThis 4element bus signal contains the tuned PID gains P,
I, D, and the filter
coefficient N for each control loop the block tunes.
These values correspond to the P
,
I
, D
, and N
parameters in the expressions given in the Form
parameter. Initially, the values are 0, 0, 0, and 100, respectively. The
block updates the values when the experiment ends. The bus signal
corresponding to each loop the block tunes always has four elements,
even if you are not tuning a PIDF controller.
Data Types: single
 double
convergence
— Convergence of FRD estimation during experimentThe block uses perturbation signals to estimate the frequency response
of the plant associated with each loop at several frequencies around the
target bandwidth for tuning. convergence
indicates
how close to completion the estimation of the plant frequency response
is. Typically, this value quickly rises to about 90% after the
experiment begins, and then gradually converges to a higher value. Stop
the experiment when it levels off near 100%.
Data Types: single
 double
estimated PM
— Estimated phase margin for most recently tuned loopThis port outputs the estimated phase margin achieved by the tuned controller for the
most recently tuned loop, in degrees. The block updates this value when
the tuning experiment ends for each loop. The estimated phase margin is
calculated from the angle of
G(jω_{c})C(jω_{c}),
where G is the estimated plant for that loop,
C is the tuned controller, and
ω_{c} is the crossover
frequency (bandwidth). The estimated phase margin might differ from the
target phase margin specified by the Target phase margin
(degrees)
parameter. It is an indicator of the robustness
and stability achieved by the tuned system.
Typically, the estimated phase margin is near the target phase margin. In general, the larger the value, the more robust is the tuned system, and the less overshoot there is.
A negative phase margin indicates that the closedloop system might be unstable.
To enable this port, on the Block tab, select Estimated phase margin achieved by tuned controllers.
Data Types: single
 double
frd
— Estimated frequency response for most recently tuned loopThis port outputs the frequencyresponse data estimated by the experiment for most
recently tuned loop. Initially, the value at frd
is
[0, 0, 0, 0, 0]. During the experiment, the block injects signals at
frequencies [1/10, 1/3, 1, 3,
10]ω_{c}, where ω_{c} is
the target bandwidth. At each sample time during the experiment, the
block updates frd
with a vector containing the
complex frequency response at each of these frequencies. You can use the
progress of the response as an alternative to
convergence
to examine the convergence of the
estimation. When the experiment stops, the block updates
frd
with the final estimated frequency response
used for computing the PID gains.
To enable this port, on the Block tab, select Plant frequency responses near bandwidth.
Data Types: single
 double
nominal
— Plant input and output at nominal operating point for most recently tuned loopThis port outputs a vector containing the plant input and plant output for the most recently tuned loop or the loop currently being tuned. These values are the plant input and output at the nominal operating point at which the block performs the experiment.
To enable this port, on the Block tab, select Plant nominal input and output.
Data Types: single
 double
loop startstops
— Active loopThis 4element bus signal indicates whether the tuning experiment for each loop tuned by
the block is active or not. For each signal in the bus, the port outputs
the logical value 1
(true
) for the
loop when the tuning experiment is running. The value is logical
0
(false
) when the experiment
is over or has not yet started. You can use this port to trigger updates
of PID gains for individual loops.
To enable this port, on the Block tab, disable Use external source for start/stop of experiment and select Start/stop of autotuning process.
Data Types: single
 double
Tune Daxis current loop
— Enable daxis current loop tuningon
(default)  off
Use this parameter to enable or disable daxis current loop autotuning.
Block Parameter:
TuneDaxisLoop 
Type: character vector 
Values:
'on'  'off'

Default:
'on' 
Tune Qaxis current loop
— Enable qaxis current loop tuningon
(default)  off
Use this parameter to enable or disable qaxis current loop autotuning.
Block Parameter:
TuneQaxisLoop 
Type: character vector 
Values:
'on'  'off'

Default:
'on' 
Tune speed loop
— Enable speed loop tuningon
(default)  off
Use this parameter to enable or disable speed loop autotuning.
Block Parameter:
TuneSpeedLoop 
Type: character vector 
Values:
'on'  'off'

Default:
'on' 
Tune flux loop
— Enable flux loop tuningon
(default)  off
Use this parameter to enable or disable flux loop autotuning.
Block Parameter:
TuneSpeedLoop 
Type: character vector 
Values:
'on'  'off'

Default:
'on' 
Use same settings for current loop controllers (Daxis + Qaxis)
— Enable same tuning and experiment settings for directaxis and quadratureaxis current loopsoff
(default)  on
Select this parameter to enable the same tuning and experiment settings for daxis and qaxis current loops. When enabled, the block uses the same controller settings, target bandwidth, phase margin, and other experiment settings to tune daxis and qaxis current loops.
Block Parameter:
UseSameSettingsInner 
Type: character vector 
Values:
'off'  'on'

Default:
'off' 
Use same settings for outer loop controllers (Speed + Flux)
— Enable same tuning and experiment settings for speed and flux loopsoff
(default)  on
Select this parameter to enable the same tuning and experiment settings for speed and flux loops. When enabled, the block uses the same controller settings, target bandwidth, phase margin, and other experiment settings to tune speed and flux loops.
Block Parameter:
UseSameSettingsOuter 
Type: character vector 
Values:
'off'  'on'

Default:
'off' 
Type
— Daxis current loop PID controller actionsPI
(default)  PID
 PIDF
 ...Specify the type of PID controller associated with the daxis current control loop.
The controller type indicates what actions are present in the controller that regulates the loop. The following controller types are available for PID autotuning:
P
— Proportional only
I
— Integral only
PI
— Proportional and integral
PD
— Proportional and derivative
PDF
— Proportional and derivative with derivative filter
PID
— Proportional, integral, and derivative
PIDF
— Proportional, integral, and derivative with derivative filter
Make sure the controller type matches the controller that regulates the loop.
Block Parameter:
PIDTypeDaxis 
Type: character vector 
Values:
'P'  'I' 
'PI'  'PD' 
'PDF'  'PID' 
'PIDF' 
Default:
'PI' 
Form
— Daxis current loop PID controller formParallel
(default)  Ideal
Specify the PID controller form associated with your daxis current control loop.
The controller form determines the interpretation of the PID coefficients P, I, D, and N.
Parallel
— In Parallel
form,
the transfer function of a discretetime PIDF controller is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
where F_{i}(z) and F_{d}(z) are the integrator and filter formulas (see Integrator
method
and Filter method
).
Other controller actions amount to setting P, I, or D to zero.
Ideal
— In Ideal
form, the
transfer function of a discretetime PIDF controller is
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
Other controller actions amount to setting D to zero or setting
I to Inf
. (In ideal form, the controller
must have proportional action.)
Make sure the controller form matches the controller that regulates the loop.
Tunable: Yes
Block Parameter:
PIDFormDaxis 
Type: character vector 
Values:
'Parallel' 
'Ideal' 
Default:
'Parallel' 
Controller sample time (sec)
— Daxis current loop PID controller sample timeSpecify the sample time of your PID controller associated with the daxis current control loop in seconds. This value also sets the sample time for the experiment performed by the block.
To perform PID tuning, the block measures frequencyresponse information up to a frequency of
10 times the target bandwidth. To ensure that this frequency is less than the Nyquist
frequency, the target bandwidth ω_{c} must satisfy ω_{c}T_{s}
≤ 0.3, where T_{s}
ω_{c} is the controller sample time that you specify
with the Controller sample time (sec)
parameter.
Make sure the controller sample time matches the controller that regulates the loop.
If you want to run the deployed block with different sample times in your application, set this parameter to –1 and put the block in a Triggered Subsystem. Then, trigger the subsystem at the desired sample time. If you do not plan to change the sample time after deployment, specify a fixed and finite sample time.
Block Parameter:
TsDaxis 
Type: scalar 
Value positive scalar  –1 
Default: 0.001 
Integrator method
— Daxis current loop controller discrete integration formula for integrator termForward Euler
(default)  Backward Euler
 Trapezoidal
Specify the discrete integration formula for the integrator term in your controller. In discrete time, the PID controller transfer function assumed by the block is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
in parallel form, or in ideal form,
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
For a controller sample time T_{s}, the
Integrator method
parameter determines the formula
F_{i} as follows.
Integrator method  F_{i} 

Forward Euler 
$$\frac{{T}_{s}}{z1}$$

Backward Euler 
$$\frac{{T}_{s}z}{z1}$$

Trapezoidal 
$$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$

For more information about the relative advantages of each method, see the Discrete PID Controller block reference page.
Make sure the controller integrator method matches the controller that regulates the loop.
Tunable: Yes
This parameter is enabled when the controller includes integral action.
Block Parameter:
IntegratorMethodDaxis 
Type: character vector 
Values:
'Forward Euler'  'Backward
Euler'  'Trapezoidal' 
Default:
'Forward Euler' 
Filter method
— Daxis current loop controller discrete integration formula for derivative filter termForward Euler
(default)  Backward Euler
 Trapezoidal
Specify the discrete integration formula for the derivative filter term in your controller. In discrete time, the PID controller transfer function assumed by the block is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
in parallel form, or in ideal form,
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
For a controller sample time T_{s}, the
Filter method
parameter determines the formula
F_{d} as follows.
Filter method  F_{d} 

Forward Euler 
$$\frac{{T}_{s}}{z1}$$

Backward Euler 
$$\frac{{T}_{s}z}{z1}$$

Trapezoidal 
$$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$

For more information about the relative advantages of each method, see the Discrete PID Controller block reference page.
Make sure the controller derivative filter method matches the controller that regulates the loop.
Tunable: Yes
This parameter is enabled when the controller includes derivative action with a derivative filter term.
Block Parameter:
FilterMethodDaxis 
Type: character vector 
Values:
'Forward Euler'  'Backward
Euler'  'Trapezoidal' 
Default:
'Forward Euler' 
Target bandwidth (rad/sec)
— Daxis current loop target crossover frequency of tuned responseThe target bandwidth is the target value for the 0 dB gain crossover frequency of the tuned openloop response CP, where P is the plant response associated with the loop, and C is the controller response. This crossover frequency roughly sets the control bandwidth. For a rise time τ seconds, a good guess for the target bandwidth is 2/τ rad/sec.
To perform PID tuning, the autotuner block measures frequencyresponse information up to a frequency of 10 times the target bandwidth. To ensure that this frequency is less than the Nyquist frequency, the target bandwidth ω_{c} must satisfy ω_{c}T_{s} ≤ 0.3, where T_{s} is the controller sample time that you specify with the Controller sample time (sec) parameter. Because of this condition, the fastest rise time you can enforce for tuning is about 1.67T_{s}. If this rise time does not meet your design goals, consider reducing T_{s}.
For best results, use a target bandwidth that is within about a factor of 10 of the bandwidth with the initial PID controller. To tune a controller for a larger change in bandwidth, tune incrementally using smaller changes.
To provide the target bandwidth by using an input port, on the Block tab, select Use external source for bandwidth.
Block Parameter:
BandwidthDaxis 
Type: positive scalar 
Default:
100 
Target phase margin (degrees)
— Daxis current loop target minimum phase marginSpecify a target minimum phase margin for the tuned openloop response associated with the daxis current control loop at the crossover frequency.
The target phase margin reflects the desired robustness of the tuned system. Typically, choose a value in the range of about 45°–60°. In general, a higher phase margin reduces overshoot, but can limit the response speed. The default value 60° tends to balance performance and robustness, yielding about 5–10% overshoot, depending on the characteristics of your plant.
To provide the target phase margin by using an input port, on the Block tab, select Use external source for target phase margins.
Tunable: Yes
Block Parameter:
TargetPMDaxis 
Type: scalar 
Values: 0–90 
Default: 60 
Type
— Qaxis current loop PID controller actionsPI
(default)  PID
 PIDF
 ...Specify the type of PID controller associated with the qaxis current control loop.
The controller type indicates what actions are present in the controller that regulates the loop. The following controller types are available for PID autotuning:
P
— Proportional only
I
— Integral only
PI
— Proportional and integral
PD
— Proportional and derivative
PDF
— Proportional and derivative with derivative filter
PID
— Proportional, integral, and derivative
PIDF
— Proportional, integral, and derivative with derivative filter
Make sure the controller type matches the controller that regulates the loop.
Block Parameter:
PIDTypeQaxis 
Type: character vector 
Values:
'P'  'I' 
'PI'  'PD' 
'PDF'  'PID' 
'PIDF' 
Default:
'PI' 
Form
— Qaxis current loop PID controller formParallel
(default)  Ideal
Specify the PID controller form associated with your qaxis current control loop.
The controller form determines the interpretation of the PID coefficients P, I, D, and N.
Parallel
— In Parallel
form,
the transfer function of a discretetime PIDF controller is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
where F_{i}(z) and F_{d}(z) are the integrator and filter formulas (see Integrator
method
and Filter method
).
Other controller actions amount to setting P, I, or D to zero.
Ideal
— In Ideal
form, the
transfer function of a discretetime PIDF controller is
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
Other controller actions amount to setting D to zero or setting
I to Inf
. (In ideal form, the controller
must have proportional action.)
Make sure the controller form matches the controller that regulates the loop.
Tunable: Yes
Block Parameter:
PIDFormQaxis 
Type: character vector 
Values:
'Parallel' 
'Ideal' 
Default:
'Parallel' 
Controller sample time (sec)
— Qaxis current loop PID controller sample timeSpecify the sample time of your PID controller associated with the qaxis current control loop in seconds. This value also sets the sample time for the experiment performed by the block.
To perform PID tuning, the block measures frequencyresponse information up to a frequency of
10 times the target bandwidth. To ensure that this frequency is less than the Nyquist
frequency, the target bandwidth ω_{c} must satisfy ω_{c}T_{s}
≤ 0.3, where T_{s}
ω_{c} is the controller sample time that you specify
with the Controller sample time (sec)
parameter.
Make sure the controller sample time matches the controller that regulates the loop.
If you want to run the deployed block with different sample times in your application, set this parameter to –1 and put the block in a Triggered Subsystem. Then, trigger the subsystem at the desired sample time. If you do not plan to change the sample time after deployment, specify a fixed and finite sample time.
Block Parameter:
TsQaxis 
Type: scalar 
Value positive scalar  –1 
Default: 0.001 
Integrator method
— Qaxis current loop controller discrete integration formula for integrator termForward Euler
(default)  Backward Euler
 Trapezoidal
Specify the discrete integration formula for the integrator term in your controller. In discrete time, the PID controller transfer function assumed by the block is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
in parallel form, or in ideal form,
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
For a controller sample time T_{s}, the
Integrator method
parameter determines the formula
F_{i} as follows.
Integrator method  F_{i} 

Forward Euler 
$$\frac{{T}_{s}}{z1}$$

Backward Euler 
$$\frac{{T}_{s}z}{z1}$$

Trapezoidal 
$$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$

For more information about the relative advantages of each method, see the Discrete PID Controller block reference page.
Make sure the controller integrator method matches the controller that regulates the loop.
Tunable: Yes
This parameter is enabled when the controller includes integral action.
Block Parameter:
IntegratorMethodQaxis 
Type: character vector 
Values:
'Forward Euler'  'Backward
Euler'  'Trapezoidal' 
Default:
'Forward Euler' 
Filter method
— Qaxis current loop controller discrete integration formula for derivative filter termForward Euler
(default)  Backward Euler
 Trapezoidal
Specify the discrete integration formula for the derivative filter term in your controller. In discrete time, the PID controller transfer function assumed by the block is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
in parallel form, or in ideal form,
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
For a controller sample time T_{s}, the
Filter method
parameter determines the formula
F_{d} as follows.
Filter method  F_{d} 

Forward Euler 
$$\frac{{T}_{s}}{z1}$$

Backward Euler 
$$\frac{{T}_{s}z}{z1}$$

Trapezoidal 
$$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$

For more information about the relative advantages of each method, see the Discrete PID Controller block reference page.
Make sure the controller derivative filter method matches the controller that regulates the loop.
Tunable: Yes
This parameter is enabled when the controller includes derivative action with a derivative filter term.
Block Parameter:
FilterMethodQaxis 
Type: character vector 
Values:
'Forward Euler'  'Backward
Euler'  'Trapezoidal' 
Default:
'Forward Euler' 
Target bandwidth (rad/sec)
— Qaxis current loop target crossover frequency of tuned responseThe target bandwidth is the target value for the 0 dB gain crossover frequency of the tuned openloop response CP, where P is the plant response associated with the loop, and C is the controller response. This crossover frequency roughly sets the control bandwidth. For a rise time τ seconds, a good guess for the target bandwidth is 2/τ rad/sec.
To perform PID tuning, the autotuner block measures frequencyresponse information up to a frequency of 10 times the target bandwidth. To ensure that this frequency is less than the Nyquist frequency, the target bandwidth ω_{c} must satisfy ω_{c}T_{s} ≤ 0.3, where T_{s} is the controller sample time that you specify with the Controller sample time (sec) parameter. Because of this condition, the fastest rise time you can enforce for tuning is about 1.67T_{s}. If this rise time does not meet your design goals, consider reducing T_{s}.
For best results, use a target bandwidth that is within about a factor of 10 of the bandwidth with the initial PID controller. To tune a controller for a larger change in bandwidth, tune incrementally using smaller changes.
To provide the target bandwidth by using an input port, on the Block tab, select Use external source for bandwidth.
Block Parameter:
BandwidthQaxis 
Type: positive scalar 
Default:
100 
Target phase margin (degrees)
— Qaxis current loop target minimum phase marginSpecify a target minimum phase margin for the tuned openloop response associated with the qaxis current control loop at the crossover frequency.
The target phase margin reflects the desired robustness of the tuned system. Typically, choose a value in the range of about 45°–60°. In general, a higher phase margin reduces overshoot, but can limit the response speed. The default value 60° tends to balance performance and robustness, yielding about 5–10% overshoot, depending on the characteristics of your plant.
To provide the target phase margin by using an input port, on the Block tab, select Use external source for target phase margins.
Tunable: Yes
Block Parameter:
TargetPMQaxis 
Type: scalar 
Values: 0–90 
Default: 60 
Type
— Speed loop PID controller actionsPI
(default)  PID
 PIDF
 ...Specify the type of PID controller associated with the speed control loop.
The controller type indicates what actions are present in the controller that regulates the loop. The following controller types are available for PID autotuning:
P
— Proportional only
I
— Integral only
PI
— Proportional and integral
PD
— Proportional and derivative
PDF
— Proportional and derivative with derivative filter
PID
— Proportional, integral, and derivative
PIDF
— Proportional, integral, and derivative with derivative filter
Make sure the controller type matches the controller that regulates the loop.
Block Parameter:
PIDTypeSpeed 
Type: character vector 
Values:
'P'  'I' 
'PI'  'PD' 
'PDF'  'PID' 
'PIDF' 
Default:
'PI' 
Form
— Speed loop PID controller formParallel
(default)  Ideal
Specify the PID controller form associated with your speed control loop.
The controller form determines the interpretation of the PID coefficients P, I, D, and N.
Parallel
— In Parallel
form,
the transfer function of a discretetime PIDF controller is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
where F_{i}(z) and F_{d}(z) are the integrator and filter formulas (see Integrator
method
and Filter method
).
Other controller actions amount to setting P, I, or D to zero.
Ideal
— In Ideal
form, the
transfer function of a discretetime PIDF controller is
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
Other controller actions amount to setting D to zero or setting
I to Inf
. (In ideal form, the controller
must have proportional action.)
Make sure the controller form matches the controller that regulates the loop.
Tunable: Yes
Block Parameter:
PIDFormSpeed 
Type: character vector 
Values:
'Parallel' 
'Ideal' 
Default:
'Parallel' 
Controller sample time (sec)
— Speed loop PID controller sample timeSpecify the sample time of your PID controller associated with the speed control loop in seconds. This value also sets the sample time for the experiment performed by the block.
To perform PID tuning, the block measures frequencyresponse information up to a frequency of
10 times the target bandwidth. To ensure that this frequency is less than the Nyquist
frequency, the target bandwidth ω_{c} must satisfy ω_{c}T_{s}
≤ 0.3, where T_{s}
ω_{c} is the controller sample time that you specify
with the Controller sample time (sec)
parameter.
Make sure the controller sample time matches the controller that regulates the loop.
If you want to run the deployed block with different sample times in your application, set this parameter to –1 and put the block in a Triggered Subsystem. Then, trigger the subsystem at the desired sample time. If you do not plan to change the sample time after deployment, specify a fixed and finite sample time.
Block Parameter:
TsSpeed 
Type: scalar 
Value positive scalar  –1 
Default: 0.1 
Integrator method
— Speed loop controller discrete integration formula for integrator termForward Euler
(default)  Backward Euler
 Trapezoidal
Specify the discrete integration formula for the integrator term in your controller. In discrete time, the PID controller transfer function assumed by the block is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
in parallel form, or in ideal form,
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
For a controller sample time T_{s}, the
Integrator method
parameter determines the formula
F_{i} as follows.
Integrator method  F_{i} 

Forward Euler 
$$\frac{{T}_{s}}{z1}$$

Backward Euler 
$$\frac{{T}_{s}z}{z1}$$

Trapezoidal 
$$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$

For more information about the relative advantages of each method, see the Discrete PID Controller block reference page.
Make sure the controller integrator method matches the controller that regulates the loop.
Tunable: Yes
This parameter is enabled when the controller includes integral action.
Block Parameter:
IntegratorMethodSpeed 
Type: character vector 
Values:
'Forward Euler'  'Backward
Euler'  'Trapezoidal' 
Default:
'Forward Euler' 
Filter method
— Speed loop controller discrete integration formula for derivative filter termForward Euler
(default)  Backward Euler
 Trapezoidal
Specify the discrete integration formula for the derivative filter term in your controller. In discrete time, the PID controller transfer function assumed by the block is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
in parallel form, or in ideal form,
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
For a controller sample time T_{s}, the
Filter method
parameter determines the formula
F_{d} as follows.
Filter method  F_{d} 

Forward Euler 
$$\frac{{T}_{s}}{z1}$$

Backward Euler 
$$\frac{{T}_{s}z}{z1}$$

Trapezoidal 
$$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$

For more information about the relative advantages of each method, see the Discrete PID Controller block reference page.
Make sure the controller derivative filter method matches the controller that regulates the loop.
Tunable: Yes
This parameter is enabled when the controller includes derivative action with a derivative filter term.
Block Parameter:
FilterMethodSpeed 
Type: character vector 
Values:
'Forward Euler'  'Backward
Euler'  'Trapezoidal' 
Default:
'Forward Euler' 
Target bandwidth (rad/sec)
— Speed loop target crossover frequency of tuned responseThe target bandwidth is the target value for the 0 dB gain crossover frequency of the tuned openloop response CP, where P is the plant response associated with the loop, and C is the controller response. This crossover frequency roughly sets the control bandwidth. For a rise time τ seconds, a good guess for the target bandwidth is 2/τ rad/sec.
To perform PID tuning, the autotuner block measures frequencyresponse information up to a frequency of 10 times the target bandwidth. To ensure that this frequency is less than the Nyquist frequency, the target bandwidth ω_{c} must satisfy ω_{c}T_{s} ≤ 0.3, where T_{s} is the controller sample time that you specify with the Controller sample time (sec) parameter. Because of this condition, the fastest rise time you can enforce for tuning is about 1.67T_{s}. If this rise time does not meet your design goals, consider reducing T_{s}.
For best results, use a target bandwidth that is within about a factor of 10 of the bandwidth with the initial PID controller. To tune a controller for a larger change in bandwidth, tune incrementally using smaller changes.
To provide the target bandwidth by using an input port, on the Block tab, select Use external source for bandwidth.
Block Parameter:
BandwidthSpeed 
Type: positive scalar 
Default:
1 
Target phase margin (degrees)
— Speed loop target minimum phase marginSpecify a target minimum phase margin for the tuned openloop response associated with the speed control loop at the crossover frequency.
The target phase margin reflects the desired robustness of the tuned system. Typically, choose a value in the range of about 45°–60°. In general, a higher phase margin reduces overshoot, but can limit the response speed. The default value 60° tends to balance performance and robustness, yielding about 5–10% overshoot, depending on the characteristics of your plant.
To provide the target phase margin by using an input port, on the Block tab, select Use external source for target phase margins.
Tunable: Yes
Block Parameter:
TargetPMSpeed 
Type: scalar 
Values: 0–90 
Default: 60 
Type
— Flux loop PID controller actionsPI
(default)  PID
 PIDF
 ...Specify the type of PID controller associated with the flux control loop.
The controller type indicates what actions are present in the controller that regulates the loop. The following controller types are available for PID autotuning:
P
— Proportional only
I
— Integral only
PI
— Proportional and integral
PD
— Proportional and derivative
PDF
— Proportional and derivative with derivative filter
PID
— Proportional, integral, and derivative
PIDF
— Proportional, integral, and derivative with derivative filter
Make sure the controller type matches the controller that regulates the loop.
Block Parameter:
PIDTypeFlux 
Type: character vector 
Values:
'P'  'I' 
'PI'  'PD' 
'PDF'  'PID' 
'PIDF' 
Default:
'PI' 
Form
— Flux loop PID controller formParallel
(default)  Ideal
Specify the PID controller form associated with your flux control loop.
The controller form determines the interpretation of the PID coefficients P, I, D, and N.
Parallel
— In Parallel
form,
the transfer function of a discretetime PIDF controller is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
where F_{i}(z) and F_{d}(z) are the integrator and filter formulas (see Integrator
method
and Filter method
).
Other controller actions amount to setting P, I, or D to zero.
Ideal
— In Ideal
form, the
transfer function of a discretetime PIDF controller is
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
Other controller actions amount to setting D to zero or setting
I to Inf
. (In ideal form, the controller
must have proportional action.)
Make sure the controller form matches the controller that regulates the loop.
Tunable: Yes
Block Parameter:
PIDFormFlux 
Type: character vector 
Values:
'Parallel' 
'Ideal' 
Default:
'Parallel' 
Controller sample time (sec)
— Flux loop PID controller sample timeSpecify the sample time of your PID controller associated with the flux control loop in seconds. This value also sets the sample time for the experiment performed by the block.
To perform PID tuning, the block measures frequencyresponse information up to a frequency of
10 times the target bandwidth. To ensure that this frequency is less than the Nyquist
frequency, the target bandwidth ω_{c} must satisfy ω_{c}T_{s}
≤ 0.3, where T_{s}
ω_{c} is the controller sample time that you specify
with the Controller sample time (sec)
parameter.
Make sure the controller sample time matches the controller that regulates the loop.
If you want to run the deployed block with different sample times in your application, set this parameter to –1 and put the block in a Triggered Subsystem. Then, trigger the subsystem at the desired sample time. If you do not plan to change the sample time after deployment, specify a fixed and finite sample time.
Block Parameter:
TsFlux 
Type: scalar 
Value positive scalar  –1 
Default: 0.1 
Integrator method
— Flux loop controller discrete integration formula for integrator termForward Euler
(default)  Backward Euler
 Trapezoidal
Specify the discrete integration formula for the integrator term in your controller. In discrete time, the PID controller transfer function assumed by the block is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
in parallel form, or in ideal form,
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
For a controller sample time T_{s}, the
Integrator method
parameter determines the formula
F_{i} as follows.
Integrator method  F_{i} 

Forward Euler 
$$\frac{{T}_{s}}{z1}$$

Backward Euler 
$$\frac{{T}_{s}z}{z1}$$

Trapezoidal 
$$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$

For more information about the relative advantages of each method, see the Discrete PID Controller block reference page.
Make sure the controller integrator method matches the controller that regulates the loop.
Tunable: Yes
This parameter is enabled when the controller includes integral action.
Block Parameter:
IntegratorMethodFlux 
Type: character vector 
Values:
'Forward Euler'  'Backward
Euler'  'Trapezoidal' 
Default:
'Forward Euler' 
Filter method
— Flux loop controller discrete integration formula for derivative filter termForward Euler
(default)  Backward Euler
 Trapezoidal
Specify the discrete integration formula for the derivative filter term in your controller. In discrete time, the PID controller transfer function assumed by the block is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
in parallel form, or in ideal form,
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
For a controller sample time T_{s}, the
Filter method
parameter determines the formula
F_{d} as follows.
Filter method  F_{d} 

Forward Euler 
$$\frac{{T}_{s}}{z1}$$

Backward Euler 
$$\frac{{T}_{s}z}{z1}$$

Trapezoidal 
$$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$

For more information about the relative advantages of each method, see the Discrete PID Controller block reference page.
Make sure the controller derivative filter method matches the controller that regulates the loop.
Tunable: Yes
This parameter is enabled when the controller includes derivative action with a derivative filter term.
Block Parameter:
FilterMethodFlux 
Type: character vector 
Values:
'Forward Euler'  'Backward
Euler'  'Trapezoidal' 
Default:
'Forward Euler' 
Target bandwidth (rad/sec)
— Flux loop target crossover frequency of tuned responseThe target bandwidth is the target value for the 0 dB gain crossover frequency of the tuned openloop response CP, where P is the plant response associated with the loop, and C is the controller response. This crossover frequency roughly sets the control bandwidth. For a rise time τ seconds, a good guess for the target bandwidth is 2/τ rad/sec.
To perform PID tuning, the autotuner block measures frequencyresponse information up to a frequency of 10 times the target bandwidth. To ensure that this frequency is less than the Nyquist frequency, the target bandwidth ω_{c} must satisfy ω_{c}T_{s} ≤ 0.3, where T_{s} is the controller sample time that you specify with the Controller sample time (sec) parameter. Because of this condition, the fastest rise time you can enforce for tuning is about 1.67T_{s}. If this rise time does not meet your design goals, consider reducing T_{s}.
For best results, use a target bandwidth that is within about a factor of 10 of the bandwidth with the initial PID controller. To tune a controller for a larger change in bandwidth, tune incrementally using smaller changes.
To provide the target bandwidth by using an input port, on the Block tab, select Use external source for bandwidth.
Block Parameter:
BandwidthFlux 
Type: positive scalar 
Default:
1 
Target phase margin (degrees)
— Flux loop target minimum phase marginSpecify a target minimum phase margin for the tuned openloop response associated with the flux control loop at the crossover frequency.
The target phase margin reflects the desired robustness of the tuned system. Typically, choose a value in the range of about 45°–60°. In general, a higher phase margin reduces overshoot, but can limit the response speed. The default value 60° tends to balance performance and robustness, yielding about 5–10% overshoot, depending on the characteristics of your plant.
To provide the target phase margin by using an input port, on the Block tab, select Use external source for target phase margins.
Tunable: Yes
Block Parameter:
TargetPMFlux 
Type: scalar 
Values: 0–90 
Default: 60 
Type
— Current loop PID controller actionsPI
(default)  PID
 PIDF
 ...Specify the type of PID controller associated with the current control loops.
The controller type indicates what actions are present in the controller that regulates the loop. The following controller types are available for PID autotuning:
P
— Proportional only
I
— Integral only
PI
— Proportional and integral
PD
— Proportional and derivative
PDF
— Proportional and derivative with derivative filter
PID
— Proportional, integral, and derivative
PIDF
— Proportional, integral, and derivative with derivative filter
Make sure the controller type matches the controller that regulates the loop.
Block Parameter:
PIDTypeAllInner 
Type: character vector 
Values:
'P'  'I' 
'PI'  'PD' 
'PDF'  'PID' 
'PIDF' 
Default:
'PI' 
Form
— Current loop PID controller formParallel
(default)  Ideal
Specify the PID controller form associated with your current control loops.
The controller form determines the interpretation of the PID coefficients P, I, D, and N.
Parallel
— In Parallel
form,
the transfer function of a discretetime PIDF controller is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
where F_{i}(z) and F_{d}(z) are the integrator and filter formulas (see Integrator
method
and Filter method
).
Other controller actions amount to setting P, I, or D to zero.
Ideal
— In Ideal
form, the
transfer function of a discretetime PIDF controller is
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
Other controller actions amount to setting D to zero or setting
I to Inf
. (In ideal form, the controller
must have proportional action.)
Make sure the controller form matches the controller that regulates the loop.
Tunable: Yes
Block Parameter:
PIDFormAllInner 
Type: character vector 
Values:
'Parallel' 
'Ideal' 
Default:
'Parallel' 
Controller sample time (sec)
— Current loop PID controller sample timeSpecify the sample time of your PID controllers associated with the current control loops in seconds. This value also sets the sample time for the experiment performed by the block.
To perform PID tuning, the block measures frequencyresponse information up to a frequency of
10 times the target bandwidth. To ensure that this frequency is less than the Nyquist
frequency, the target bandwidth ω_{c} must satisfy ω_{c}T_{s}
≤ 0.3, where T_{s}
ω_{c} is the controller sample time that you specify
with the Controller sample time (sec)
parameter.
Make sure the controller sample time matches the controller that regulates the loop.
If you want to run the deployed block with different sample times in your application, set this parameter to –1 and put the block in a Triggered Subsystem. Then, trigger the subsystem at the desired sample time. If you do not plan to change the sample time after deployment, specify a fixed and finite sample time.
Block Parameter:
TsAllInner 
Type: scalar 
Value positive scalar  –1 
Default: 0.001 
Integrator method
— Current loop controller discrete integration formula for integrator termForward Euler
(default)  Backward Euler
 Trapezoidal
Specify the discrete integration formula for the integrator term in your controller. In discrete time, the PID controller transfer function assumed by the block is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
in parallel form, or in ideal form,
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
For a controller sample time T_{s}, the
Integrator method
parameter determines the formula
F_{i} as follows.
Integrator method  F_{i} 

Forward Euler 
$$\frac{{T}_{s}}{z1}$$

Backward Euler 
$$\frac{{T}_{s}z}{z1}$$

Trapezoidal 
$$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$

For more information about the relative advantages of each method, see the Discrete PID Controller block reference page.
Make sure the controller integrator method matches the controller that regulates the loop.
Tunable: Yes
This parameter is enabled when the controller includes integral action.
Block Parameter:
IntegratorMethodAllInner 
Type: character vector 
Values:
'Forward Euler'  'Backward
Euler'  'Trapezoidal' 
Default:
'Forward Euler' 
Filter method
— Current loop controller discrete integration formula for derivative filter termForward Euler
(default)  Backward Euler
 Trapezoidal
Specify the discrete integration formula for the derivative filter term in your controller. In discrete time, the PID controller transfer function assumed by the block is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
in parallel form, or in ideal form,
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
For a controller sample time T_{s}, the
Filter method
parameter determines the formula
F_{d} as follows.
Filter method  F_{d} 

Forward Euler 
$$\frac{{T}_{s}}{z1}$$

Backward Euler 
$$\frac{{T}_{s}z}{z1}$$

Trapezoidal 
$$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$

For more information about the relative advantages of each method, see the Discrete PID Controller block reference page.
Make sure the controller derivative filter method matches the controller that regulates the loop.
Tunable: Yes
This parameter is enabled when the controller includes derivative action with a derivative filter term.
Block Parameter:
FilterMethodAllInner 
Type: character vector 
Values:
'Forward Euler'  'Backward
Euler'  'Trapezoidal' 
Default:
'Forward Euler' 
Target bandwidth (rad/sec)
— Current loop target crossover frequency of tuned responsesThe target bandwidth is the target value for the 0 dB gain crossover frequency of the tuned openloop response CP, where P is the plant response associated with the loop, and C is the controller response. This crossover frequency roughly sets the control bandwidth. For a rise time τ seconds, a good guess for the target bandwidth is 2/τ rad/sec.
To perform PID tuning, the autotuner block measures frequencyresponse information up to a frequency of 10 times the target bandwidth. To ensure that this frequency is less than the Nyquist frequency, the target bandwidth ω_{c} must satisfy ω_{c}T_{s} ≤ 0.3, where T_{s} is the controller sample time that you specify with the Controller sample time (sec) parameter. Because of this condition, the fastest rise time you can enforce for tuning is about 1.67T_{s}. If this rise time does not meet your design goals, consider reducing T_{s}.
For best results, use a target bandwidth that is within about a factor of 10 of the bandwidth with the initial PID controller. To tune a controller for a larger change in bandwidth, tune incrementally using smaller changes.
To provide the target bandwidth by using an input port, on the Block tab, select Use external source for bandwidth.
Block Parameter:
BandwidthAllInner 
Type: positive scalar 
Default:
1 
Target phase margin (degrees)
— Current loop target minimum phase marginsSpecify target minimum phase margin for the tuned openloop responses associated with the current control loops at the crossover frequency.
The target phase margin reflects the desired robustness of the tuned system. Typically, choose a value in the range of about 45°–60°. In general, a higher phase margin reduces overshoot, but can limit the response speed. The default value 60° tends to balance performance and robustness, yielding about 5–10% overshoot, depending on the characteristics of your plant.
To provide the target phase margin by using an input port, on the Block tab, select Use external source for target phase margins.
Tunable: Yes
Block Parameter:
TargetPMAllInner 
Type: scalar 
Values: 0–90 
Default: 60 
Type
— Outer loop PID controller actionsPI
(default)  PID
 PIDF
 ...Specify the type of PID controllers associated with the outer control loops.
The controller type indicates what actions are present in the controller that regulates the loop. The following controller types are available for PID autotuning:
P
— Proportional only
I
— Integral only
PI
— Proportional and integral
PD
— Proportional and derivative
PDF
— Proportional and derivative with derivative filter
PID
— Proportional, integral, and derivative
PIDF
— Proportional, integral, and derivative with derivative filter
Make sure the controller type matches the controller that regulates the loop.
Block Parameter:
PIDTypeAllOuter 
Type: character vector 
Values:
'P'  'I' 
'PI'  'PD' 
'PDF'  'PID' 
'PIDF' 
Default:
'PI' 
Form
— Outer loop PID controller formParallel
(default)  Ideal
Specify the PID controller form associated with your outer control loops.
The controller form determines the interpretation of the PID coefficients P, I, D, and N.
Parallel
— In Parallel
form,
the transfer function of a discretetime PIDF controller is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
where F_{i}(z) and F_{d}(z) are the integrator and filter formulas (see Integrator
method
and Filter method
).
Other controller actions amount to setting P, I, or D to zero.
Ideal
— In Ideal
form, the
transfer function of a discretetime PIDF controller is
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
Other controller actions amount to setting D to zero or setting
I to Inf
. (In ideal form, the controller
must have proportional action.)
Make sure the controller form matches the controller that regulates the loop.
Tunable: Yes
Block Parameter:
PIDFormAllOuter 
Type: character vector 
Values:
'Parallel' 
'Ideal' 
Default:
'Parallel' 
Controller sample time (sec)
— Outer loop PID controller sample timeSpecify the sample time of your PID controllers associated with the outer control loop in seconds. This value also sets the sample time for the experiment performed by the block.
To perform PID tuning, the block measures frequencyresponse information up to a frequency of
10 times the target bandwidth. To ensure that this frequency is less than the Nyquist
frequency, the target bandwidth ω_{c} must satisfy ω_{c}T_{s}
≤ 0.3, where T_{s}
ω_{c} is the controller sample time that you specify
with the Controller sample time (sec)
parameter.
Make sure the controller sample time matches the controller that regulates the loop.
If you want to run the deployed block with different sample times in your application, set this parameter to –1 and put the block in a Triggered Subsystem. Then, trigger the subsystem at the desired sample time. If you do not plan to change the sample time after deployment, specify a fixed and finite sample time.
Block Parameter:
TsAllOuter 
Type: scalar 
Value positive scalar  –1 
Default: 0.1 
Integrator method
— Outer loop controller discrete integration formula for integrator termForward Euler
(default)  Backward Euler
 Trapezoidal
Specify the discrete integration formula for the integrator term in your controller. In discrete time, the PID controller transfer function assumed by the block is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
in parallel form, or in ideal form,
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
For a controller sample time T_{s}, the
Integrator method
parameter determines the formula
F_{i} as follows.
Integrator method  F_{i} 

Forward Euler 
$$\frac{{T}_{s}}{z1}$$

Backward Euler 
$$\frac{{T}_{s}z}{z1}$$

Trapezoidal 
$$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$

For more information about the relative advantages of each method, see the Discrete PID Controller block reference page.
Make sure the controller integrator method matches the controller that regulates the loop.
Tunable: Yes
This parameter is enabled when the controller includes integral action.
Block Parameter:
IntegratorMethodAllOuter 
Type: character vector 
Values:
'Forward Euler'  'Backward
Euler'  'Trapezoidal' 
Default:
'Forward Euler' 
Filter method
— Outer loop controller discrete integration formula for derivative filter termForward Euler
(default)  Backward Euler
 Trapezoidal
Specify the discrete integration formula for the derivative filter term in your controller. In discrete time, the PID controller transfer function assumed by the block is
$$C=P+I{F}_{i}\left(z\right)+D\left[\frac{N}{1+N{F}_{d}\left(z\right)}\right],$$
in parallel form, or in ideal form,
$$C=P\left[1+I{F}_{i}\left(z\right)+D\left(\frac{N}{1+N{F}_{d}\left(z\right)}\right)\right].$$
For a controller sample time T_{s}, the
Filter method
parameter determines the formula
F_{d} as follows.
Filter method  F_{d} 

Forward Euler 
$$\frac{{T}_{s}}{z1}$$

Backward Euler 
$$\frac{{T}_{s}z}{z1}$$

Trapezoidal 
$$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$

For more information about the relative advantages of each method, see the Discrete PID Controller block reference page.
Make sure the controller derivative filter method matches the controller that regulates the loop.
Tunable: Yes
This parameter is enabled when the controller includes derivative action with a derivative filter term.
Block Parameter:
FilterMethodAllOuter 
Type: character vector 
Values:
'Forward Euler'  'Backward
Euler'  'Trapezoidal' 
Default:
'Forward Euler' 
Target bandwidth (rad/sec)
— Outer loop target crossover frequency of tuned responsesThe target bandwidth is the target value for the 0 dB gain crossover frequency of the tuned openloop response CP, where P is the plant response associated with the loop, and C is the controller response. This crossover frequency roughly sets the control bandwidth. For a rise time τ seconds, a good guess for the target bandwidth is 2/τ rad/sec.
To perform PID tuning, the autotuner block measures frequencyresponse information up to a frequency of 10 times the target bandwidth. To ensure that this frequency is less than the Nyquist frequency, the target bandwidth ω_{c} must satisfy ω_{c}T_{s} ≤ 0.3, where T_{s} is the controller sample time that you specify with the Controller sample time (sec) parameter. Because of this condition, the fastest rise time you can enforce for tuning is about 1.67T_{s}. If this rise time does not meet your design goals, consider reducing T_{s}.
For best results, use a target bandwidth that is within about a factor of 10 of the bandwidth with the initial PID controller. To tune a controller for a larger change in bandwidth, tune incrementally using smaller changes.
To provide the target bandwidth by using an input port, on the Block tab, select Use external source for bandwidth.
Block Parameter:
BandwidthAllOuter 
Type: positive scalar 
Default:
1 
Target phase margin (degrees)
— Outer loop target minimum phase marginsSpecify a target minimum phase margin for the tuned openloop responses associated with the outer control loops at the crossover frequency.
The target phase margin reflects the desired robustness of the tuned system. Typically, choose a value in the range of about 45°–60°. In general, a higher phase margin reduces overshoot, but can limit the response speed. The default value 60° tends to balance performance and robustness, yielding about 5–10% overshoot, depending on the characteristics of your plant.
To provide the target phase margin by using an input port, on the Block tab, select Use external source for target phase margins.
Tunable: Yes
Block Parameter:
TargetPMAllOuter 
Type: scalar 
Values: 0–90 
Default: 60 
Daxis current loop start time (sec)
— Specify directaxis current loop tuning experiment start time1
(default)Specify the simulation time when the daxis current loop tuning experiment starts.
Block Parameter:
StartTimeDaxis 
Type: positive scalar 
Default: 1 
Daxis current loop experiment duration (sec)
— Specify directaxis current loop tuning experiment duration0.05
(default)Specify the daxis current loop tuning experiment duration.
Block Parameter:
DurationDaxis 
Type: positive scalar 
Default: 0.05 
Qaxis current loop start time (sec)
— Specify quadratureaxis current loop tuning experiment start time1.1
(default)Specify the simulation time when the qaxis current loop tuning experiment starts.
Block Parameter:
StartTimeQaxis 
Type: positive scalar 
Default: 1.1 
Qaxis current loop experiment duration (sec)
— Specify quadratureaxis current loop tuning experiment duration0.05
(default)Specify the qaxis current loop tuning experiment duration.
Block Parameter:
DurationQaxis 
Type: positive scalar 
Default: 0.05 
Speed loop start time (sec)
— Specify speed loop tuning experiment start time2
(default)Specify the simulation time when the speed loop tuning experiment starts.
Block Parameter:
StartTimeSpeed 
Type: positive scalar 
Default: 2 
Speed loop experiment duration (sec)
— Specify speed loop tuning experiment duration3
(default)Specify the speed loop tuning experiment duration.
Block Parameter:
DurationSpeed 
Type: positive scalar 
Default: 3 
Flux loop start time (sec)
— Specify flux loop tuning experiment start time6
(default)Specify the simulation time when the flux tuning experiment starts.
Block Parameter:
StartTimeFlux 
Type: positive scalar 
Default: 6 
Flux loop experiment duration (sec)
— Specify flux loop tuning experiment duration3
(default)Specify the flux loop tuning experiment duration.
Block Parameter:
DurationFlux 
Type: positive scalar 
Default: 3 
Plant Type
— Stability of directaxis current plantStable
(default)  Integrating
Specify whether the plant associated with the daxis current control
loop is stable or integrating. If the plant has one or more integrators,
select Integrating
.
Block Parameter:
PlantTypeDaxis 
Type: character vector 
Values:
'Stable' 
'Integrating' 
Default:
'Stable' 
Plant Sign
— Sign of directaxis current plantPositive
(default)  Negative
Specify whether the plant associated with the daxis current control
loop is positive or negative. If a positive change in the plant input at
the nominal operating point results in a positive change in the plant
output, specify Positive
. Otherwise, specify
negative. For stable plants, the sign of the plant is the sign of the
plant DC gain.
Block Parameter:
PlantSignDaxis 
Type: character vector 
Values:
'Positive' 
'Negative' 
Default:
'Positive' 
Sine Amplitudes
— Amplitude of sinusoidal perturbations in directaxis current loopDuring the experiment, the block injects a sinusoidal signal into the plant associated with the loop at the frequencies [1/10, 1/3, 1, 3, 10]ω_{c} , where ω_{c} is the target bandwidth for tuning. Use Sine Amplitudes to specify the amplitude of each of these injected signals. Specify a:
Scalar value to inject the same amplitude at each frequency
Vector of length 5 to specify a different amplitude at each of [1/10, 1/3, 1, 3, 10]ω_{c}
In a typical plant with typical target bandwidth, the magnitudes of the plant responses at the experiment frequencies do not vary widely. In such cases, you can use a scalar value to apply the same magnitude perturbation at all frequencies. However, if you know that the response decays sharply over the frequency range, consider decreasing the amplitude of the lower frequency inputs and increasing the amplitude of the higher frequency inputs. It is numerically better for the estimation experiment when all the plant responses have comparable magnitudes.
The perturbation amplitudes must be:
Large enough that the perturbation overcomes any deadband in the plant actuator and generates a response above the noise level
Small enough to keep the plant running within the approximately linear region near the nominal operating point, and to avoid saturating the plant input or output
In the experiment, the sinusoidal signals are superimposed. Thus, the perturbation can be at least as large as the sum of all amplitudes. Make sure that the largest possible perturbation is within the range of your plant actuator. Saturating the actuator can introduce errors into the estimated frequency response.
To provide the sine amplitudes by using an input port, on the Block tab, select Use external source for sine amplitudes.
Tunable: Yes
Block Parameter:
AmpSineDaxis 
Type: scalar, vector of length 5 
Default: 1 
Plant Type
— Stability of quadratureaxis current plantStable
(default)  Integrating
Specify whether the plant associated with the qaxis current control
loop is stable or integrating. If the plant has one or more integrators,
select Integrating
.
Block Parameter:
PlantTypeQaxis 
Type: character vector 
Values:
'Stable' 
'Integrating' 
Default:
'Stable' 
Plant Sign
— Sign of quadratureaxis current plantPositive
(default)  Negative
Specify whether the plant associated with the qaxis current control
loop is positive or negative. If a positive change in the plant input at
the nominal operating point results in a positive change in the plant
output, specify Positive
. Otherwise, specify
negative. For stable plants, the sign of the plant is the sign of the
plant DC gain.
Block Parameter:
PlantSignQaxis 
Type: character vector 
Values:
'Positive' 
'Negative' 
Default:
'Positive' 
Sine Amplitudes
— Amplitude of sinusoidal perturbations in quadratureaxis current loopDuring the experiment, the block injects a sinusoidal signal into the plant associated with the loop at the frequencies [1/10, 1/3, 1, 3, 10]ω_{c} , where ω_{c} is the target bandwidth for tuning. Use Sine Amplitudes to specify the amplitude of each of these injected signals. Specify a:
Scalar value to inject the same amplitude at each frequency
Vector of length 5 to specify a different amplitude at each of [1/10, 1/3, 1, 3, 10]ω_{c}
In a typical plant with typical target bandwidth, the magnitudes of the plant responses at the experiment frequencies do not vary widely. In such cases, you can use a scalar value to apply the same magnitude perturbation at all frequencies. However, if you know that the response decays sharply over the frequency range, consider decreasing the amplitude of the lower frequency inputs and increasing the amplitude of the higher frequency inputs. It is numerically better for the estimation experiment when all the plant responses have comparable magnitudes.
The perturbation amplitudes must be:
Large enough that the perturbation overcomes any deadband in the plant actuator and generates a response above the noise level
Small enough to keep the plant running within the approximately linear region near the nominal operating point, and to avoid saturating the plant input or output
In the experiment, the sinusoidal signals are superimposed. Thus, the perturbation can be at least as large as the sum of all amplitudes. Make sure that the largest possible perturbation is within the range of your plant actuator. Saturating the actuator can introduce errors into the estimated frequency response.
To provide the sine amplitudes by using an input port, on the Block tab, select Use external source for sine amplitudes.
Tunable: Yes
Block Parameter:
AmpSineQaxis 
Type: scalar, vector of length 5 
Default: 1 
Plant Type
— Stability of speed loop plantStable
(default)  Integrating
Specify whether the plant associated with the speed control loop is
stable or integrating. If the plant has one or more integrators, select
Integrating
.
Block Parameter:
PlantTypeSpeed 
Type: character vector 
Values:
'Stable' 
'Integrating' 
Default:
'Stable' 
Plant Sign
— Sign of speed loop plantPositive
(default)  Negative
Specify whether the plant associated with the speed control loop is
positive or negative. If a positive change in the plant input at the
nominal operating point results in a positive change in the plant
output, specify Positive
. Otherwise, specify
negative. For stable plants, the sign of the plant is the sign of the
plant DC gain.
Block Parameter:
PlantSignSpeed 
Type: character vector 
Values:
'Positive' 
'Negative' 
Default:
'Positive' 
Sine Amplitudes
— Amplitude of sinusoidal perturbations in speed loopDuring the experiment, the block injects a sinusoidal signal into the plant associated with the loop at the frequencies [1/10, 1/3, 1, 3, 10]ω_{c} , where ω_{c} is the target bandwidth for tuning. Use Sine Amplitudes to specify the amplitude of each of these injected signals. Specify a:
Scalar value to inject the same amplitude at each frequency
Vector of length 5 to specify a different amplitude at each of [1/10, 1/3, 1, 3, 10]ω_{c}
In a typical plant with typical target bandwidth, the magnitudes of the plant responses at the experiment frequencies do not vary widely. In such cases, you can use a scalar value to apply the same magnitude perturbation at all frequencies. However, if you know that the response decays sharply over the frequency range, consider decreasing the amplitude of the lower frequency inputs and increasing the amplitude of the higher frequency inputs. It is numerically better for the estimation experiment when all the plant responses have comparable magnitudes.
The perturbation amplitudes must be:
Large enough that the perturbation overcomes any deadband in the plant actuator and generates a response above the noise level
Small enough to keep the plant running within the approximately linear region near the nominal operating point, and to avoid saturating the plant input or output
In the experiment, the sinusoidal signals are superimposed. Thus, the perturbation can be at least as large as the sum of all amplitudes. Make sure that the largest possible perturbation is within the range of your plant actuator. Saturating the actuator can introduce errors into the estimated frequency response.
To provide the sine amplitudes by using an input port, on the Block tab, select Use external source for sine amplitudes.
Tunable: Yes
Block Parameter:
AmpSineSpeed 
Type: scalar, vector of length 5 
Default: 1 
Plant Type
— Stability of flux loop plantStable
(default)  Integrating
Specify whether the plant associated with the flux control loop is
stable or integrating. If the plant has one or more integrators, select
Integrating
.
Block Parameter:
PlantTypeFlux 
Type: character vector 
Values:
'Stable' 
'Integrating' 
Default:
'Stable' 
Plant Sign
— Sign of flux loop plantPositive
(default)  Negative
Specify whether the plant associated with the flux control loop is
positive or negative. If a positive change in the plant input at the
nominal operating point results in a positive change in the plant
output, specify Positive
. Otherwise, specify
negative. For stable plants, the sign of the plant is the sign of the
plant DC gain.
Block Parameter:
PlantSignFlux 
Type: character vector 
Values:
'Positive' 
'Negative' 
Default:
'Positive' 
Sine Amplitudes
— Amplitude of sinusoidal perturbations in flux loopDuring the experiment, the block injects a sinusoidal signal into the plant associated with the loop at the frequencies [1/10, 1/3, 1, 3, 10]ω_{c} , where ω_{c} is the target bandwidth for tuning. Use Sine Amplitudes to specify the amplitude of each of these injected signals. Specify a:
Scalar value to inject the same amplitude at each frequency
Vector of length 5 to specify a different amplitude at each of [1/10, 1/3, 1, 3, 10]ω_{c}
In a typical plant with typical target bandwidth, the magnitudes of the plant responses at the experiment frequencies do not vary widely. In such cases, you can use a scalar value to apply the same magnitude perturbation at all frequencies. However, if you know that the response decays sharply over the frequency range, consider decreasing the amplitude of the lower frequency inputs and increasing the amplitude of the higher frequency inputs. It is numerically better for the estimation experiment when all the plant responses have comparable magnitudes.
The perturbation amplitudes must be:
Large enough that the perturbation overcomes any deadband in the plant actuator and generates a response above the noise level
Small enough to keep the plant running within the approximately linear region near the nominal operating point, and to avoid saturating the plant input or output
In the experiment, the sinusoidal signals are superimposed. Thus, the perturbation can be at least as large as the sum of all amplitudes. Make sure that the largest possible perturbation is within the range of your plant actuator. Saturating the actuator can introduce errors into the estimated frequency response.
To provide the sine amplitudes by using an input port, on the Block tab, select Use external source for sine amplitudes.
Tunable: Yes
Block Parameter:
AmpSineFlux 
Type: scalar, vector of length 5 
Default: 1 
Plant Type
— Stability of current loop plantsStable
(default)  Integrating
Specify whether the plants associated with the current control loops
are stable or integrating. If the plant has one or more integrators,
select Integrating
.
Block Parameter:
PlantTypeAllInner 
Type: character vector 
Values:
'Stable' 
'Integrating' 
Default:
'Stable' 
Plant Sign
— Sign of current loop plantsPositive
(default)  Negative
Specify whether the plants associated with the current control loops
are positive or negative. If a positive change in the plant input at the
nominal operating point results in a positive change in the plant
output, specify Positive
. Otherwise, specify
negative. For stable plants, the sign of the plant is the sign of the
plant DC gain.
Block Parameter:
PlantSignAllInner 
Type: character vector 
Values:
'Positive' 
'Negative' 
Default:
'Positive' 
Sine Amplitudes
— Amplitude of sinusoidal perturbations in current loopsDuring the experiment, the block injects a sinusoidal signal into the plant associated with the loop at the frequencies [1/10, 1/3, 1, 3, 10]ω_{c} , where ω_{c} is the target bandwidth for tuning. Use Sine Amplitudes to specify the amplitude of each of these injected signals. Specify a:
Scalar value to inject the same amplitude at each frequency
Vector of length 5 to specify a different amplitude at each of [1/10, 1/3, 1, 3, 10]ω_{c}
In a typical plant with typical target bandwidth, the magnitudes of the plant responses at the experiment frequencies do not vary widely. In such cases, you can use a scalar value to apply the same magnitude perturbation at all frequencies. However, if you know that the response decays sharply over the frequency range, consider decreasing the amplitude of the lower frequency inputs and increasing the amplitude of the higher frequency inputs. It is numerically better for the estimation experiment when all the plant responses have comparable magnitudes.
The perturbation amplitudes must be:
Large enough that the perturbation overcomes any deadband in the plant actuator and generates a response above the noise level
Small enough to keep the plant running within the approximately linear region near the nominal operating point, and to avoid saturating the plant input or output
In the experiment, the sinusoidal signals are superimposed. Thus, the perturbation can be at least as large as the sum of all amplitudes. Make sure that the largest possible perturbation is within the range of your plant actuator. Saturating the actuator can introduce errors into the estimated frequency response.
To provide the sine amplitudes by using an input port, on the Block tab, select Use external source for sine amplitudes.
Tunable: Yes
Block Parameter:
AmpSineAllInner 
Type: scalar, vector of length 5 
Default: 1 
Plant Type
— Stability of outer loop plantsStable
(default)  Integrating
Specify whether the plants associated with the outer control loops are
stable or integrating. If the plant has one or more integrators, select
Integrating
.
Block Parameter:
PlantTypeAllOuter 
Type: character vector 
Values:
'Stable' 
'Integrating' 
Default:
'Stable' 
Plant Sign
— Sign of outer loop plantsPositive
(default)  Negative
Specify whether the plants associated with the outer control loops are
positive or negative. If a positive change in the plant input at the
nominal operating point results in a positive change in the plant
output, specify Positive
. Otherwise, specify
negative. For stable plants, the sign of the plant is the sign of the
plant DC gain.
Block Parameter:
PlantSignAllOuter 
Type: character vector 
Values:
'Positive' 
'Negative' 
Default:
'Positive' 
Sine Amplitudes
— Amplitude of sinusoidal perturbations in outer loopsDuring the experiment, the block injects a sinusoidal signal into the plant associated with the loop at the frequencies [1/10, 1/3, 1, 3, 10]ω_{c} , where ω_{c} is the target bandwidth for tuning. Use Sine Amplitudes to specify the amplitude of each of these injected signals. Specify a:
Scalar value to inject the same amplitude at each frequency
Vector of length 5 to specify a different amplitude at each of [1/10, 1/3, 1, 3, 10]ω_{c}
In a typical plant with typical target bandwidth, the magnitudes of the plant responses at the experiment frequencies do not vary widely. In such cases, you can use a scalar value to apply the same magnitude perturbation at all frequencies. However, if you know that the response decays sharply over the frequency range, consider decreasing the amplitude of the lower frequency inputs and increasing the amplitude of the higher frequency inputs. It is numerically better for the estimation experiment when all the plant responses have comparable magnitudes.
The perturbation amplitudes must be:
Large enough that the perturbation overcomes any deadband in the plant actuator and generates a response above the noise level
Small enough to keep the plant running within the approximately linear region near the nominal operating point, and to avoid saturating the plant input or output
In the experiment, the sinusoidal signals are superimposed. Thus, the perturbation can be at least as large as the sum of all amplitudes. Make sure that the largest possible perturbation is within the range of your plant actuator. Saturating the actuator can introduce errors into the estimated frequency response.
To provide the sine amplitudes by using an input port, on the Block tab, select Use external source for sine amplitudes.
Tunable: Yes
Block Parameter:
AmpSineAllOuter 
Type: scalar, vector of length 5 
Default: 1 
Use external source for bandwidths
— Supply external signal for target bandwidthsSelect this parameter to enable the bandwidth
input port of the
block. You can specify the target bandwidth for all the loops the block
tunes at this port. When this parameter is disabled, specify the target
bandwidths at the block parameters. For more details, see the
bandwidth
port description.
Block Parameter:
UseExternalWc 
Type: character vector 
Values:
'off'  'on'

Default:
'off' 
Use external source for target phase margins
— Supply external signal for target phase marginSelect this parameter to enable the target PM
input port of the
block. You can specify the target phase margin for all the loops the
block tunes at this port. When this parameter is disabled, specify the
target phase margins at the block parameters. For more details, see the
target PM
port description.
Block Parameter:
UseExternalPM 
Type: character vector 
Values:
'off'  'on'

Default:
'off' 
Use external source for start/stops of experiment
— Supply external signal for start and stop of tuning experimentSelect this parameter to enable the start/stop
and
ActiveLoop
input ports of the block. You can
specify the start and stop of the experiment and which loop the block
tunes at these ports. When this parameter is disabled, specify the start
time and duration of the tuning experiment at the block parameters. For
more details, see the start/stop
and
ActiveLoop
port descriptions.
Block Parameter:
UseExternalSourceStartStop 
Type: character vector 
Values:
'off'  'on'

Default:
'off' 
Use external source for sine amplitudes
— Supply external signal for sinusoidal perturbation amplitudeSelect this parameter to enable the sine Amp
input port of the block.
You can specify sinusoidal perturbation amplitude for all the loops the
block tunes at this port. When this parameter is disabled, supply the
sine amplitudes at block parameters. For more details, see the
sine Amp
port description.
Block Parameter:
UseExternalAmpSine 
Type: character vector 
Values:
'off'  'on'

Default:
'off' 
Data Type
— Floating point precisiondouble
(default)  single
Specify the floatingpoint precision based on the simulation environment or hardware requirements.
Block Parameter:
BlockDataType 
Type: character vector 
Values:
'double'  'single'

Default:
'double' 
Estimated phase margin achieved by tuned controllers
— Phase margin achieved by most recently tuned loopSelect this parameter to enable the estimated PM
output port of the block. The block returns the phase margin achieved by
the tuned controller of the most recently tuned loop. When this
parameter is disabled, you can see the tuning results by using the
Export to MATLAB parameter. For more details,
see the estimated PM
port description.
Block Parameter:
UseExternalAchievedPM 
Type: character vector 
Values:
'off'  'on'

Default:
'off' 
Plant frequency responses near bandwidth
— Estimated frequency response for most recently tuned loopSelect this parameter to enable the frd
output port of the block. The
block returns the phase margin achieved by the tuned controller of the
most recently tuned loop. When this parameter is disabled, you can see
the tuning results by using the Export to MATLAB
parameter. For more details, see the frd
port
description.
Block Parameter:
UseExternalFRD 
Type: character vector 
Values:
'off'  'on'

Default:
'off' 
Plant nominal input and output
— Plant input and output at nominal operating pointSelect this parameter to enable the nominal
output port of the block.
The block returns the plant input and output at the nominal operating
point of the most recently tuned loop. When this parameter is disabled,
you can see the tuning results by using the Export to
MATLAB parameter. For more details, see the port
description.
Block Parameter:
UseExternalU0 
Type: character vector 
Values:
'off'  'on'

Default:
'off' 
Start/stop of autotuning process
— Signal indicating start and end of experiment for each tuned loopSelect this parameter to enable loop start/stops
output port of the
block. The block returns a signal indicating the times at which the
autotuning experiment started and ended for each loop tuned by the
block. When this parameter is disabled, you can see the tuning results
by using the Export to MATLAB parameter. For more
details, see the loop start/stops
port
description.
Block Parameter:
UseExternalActiveLoop 
Type: character vector 
Values:
'off'  'on'

Default:
'off' 
Export to MATLAB
— Send experiment and tuning results to MATLAB workspaceWhen you click this button, the block creates a structure in the
MATLAB^{®} workspace containing the experiment and tuning results.
This structure, FOCTuningResult
, contains the tuning
results for each loop the block tunes.
Daxis
— Daxis current loop tuning
results
Qaxis
— Qaxis current loop tuning
results
Speed
— Speed loop tuning results
Flux
— Flux loop tuning results
For each loop tuned by the block, the result contains the following fields:
P
, I
,
D
, N
— Tuned PID
gains. The structure contains whichever of these fields are
necessary for the controller type you are tuning. For instance,
if you are tuning a PI controller, the structure contains
P
and I
, but not
D
and N
.
TargetBandwidth
— The value you specified
in the Target bandwidth (rad/sec)
parameter
of the block.
TargetPhaseMargin
— The value you specified
in the Target phase margin (degrees)
parameter of the block.
EstimatedPhaseMargin
— Estimated phase
margin achieved by the tuned system.
Controller
— The tuned PID controller,
returned as a pid
(for parallel form) or
pidstd
(for ideal form) model
object.
Plant
— The estimated plant, returned as an
frd
model object. This
frd
contains the response data obtained
at the experiment frequencies [1/10, 1/3, 1, 3,
10]ω_{c}.
PlantNominal
— The plant input and output
at the nominal operating point when the experiment begins,
specified as a structure with the fields u
(input) and y
(output).
You can export to the MATLAB workspace while the simulation is running, including when running in external mode.
The generated code for this block can be resource heavy. For realtime applications, deploying the code on rapid prototyping hardware, such as the Speedgoat realtime target machine, is recommended.
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
Select web siteYou can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.