> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/smart-power-simulation-software-sps/blocks-functions-tools/control-and-measurements/additional-components/discrete-shift-register.md).

# Discrete Shift Register

## Description

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-e3536e04a66a4ec4d32e9dcff9181a242e479270%2Fdiscrete_shift_register_block.png?alt=media" alt=""><figcaption></figcaption></figure>

The **Discrete Shift Register** block, located in the **OPAL-RT SPS Software/Control** library, implements serial-in, parallel-out shift register and outputs a vector containing the last N samples of the input signal. When the input contains more than one signal, the block outputs the last N samples of each signal in the following order:

Out = \[u1(k), u1(k−1), u1(k−2), u1(k−3), u2(k), u2(k−1), u2(k−2), u2(k−3)]

This example shows the block output for an input containing two signals, represented by u1 and u2, and a number of samples N = 4, represented by the k to k−3 indices. The dimension of the output vector is 4 × 2 = 8.

## Parameters

<table data-header-hidden><thead><tr><th width="249.5555419921875"></th><th></th></tr></thead><tbody><tr><td><strong>Number of samples N</strong></td><td><p>Specify the number of samples, or stages, of the register. The minimum value is 1.</p><p>Default is 32.</p></td></tr><tr><td><strong>Initial inputs</strong></td><td><p>Specify the initial value of the N-1 samples preceding time 0.</p><p>Enter a scalar value or a vector of the same size as the input signal. Default is 0.</p></td></tr><tr><td><strong>Sample time</strong></td><td><p>Specify the time interval between the samples.</p><p>Default is 50e-6.</p></td></tr></tbody></table>

## Characteristics

<table><thead><tr><th width="249.5555419921875">Direct Feedthrough</th><th>Yes</th></tr></thead><tbody><tr><td>Sample Time</td><td>Discrete</td></tr><tr><td>Dimensionalized</td><td>Yes</td></tr><tr><td>Scalar Expansion</td><td>Yes, of the parameter <strong>Initial inputs</strong></td></tr><tr><td>Zero-Crossing Detection</td><td>No</td></tr></tbody></table>

## Examples

The power\_DiscreteShiftRegister example shows various uses of the Discrete Shift Register block.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/smart-power-simulation-software-sps/blocks-functions-tools/control-and-measurements/additional-components/discrete-shift-register.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
