# Lead-Lag (Discrete or Continuous)

Discrete-time or continuous-time lead-lag compensator

**Libraries:**

Simscape /
Electrical /
Control /
General Control

## Description

The Lead-Lag (Discrete or Continuous) block implements a lead-lag
compensator in conformance with IEEE 421.5-2016^{[1]}.

You can switch between continuous and discrete implementations of the block using the
**Sample time** parameter.

### Equations

**Continuous**

To configure the compensator for continuous time, set the **Sample
time** property to `0`

. This representation is
equivalent to the continuous transfer function:

$$G(s)=\frac{{T}_{1}s+1}{{T}_{2}s+1},$$

where:

*T*is the lead time constant._{1}*T*is the lag time constant._{2}

From the preceeding transfer function, the compensator defining equations are:

$$\{\begin{array}{c}\dot{x}(t)=\frac{1}{{T}_{2}}\left(u(t)-x(t)\right)\\ y(t)=\frac{{T}_{1}}{{T}_{2}}u(t)+\left(1-\frac{{T}_{1}}{{T}_{2}}\right)x(t)\end{array}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}y(0)=x(0)={u}_{0},$$

where:

*u*is the block input.*x*is the block state.*y*is the block output.*t*is the simulation time.*u*is the initial input to the block._{0}

**Discrete**

To configure the compensator for discrete time, set the **Sample
time** property to a positive, nonzero value, or to
`-1`

to inherit the sample time from an upstream block. The
discrete representation is equivalent to the transfer function:

$$\frac{{T}_{1}z+({T}_{s}-{T}_{1})}{{T}_{2}z+({T}_{s}-{T}_{2})},$$

where:

*T*is the lead time constant._{1}*T*is the lag time constant._{2}*T*is the compensator sample time._{s}

From the discrete transfer function, the compensator equations are defined using the forward Euler method:

$$\{\begin{array}{c}x(n+1)=\left(1-\frac{{T}_{s}}{{T}_{2}}\right)x(n)+\left(\frac{{T}_{s}}{{T}_{2}}\right)u(n)\\ y(n)=\left(1-\frac{{T}_{1}}{{T}_{2}}\right)x(n)+\left(\frac{{T}_{1}}{{T}_{2}}\right)u(n)\end{array}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}y(0)=x(0)={u}_{0},$$

where:

*u*is the block input.*x*is the state.*y*is the block output.*n*is the simulation time step.*u*is the initial input to the block._{0}

### Initial Conditions

To specify the initial conditions of this block, set
**Initialization** to:

`Inherited from block input`

— The block sets the state and output initial conditions to the initial input.`Specify as parameter`

— The block sets the state initial condition to the value of**Initial state**.

### Limiting the Integral

Set the **Upper saturation limit** and **Lower saturation
limit** parameters to use the anti-windup saturation method.

The anti-windup method limits the compensator state between the lower saturation
limit *A* and upper saturation limit *B*:

$$A<=x<=B\text{\hspace{0.17em}}.$$

Because the state is limited, the output can respond immediately to a reversal of the input sign when the integral is saturated.

This block does not provide a windup saturation method. To use the windup
saturation method, set the **Upper saturation limit** parameter to
`inf`

, the **Lower saturation limit**
parameter to `-inf`

, and attach a Saturation block
to the output.

### Bypass Compensator Dynamics

Set the lag time constant to zero or to a value equal to that of the lead time constant to ignore the dynamics of the compensator. When bypassed, the block feeds the input directly to the output:

$$\begin{array}{c}{T}_{1}=0\\ {T}_{2}=0\\ {T}_{1}={T}_{2}\end{array}\}\text{\hspace{0.17em}}\text{\hspace{0.17em}}y=u\text{\hspace{0.17em}}.$$

In the continuous case, both the sample time and at least one time constant must be zero.

## Examples

## Ports

### Input

### Output

## Parameters

## References

[1] *IEEE Recommended
Practice for Excitation System Models for Power System Stability
Studies.* IEEE Std 421.5-2016. Piscataway, NJ: IEEE-SA,
2016.

## Extended Capabilities

## Version History

**Introduced in R2017b**