# Integrator with Wrapped State (Discrete or Continuous)

Discrete-time or continuous-time integrator with wrapped state

**Libraries:**

Simscape /
Electrical /
Control /
General Control

## Description

The Integrator with Wrapped State (Discrete or Continuous) block
implements a wrapped state integrator in conformance with IEEE
421.5-2016^{[1]}.

Use this block to generate periodic signals such as angles or to represent a
voltage-controlled oscillator. You can switch between continuous and discrete
implementations of the integrator using the **Sample time**
parameter.

### Equations

**Continuous**

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

. This representation is
equivalent to the continuous transfer function:

$$G(s)=\frac{1}{s}.$$

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

$$\{\begin{array}{c}\dot{x}(t)=u(t)\\ y(t)=x(t)\end{array}\text{\hspace{0.17em}}\text{\hspace{0.17em}}x(0)={x}_{0},$$

where:

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

**Discrete**

To configure the integrator 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:

$$G(z)=\frac{{T}_{s}}{z-1},$$

where *T _{s}* is the
sample time. From the discrete transfer function, the integrator equations are
defined using the forward Euler method:

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

where:

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

### Defining Initial Conditions

You can define the state initial conditions using **Initial
condition** parameter.

### Wrapping Cyclic States

The integrator wraps its state between the specified lower and upper values. This diagram shows the outputs of a wrapped and nonwrapped state integrator for a constant input.

In the diagram, the lower and upper limits are *0*
and *2π*, respectively.

## 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**