---
url: /dyad/stable/stdlib/BlockComponents/components/Continuous.FirstOrder.md
description: >-
  Dyad Continuous.FirstOrder docs.  First-order filter with a single real pole
  and adjustable gain.
---

# `Continuous.FirstOrder` {#Continuous.FirstOrder}

First-order filter with a single real pole and adjustable gain.

Implements a dynamic system with transfer function

$$\frac{k}{sT + 1}$$

where `T` is the time constant and `k` is the gain. The filter has a single real pole at s = -1/T and smoothly tracks the input signal with the specified time constant.

This component extends from [`BlockComponents.Interfaces.SISO`](../types/Interfaces.SISO.md)

## Usage {#Usage}

`BlockComponents.Continuous.FirstOrder(T, k=1.0)`

## Parameters: {#Parameters:}

| Name |                                     Description | Units | Default value |
| ----:| -----------------------------------------------:| -----:| -------------:|
|  `T` | Time constant controlling the speed of response |     – |               |
|  `k` |                Gain factor applied to the input |     – |           1.0 |

## Connectors {#Connectors}

* `u` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `y` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

## Variables {#Variables}

| Name |                                    Description | Units |
| ----:| ----------------------------------------------:| -----:|
|  `x` | State variable representing the filtered value |     – |

## Behavior {#Behavior}

$$ \begin{align}
\frac{\mathrm{d}x\left( t \right)}{\mathrm{d}t} &= \frac{ - x\left( t \right) + k ~ u\left( t \right)}{T} \\
y\left( t \right) &= x\left( t \right)
\end{align}
$$

## Source {#Source}

````dyad
"""
First-order filter with a single real pole and adjustable gain.

Implements a dynamic system with transfer function

```math
\frac{k}{sT + 1}
```
where `T` is the time constant and `k` is the gain. The filter has a single real pole at s = -1/T
and smoothly tracks the input signal with the specified time constant.
"""
component FirstOrder
  extends BlockComponents.Interfaces.SISO
  "State variable representing the filtered value"
  variable x::Real(stateSelect = StateSelect.Prefer)
  "Time constant controlling the speed of response"
  parameter T::Real
  "Gain factor applied to the input"
  parameter k::Real = 1.0
relations
  der(x) = (k * u - x) / T
  y = x
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/FirstOrder.svg"}
  }
}
end
````

````dyad
"""
First-order filter with a single real pole and adjustable gain.

Implements a dynamic system with transfer function

```math
\frac{k}{sT + 1}
```
where `T` is the time constant and `k` is the gain. The filter has a single real pole at s = -1/T
and smoothly tracks the input signal with the specified time constant.
"""
component FirstOrder
  "Input signal port"
  u = RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0},
        "diagram": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
      }
    }
  }
  "Output signal port"
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0},
        "diagram": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      }
    }
  }
  "State variable representing the filtered value"
  variable x::Real(stateSelect = StateSelect.Prefer)
  "Time constant controlling the speed of response"
  parameter T::Real
  "Gain factor applied to the input"
  parameter k::Real = 1.0
relations
  der(x) = (k * u - x) / T
  y = x
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/FirstOrder.svg"}
  }
}
end
````

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`Constant`](Continuous.FirstOrder.md)

  * [`FirstOrder`](Continuous.FirstOrder.md)

  * [`FirstOrder`](Continuous.FirstOrder.md)
