---
url: /dyad/stable/stdlib/BlockComponents/tests/Continuous.Tests.FirstOrder.md
description: >-
  Dyad Continuous.Tests.FirstOrder docs.  Test fixture for evaluating
  first-order system response to constant input.
---

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

Test fixture for evaluating first-order system response to constant input.

This component connects a constant value (1.0) to a first-order system with gain 1.2 and time constant 0.1, allowing observation of the step response. The first-order system is expected to reach its steady state value of 1.2 after approximately 5 time constants (0.5 seconds). The metadata includes a test case that verifies this expected behavior after 10 seconds of simulation.

## Usage {#Usage}

`BlockComponents.Continuous.Tests.FirstOrder()`

## Behavior {#Behavior}

$$ \begin{align}
0 &= \mathrm{connect}\left( c\_{+}y, pt1\_{+}u \right) \\
\mathtt{c.y}\left( t \right) &= \mathtt{c.k} \\
\frac{\mathrm{d}\mathtt{pt1.x}\left( t \right)}{\mathrm{d}t} &= \frac{ - \mathtt{pt1.x}\left( t \right) + \mathtt{pt1.k} ~ \mathtt{pt1.u}\left( t \right)}{\mathtt{pt1.T}} \\
\mathtt{pt1.y}\left( t \right) &= \mathtt{pt1.x}\left( t \right)
\end{align}
$$

## Source {#Source}

```dyad
"""
Test fixture for evaluating first-order system response to constant input.

This component connects a constant value (1.0) to a first-order system with gain 1.2 and
time constant 0.1, allowing observation of the step response. The first-order system is
expected to reach its steady state value of 1.2 after approximately 5 time constants (0.5 seconds).
The metadata includes a test case that verifies this expected behavior after 10 seconds of simulation.
"""
test component FirstOrder
  "Constant block that provides a unit step input with value k=1"
  c = BlockComponents.Sources.Constant(k = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 70, "y1": 110, "x2": 170, "y2": 210, "rot": 0}
      }
    }
  }
  "First-order system with gain 1.2 and time constant 0.1 seconds"
  pt1 = BlockComponents.Continuous.FirstOrder(k = 1.2, T = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 310, "y1": 110, "x2": 410, "y2": 210, "rot": 0}
      }
    }
  }
relations
  "Connects the constant output to the first-order system input"
  connect(c.y, pt1.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  initial pt1.y = 0
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "experiments": {},
    "tests": {
      "case1": {
        "stop": 10,
        "atol": {"pt1.y": 0.001},
        "expect": {"final": {"pt1.y": 1.2}, "signals": ["pt1.y"]}
      }
    }
  }
}
end
```

```dyad
"""
Test fixture for evaluating first-order system response to constant input.

This component connects a constant value (1.0) to a first-order system with gain 1.2 and
time constant 0.1, allowing observation of the step response. The first-order system is
expected to reach its steady state value of 1.2 after approximately 5 time constants (0.5 seconds).
The metadata includes a test case that verifies this expected behavior after 10 seconds of simulation.
"""
test component FirstOrder
  "Constant block that provides a unit step input with value k=1"
  c = BlockComponents.Sources.Constant(k = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 70, "y1": 110, "x2": 170, "y2": 210, "rot": 0}
      }
    }
  }
  "First-order system with gain 1.2 and time constant 0.1 seconds"
  pt1 = BlockComponents.Continuous.FirstOrder(k = 1.2, T = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 310, "y1": 110, "x2": 410, "y2": 210, "rot": 0}
      }
    }
  }
relations
  "Connects the constant output to the first-order system input"
  connect(c.y, pt1.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  initial pt1.y = 0
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "experiments": {},
    "tests": {
      "case1": {
        "stop": 10,
        "atol": {"pt1.y": 0.001},
        "expect": {"final": {"pt1.y": 1.2}, "signals": ["pt1.y"]}
      }
    }
  }
}
end
```

## Test Cases {#Test-Cases}

### Test Case `case1` {#Test-Case-case1}

```julia
plt
```

![](zrscwst.svg)

## Related {#Related}

* Examples

* Experiments

* Analyses

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

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

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