---
url: /dyad/stable/stdlib/BlockComponents/tests/Continuous.Tests.SecondOrder.md
description: >-
  Dyad Continuous.Tests.SecondOrder docs.  Second-order system test with
  constant input.
---

# `Continuous.Tests.SecondOrder` {#Continuous.Tests.SecondOrder}

Second-order system test with constant input.

Tests a second-order dynamic system by applying a constant input and verifying the expected step response. The second-order system is configured with a gain of 1.0, natural frequency of 1.0, and damping ratio of 0.5, which produces a slightly under-damped response. The system should eventually reach the steady-state output value matching the input constant.

## Usage {#Usage}

`BlockComponents.Continuous.Tests.SecondOrder()`

## Behavior {#Behavior}

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

## Source {#Source}

```dyad
"""
Second-order system test with constant input.

Tests a second-order dynamic system by applying a constant input and verifying the expected
step response. The second-order system is configured with a gain of 1.0, natural frequency
of 1.0, and damping ratio of 0.5, which produces a slightly under-damped response. The system
should eventually reach the steady-state output value matching the input constant.
"""
test component SecondOrder
  "Constant source block that provides a fixed value of 1 as input"
  c = BlockComponents.Sources.Constant(k = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 70, "y1": 120, "x2": 170, "y2": 220, "rot": 0}
      }
    }
  }
  "Second-order transfer function block with specified dynamics parameters"
  pt2 = BlockComponents.Continuous.SecondOrder(k = 1.0, w = 1.0, d = 0.5) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 120, "x2": 390, "y2": 220, "rot": 0}
      }
    }
  }
relations
  "Connects the constant output to the input of the second-order system"
  connect(c.y, pt2.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  initial pt2.x = 0
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "experiments": {},
    "tests": {
      "case1": {
        "stop": 10,
        "initial": {"pt2.xd": 0},
        "atol": {"pt2.y": 0.01},
        "expect": {"final": {"pt2.y": 1}, "signals": ["pt2.y"]}
      }
    }
  }
}
end
```

```dyad
"""
Second-order system test with constant input.

Tests a second-order dynamic system by applying a constant input and verifying the expected
step response. The second-order system is configured with a gain of 1.0, natural frequency
of 1.0, and damping ratio of 0.5, which produces a slightly under-damped response. The system
should eventually reach the steady-state output value matching the input constant.
"""
test component SecondOrder
  "Constant source block that provides a fixed value of 1 as input"
  c = BlockComponents.Sources.Constant(k = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 70, "y1": 120, "x2": 170, "y2": 220, "rot": 0}
      }
    }
  }
  "Second-order transfer function block with specified dynamics parameters"
  pt2 = BlockComponents.Continuous.SecondOrder(k = 1.0, w = 1.0, d = 0.5) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 120, "x2": 390, "y2": 220, "rot": 0}
      }
    }
  }
relations
  "Connects the constant output to the input of the second-order system"
  connect(c.y, pt2.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  initial pt2.x = 0
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "experiments": {},
    "tests": {
      "case1": {
        "stop": 10,
        "initial": {"pt2.xd": 0},
        "atol": {"pt2.y": 0.01},
        "expect": {"final": {"pt2.y": 1}, "signals": ["pt2.y"]}
      }
    }
  }
}
end
```

## Test Cases {#Test-Cases}

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

```julia
plt
```

![](bsbgcts.svg)

## Related {#Related}

* Examples

* Experiments

* Analyses

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

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

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