Engee documentation

PidStd

Page in progress.

The PID controller is in the standard form.

Library

EngeeControlSystems

Description

The function creates a continuous or discrete proportional-integral-differential controller (PID controller) in a standard form:

where

  • — proportional coefficient;

  • — constant integration;

  • — constant differentiation;

  • — the divisor of the differentiation constant;

  • — discrete integrator of the integral part;

  • — discrete integrator of the differential part.

Syntax

Function call

  • c = PidStd() creates a continuous PID controller with default parameters. You can change the parameter values using the function setproperty!.

  • c = PidStd(kp) creates a continuous proportional regulator (P-regulator).

  • c = PidStd(kp, ti) creates a continuous proportional-integral regulator (PI-regulator).

  • c = PidStd(kp, Inf, td) creates a continuous proportional-differential regulator (PD-regulator).

  • c = PidStd(kp, ti, td) creates a continuous PID controller.

  • c = PidStd(kp, Inf, td, n) creates a continuous PD controller with a first-order filter.

  • c = PidStd(kp, ti, td, n) - creates a continuous PID controller with a first-order filter.

  • c = PidStd(kp, ti, td, Inf, ts) creates a discrete PID controller.

  • c = PidStd(kp, ti, td, n, ts) creates a discrete PID controller with a first-order filter.

  • c = PidStd(kp, ti, td, n, ts, iformula) creates a discrete PID controller with a first-order filter, while the method of integrating the integral component is explicitly specified.

  • c = PidStd(kp, ti, td, n, ts, iformula, dformula) creates a discrete PID controller with a first-order filter, while the integration methods of the integral and differential components are specified explicitly.

Arguments

Input arguments

# kp — proportional coefficient

+ 1.0 (default) | scalar

Details

The proportional coefficient of the regulator. The value must be a finite number not equal to zero.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers

None

# ti is the integration constant

+ Inf (by default) | scalar

Details

The constant of integration of the regulator. The value must be a positive number.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers

None

# td — differentiation constant

+ 0.0 (by default) | scalar

Details

The constant of differentiation of the regulator. The value must be a finite non-negative number.

The creation of a D-regulator is not provided.
Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers

None

# n is the divisor of the differentiation constant

+ Inf (by default) | scalar

Details

The coefficient that determines the limit frequency of the filter. The value must be a positive number.

The value of this parameter must be equal to Inf when the differentiation constant is 0.
Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers

None

# ts — sampling period

+ nothing (by default) | scalar

Details

The sampling period of the controller. For a continuous regulator, the argument takes the value nothing, and for a discrete controller, the value of the argument can be any positive number.

The value of this parameter must be equal to 0 when the regulator has no differential component.
Data types

Nothing, Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers

None

# iformula is a method for integrating an integral component

+ nothing (by default) | :forward_euler | :backward_euler | :trapezoidal

Details

The method of integrating the integral component discrete PID controller

The argument takes the following values:

  • :forward_euler — the direct Euler method

    It is recommended to use this method when the sampling period is short, i.e. if the Nyquist frequency is much higher than the bandwidth of the controller. For large values of the sampling period, using the direct Euler method can make the regulator unstable, even if a similar continuous regulator is stable.

  • :backward_euler — the inverse Euler method

    This method guarantees the stability of a discrete regulator when sampling a stable continuous regulator.

  • :trapezoidal — the trapezoid method

    This method guarantees the stability of a discrete regulator when sampling a stable continuous regulator. The trapezoid method allows to obtain a better correspondence of the frequency characteristics of continuous and discrete regulators in comparison with the Euler method.

For a continuous regulator, this argument takes the value nothing.
Data types

Nothing, Symbol

# dformula is a method for integrating the differential component

+ nothing (by default) | :forward_euler | :backward_euler | :trapezoidal

Details

The method of integrating the integral component discrete PID controller

The argument takes the following values:

  • :forward_euler — the direct Euler method

    It is recommended to use this method when the sampling period is short, i.e. if the Nyquist frequency is much higher than the bandwidth of the controller. For large values of the sampling period, using the direct Euler method can make the regulator unstable, even if a similar continuous regulator is stable.

  • :backward_euler — the inverse Euler method

    This method guarantees the stability of a discrete regulator when sampling a stable continuous regulator.

  • :trapezoidal — the trapezoid method

    This method guarantees the stability of a discrete regulator when sampling a stable continuous regulator. The trapezoid method allows to obtain a better correspondence of the frequency characteristics of continuous and discrete regulators in comparison with the Euler method.

For a continuous regulator, this argument takes the value nothing.
Data types

Nothing, Symbol

Output arguments

# c — PID controller in standard form

+ PidStd

Details

The PID controller is in the standard form. The structure of the regulator depends on the specified parameters.

Data types

PidStd