Simulate continuous or discretetime PID controllers
Continuous, Discrete
Implement a continuous or discretetime controller (PID, PI, PD, P, or I) in your Simulink^{®} model. PID controller gains are tunable either manually or automatically. Automatic tuning requires Simulink Control Design™ software (PID Tuner or SISO Design Tool).
The PID Controller block output is a weighted sum of the input signal, the integral of the input signal, and the derivative of the input signal. The weights are the proportional, integral, and derivative gain parameters. A firstorder pole filters the derivative action.
Configurable options in the PID Controller block include:
Controller type (PID, PI, PD, P, or I)
Controller form (Parallel or Ideal)
Time domain (continuous or discrete)
Initial conditions and reset trigger
Output saturation limits and builtin antiwindup mechanism
Signal tracking for bumpless control transfer and multiloop control
In one common implementation, the PID Controller block operates in the feedforward path of the feedback loop:
The input of the block is typically an error signal, which is the difference between a reference signal and the system output. For a twoinput block that permits setpoint weighting, see the PID Controller (2 DOF) block reference page.
You can generate code to implement your controller using any Simulink data type, including fixedpoint data types. (Code generation requires Simulink Coder™ software; fixedpoint implementation requires the FixedPoint Designer™ product.)
For examples illustrating some applications of the PID Controller block, see the following Simulink examples:
The PID Controller block accepts real signals of any numeric data type that Simulink software supports, including fixedpoint data types. See Data Types Supported by Simulink in the Simulink documentation for more information.
The following table summarizes the PID Controller block parameters, accessible on the block parameter dialog box.
Task  Parameters 

Choose controller form and type. 

Choose discrete or continuous time.  
Choose an integration method (discrete time).  
Set and tune controller gains. 

Set integrator and filter initial conditions. 

Limit block output. 

Configure antiwindup mechanism (when you limit block output). 

Enable signal tracking. 

Configure data types. 

Configure block for code generation. 

Select the controller form.
Parallel
(Default)Selects a controller form in which the output is the sum of the proportional, integral, and derivative actions, weighted according to the independent gain parameters P, I, and D. The filter coefficient N sets the location of the pole in the derivative filter. For a continuoustime parallel PID controller, the transfer function is:
$${C}_{par}(s)=\left[P+I\left(\frac{1}{s}\right)+D\left(\frac{Ns}{s+N}\right)\right]$$
For a discretetime parallel PID controller, the transfer function takes the form:
$${C}_{par}(z)=P+Ia(z)+D\left[\frac{N}{1+Nb(z)}\right]$$
where the Integrator
method determines a(z)
and the Filter
method determines b(z)
(for sampling
time T_{s}
):
Forward Euler method  Backward Euler method  Trapezoidal method  

