离散PID Controller (2DOF)
离散-time or continuous-time two-degree-of-freedom PID controller
Libraries:
Simulink / Discrete
Description
The离散PID Controller (2DOF)block implements a two-degree-of-freedom PID controller (PID, PI, or PD). The block is identical to thePID Controller (2DOF)block with theTime domainparameter set to离散-time
.
The block generates an output signal based on the difference between a reference signal and a measured system output. The block computes a weighted difference signal for the proportional and derivative actions according to the setpoint weights (bandc) that you specify. The block output is the sum of the proportional, integral, and derivative actions on the respective difference signals, where each action is weighted according to the gain parametersP,I, andD. A first-order pole filters the derivative action.
The block supports several controller types and structures. Configurable options in the block include:
Controller type (PID, PI, or PD) — See theControllerparameter.
Controller form (Parallel or Ideal) — See theFormparameter.
Time domain (discrete or continuous) — See theTime domainparameter.
Initial conditions and reset trigger — See theSourceandExternal resetparameters.
Output saturation limits and built-in anti-windup mechanism — See theLimit outputparameter.
Signal tracking for bumpless control transfer and multiloop control — See theEnable tracking modeparameter.
As you change these options, the internal structure of the block changes by activating different variant subsystems. (SeeImplement Variations in Separate Hierarchy Using Variant Subsystems.) To examine the internal structure of the block and its variant subsystems, right-click the block and selectMask>Look Under Mask.
Control Configuration
In one common implementation, thePID Controllerblock operates in the feedforward path of a feedback loop.
For a single-input block that accepts an error signal (a difference between a setpoint and a system output), see离散PID Controller.
PID Gain Tuning
The PID controller coefficients and the setpoint weights are tunable either manually or automatically. Automatic tuning requires金宝app®Control Design™software. For more information about automatic tuning, see theSelect tuning methodparameter.
Ports
Input
Ref—Reference signal
scalar | vector
Reference signal for plant to follow, as shown.
When the reference signal is a vector, the block acts separately on each signal, vectorizing the PID coefficients and producing a vector output signal of the same dimensions. You can specify the PID coefficients and some other parameters as vectors of the same dimensions as the input signal. Doing so is equivalent to specifying a separate PID controller for each entry in the input signal.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
Port_1( y )—Measured system output
scalar | vector
Feedback signal for the controller, from the plant output.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
P—Proportional gain
scalar | vector
Proportional gain, provided from a source external to the block. 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 gain-scheduled PID control. In gain-scheduled control, you determine the PID coefficients by logic or other calculation in your model and feed them to the block.
Dependencies
To enable this port, setController parameters Sourcetoexternal
.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
I—Integral gain
scalar | vector
Integral gain, provided from a source external to the block. 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 gain-scheduled PID control. In gain-scheduled control, you determine the PID coefficients by logic or other calculation in your model and feed them to the block.
When you supply gains externally, time variations in the integral gain are also integrated. This result occurs because of the way the PID gains are implemented within the block. For details, see theController parameters Sourceparameter.
Dependencies
To enable this port, setController parameters Sourcetoexternal
, and setControllerto a controller type that has integral action.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
I*Ts—Integral gain multiplied by sample time
scalar | vector
Integral gain multiplied by the controller sample time, provided from a source external to the block. 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 gain-scheduled PID control. In gain-scheduled control, you determine the PID coefficients by logic or other calculations in your model and feed them to the block.
Note
PID tuning tools, such as thePID Tunerapp andClosed-Loop PID Autotunerblock, tune the gainIbut notI*Ts. Therefore, multiply the integral gain value you obtain from a tuning tool by the sample time before you supply it to this port.
When you useI*Tsinstead ofI块需要更少的计算执行integration. This improves the execution time of the generated code.
Dependencies
To enable this port, setController parameters Sourcetoexternal
, setControllerto a controller type that has integral action, and enable theUse I*Tsparameter.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
D—Derivative gain
scalar | vector
Derivative gain, provided from a source external to the block. 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 gain-scheduled PID control. In gain-scheduled control, you determine the PID coefficients by logic or other calculation in your model and feed them to the block.
When you supply gains externally, time variations in the derivative gain are also differentiated. This result occurs because of the way the PID gains are implemented within the block. For details, see theController parameters Sourceparameter.
Dependencies
To enable this port, setController parameters Sourcetoexternal
, and setControllerto a controller type that has derivative action.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
N—Filter coefficient
scalar | vector
Derivative filter coefficient, provided from a source external to the block. External coefficient 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 the external input to implement gain-scheduled PID control. In gain-scheduled control, you determine the PID coefficients by logic or other calculation in your model and feed them to the block.
Dependencies
To enable this port, setController parameters Sourcetoexternal
, and setControllerto a controller type that has a filtered derivative.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
b—Proportional setpoint weight
scalar | vector
Proportional setpoint weight, provided from a source external to the block. External 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 the external input to implement gain-scheduled PID control. In gain-scheduled control, you determine the PID coefficients by logic or other calculation in your model and feed them to the block.
Dependencies
To enable this port, setController parameters Sourcetoexternal
.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
c—Derivative setpoint weight
scalar | vector
Derivative setpoint weight, provided from a source external to the block. External 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 the external input to implement gain-scheduled PID control. In gain-scheduled control, you determine the PID coefficients by logic or other calculation in your model and feed them to the block.
Dependencies
To enable this port, setController parameters Sourcetoexternal
, and setControllerto a controller type that has derivative action.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
Reset—External reset trigger
scalar
Trigger to reset the integrator and filter to their initial conditions. Use theExternal resetparameter to specify what kind of signal triggers a reset. The port icon indicates the trigger type specified in that parameter. For example, the following illustration shows a continuous-time PID Controller (2DOF) block withExternal resetset torising
.
When the trigger occurs, the block resets the integrator and filter to the initial conditions specified by theIntegrator Initial conditionandFilter Initial conditionparameters or theI0andD0ports.
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 thePID controllerblock.
Dependencies
To enable this port, setExternal resetto any value other thannone
.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
|Boolean
I0—Integrator initial condition
scalar | vector
Integrator initial condition, provided from a source external to the block.
Dependencies
To enable this port, setInitial conditions Sourcetoexternal
, and setControllerto a controller type that has integral action.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
D0—Filter initial condition
scalar | vector
Initial condition of the derivative filter, provided from a source external to the block.
Dependencies
To enable this port, setInitial conditions Sourcetoexternal
, and setControllerto a controller type that has derivative action.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
up—Output saturation upper limit
scalar | vector
Upper limit of the block output, provided from a source external to the block. If the weighted sum of the proportional, integral, and derivative actions exceeds the value provided at this port, the block output is held at that value.
Dependencies
To enable this port, selectLimit outputand set the output saturationSourcetoexternal
.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
lo—Output saturation lower limit
scalar | vector
Lower limit of the block output, provided from a source external to the block. If the weighted sum of the proportional, integral, and derivative actions goes below the value provided at this port, the block output is held at that value.
Dependencies
To enable this port, selectLimit outputand set the output saturationSourcetoexternal
.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
TR—Tracking signal
scalar | vector
Signal for controller output to track. When signal tracking is active, the difference between the tracking signal and the block output is fed back to the integrator input. Signal tracking is useful for implementing bumpless control transfer in systems that switch between two controllers. It can also be useful to prevent block windup in multiloop control systems. For more information, see theEnable tracking modeparameter.
Dependencies
To enable this port, select theEnable tracking modeparameter.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
TDTI—离散-integrator time
scalar
离散-integrator time, provided as a scalar to the block. You can use your own value of discrete-time integrator sample time that defines the rate at which the block is going to be run either in Simulink or on external hardware. The value of the discrete-time integrator time should match the average sampling rate of the external interrupts, when the block is used inside a conditionally-executed subsystem.
In other words, you can specifyTs
for any of the integrator methods below such that the value matches the average sampling rate of the external interrupts. In discrete time, the derivative term of the controller transfer function is:
whereα(z) depends on the integrator method you specify with this parameter.
-
Forward Euler
-
-
Backward Euler
-
-
Trapezoidal
-
For more information about discrete-time integration, see the离散-Time Integratorblock reference page. For more information on conditionally executed subsystems, seeConditionally Executed Subsystems Overview.
Dependencies
To enable this port, setTime Domainto离散-time
and select thePID Controller is inside a conditionally executed subsystemoption.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
Output
Port_1( u )—控制器输出
scalar | vector
控制器输出, generally based on a sum of the input signal, the integral of the input signal, and the derivative of the input signal, weighted by the setpoint weights and by the proportional, integral, and derivative gain parameters. A first-order pole filters the derivative action. Which terms are present in the controller signal depends on what you select for theControllerparameter. The base controller transfer function for the current settings is displayed in theCompensator formulasection of the block parameters and under the mask. Other parameters modify the block output, such as saturation limits specified by theUpper LimitandLower Limitsaturation parameters.
The controller output is a vector signal when any of the inputs is a vector signal. In that case, the block acts asN独立的PID控制器,在那里Nis the number of signals in the input vector.
Data Types:single
|double
|int8
|int16
|int32
|int64
|uint8
|uint16
|uint32
|uint64
|fixed point
Parameters
Controller—Controller type
PID
(默认)|PI
|PD
Specify which of the proportional, integral, and derivative terms are in the controller.
-
PID
-
Proportional, integral, and derivative action.
-
PI
-
Proportional and integral action only.
-
PD
-
Proportional and derivative action only.
Tip
The controller output for the current setting is displayed in theCompensator formulasection of the block parameters and under the mask.
Programmatic Use
Block Parameter:Controller |
Type:string, character vector |
Values:"PID" ,"PI" ,"PD" |
Default:"PID" |
Form—Controller structure
Parallel
(默认)|Ideal
Specify whether the controller structure is parallel or ideal.
-
Parallel
-
The proportional, integral, and derivative gainsP,I, andD, are applied independently. For example, for a continuous-time 2-DOF PID controller in parallel form, the controller outputuis:
whereris the reference signal,yis the measured plant output signal, andbandcare the setpoint weights.
For a discrete-time 2-DOF controller in parallel form, the controller output is:
where theIntegrator methodandFilter methodparameters determineα(z) andβ(z), respectively.
-
Ideal
-
The proportional gainPacts on the sum of all actions. For example, for a continuous-time 2-DOF PID controller in ideal form, the controller output is:
For a discrete-time 2-DOF PID controller in ideal form, the transfer function is:
where theIntegrator methodandFilter methodparameters determineα(z) andβ(z), respectively.
Tip
The controller output for the current settings is displayed in theCompensator formulasection of the block parameters and under the mask.
Programmatic Use
Block Parameter:Controller |
Type:string, character vector |
Values:"Parallel" ,"Ideal" |
Default:"Parallel" |
Time domain—Specify discrete-time or continuous-time controller
离散-time
(默认)|Continuous-time
When you select离散-time
, it is recommended that you specify an explicit sample time for the block. See theSample time (-1 for inherited)parameter. Selecting离散-time
also enables theIntegrator method, andFilter methodparameters.
When thePID Controllerblock is in a model with synchronous state control (see theState Control(HDL Coder)block), you cannot selectContinuous-time
.
Note
ThePID Controller (2DOF)and离散PID Controller (2DOF)blocks are identical except for the default value of this parameter.
Programmatic Use
Block Parameter:TimeDomain |
Type:string, character vector |
Values:"Continuous-time" ,"Discrete-time" |
Default:"Discrete-time" |
PID Controller is inside a conditionally executed subsystem—Enable the discrete-integrator time port
off
(默认)|on
For discrete-time PID controllers, enable the discrete-time integrator port to use your own value of discrete-time integrator sample time. To ensure proper integration, use theTDTI
port to provide a scalar value of Δt for accurate discrete-time integration.
Dependencies
To enable this parameter, setTime Domainto离散-time
.
Programmatic Use
Block Parameter:UseExternalTs |
Type:string, character vector |
Values:"on" ,"off" |
Default:"off" |
Sample time (-1 for inherited)—离散interval between samples
–1 (default) | positive scalar
Specify a sample time by entering a positive scalar value, such as 0.1. The default discrete sample time of –1 means that the block inherits its sample time from upstream blocks. However, it is recommended that you set the controller sample time explicitly, especially if you expect the sample time of upstream blocks to change. The effect of the controller coefficients P, I, D, and N depend on the sample time. Thus, for a given set of coefficient values, changing the sample time changes the performance of the controller.
SeeSpecify Sample Timefor more information.
To implement a continuous-time controller, setTime domaintoContinuous-time
.
Tip
If you want to run the block with an externally specified or variable sample time, set this parameter to –1 and put the block in aTriggered Subsystem. Then, trigger the subsystem at the desired sample time.
Dependencies
To enable this parameter, setTime domainto离散-time
.
Programmatic Use
Block Parameter:SampleTime |
Type:scalar |
Values:-1 , positive scalar |
Default:-1 |
Integrator method—Method for computing integral in discrete-time controller
Forward Euler
(默认)|Backward Euler
|Trapezoidal
In discrete time, the integral term of the controller transfer function isIa(z), wherea(z) depends on the integrator method you specify with this parameter.
-
Forward Euler
-
Forward rectangular (left-hand) 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
-
Backward rectangular (right-hand) approximation,
An advantage of the
Backward Euler
method is that discretizing a stable continuous-time system using this method always yields a stable discrete-time result. -
Trapezoidal
-
Bilinear approximation,
An advantage of the
Trapezoidal
method is that discretizing a stable continuous-time system using this method always yields a stable discrete-time result. Of all available integration methods, theTrapezoidal
method yields the closest match between frequency-domain properties of the discretized system and the corresponding continuous-time system.Tip
The controller formula for the current setting is displayed in theCompensator formulasection of the block parameters and under the mask.
For more information about discrete-time integration, see the离散-Time Integratorblock reference page.
Dependencies
To enable this parameter, setTime Domainto离散-time
and setControllerto a controller type with integral action.
Programmatic Use
Block Parameter:IntegratorMethod |
Type:string, character vector |
Values:"Forward Euler" ,"Backward Euler" ,"Trapezoidal" |
Default:"Forward Euler" |
Filter method—Method for computing derivative in discrete-time controller
Forward Euler
(默认)|Backward Euler
|Trapezoidal
In discrete time, the derivative term of the controller transfer function is:
whereα(z) depends on the filter method you specify with this parameter.
-
Forward Euler
-
Forward rectangular (left-hand) 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
-
Backward rectangular (right-hand) approximation,
An advantage of the
Backward Euler
method is that discretizing a stable continuous-time system using this method always yields a stable discrete-time result. -
Trapezoidal
-
Bilinear approximation,
An advantage of the
Trapezoidal
method is that discretizing a stable continuous-time system using this method always yields a stable discrete-time result. Of all available integration methods, theTrapezoidal
method yields the closest match between frequency-domain properties of the discretized system and the corresponding continuous-time system.Tip
The controller formula for the current setting is displayed in theCompensator formulasection of the block parameters and under the mask.
For more information about discrete-time integration, see the离散-Time Integratorblock reference page.
Dependencies
To enable this parameter, setTime Domainto离散-time
and enableUse filtered derivative.
Programmatic Use
Block Parameter:FilterMethod |
Type:string, character vector |
Values:"Forward Euler" ,"Backward Euler" ,"Trapezoidal" |
Default:"Forward Euler" |
Main
Source—Source for controller gains and filter coefficient
internal (default) | external
-
internal
-
Specify the controller gains, filter coefficient, and setpoint weights using the block parametersP,I,D,N,b, andcrespectively.
-
external
-
Specify the PID gains, filter coefficient, and setpoint weights externally using block inputs. An additional input port appears on the block for each parameter that is required for the current controller type.
Enabling external inputs for the parameters allows you to compute their values externally to the block and provide them to the block as signal inputs.
External 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 gain-scheduled PID control. In gain-scheduled control, you determine the PID gains by logic or other calculation in your model and feed them to the block.
When you supply gains externally, time variations in the integral and derivative gain values are integrated and differentiated, respectively. The derivative setpoint weightcis also differentiated. This result occurs because in both continuous time and discrete time, the gains are applied to the signal before integration or differentiation. For example, for a continuous-time PID controller with external inputs, the integrator term is implemented as shown in the following illustration.
Within the block, the input signaluis multiplied by the externally supplied integrator gain,I, before integration. This implementation yields:
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 gainDand the derivative setpoint weightcto be differentiated.
Programmatic Use
Block Parameter:ControllerParametersSource |
Type:string, character vector |
Values:"internal" ,“外部” |
Default:"internal" |
Proportional (P)—Proportional gain
1 (default) | scalar | vector
Specify a finite, real gain value for the proportional gain. WhenController formis:
Parallel
— Proportional action is independent of the integral and derivative actions. For example, for a continuous-time 2-DOF PID controller in parallel form, the controller outputuis:whereris the reference signal,yis the measured plant output signal, andbandcare the setpoint weights.
For a discrete-time 2-DOF controller in parallel form, the controller output is:
where theIntegrator methodandFilter methodparameters determineα(z) andβ(z), respectively.
Ideal
— The proportional gain multiples the integral and derivative terms. For example, for a continuous-time 2-DOF PID controller in ideal form, the controller output is:For a discrete-time 2-DOF PID controller in ideal form, the transfer function is:
where theIntegrator methodandFilter methodparameters determineα(z) andβ(z), respectively.
Tunable:Yes
Dependencies
To enable this parameter, set the Controller parametersSourcetointernal
.
Programmatic Use
Block Parameter:P |
Type:scalar, vector |
Default:1 |
Integral (I)—Integral gain
1 (default) | scalar | vector
Specify a finite, real gain value for the integral gain.
Tunable:Yes
Dependencies
要启用该参数,Maintab, set the controller-parametersSourcetointernal
, and setControllerto a type that has integral action.
Programmatic Use
Block Parameter:I |
Type:scalar, vector |
Default:1 |
Integral (I*Ts)—Integral gain multiplied by sample time
1 (default) | scalar | vector
Specify a finite, real gain value for the integral gain multiplied by the sample time.
Note
PID tuning tools, such as thePID Tunerapp andClosed-Loop PID Autotunerblock, tune the gainIbut notI*Ts. Therefore, multiply the integral gain value you obtain from a tuning tool by the sample time before you write it to this parameter.
When you useI*Tsinstead ofI块需要更少的计算执行integration. This improves the execution time of the generated code.
Tunable:No
Dependencies
要启用该参数,Maintab, set the controller-parametersSourcetointernal
, setControllerto a type that has integral action, and enable theUse I*Tsparameter.
Programmatic Use
Block Parameter:I |
Type:scalar, vector |
Default:1 |
Use I*Ts—Use integral gain multiplied by sample time
off
(默认)|on
For discrete-time controllers with integral action, the block takes the integral gain as an input and multiplies it by the sample time internally as a part of performing the integration. You can enable this parameter to specify integral gain multiplied by sample time as input (I*Ts) in place of the integral gain (I). Doing so reduces the number of internal calculations and is useful when you want to improve the execution time of your generated code.
Dependencies
To enable this parameter, setControllerto a controller type that has integral action.
Programmatic Use
Block Parameter:UseKiTs |
Type:string, character vector |
Values:"on" ,"off" |
Default:"on" |
Derivative (D)—Derivative gain
0 (default) | scalar | vector
Specify a finite, real gain value for the derivative gain.
Tunable:Yes
Dependencies
要启用该参数,Maintab, set the controller-parametersSourcetointernal
, and setControllertoPID
orPD
.
Programmatic Use
Block Parameter:D |
Type:scalar, vector |
Default:0 |
Use filtered derivative—Apply filter to derivative term
on
(默认)|off
For discrete-time PID controllers only, clear this option to replace the filtered derivative with an unfiltered discrete-time differentiator. When you do so, the derivative term of the controller output becomes:
For continuous-time PID controllers, the derivative term is always filtered.
Dependencies
To enable this parameter, setTime domainto离散-time
, and setControllerto a type that has a derivative term.
Programmatic Use
Block Parameter:UseFilter |
Type:string, character vector |
Values:"on" ,"off" |
Default:"on" |
Filter coefficient (N)—Derivative filter coefficient
100 (default) | scalar | vector
Specify a finite, real gain value for the filter coefficient. The filter coefficient determines the pole location of the filter in the derivative action of the block. The location of the filter pole depends on theTime domainparameter.
WhenTime domainis
Continuous-time
, the pole location iss = -N
.WhenTime domainis
离散-time
, the pole location depends on theFilter methodparameter.Filter Method Location of Filter Pole Forward Euler
Backward Euler
Trapezoidal
The block does not supportN = Inf
(ideal unfiltered derivative). When theTime domainis离散-time
, you can clearUse filtered derivativeto remove the derivative filter.
Tunable:Yes
Dependencies
要启用该参数,Maintab, set the controller-parametersSourcetointernal
and setControllertoPID
orPD
.
Programmatic Use
Block Parameter:N |
Type:scalar, vector |
Default:100 |
Setpoint weight (b)—Proportional setpoint weight
1 (default) | scalar | vector
Setpoint weight on the proportional term of the controller. The proportional term of a 2-DOF controller output isP(br–y), whereris the reference signal andyis the measured plant output. Settingbto 0 eliminates proportional action on the reference signal, which can reduce overshoot in the system response to step changes in the setpoint. Changing the relative values ofbandcchanges the balance between disturbance rejection and setpoint tracking.
Tunable:Yes
Dependencies
要启用该参数,Maintab, set the controller-parametersSourcetointernal
.
Programmatic Use
Block Parameter:b |
Type:scalar, vector |
Default:1 |
Setpoint weight (c)—Derivative setpoint weight
1 (default) | scalar | vector
Setpoint weight on the derivative term of the controller. The derivative term of a 2-DOF controller acts oncr–y, whereris the reference signal andyis the measured plant output. Thus, settingc0消除导数行动参考signal, which can reduce transient response to step changes in the setpoint. Settingcto 0 can yield a controller that achieves both effective disturbance rejection and smooth setpoint tracking without excessive transient response. Changing the relative values ofbandcchanges the balance between disturbance rejection and setpoint tracking.
Tunable:Yes
Dependencies
要启用该参数,Maintab, set the controller-parametersSourcetointernal
and setControllerto a type that has derivative action.
Programmatic Use
Block Parameter:c |
Type:scalar, vector |
Default:1 |
Select tuning method—Tool for automatic tuning of controller coefficients
Transfer Function Based (PID Tuner App)
(默认)|Frequency Response Based
If you haveSimulink Control Designsoftware, you can automatically tune the PID coefficients when they are internal to the block. To do so, use this parameter to select a tuning tool, and clickTune.
-
Transfer Function Based (PID Tuner App)
-
UsePID Tuner, which lets you interactively tune PID coefficients while examining relevant system responses to validate performance.PID Tunercan tune all the coefficientsP,I,D, andN, and the setpoint coefficientsbandc. By default,PID Tunerworks with a linearization of your plant model. For models that cannot be linearized, you can tune PID coefficients against a plant model estimated from simulated or measured response data. For more information, seeDesign Two-Degree-of-Freedom PID Controllers(Simulink Control Design).
-
Frequency Response Based
-
UseFrequency Response Based PID Tuner, which tunes PID controller coefficients based on frequency-response estimation data obtained by simulation. This tuning approach is especially useful for plants that are not linearizable or that linearize to zero.Frequency Response Based PID Tunertunes the coefficientsP,I,D, andN, but does not tune the setpoint coefficientsbandc. For more information, seeDesign PID Controller from Plant Frequency-Response Data(Simulink Control Design).
Both of these tuning methods assume a single-loop control configuration.Simulink Control Design软件包括es other tuning approaches that suit more complex configurations. For information about other ways to tune aPID Controllerblock, seeChoose a Control Design Approach(Simulink Control Design).
Dependencies
要启用该参数,Maintab, set the controller-parametersSourcetointernal
.
Enable zero-crossing detection—Detect zero crossings on reset and on entering or leaving a saturation state
on
(默认)|off
Zero-crossing detection can accurately locate signal discontinuities without resorting to excessively small time steps that can lead to lengthy simulation times. If you selectLimit outputor activateExternal resetin your PID Controller block, activating zero-crossing detection can reduce computation time in your simulation. Selecting this parameter activates zero-crossing detection:
At initial-state reset
When entering an upper or lower saturation state
When leaving an upper or lower saturation state
For more information about zero-crossing detection, seeZero-Crossing Detection.
Programmatic Use
Block Parameter:ZeroCross |
Type:string, character vector |
Values:"on" ,"off" |
Default:"on" |
Initialization
Source—Source for integrator and derivative initial conditions
internal
(默认)|external
Simulink uses initial conditions to initialize the integrator and derivative-filter (or the unfiltered derivative) output at the start of a simulation or at a specified trigger event. (See theExternal resetparameter.) These initial conditions determine the initial block output. Use this parameter to select how to supply the initial condition values to the block.
-
internal
-
Specify the initial conditions using theIntegrator Initial conditionandFilter Initial conditionparameters. IfUse filtered derivativeis not selected, use theDifferentiatorparameter to specify the initial condition for the unfiltered differentiator instead of a filter initial condition.
-
external
-
Specify the initial conditions externally using block inputs. Additional input portsIoandDoappear on the block. IfUse filtered derivativeis not selected, supply the initial condition for the unfiltered differentiator atDoinstead of a filter initial condition.
Programmatic Use
Block Parameter:InitialConditionSource |
Type:string, character vector |
Values:"internal" ,“外部” |
Default:"internal" |
Integrator—Integrator initial condition
0 (default) | scalar | vector
Simulink uses the integrator initial condition to initialize the integrator at the start of a simulation or at a specified trigger event (seeExternal reset). The integrator initial condition and the filter initial condition determine the initial output of thePID controllerblock.
The integrator initial condition cannot beNaN
orInf
.
Dependencies
To use this parameter, in theInitializationtab, setSourcetointernal
, and setControllerto a type that has integral action.
Programmatic Use
Block Parameter:InitialConditionForIntegrator |
Type:scalar, vector |
Default:0 |
Filter—Filter initial condition
0 (default) | scalar | vector
Simulink uses the filter initial condition to initialize the derivative filter at the start of a simulation or at a specified trigger event (seeExternal reset). The integrator initial condition and the filter initial condition determine the initial output of thePID controllerblock.
The filter initial condition cannot beNaN
orInf
.
Dependencies
To use this parameter, in theInitializationtab, setSourcetointernal
, and use a controller that has a derivative filter.
Programmatic Use
Block Parameter:InitialConditionForFilter |
Type:scalar, vector |
Default:0 |
Differentiator—Initial condition for unfiltered derivative
0 (default) | scalar | vector
When you use an unfiltered derivative, Simulink uses this parameter to initialize the differentiator at the start of a simulation or at a specified trigger event (seeExternal reset). The integrator initial condition and the derivative initial condition determine the initial output of thePID controllerblock.
The derivative initial condition cannot beNaN
orInf
.
Dependencies
To use this parameter, setTime domainto离散-time
, clear theUse filtered derivativecheck box, and in theInitializationtab, setSourcetointernal
.
Programmatic Use
Block Parameter:DifferentiatorICPrevScaledInput |
Type:scalar, vector |
Default:0 |
Initial condition setting—Location at which initial condition is applied
Auto
(默认)|Output
使用this parameter to specify whether to apply theIntegrator Initial conditionandFilter Initial conditionparameter to the corresponding block state or output. You can change this parameter at the command line only, usingset_param
to set theInitialConditionSetting
parameter of the block.
-
Auto
-
使用this option in all situations except when the block is in a triggered subsystem or a function-call subsystem and simplified initialization mode is enabled.
-
Output
-
使用this option when the block is in a triggered subsystem or a function-call subsystem and simplified initialization mode is enabled.
For more information about theInitial condition settingparameter, see the离散-Time Integratorblock.
This parameter is only accessible through programmatic use.
Programmatic Use
Block Parameter:InitialConditionSetting |
Type:string, character vector |
Values:"Auto" ,"Output" |
Default:"Auto" |
External reset—Trigger for resetting integrator and filter values
none
(默认)|rising
|falling
|either
|level
Specify the trigger condition that causes the block to reset the integrator and filter to initial conditions. (IfUse filtered derivativeis not selected, the trigger resets the integrator and differentiator to initial conditions.) Selecting any option other thannone
enables theResetport on the block for the external reset signal.
-
none
-
The integrator and filter (or differentiator) outputs are set to initial conditions at the beginning of simulation, and are not reset during simulation.
-
rising
-
Reset the outputs when the reset signal has a rising edge.
-
falling
-
Reset the outputs when the reset signal has a falling edge.
-
either
-
Reset the outputs when the reset signal either rises or falls.
-
level
-
Reset the outputs when the reset signal either:
Is nonzero at the current time step
Changes from nonzero at the previous time step to zero at the current time step
This option holds the outputs to the initial conditions while the reset signal is nonzero.
Dependencies
To enable this parameter, setControllerto a type that has derivative or integral action.
Programmatic Use
Block Parameter:ExternalReset |
Type:string, character vector |
Values:"none" ,"rising" ,"falling" ,"either" ,"level" |
Default:"none" |
Ignore reset when linearizing—Force linearization to ignore reset
off
(默认)|on
Select to force Simulink andSimulink Control Designlinearization commands to ignore any reset mechanism specified in theExternal resetparameter. Ignoring reset states allows you to linearize a model around an operating point even if that operating point causes the block to reset.
Programmatic Use
Block Parameter:IgnoreLimit |
Type:string, character vector |
Values:"off" ,"on" |
Default:"off" |
Enable tracking mode—Activate signal tracking
off
(默认)|on
Signal tracking lets the block output follow a tracking signal that you provide at theTRport. When signal tracking is active, the difference between the tracking signal and the block output is fed back to the integrator input with a gainKt
, specified by theTracking gain (Kt)parameter. Signal tracking has several applications, including bumpless control transfer and avoiding windup in multiloop control structures.
Bumpless control transfer
Use signal tracking to achieve bumpless control transfer in systems that switch between two controllers. Suppose you want to transfer control between a PID controller and another controller. To do so, connecting the controller output to theTRinput as shown in the following illustration.
For more information, seeBumpless Control Transfer with a Two-Degree-of-Freedom PID Controller.
Multiloop control
Use signal tracking to prevent block windup in multiloop control approaches. For an example illustrating this approach with a 1DOF PID controller, seePrevent Block Windup in Multiloop Control.
Dependencies
To enable this parameter, setControllerto a type that has integral action.
Programmatic Use
Block Parameter:TrackingMode |
Type:string, character vector |
Values:"off" ,"on" |
Default:"off" |
Tracking coefficient (Kt)—Gain of signal-tracking feedback loop
1 (default) | scalar
When you selectEnable tracking mode, the difference between the signalTRand the block output is fed back to the integrator input with a gainKt
. Use this parameter to specify the gain in that feedback loop.
Dependencies
To enable this parameter, selectEnable tracking mode.
Programmatic Use
Block Parameter:Kt |
Type:scalar |
Default:1 |
Saturation
Output saturationLimit Output—Limit block output to specified saturation values
off
(默认)|on
Activating this option limits the block output, so that you do not need a separateSaturation块后控制器。它还允许您activate the anti-windup mechanism built into the block (see theAnti-windup methodparameter). Specify the output saturation limits using theLower limitandUpper limitparameters. You can also specify the saturation limits externally as block input ports.
Programmatic Use
Block Parameter:LimitOutput |
Type:string, character vector |
Values:"off" ,"on" |
Default:"off" |
Source—Source for output saturation limits
internal (default) | external
使用this parameter to specify how to supply the upper and lower saturation limits of the block output.
-
internal
-
Specify the output saturation limits using theUpper limitandLower limitparameters.
-
external
-
Specify the output saturation limits externally using block input ports. The additional input portsupandloappear on the block. You can use the input ports to implement the upper and lower output saturation limits determined by logic or other calculations in the Simulink model and passed to the block.
Programmatic Use
Block Parameter:SatLimitsSource |
Type:string, character vector |
Values:"internal" ,“外部” |
Default:"internal" |
Upper limit—Upper saturation limit for block output
Inf
(默认)|scalar
Specify the upper limit for the block output. The block output is held at theUpper saturation limitwhenever the weighted sum of the proportional, integral, and derivative actions exceeds that value.
Dependencies
To enable this parameter, selectLimit output.
Programmatic Use
Block Parameter:UpperSaturationLimit |
Type:scalar |
Default:Inf |
Lower limit—Lower saturation limit for block output
-Inf
(默认)|scalar
Specify the lower limit for the block output. The block output is held at theLower saturation limitwhenever the weighted sum of the proportional, integral, and derivative actions goes below that value.
Dependencies
To enable this parameter, selectLimit output.
Programmatic Use
Block Parameter:LowerSaturationLimit |
Type:scalar |
Default:-Inf |
Ignore saturation when linearizing—Force linearization to ignore output limits
off
(默认)|on
Force Simulink andSimulink Control Designlinearization commands to ignore block output limits specified in theUpper limitandLower limitparameters. Ignoring output limits allows you to linearize a model around an operating point even if that operating point causes the block to exceed the output limits.
Dependencies
To enable this parameter, select theLimit outputparameter.
Programmatic Use
Block Parameter:LinearizeAsGain |
Type:string, character vector |
Values:"off" ,"on" |
Default:"off" |
Anti-windup method—Integrator anti-windup method
none
(默认)|back-calculation
|clamping
When you selectLimit outputand 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. In other words, the internal signals in the block can be unbounded even if the output appears bounded by saturation limits. Without a mechanism to prevent integrator windup, two results are possible:
If the sign of the signal entering the integrator 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 signal entering the integrator changes once the weighted sum has grown beyond the output limits, it can take a long time to unwind the integrator and return the weighted sum within the block saturation limit.
In either case, controller performance can suffer. To combat the effects of windup without an anti-windup mechanism, it may be necessary to detune the controller (for example, by reducing the controller gains), resulting in a sluggish controller. To avoid this problem, activate an anti-windup mechanism using this parameter.
-
none
-
Do not use an anti-windup mechanism.
-
back-calculation
-
Unwind the integrator when the block output saturates by feeding back to the integrator the difference between the saturated and unsaturated control signal. The following diagram represents the back-calculation feedback circuit for a continuous-time controller. To see the actual feedback circuit for your controller configuration, right-click on the block and selectMask>Look Under Mask.
使用theBack-calculation coefficient (Kb)parameter to specify the gain of the anti-windup feedback circuit. It is usually satisfactory to set
Kb = I
, or for controllers with derivative action,Kb = sqrt(I*D)
. Back-calculation can be effective for plants with relatively large dead time[1]. -
clamping
-
Integration stops when the sum of the block components exceeds the output limits and the integrator output and block input have the same sign. Integration resumes when the sum of the block components exceeds the output limits and the integrator output and block input have opposite sign. Clamping is sometimes referred to as conditional integration.
Clamping can be useful for plants with relatively small dead times, but can yield a poor transient response for large dead times[1].
Dependencies
To enable this parameter, select theLimit outputparameter.
Programmatic Use
Block Parameter:AntiWindupMode |
Type:string, character vector |
Values:"none" ,"back-calculation" ,"clamping" |
Default:"none" |
Back-calculation coefficient (Kb)—Gain coefficient of anti-windup feedback loop
1 (default) | scalar
Theback-calculation
anti-windup method unwinds the integrator when the block output saturates. It does so by feeding back to the integrator the difference between the saturated and unsaturated control signal. Use theBack-calculation coefficient (Kb)parameter to specify the gain of the anti-windup feedback circuit. For more information, see theAnti-windup methodparameter.
Dependencies
To enable this parameter, select theLimit outputparameter, and set theAnti-windup methodparameter toback-calculation
.
Programmatic Use
Block Parameter:Kb |
Type:scalar |
Default:1 |
Limit Output—Limit integrator output to specified saturation limits
off
(默认)|on
Enable this parameter to limit the integrator output to be within a specified range. When the integrator output reaches the limits, the integral action turns off to prevent integral windup. Specify the saturation limits using theLower limitandUpper limitparameters.
Dependencies
To enable this parameter, setControllerto a controller type that has integral action.
Programmatic Use
Block Parameter:LimitIntegratorOutput |
Type:string, character vector |
Values:"off" ,"on" |
Default:"off" |
Upper limit—Upper saturation limit for integrator
Inf
(默认)|scalar
Specify the upper limit for the integrator output. The integrator output is held at this value whenever it would otherwise exceed this value.
Dependencies
To enable this parameter, underIntegrator saturation, selectLimit output.
Programmatic Use
Block Parameter:UpperIntegratorSaturationLimit |
Type:scalar |
Default:Inf |
Lower limit—Lower saturation limit for integrator
-Inf
(默认)|scalar
Specify the lower limit for the integrator output. The integrator output is held at this value whenever it would otherwise go below this value.
Dependencies
To enable this parameter, underIntegrator saturation, selectLimit output.
Programmatic Use
Block Parameter:LowerIntegratorSaturationLimit |
Type:scalar |
Default:-Inf |
Data Types
The parameters in this tab are primarily of use in fixed-point code generation using Fixed-Point Designer™. They define how numeric quantities associated with the block are stored and processed when you generate code.
If you need to configure data types for fixed-point code generation, clickOpen Fixed-Point Tooland use that tool to configure the rest of the parameters in the tab. For information about using Fixed-Point Tool, seeAutoscaling Data Objects Using the Fixed-Point Tool(Fixed-Point Designer).
After you use Fixed-Point Tool, you can use the parameters in this tab to make adjustments to fixed-point data-type settings if necessary. For each quantity associated with the block, you can specify:
Floating-point or fixed-point data type, including whether the data type is inherited from upstream values in the block.
The minimum and maximum values for the quantity, which determine how the quantity is scaled for fixed-point representation.
For assistance in selecting appropriate values, clickto open the Data Type Assistant for the corresponding quantity. For more information, seeSpecify Data Types Using Data Type Assistant.
我列出的具体数量n the Data Types tab vary depending on how you configure the PID controller block. In general, you can configure data types for the following types of quantities:
Product output — Stores the result of a multiplication carried out under the block mask. For example,P product outputstores the output of the gain block that multiplies the block input with the proportional gainP.
Parameter — Stores the value of a numeric block parameter, such asP,I, orD.
Block output — Stores the output of a block that resides under the PID controller block mask. For example, useIntegrator outputto specify the data type of the output of the block called Integrator. This block resides under the mask in the Integrator subsystem, and computes integrator term of the controller action.
Accumulator — Stores values associated with a sum block. For example,SumI2 Accumulatorsets the data type of the accumulator associated with the sum block SumI2. This block resides under the mask in the Back Calculation subsystem of the Anti-Windup subsystem.
In general, you can find the block associated with any listed parameter by looking under the PID Controller block mask and examining its subsystems. You can also use the Model Explorer to search under the mask for the listed parameter name, such asSumI2
. (SeeModel Explorer.)
Matching Input and Internal Data Types
By default, all data types in the block are set toInherit: Inherit via internal rule
. With this setting, Simulink chooses data types to balance numerical accuracy, performance, and generated code size, while accounting for the properties of the embedded target hardware.
Under some conditions, incompatibility can occur between data types within the block. For instance, in continuous time, the Integrator block under the mask can accept only signals of typedouble
. If the block input signal is a type that cannot be converted todouble
, such asuint16
, the internal rules for type inheritance generate an error when you generate code.
To avoid such errors, you can use the Data Types settings to force a data type conversion. For instance, you can explicitly setP product output,I product output, andD product outputtodouble
, ensuring that the signals reaching the continuous-time integrators are of typedouble
.
In general, it is not recommended to use the block in continuous time for code generation applications. However, similar data type errors can occur in discrete time, if you explicitly set some values to data types that are incompatible with downstream signal constraints within the block. In such cases, use the Data Types settings to ensure that all data types are internally compatible.
Fixed-Point Operational ParametersInteger rounding mode—Rounding mode for fixed-point operations
Floor
(默认)|Ceiling
|Convergent
|Nearest
|Round
|Simplest
|Zero
Specify the rounding mode for fixed-point operations. For more information, seeRounding(Fixed-Point Designer).
Block parameters always round to the nearest representable value. To control the rounding of a block parameter, enter an expression using a MATLAB®rounding function into the mask field.
Programmatic Use
Block Parameter:RndMeth |
Type:character vector |
Values:'Ceiling' | 'Convergent' | 'Floor' | 'Nearest' | 'Round' | 'Simplest' | 'Zero' |
Default:'Floor' |
Saturate on integer overflow—Method of overflow action
off
(默认)|on
指定是否溢出饱和或包装。
off
— Overflows wrap to the appropriate value that the data type can represent.For example, the number 130 does not fit in a signed 8-bit integer and wraps to -126.
on
— Overflows saturate to either the minimum or maximum value that the data type can represent.For example, an overflow associated with a signed 8-bit integer can saturate to -128 or 127.
Tip
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 out-of-range signals. For more information, seeTroubleshoot Signal Range Errors.
When you select this check box, saturation applies to every internal operation on the block, not just the output or result.
一般来说,代码生成过程可以检测when overflow is not possible. In this case, the code generator does not produce saturation code.
Programmatic Use
Block Parameter:SaturateOnIntegerOverflow |
Type:character vector |
Values:'off' | 'on' |
Default:'off' |
Lock data type settings against changes by the fixed-point tools—Prevent fixed-point tools from overriding data types
off
(默认)|on
Select this parameter to prevent the fixed-point tools from overriding the data types you specify on this block. For more information, seeLock the Output Data Type Setting(Fixed-Point Designer).
Programmatic Use
Block Parameter:LockScale |
Type:character vector |
Values:'off' | 'on' |
Default:'off' |
State Attributes
The parameters in this tab are primarily of use in code generation.
State name (e.g., 'position')—Name for continuous-time filter and integrator states
''
(默认)|character vector
Assign a unique name to the state associated with the integrator or the filter, for continuous-time PID controllers. (For information about state names in a discrete-time PID controller, see theState nameparameter.) The state name is used, for example:
For the corresponding variable in generated code
As part of the storage name when logging states during simulation
For the corresponding state in a linear model obtain by linearizing the block
A valid state name begins with an alphabetic or underscore character, followed by alphanumeric or underscore characters.
Dependencies
To enable this parameter, setTime domaintoContinuous-time
.
Programmatic Use
Parameter:IntegratorContinuousStateAttributes ,FilterContinuousStateAttributes |
Type:character vector |
Default:'' |
State name—Names for discrete-time filter and integrator states
empty string (default) | string | character vector
Assign a unique name to the state associated with the integrator or the filter, for discrete-time PID controllers. (For information about state names in a continuous-time PID controller, see theState name (e.g., 'position')parameter.)
A valid state name begins with an alphabetic or underscore character, followed by alphanumeric or underscore characters. The state name is used, for example:
For the corresponding variable in generated code
As part of the storage name when logging states during simulation
For the corresponding state in a linear model obtain by linearizing the block
For more information about the use of state names in code generation, seeC Code Generation Configuration for Model Interface Elements(Simulink Coder).
Dependencies
To enable this parameter, setTime domainto离散-time
.
Programmatic Use
Parameter:IntegratorStateIdentifier ,FilterStateIdentifier |
Type:string, character vector |
Default:"" |
State name must resolve to Simulink signal object—Require that state name resolve to a signal object
off
(默认)|on
Select this parameter to require that the discrete-time integrator or filter state name resolves to a Simulink signal object.
Dependencies
To enable this parameter for the discrete-time integrator or filter state:
SetTime domainto
离散-time
.Specify a value for the integrator or filterState name.
Set the model configuration parameterSignal resolutionto a value other than
None
.
Programmatic Use
Block Parameter:IntegratorStateMustResolveToSignalObject ,FilterStateMustResolveToSignalObject |
Type:string, character vector |
Values:"off" ,"on" |
Default:"off" |
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
More About
Decomposition of 2-DOF PID Controllers
A 2-DOF PID controller can be interpreted as a PID controller with a prefilter, or a PID controller with a feedforward element.
In parallel form, a two-degree-of-freedom PID controller can be equivalently modeled by the following block diagram, whereCis a single degree-of-freedom PID controller andFis a prefilter on the reference signal.
Refis the reference signal,yis the feedback from the measured system output, anduis the controller output. For a continuous-time 2-DOF PID controller in parallel form, the transfer functions forFandCare
wherebandcare the setpoint weights.
For a 2-DOF PID controller in ideal form, the transfer functions are
A similar decomposition applies for a discrete-time 2-DOF controller.
Alternatively, the parallel two-degree-of-freedom PID controller can be modeled by the following block diagram.
In this realization,Qacts as feed-forward conditioning on the reference signal. For a continuous-time 2-DOF PID controller in parallel form, the transfer function forQis
For a 2-DOF PID controller in ideal form, the transfer function is
The transfer functions forCare the same as in the filter decomposition.
A similar decomposition applies for a discrete-time 2-DOF controller.
References
[1] Visioli, A., "Modified Anti-Windup Scheme for PID Controllers,"IEE Proceedings - Control Theory and Applications, Vol. 150, Number 1, January 2003
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
For continuous-time PID controllers (Time domainset toContinuous-time
):
Consider usingModel Discretizerto map continuous-time blocks to discrete equivalents that support code generation. To access Model Discretizer, in theAppstab, underControl Systems, clickModel Discretizer.
Not recommended for production code.
For discrete-time PID controllers (Time domainset to离散-time
):
Depends on absolute time when placed inside a triggered subsystem hierarchy.
Generated code relies on
memcpy
ormemset
functions (string.h
) under certain conditions.
PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.
Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.
Fixed-point code generation is supported for discrete-time PID controllers only (Time domainset to离散-time
).
Version History
Introduced in R2009bR2022b:Issues error when integrator and filter initial conditions lie outside saturation limits
The block now issues an error when the integrator or filter initial condition value lies outside the output saturation limits. In previous releases, the block did not issue an error when these initial conditions had such values.
If this change impacts your model, update the PID integrator or filter initial condition values such that they are within the output saturation limits.
R2021b:ReferenceBlock
parameter returns different path
Starting in R2021b, theget_param
function returns a different value for theReferenceBlock
parameter. TheReferenceBlock
parameter is a property common to all Simulink blocks and gives the path of the library block to which a block links. ThePID Controller (2DOF)and离散PID Controller (2DOF)blocks now link to'slpidlib/PID Controller (2DOF)'
. Previously, the blocks linked to'pid_lib/PID Controller (2DOF)'
.
This change does not affect any other functionality or workflows. You can still use the previous path with theset_param
function.
R2020b:ReferenceBlock
parameter returns different path
Starting in R2020b, theget_param
function returns a different value for theReferenceBlock
parameter. TheReferenceBlock
parameter is a property common to all Simulink blocks and gives the path of the library block to which a block links. ThePID Controller (2DOF)and离散PID Controller (2DOF)blocks now link to'pid_lib/PID Controller (2DOF)'
. Previously, the blocks linked to'simulink/Continuous/PID Controller (2DOF)'
.
This change does not affect any other functionality or workflows. You can still use the previous path with theset_param
function.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
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:.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina(Español)
- Canada(English)
- United States(English)
Europe
- Belgium(English)
- Denmark(English)
- Deutschland(Deutsch)
- España(Español)
- Finland(English)
- France(Français)
- Ireland(English)
- Italia(Italiano)
- Luxembourg(English)
- Netherlands(English)
- Norway(English)
- Österreich(Deutsch)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)