---
url: /dyad/stable/stdlib/BlockComponents/tests/Sources.Tests.Ramp.md
description: >-
  Dyad Sources.Tests.Ramp docs.  Test passing a ramp signal to an integrator for
  verification purposes.
---

# `Sources.Tests.Ramp` {#Sources.Tests.Ramp}

Test passing a ramp signal to an integrator for verification purposes.

A test component that connects a Ramp signal generator to an Integrator to verify correct behavior. The ramp starts at an offset value of 0.5, remains constant until the start time (0.5s), then increases linearly by 1.0 over 0.7 seconds to reach a final value of 1.5. The integrator accumulates this signal, and the metadata specifies expected initial and final values for verification purposes.

## Usage {#Usage}

`BlockComponents.Sources.Tests.Ramp()`

## Behavior {#Behavior}

$$ \begin{align}
0 &= \mathrm{connect}\left( signal\_{+}y, integrator\_{+}u \right) \\
\frac{\mathrm{d}\mathtt{integrator.x}\left( t \right)}{\mathrm{d}t} &= \mathtt{integrator.k} ~ \mathtt{integrator.u}\left( t \right) \\
\mathtt{integrator.y}\left( t \right) &= \mathtt{integrator.x}\left( t \right) \\
\mathtt{signal.y}\left( t \right) &= ifelse\left( \mathtt{signal.start_time} < t, ifelse\left( t < \mathtt{signal.duration} + \mathtt{signal.start_time}, \mathtt{signal.offset} + \frac{\mathtt{signal.height} ~ \left(  - \mathtt{signal.start_time} + t \right)}{\mathtt{signal.duration}}, \mathtt{signal.height} + \mathtt{signal.offset} \right), \mathtt{signal.offset} \right)
\end{align}
$$

## Source {#Source}

```dyad
"""
Test passing a ramp signal to an integrator for verification purposes.

A test component that connects a Ramp signal generator to an Integrator to verify correct
behavior. The ramp starts at an offset value of 0.5, remains constant until the start
time (0.5s), then increases linearly by 1.0 over 0.7 seconds to reach a final value of 1.5.
The integrator accumulates this signal, and the metadata specifies expected initial and final
values for verification purposes.
"""
test component Ramp
  "Integrator component that accumulates the input signal"
  integrator = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 155, "y1": 20, "x2": 255, "y2": 120, "rot": 0}
      }
    }
  }
  "Ramp signal generator with configurable duration, height, start time and offset"
  signal = BlockComponents.Sources.Ramp(duration = 0.7, height = 1.0, start_time = 0.5, offset = 0.5) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
      }
    }
  }
relations
  "Connects the ramp output to the integrator input"
  connect(signal.y, integrator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "tests": {
      "case1": {
        "stop": 3,
        "atol": {"integrator.x": 0.001},
        "expect": {"signals": ["signal.y", "integrator.x"]}
      }
    }
  }
}
end
```

```dyad
"""
Test passing a ramp signal to an integrator for verification purposes.

A test component that connects a Ramp signal generator to an Integrator to verify correct
behavior. The ramp starts at an offset value of 0.5, remains constant until the start
time (0.5s), then increases linearly by 1.0 over 0.7 seconds to reach a final value of 1.5.
The integrator accumulates this signal, and the metadata specifies expected initial and final
values for verification purposes.
"""
test component Ramp
  "Integrator component that accumulates the input signal"
  integrator = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 155, "y1": 20, "x2": 255, "y2": 120, "rot": 0}
      }
    }
  }
  "Ramp signal generator with configurable duration, height, start time and offset"
  signal = BlockComponents.Sources.Ramp(duration = 0.7, height = 1.0, start_time = 0.5, offset = 0.5) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
      }
    }
  }
relations
  "Connects the ramp output to the integrator input"
  connect(signal.y, integrator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "tests": {
      "case1": {
        "stop": 3,
        "atol": {"integrator.x": 0.001},
        "expect": {"signals": ["signal.y", "integrator.x"]}
      }
    }
  }
}
end
```

## Test Cases {#Test-Cases}

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

```julia
plt
```

![](jxkrqcc.svg)

```julia
plt
```

![](jxnqdgz.svg)

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`Exponentiation`](Sources.Tests.Ramp.md)

  * [`Integrator`](Sources.Tests.Ramp.md)

  * [`LogicGates`](Sources.Tests.Ramp.md)

  * [`Logical`](Sources.Tests.Ramp.md)

  * [`LogicalValidation`](Sources.Tests.Ramp.md)

  * [`PIDTextbook`](Sources.Tests.Ramp.md)

  * [`Ramp`](Sources.Tests.Ramp.md)

  * [`Ramp`](Sources.Tests.Ramp.md)

  * [`TransferFunction`](Sources.Tests.Ramp.md)

  * [`VariableLimiter`](Sources.Tests.Ramp.md)

  * [`VariableSinCos`](Sources.Tests.Ramp.md)

  * [`ZeroThresholds`](Sources.Tests.Ramp.md)