$$a(z)$$ (determined by Integrator method)  $$\frac{{T}_{s}}{z1}$$  $$\frac{{T}_{s}z}{z1}$$  $$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$ 
$$b(z)$$ (determined by Filter method)  $$\frac{{T}_{s}}{z1}$$  $$\frac{{T}_{s}z}{z1}$$  $$\frac{{T}_{s}}{2}\frac{z+1}{z1}$$ 
The controller transfer function for the current settings is displayed in the block dialog box.
Parallel PID Controller
Ideal
Selects a controller form in which the proportional gain P
acts
on the sum of all actions. The transfer functions are the same as
for the parallel form, except that P
multiplies
all terms. For a continuoustime ideal PID controller, the transfer
function is:
$${C}_{id}(s)=P\left[1+I\left(\frac{1}{s}\right)+D\left(\frac{Ns}{s+N}\right)\right]$$
For a discretetime ideal PID controller the transfer function is:
$${C}_{id}(z)=P\left[1+Ia(z)+D\frac{N}{1+Nb(z)}\right]$$
where the Integrator
method determines a(z)
and the Filter
method determines b(z)
as described
previously for the parallel controller form.
Ideal PID Controller
Specify the controller type.
PID
(Default)Implements a controller with proportional, integral, and derivative action.
PI
Implements a controller with proportional and integral action.
PD
Implements a controller with proportional and derivative action.
P
Implements a controller with proportional action.
I
Implements a controller with integral action.
The controller transfer function for the current settings is displayed in the block dialog box.
Select continuous or discrete time domain. The appearance of the block changes to reflect your selection.
Continuoustime
(Default)Selects the continuoustime representation.
Discretetime
Selects the discretetime representation. Selecting Discretetime
also
allows you to specify the:
Sample time, which is the discrete interval between samples.
Discrete integration methods for the integrator and the derivative filter using the Integrator method and Filter method menus.
(Available only when you set Timedomain to Discretetime
.)
Specify the method used to compute the integrator output. For more
information about discretetime integration methods, see the DiscreteTime Integrator block
reference page.
Forward Euler
(Default)Selects the Forward Rectangular (lefthand) approximation.
This method is best for small sampling times, where the Nyquist
limit is large compared to the bandwidth of the controller. For larger
sampling times, the Forward Euler
method
can result in instability, even when discretizing a system that is
stable in continuous time.
Backward Euler
Selects the Backward Rectangular (righthand) approximation.
An advantage of the Backward Euler
method
is that discretizing a stable continuoustime system using this method
always yields a stable discretetime result.
If you activate the Backcalculation
Antiwindup
method, this integration method can cause algebraic loops
in your controller. Algebraic loops can slow down simulation of the
model. In addition, if you want to generate code using Simulink Coder software
or the FixedPoint Designer product, you cannot generate code for
a model that contains an algebraic loop. For more information about
algebraic loops in Simulink models, see Algebraic Loops in
the Simulink documentation.
Trapezoidal
Selects the Bilinear approximation.
An advantage of the Trapezoidal
method
is that discretizing a stable continuoustime system using this method
always yields a stable discretetime result. Of all available integration
methods, the Trapezoidal
method yields
the closest match between frequencydomain properties of the discretized
system and the corresponding continuoustime system.
If you activate the Backcalculation
Antiwindup
method, this integration method can cause algebraic loops
in your controller. Algebraic loops can slow down simulation of the
model. In addition, if you want to generate code using Simulink Coder software
or the FixedPoint Designer product, you cannot generate code for
a model that contains an algebraic loop. For more information about
algebraic loops in Simulink models, see Algebraic Loops in
the Simulink documentation.
(Available only when you set Timedomain to Discretetime
.)
Specify the method used to compute the derivative filter output. For
more information about discretetime integration methods, see the DiscreteTime Integrator block
reference page.
Forward Euler
(Default)Selects the Forward Rectangular (lefthand) approximation.
This method is best for small sampling times, where the Nyquist
limit is large compared to the bandwidth of the controller. For larger
sampling times, the Forward Euler
method
can result in instability, even when discretizing a system that is
stable in continuous time.
Backward Euler
Selects the Backward Rectangular (righthand) approximation.
An advantage of the Backward Euler
method
is that discretizing a stable continuoustime system using this method
always yields a stable discretetime result. Any filter parameter
value N > 0
yields a stable result with this
method.
This filter method can cause algebraic loops in your controller. Algebraic loops can slow down simulation of the model. In addition, if you want to generate code using Simulink Coder software or the FixedPoint Designer product, you cannot generate code for a model that contains an algebraic loop. For more information about algebraic loops in Simulink models, see Algebraic Loops in the Simulink documentation.
Trapezoidal
Selects the Bilinear approximation.
An advantage of the Trapezoidal
method
is that discretizing a stable continuoustime system using this method
always yields a stable discretetime result. Any filter parameter
value N > 0
yields a stable result with this
method. Of all available filter methods, the Trapezoidal
method
yields the closest match between frequencydomain properties of the
discretized system and the corresponding continuoustime system.
This filter method can cause algebraic loops in your controller. Algebraic loops can slow down simulation of the model. In addition, if you want to generate code using Simulink Coder software or the FixedPoint Designer product, you cannot generate code for a model that contains an algebraic loop. For more information about algebraic loops in Simulink models, see Algebraic Loops in the Simulink documentation.
(Available only when you set Timedomain to Discretetime
.)
Specify the discrete interval between samples.
Default: 1
By default, the block uses a discrete sample time of 1. To specify a different sample time, enter another discrete value, such as 0.1.
If you specify a value of 1, the PID Controller block inherits
the sample time from the upstream block. Do not enter a value of 0;
to implement a continuoustime controller, select the Timedomain Continuoustime
.
See Specify Sample Time in the online documentation for more information.
Select the source of the controller gains and filter coefficient. You can provide these parameters explicitly in the block dialog box, or enable external inputs for them on the block. Enabling external inputs for the parameters allows you to compute PID gains and filter coefficients externally to the block and provide them to the block as signal inputs.
External gain input is useful, for example, when you want to map a different PID parameterization to the PID gains of the block. You can also use external gain input to implement gainscheduled PID control, in which controller gains are determined by logic or other calculation in the Simulink model and passed to the block.
internal
(Default)Specify the PID gains and filter coefficient explicitly using the P, I, D, and N parameters.
external
Specify the PID gains and filter coefficient externally. An additional input port appears under the block input for each parameter that is required for the current controller type:
When you supply gains externally, time variations in the integral and derivative gain values are integrated and differentiated, respectively. This result occurs because of the way the PID gains are implemented within the block. For example, for a continuoustime PID controller with external inputs, the integrator term is implemented as shown in the following illustration.
Within the block, the block's input signal is multiplied by the externallysupplied integrator gain, I, before integration. This implementation yields:
$${y}_{i}={\displaystyle \int uI\text{\hspace{0.17em}}dt}.$$
Thus, the integrator gain is included in the integral. Similarly, in the derivative term of the block, multiplication by the derivative gain precedes the differentiation, which causes the derivative gain D to be differentiated.
(Available for PID, PD, PI, and P controllers.) Specify the
proportional gain P
.
Default: 1
Enter a finite, real gain value into the Proportional
(P) field. Use either scalar or vector gain values. For
a Parallel
PID Controller form,
the proportional action is independent of the integral and derivative
actions. For an Ideal
PID Controller
form, the proportional action acts on the integral and
derivative actions. See Controller form for more information about the role of P
in
the controller transfer function.
When you have Simulink Control Design software installed, you can automatically tune the controller gains using the PID Tuner or the SISO Design Tool. See Choosing a Control Design Approach.
(Available for PID, PI, and I controllers.) Specify the integral
gain I
.
Default: 1
Enter a finite, real gain value into the Integral (I) field. Use either scalar or vector gain values.
When you have Simulink Control Design software installed, you can automatically tune the controller gains using the PID Tuner or the SISO Design Tool. See Choosing a Control Design Approach.
(Available for PID and PD controllers.) Specify the derivative
gain D
.
Default: 0
Enter a finite, real gain value into the Derivative (D) field. Use either scalar or vector gain values.
When you have Simulink Control Design software installed, you can automatically tune the controller gains using the PID Tuner or the SISO Design Tool. See Choosing a Control Design Approach.
(Available for PID and PD controllers, when Use filtered
derivative is checked.) Specify the filter coefficient N
,
which determines the pole location of the filter in the derivative
action:
The filter pole falls at s = N
in the Continuoustime
Timedomain.
For Discretetime
, the location of the
pole depends on which Filter method you select
(for sampling time T_{s}
):
Forward Euler
:
$${z}_{pole}=1N{T}_{s}$$
Backward Euler
:
$${z}_{pole}=\frac{1}{1+N{T}_{s}}$$
Trapezoidal
:
$${z}_{pole}=\frac{1N{T}_{s}/2}{1+N{T}_{s}/2}$$
Default: 100.
Enter a finite, real gain value into the Filter Coefficient
(N) field. Use either scalar or vector gain values. Note
that the PID controller block does not support N
= inf
(ideal unfiltered derivative).
When you have Simulink Control Design software installed,
you can automatically tune the controller gains using the PID Tuner
or the SISO Design Tool. See Choosing a Control Design Approach. Automatic
tuning requires N > 0
.
Specify whether derivative term is filtered (finite N
)
or unfiltered. Unfiltered derivative is available only for discretetime
controllers.
Unchecking this option replaces the filtered derivative with
a discrete differentiator. For example, if Filter Method is Forward
Euler
, then the filtered derivative term is represented
by:
When you uncheck Use filtered derivative, the derivative term becomes:
On
(Default)Use derivative filter (finite N
).
Off
Derivative is unfiltered.
(Only available for controllers with integral or derivative action.) Select the source of the integrator and filter initial conditions. Simulink uses initial conditions to initialize the integrator and filter output at the start of a simulation or at a specified trigger event (See External reset). The integrator and filter initial conditions in turn determine the initial block output.
internal
(Default)Specifies the integrator and filter initial conditions explicitly using the Integrator Initial condition and Filter Initial condition parameters.
external
Specifies the integrator and filter initial conditions externally.
An additional input port appears under the block input for each initial
condition: I_{0}
for the integrator
and D_{0}
for the filter:
(Available only when Initial conditions
Source is internal
and the controller
includes integral action.) Specify the integrator initial value. Simulink uses
the initial condition to initialize the integrator output at the start
of a simulation or at a specified trigger event (see External reset). The integrator initial
condition, together with the filter initial condition, determines
the initial output of the PID controller block.
Default: 0
Simulink does not permit the integrator initial condition
to be inf
or NaN
.
(Available only when Initial conditions
Source is internal
, the controller
includes derivative action, and Use filtered derivative is
checked.) Specify the filter initial value. Simulink uses the
initial condition to initialize the filter output at the start of
a simulation or at a specified trigger event (see External reset). The filter initial condition,
together with the integrator initial condition, determines the initial
output of the PID controller block.
Default: 0
Simulink does not permit the filter initial condition to
be inf
or NaN
.
Select the trigger event that resets the integrator and filter
outputs to the initial conditions you specify in the Integrator
Initial condition and Filter Initial condition fields.
Selecting any option other than none
enables
a reset input on the block for the external reset signal, as shown:
Or, if the Initial
conditions Source is External
,
The reset signal must
be a scalar of type single
, double
, boolean
,
or integer
. Fixed point data types, except for ufix1
,
are not supported.
Note: To be compliant with the Motor Industry Software Reliability Association (MISRA^{®}) software standard, your model must use Boolean signals to drive the external reset ports of the PID controller block. 
none
(Default)Does not reset the integrator and filter outputs to initial conditions.
rising
Resets the outputs when the reset signal has a rising edge.
falling
Resets the outputs when the reset signal has a falling edge.
either
Resets the outputs when the reset signal either rises or falls.
level
Resets and holds the outputs to the initial conditions while the reset signal is nonzero.
Force Simulink linearization commands to ignore any reset mechanism that you have chosen with the External reset menu. Ignoring reset states allows you to linearize a model around an operating point even if that operating point causes the PID Controller block to reset.
Off
(Default)Simulink linearization commands do not ignore states corresponding to the reset mechanism.
On
Simulink linearization commands ignore states corresponding to the reset mechanism.
Enable zerocrossing detection in continuoustime models upon reset and upon entering or leaving a saturation state.
Zerocrossing detection can accurately locate signal discontinuities without resorting to excessively small time steps that can lead to lengthy simulation times. If you select Limit output or activate an External reset in your PID Controller block, activating zerocrossing detection can reduce computation time in your simulation. For more information, see ZeroCrossing Detection.
On
(Default)Uses zerocrossing detection at any of the following events: reset; entering or leaving an upper saturation state; and entering or leaving a lower saturation state.
Off
Does not use zerocrossing detection.
Enabling zerocrossing detection for the PID Controller block also enables zerocrossing detection for all undermask blocks that include the zerocrossing detection feature.
Limit the block output to values you specify as the Lower saturation limit and Upper saturation limit parameters.
Activating this option limits the block output internally to the block, obviating the need for a separate Saturation block after the controller in your Simulink model. It also allows you to activate the block's builtin antiwindup mechanism (see Antiwindup method).
Off
(Default)Does not limit the block output, which equals the weighted sum of the proportional, integral, and derivative actions.
On
Limits the block output to the Lower saturation limit or the Upper saturation limit whenever the weighted sum exceeds those limits. Allows you to select an Antiwindup method.
(Available only when you select the Limit output check box.) Specify the lower limit for the block output. The block output is held at the Lower saturation limit whenever the weighted sum of the proportional, integral, and derivative actions goes below that value.
Default: inf
(Available only when you select the Limit output check box.) Specify the upper limit for the block output. The block output is held at the Upper saturation limit whenever the weighted sum of the proportional, integral, and derivative actions exceeds that value.
Default: inf
(Available only when you select the Limit output option and the controller includes integral action.) Select an antiwindup mechanism to discharge the integrator when the block is saturated, which occurs when the sum of the block components exceeds the output limits.
When you select the Limit output check box and the weighted sum of the controller components exceeds the specified output limits, the block output holds at the specified limit. However, the integrator output can continue to grow (integrator windup), increasing the difference between the block output and the sum of the block components. Without a mechanism to prevent integrator windup, two results are possible:
If the sign of the input signal never changes, the integrator continues to integrate until it overflows. The overflow value is the maximum or minimum value for the data type of the integrator output.
If the sign of the input signal changes once the weighted sum has grown beyond the output limits, it can take a long time to discharge the integrator and return the weighted sum within the block saturation limit.
In both cases, controller performance can suffer. To combat the effects of windup without an antiwindup mechanism, it may be necessary to detune the controller (for example, by reducing the controller gains), resulting in a sluggish controller. Activating an antiwindup mechanism can improve controller performance.
none
(Default)Does not use an antiwindup mechanism. This setting may cause the block's internal signals to be unbounded even if the output appears to be bounded by the saturation limits. This can result in slow recovery from saturation or unexpected overflows.
backcalculation
Discharges the integrator when the block output saturates using the integralgain feedback loop:
You can also specify a value for the Backcalculation coefficient (Kb).
clamping
Stops integration when the sum of the block components exceeds the output limits and the integrator output and block input have the same sign. Resumes integration when the sum of the block components exceeds the output limits and the integrator output and block input have opposite sign. The integrator portion of the block is:
The clamping circuit implements the logic necessary to determine whether integration continues.
(Available only when the backcalculation
Antiwindup
method is active.) Specify the gain coefficient of the
antiwindup feedback loop.
The backcalculation
antiwindup method discharges
the integrator on block saturation using a feedback loop having gain
coefficient Kb
.
Default: 1
Force Simulink linearization commands ignore PID Controller block output limits. Ignoring output limits allows you to linearize a model around an operating point even if that operating point causes the PID Controller block to exceed the output limits.
On
(Default)Simulink linearization commands ignore states corresponding to saturation.
Off
Simulink linearization commands do not ignore states corresponding to saturation.
(Available for any controller with integral action.) Activate
signal tracking, which lets the output of the PID Controller block
follow a tracking signal. Provide the tracking signal to the block
at the TR
port, which becomes active when you select Enable
tracking mode.
When signal tracking is active, the difference between the tracked
signal and the block output is fed back to the integrator input with
a gain Kt
. The structure is illustrated for a PI
controller:
You can also specify the Tracking coefficient (Kt).
Use signal tracking, for example, to achieve
bumpless control transfer in systems that switch between two controllers.
You can make one controller track the output of the other controller
by connecting the TR
port to the signal you want
to track. For example:
In this example, the outputs Out1
and Out2
can
drive a controlled system (not shown) through a switch that transfers
control between the "Active controller" block and the PID
Controller block. The signal tracking feature of the PID
Controller block provides smooth operation upon transfer of
control from one controller to another, ensuring that the two controllers
have the same output at the time of transfer.
Use signal tracking to prevent block windup in multiloop control approaches, as this example illustrates:
The innerloop subsystem contains the following blocks:
In this example, the inner loop has an effective gain of 1 when it does not saturate. Without signal tracking, the inner loop winds up in saturation. Signal tracking ensures that the PID Controller output does not exceed the saturated output of the inner loop.
Off
(Default)Disables signal tracking and removes TR
block
input.
On
Enables signal tracking and activates TR
input.
(Available only when you select Enable
tracking mode.) Specify Kt
, which is
the gain of the signal tracking feedback loop.
Default: 1
Select the data type of the gain parameters P, I, D, N, Kb, and Kt.
See Data Types Supported by Simulink in the Simulink documentation for more information.
Inherit: Inherit via internal rule
(Default) Simulink chooses a data type to balance numerical accuracy, performance, and generated code size, while taking into account the properties of the embedded target hardware. If you change the embedded target settings, the data type selected by the internal rule might change. It is not always possible for the software to optimize code efficiency and numerical accuracy at the same time. If the internal rule doesn't meet your specific needs for numerical accuracy or performance, use one of the following options:
Specify the output data type explicitly.
Use the simple choice of Inherit: Same
as input
.
Explicitly specify a default data type such as fixdt(1,32,16)
and
then use the FixedPoint Tool to propose data types for your model.
For more information, see fxptdlg
.
To specify your own inheritance rule, use Inherit:
Inherit via back propagation
and then use a Data Type Propagation block. Examples
of how to use this block are available in the Signal Attributes library Data
Type Propagation Examples block.
Inherit: Inherit via back propagation
Use data type of the driving block.
Inherit: Same as input
Use data type of input signal.
double
single
int8
uint8
int16
uint16
int32
uint32
fixdt(1,16)
fixdt(1,16,0)
fixdt(1,16,2^0,0)
<data type expression>
Name of a data type object. For example, Simulink.NumericType
.
Select the product output data type of the gain parameters P, I, D, N, Kb, and Kt .
See Data Types Supported by Simulink in the Simulink documentation for more information.
Inherit: Inherit via internal rule
(Default) Simulink chooses a data type to balance numerical accuracy, performance, and generated code size, while taking into account the properties of the embedded target hardware. If you change the embedded target settings, the data type selected by the internal rule might change. It is not always possible for the software to optimize code efficiency and numerical accuracy at the same time. If the internal rule doesn't meet your specific needs for numerical accuracy or performance, use one of the following options:
Specify the output data type explicitly.
Use the simple choice of Inherit: Same
as input
.
Explicitly specify a default data type such as fixdt(1,32,16)
and
then use the FixedPoint Tool to propose data types for your model.
For more information, see fxptdlg
.
To specify your own inheritance rule, use Inherit:
Inherit via back propagation
and then use a Data Type Propagation block. Examples
of how to use this block are available in the Signal Attributes library Data
Type Propagation Examples block.
Inherit: Inherit via back propagation
Use data type of the driving block.
Inherit: Same as input
Use data type of input signal.
double
single
int8
uint8
int16
uint16
int32
uint32
fixdt(1,16)
fixdt(1,16,0)
fixdt(1,16,2^0,0)
<data type expression>
Name of a data type object. For example, Simulink.NumericType
.
Select the summation output data type of the sums Sum, Sum
D, Sum I1 , SumI2 ,and SumI3,
which are sums computed internally within the block. To see where Simulink computes
each of these sums , rightclick the PID Controller block
in your model and select Look Under Mask
:
Sum is the weighted sum of the proportional, derivative, and integral signals.
SumD is the sum in the derivative filter feedback loop.
SumI1 is the sum
of the block input signal (weighted by the integral gain I
)
and SumI2. SumI1 is
computed only when Limit output and Antiwindup
method backcalculation
are
active.
SumI2 is the difference
between the weighted sum Sum and
the limited block output. SumI2 is
computed only when Limit output and Antiwindup
method backcalculation
are
active.
SumI3 is the difference between the block output and the signal at the block's tracking input. SumI3 is computed only when you select the Enable tracking mode box.
See Data Types Supported by Simulink in the Simulink documentation for more information.
Inherit: Inherit via internal rule
(Default) Simulink chooses a data type to balance numerical accuracy, performance, and generated code size, while taking into account the properties of the embedded target hardware. If you change the embedded target settings, the data type selected by the internal rule might change. It is not always possible for the software to optimize code efficiency and numerical accuracy at the same time. If the internal rule doesn't meet your specific needs for numerical accuracy or performance, use one of the following options:
Specify the output data type explicitly.
Use the simple choice of Inherit: Same
as first input
.
Explicitly specify a default data type such as fixdt(1,32,16)
and
then use the FixedPoint Tool to propose data types for your model.
For more information, see fxptdlg
.
Note:
The accumulator internal rule favors greater numerical accuracy,
possibly at the cost of less efficient generated code. To get the
same accuracy for the output, set the output data type to 
Inherit: Inherit via back propagation
Use data type of the driving block.
Inherit: Same as first input
Use data type of first input signal.
Inherit: Same as accumulator
Use the same data type as the corresponding accumulator.
double
single
int8
uint8
int16
uint16
int32
uint32
fixdt(1,16)
fixdt(1,16,0)
fixdt(1,16,2^0,0)
<data type expression>
Name of a data type object. For example, Simulink.NumericType
.
Specify the accumulator data type.
Default: Inherit:
Inherit via internal rule
Inherit: Inherit via internal rule
Use internal rule to determine accumulator data type.
Inherit: Same as first input
Use data type of first input signal.
double
Accumulator data type is double
.
single
Accumulator data type is single
.
int8
Accumulator data type is int8
.
uint8
Accumulator data type is uint8
.
int16
Accumulator data type is int16
.
uint16
Accumulator data type is uint16
.
int32
Accumulator data type is int32
.
uint32
Accumulator data type is uint32
.
fixdt(1,16,0)
Accumulator data type is fixed point fixdt(1,16,0)
.
fixdt(1,16,2^0,0)
Accumulator data type is fixed point fixdt(1,16,2^0,0)
.
<data type expression>
The name of a data type object, for example Simulink.NumericType
See BlockSpecific Parameters for the commandline information.
For more information, see Specify Data Types Using Data Type Assistant.
Select the data type of the integrator output.
See Data Types Supported by Simulink in the Simulink documentation for more information.
Inherit: Inherit via internal rule
(Default) Simulink chooses a data type to balance numerical accuracy, performance, and generated code size, while taking into account the properties of the embedded target hardware. If you change the embedded target settings, the data type selected by the internal rule might change. It is not always possible for the software to optimize code efficiency and numerical accuracy at the same time. If the internal rule doesn't meet your specific needs for numerical accuracy or performance, use one of the following options:
Specify the output data type explicitly.
Use Inherit: Inherit via back propagation
.
Explicitly specify a default data type such as fixdt(1,32,16)
and
then use the FixedPoint Tool to propose data types for your model.
For more information, see fxptdlg
.
Inherit: Inherit via back propagation
Use data type of the driving block.
double
single
int8
uint8
int16
uint16
int32
uint32
fixdt(1,16)
fixdt(1,16,0)
fixdt(1,16,2^0,0)
<data type expression>
Name of a data type object. For example, Simulink.NumericType
.
Select the data type of the filter output.
See Data Types Supported by Simulink in the Simulink documentation for more information.
Inherit: Inherit via internal rule
(Default) Simulink chooses a data type to balance numerical accuracy, performance, and generated code size, while taking into account the properties of the embedded target hardware. If you change the embedded target settings, the data type selected by the internal rule might change. It is not always possible for the software to optimize code efficiency and numerical accuracy at the same time. If the internal rule doesn't meet your specific needs for numerical accuracy or performance, use one of the following options:
Specify the output data type explicitly.
Use Inherit: Inherit via back propagation
.
Explicitly specify a default data type such as fixdt(1,32,16)
and
then use the FixedPoint Tool to propose data types for your model.
For more information, see fxptdlg
.
Inherit: Inherit via back propagation
Use data type of the driving block.
double
single
int8
uint8
int16
uint16
int32
uint32
fixdt(1,16)
fixdt(1,16,0)
fixdt(1,16,2^0,0)
<data type expression>
Name of a data type object. For example, Simulink.NumericType
.
Select the saturation output data type.
See Data Types Supported by Simulink in the Simulink documentation for more information.
Inherit: Same as input
(Default)Use data type of input signal.
Inherit: Inherit via back propagation
Use data type of the driving block.
double
single
int8
uint8
int16
uint16
int32
uint32
fixdt(1,16)
fixdt(1,16,0)
fixdt(1,16,2^0,0)
<data type expression>
Name of a data type object. For example, Simulink.NumericType
.
Select the category of data to specify.
Default: Inherit
Inherit
Inheritance rules for data types. Selecting Inherit
enables
a second menu/text box to the right. Select one of the following choices:
Inherit via internal rule
(default)
Inherit via back propagation
Same as first input
Same as accumulator
Built in
Builtin data types. Selecting Built in
enables
a second menu/text box to the right. Select one of the following choices:
double
(default)
single
int8
uint8
int16
uint16
int32
uint32
Fixed point
Fixedpoint data types.
Expression
Expressions that evaluate to data types. Selecting Expression
enables
a second menu/text box to the right, where you can enter the expression.
Clicking the Show data type assistant button enables this parameter.
See BlockSpecific Parameters for the commandline information.
See Specify Data Types Using Data Type Assistant.
Select the category of data to specify.
Default: Inherit
Inherit
Inheritance rules for data types. Selecting Inherit
enables
a second menu/text box to the right. Select one of the following choices:
Inherit via back propagation
Same as input
(default)
Built in
Builtin data types. Selecting Built in
enables
a second menu/text box to the right. Select one of the following choices:
double
(default)
single
int8
uint8
int16
uint16
int32
uint32
Fixed point
Fixedpoint data types.
Expression
Expressions that evaluate to data types. Selecting Expression
enables
a second menu/text box to the right, where you can enter the expression.
Clicking the Show data type assistant button enables this parameter.
See BlockSpecific Parameters for the commandline information.
See Specify Data Types Using Data Type Assistant.
Select the category of accumulator data to specify
Default: Inherit
Inherit
Specifies inheritance rules for data types. Selecting Inherit
enables
a list of possible values:
Inherit via internal rule
(default)
Same as first input
Built in
Specifies builtin data types. Selecting Built
in
enables a list of possible values:
double
(default)
single
int8
uint8
int16
uint16
int32
uint32
Fixed point
Specifies fixedpoint data types.
Expression
Specifies expressions that evaluate to data types. Selecting Expression
enables
you to enter an expression.
Clicking the Show data type assistant button for the accumulator data type enables this parameter.
See BlockSpecific Parameters for the commandline information.
See Specify Data Types Using Data Type Assistant.
Specify data type override mode for this signal.
Default: Inherit
Inherit
Inherits the data type override setting from its context, that
is, from the block, Simulink.Signal
object or Stateflow^{®} chart
in Simulink that is using the signal.
Off
Ignores the data type override setting of its context and uses the fixedpoint data type specified for the signal.
The ability to turn off data type override for an individual data type provides greater control over the data types in your model when you apply data type override. For example, you can use this option to ensure that data types meet the requirements of downstream blocks regardless of the data type override setting.
This parameter appears only when the Mode is Built
in
or Fixed point
.
Specify whether you want the fixedpoint data as signed or unsigned.
Default: Signed
Signed
Specify the fixedpoint data as signed.
Unsigned
Specify the fixedpoint data as unsigned.
Selecting Mode > Fixed
point
enables this parameter.
For more information, see Specifying a FixedPoint Data Type.
Specify whether you want the fixedpoint data to be signed or unsigned.
Default: Signed
Signed
Specify the fixedpoint data to be signed.
Unsigned
Specify the fixedpoint data to be unsigned.
Selecting Mode > Fixed
point
for the accumulator data type enables this parameter.
See BlockSpecific Parameters for the commandline information.
See Specifying a FixedPoint Data Type for more information.
Specify the method for scaling your fixedpoint data to avoid overflow conditions and minimize quantization errors.
Default: Best
precision
, Binary point
, Integer
Binary point
Specify binary point location.
Slope and bias
Enter slope and bias.
Best precision
Specify bestprecision values. This option appears for some blocks.
Integer
Specify integer. This setting has the same result as specifying a binary point location and setting fraction length to 0. This option appears for some blocks.
Selecting Mode > Fixed
point
enables this parameter.
Selecting Binary point
enables:
Fraction length
Calculate BestPrecision Scaling
Selecting Slope and bias
enables:
Slope
Bias
Calculate BestPrecision Scaling
See BlockSpecific Parameters for the commandline information.
For more information, see Specifying a FixedPoint Data Type.
Specify the method for scaling your fixedpoint data to avoid overflow conditions and minimize quantization errors.
Default: Binary
point
Binary point
Specify binary point location.
Slope and bias
Enter slope and bias.
Selecting Mode > Fixed
point
for the accumulator data type enables this parameter.
Selecting Binary point
enables:
Fraction length
Selecting Slope and bias
enables:
Slope
Bias
See BlockSpecific Parameters for the commandline information.
See Specifying a FixedPoint Data Type for more information.
Specify the bit size of the word that holds the quantized integer.
Default: 16
Minimum: 0
Maximum: 32
Selecting Mode > Fixed
point
enables this parameter.
For more information, see Specifying a FixedPoint Data Type.
Specify the bit size of the word that will hold the quantized integer.
Default: 16
Minimum: 0
Maximum: 32
Large word sizes represent large values with greater precision than small word sizes.
Selecting Mode > Fixed
point
for the accumulator data type enables this parameter.
See BlockSpecific Parameters for the commandline information.
See Specifying a FixedPoint Data Type for more information.
Specify fraction length for fixedpoint data type.
Default: 0
Binary points can be positive or negative integers.
Selecting Scaling > Binary
point
enables this parameter.
For more information, see Specifying a FixedPoint Data Type.
Specify fraction length for fixedpoint data type.
Default: 0
Binary points can be positive or negative integers.
Selecting Scaling > Binary
point
for the accumulator data type enables this parameter.
See BlockSpecific Parameters for the commandline information.
See Specifying a FixedPoint Data Type for more information.
Specify slope for the fixedpoint data type.
Default: 2^0
Specify any positive real number.
Selecting Scaling > Slope
and bias
enables this parameter.
For more information, see Specifying a FixedPoint Data Type.
Specify slope for the fixedpoint data type.
Default: 2^0
Specify any positive real number.
Selecting Scaling > Slope
and bias
for the accumulator data type enables this
parameter.
See BlockSpecific Parameters for the commandline information.
See Specifying a FixedPoint Data Type for more information.
Specify bias for the fixedpoint data type.
Default: 0
Specify any real number.
Selecting Scaling > Slope
and bias
enables this parameter.
For more information, see Specifying a FixedPoint Data Type.
Specify bias for the fixedpoint data type.
Default: 0
Specify any real number.
Selecting Scaling > Slope
and bias
for the accumulator data type enables this
parameter.
See BlockSpecific Parameters for the commandline information.
See Specifying a FixedPoint Data Type for more information.
Select to lock the output data type setting of this block against changes by the FixedPoint Tool and the FixedPoint Advisor.
Default: Off
Locks the output data type setting for this block.
Allows the FixedPoint Tool and the FixedPoint Advisor to change the output data type setting for this block.
Parameter: LockScale 
Type: string 
Value: 'off'  'on' 
Default: 'off' 
For more information, see Use Lock Output Data Type Setting.
Specify whether overflows saturate.
Default: Off
Overflows saturate to either the minimum or maximum value that the data type can represent.
For example, an overflow associated with a signed 8bit integer can saturate to 128 or 127.
Overflows wrap to the appropriate value that the data type can represent.
For example, the number 130 does not fit in a signed 8bit integer and wraps to 126.
Consider selecting this check box when your model has a possible overflow and you want explicit saturation protection in the generated code.
Consider clearing this check box when you want to optimize efficiency of your generated code.
Clearing this check box also helps you to avoid overspecifying how a block handles outofrange signals. For more information, see Checking for Signal Range Errors.
When you select this check box, saturation applies to every internal operation on the block, not just the output or result.
In general, the code generation process can detect when overflow is not possible. In this case, the code generator does not produce saturation code.
Parameter: SaturateOnIntegerOverflow 
Type: string 
Value: 'off'  'on' 
Default: 'off' 
Specify the rounding mode for fixedpoint operations.
Default: Floor
Ceiling
Rounds both positive and negative numbers toward positive infinity.
Equivalent to the MATLAB^{®} ceil
function.
Convergent
Rounds number to the nearest representable value. If a tie occurs,
rounds to the nearest even integer. Equivalent to the FixedPoint Designer convergent
function.
Floor
Rounds both positive and negative numbers toward negative infinity.
Equivalent to the MATLAB floor
function.
Nearest
Rounds number to the nearest representable value. If a tie occurs,
rounds toward positive infinity. Equivalent to the FixedPoint Designer nearest
function.
Round
Rounds number to the nearest representable value. If a tie occurs,
rounds positive numbers toward positive infinity and rounds negative
numbers toward negative infinity. Equivalent to the FixedPoint Designer round
function.
Simplest
Automatically chooses between round toward floor and round toward zero to generate rounding code that is as efficient as possible.
Zero
Rounds number toward zero. Equivalent to the MATLAB fix
function.
Parameter: RndMeth 
Type: string 
Value: 'Ceiling'  'Convergent'  'Floor'  'Nearest'  'Round'  'Simplest'  'Zero' 
Default: 'Floor' 
For more information, see Rounding in the FixedPoint Designer documentation.
Assign unique name to each state. The state names apply only to the selected block.
To assign a name to a single state, enter the name between quotes;
for example, 'velocity'
.
To assign names to multiple states, enter a commadelimited
list surrounded by braces; for example, {'a', 'b', 'c'}
.
Each name must be unique. To assign state names with a variable that
has been defined in the MATLAB workspace, enter the variable
without quotes. The variable can be a string, cell, or structure.
Default: ' '
(no
name)
Require that state name resolve to Simulink signal object.
Default: Off
Require that state name resolve to Simulink signal object.
Do not require that state name resolve to Simulink signal object.
State name enables this parameter.
Selecting this check box disables Code generation storage class.
Parameter: StateMustResolveToSignalObject 
Type: string 
Value: 'off'  'on' 
Default: 'off' 
Select state storage class.
Default: Auto
Auto
Auto is the appropriate storage class for states that you do not need to interface to external code.
ExportedGlobal
State is stored in a global variable
ImportedExtern
declares
the state as an extern variable.model
_private.h
ImportedExternPointer
declares
the state as an extern pointer.model
_private.h
State name enables this parameter.
Setting this parameter to ExportedGlobal
, ImportedExtern
,
or ImportedExternPointer
enables Code
generation storage type qualifier.
CommandLine Information
Parameter: StateStorageClass 
Type: string 
Value: 'Auto'  'ExportedGlobal'  'ImportedExtern'  'ImportedExternPointer' 
Default: 'Auto' 
Specify the Simulink Coder storage type qualifier.
Default: ' '
If left blank, no qualifier is assigned.
Setting Package to None
and Code
generation storage class to ExportedGlobal
, ImportedExtern
,
or ImportedExternPointer
enables this parameter.
Parameter: RTWStateStorageTypeQualifier 
Type: string 
Value: ' ' 
Default: ' ' 
Direct Feedthrough  The following ports support direct feedthrough:

Sample Time  Specified in the Sample time parameter 
Scalar Expansion  Supported for gain parameters P, I, and D and for filter coefficient N 
States  Inherited from driving block and parameters 
Dimensionalized  Yes 
ZeroCrossing Detection  Yes (in continuoustime domain) 
PID Controller (2 DOF), Gain, Integrator, DiscreteTime Integrator, Derivative, Discrete Derivative.