---
url: /dyad/stable/stdlib/BlockComponents/tests/Sources.Tests.Chirp.md
description: >-
  Dyad Sources.Tests.Chirp docs.  Test component that verifies linear,
  quadratic, and exponential chirp signal generators.
---

# `Sources.Tests.Chirp` {#Sources.Tests.Chirp}

Test component that verifies linear, quadratic, and exponential chirp signal generators.

This component instantiates three Chirp blocks — one with linear, one with quadratic, and one with exponential frequency sweep law — and connects each to an Integrator to validate the time-domain integration of the chirp signals. With default parameters (fmin=0.1 Hz, fmax=5 Hz, T=100 s, amplitude=1), the linear chirp sweeps frequency uniformly while the quadratic chirp sweeps with a slow start and fast rise.

## Usage {#Usage}

`BlockComponents.Sources.Tests.Chirp()`

## Behavior {#Behavior}

$$ \begin{align}
0 &= \mathrm{connect}\left( linear\_{+}y, linear\_{integrator\_{+}u} \right) \\
0 &= \mathrm{connect}\left( quadratic\_{+}y, quadratic\_{integrator\_{+}u} \right) \\
0 &= \mathrm{connect}\left( exponential\_{+}y, exponential\_{integrator\_{+}u} \right) \\
\frac{\mathrm{d}\mathtt{linear_integrator.x}\left( t \right)}{\mathrm{d}t} &= \mathtt{linear_integrator.k} ~ \mathtt{linear_integrator.u}\left( t \right) \\
\mathtt{linear_integrator.y}\left( t \right) &= \mathtt{linear_integrator.x}\left( t \right) \\
\frac{\mathrm{d}\mathtt{quadratic_integrator.x}\left( t \right)}{\mathrm{d}t} &= \mathtt{quadratic_integrator.k} ~ \mathtt{quadratic_integrator.u}\left( t \right) \\
\mathtt{quadratic_integrator.y}\left( t \right) &= \mathtt{quadratic_integrator.x}\left( t \right) \\
\mathtt{linear.y}\left( t \right) &= \mathtt{linear.amplitude} ~ \sin\left( \mathtt{linear.phase} + 6.2832 ~ \mathtt{linear.phi}\left( t \right) \right) \\
\mathtt{linear.phi}\left( t \right) &= \frac{t^{2} ~ \left( \mathtt{linear.fmax} - \mathtt{linear.fmin} \right)}{2 ~ \mathtt{linear.T}} + \mathtt{linear.fmin} ~ t \\
\mathtt{quadratic.y}\left( t \right) &= \mathtt{quadratic.amplitude} ~ \sin\left( \mathtt{quadratic.phase} + 6.2832 ~ \mathtt{quadratic.phi}\left( t \right) \right) \\
\mathtt{quadratic.phi}\left( t \right) &= \frac{t^{3} ~ \left( \mathtt{quadratic.fmax} - \mathtt{quadratic.fmin} \right)}{3 ~ \mathtt{quadratic.T}^{2}} + \mathtt{quadratic.fmin} ~ t \\
\frac{\mathrm{d}\mathtt{exponential_integrator.x}\left( t \right)}{\mathrm{d}t} &= \mathtt{exponential_integrator.k} ~ \mathtt{exponential_integrator.u}\left( t \right) \\
\mathtt{exponential_integrator.y}\left( t \right) &= \mathtt{exponential_integrator.x}\left( t \right) \\
\mathtt{exponential.y}\left( t \right) &= \mathtt{exponential.amplitude} ~ \sin\left( \mathtt{exponential.phase} + 6.2832 ~ \mathtt{exponential.phi}\left( t \right) \right) \\
\mathtt{exponential.phi}\left( t \right) &= \frac{\left( -1 + \left( \frac{\mathtt{exponential.fmax}}{\mathtt{exponential.fmin}} \right)^{\frac{t}{\mathtt{exponential.T}}} \right) ~ \mathtt{exponential.T} ~ \mathtt{exponential.fmin}}{\log\left( \frac{\mathtt{exponential.fmax}}{\mathtt{exponential.fmin}} \right)}
\end{align}
$$

## Source {#Source}

```dyad
"""
Test component that verifies linear, quadratic, and exponential chirp signal generators.

This component instantiates three Chirp blocks — one with linear, one with quadratic,
and one with exponential frequency sweep law — and connects each to an Integrator to validate the time-domain integration
of the chirp signals. With default parameters (fmin=0.1 Hz, fmax=5 Hz, T=100 s, amplitude=1),
the linear chirp sweeps frequency uniformly while the quadratic chirp sweeps with a slow start
and fast rise.
"""
test component Chirp
  "Integrator for the linear chirp signal"
  linear_integrator = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 200, "y1": 20, "x2": 300, "y2": 120, "rot": 0}
      }
    }
  }
  "Integrator for the quadratic chirp signal"
  quadratic_integrator = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 200, "y1": 170, "x2": 300, "y2": 270, "rot": 0}
      }
    }
  }
  "Linear chirp signal generator"
  linear = BlockComponents.Sources.Chirp(law = BlockComponents.Sources.ChirpLaw.Linear()) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  "Quadratic chirp signal generator"
  quadratic = BlockComponents.Sources.Chirp() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 170, "x2": 120, "y2": 270, "rot": 0}
      },
      "tags": []
    }
  }
  "Integrator for the exponential chirp signal"
  exponential_integrator = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 200, "y1": 320, "x2": 300, "y2": 420, "rot": 0}
      }
    }
  }
  "Exponential chirp signal generator"
  exponential = BlockComponents.Sources.Chirp(law = BlockComponents.Sources.ChirpLaw.Exponential()) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 320, "x2": 120, "y2": 420, "rot": 0}
      },
      "tags": []
    }
  }
relations
  "Connects the linear chirp output to its integrator"
  connect(linear.y, linear_integrator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  "Connects the quadratic chirp output to its integrator"
  connect(quadratic.y, quadratic_integrator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  "Connects the exponential chirp output to its integrator"
  connect(exponential.y, exponential_integrator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "tests": {
      "case1": {
        "stop": 100,
        "atol": {
          "linear.y": 0.001,
          "quadratic.y": 0.001,
          "exponential.y": 0.001,
          "linear_integrator.x": 0.01,
          "quadratic_integrator.x": 0.01,
          "exponential_integrator.x": 0.01
        },
        "expect": {
          "initial": {"linear.y": 0, "quadratic.y": 0, "exponential.y": 0},
          "signals": [
            "linear.y",
            "quadratic.y",
            "exponential.y",
            "linear_integrator.x",
            "quadratic_integrator.x",
            "exponential_integrator.x"
          ],
          "final": {
            "linear.y": 0,
            "quadratic.y": 0.866,
            "exponential.y": 0.9995,
            "linear_integrator.x": 1.12,
            "quadratic_integrator.x": 1.66,
            "exponential_integrator.x": 1.58
          }
        }
      }
    }
  }
}
end
```

```dyad
"""
Test component that verifies linear, quadratic, and exponential chirp signal generators.

This component instantiates three Chirp blocks — one with linear, one with quadratic,
and one with exponential frequency sweep law — and connects each to an Integrator to validate the time-domain integration
of the chirp signals. With default parameters (fmin=0.1 Hz, fmax=5 Hz, T=100 s, amplitude=1),
the linear chirp sweeps frequency uniformly while the quadratic chirp sweeps with a slow start
and fast rise.
"""
test component Chirp
  "Integrator for the linear chirp signal"
  linear_integrator = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 200, "y1": 20, "x2": 300, "y2": 120, "rot": 0}
      }
    }
  }
  "Integrator for the quadratic chirp signal"
  quadratic_integrator = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 200, "y1": 170, "x2": 300, "y2": 270, "rot": 0}
      }
    }
  }
  "Linear chirp signal generator"
  linear = BlockComponents.Sources.Chirp(law = BlockComponents.Sources.ChirpLaw.Linear()) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  "Quadratic chirp signal generator"
  quadratic = BlockComponents.Sources.Chirp() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 170, "x2": 120, "y2": 270, "rot": 0}
      },
      "tags": []
    }
  }
  "Integrator for the exponential chirp signal"
  exponential_integrator = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 200, "y1": 320, "x2": 300, "y2": 420, "rot": 0}
      }
    }
  }
  "Exponential chirp signal generator"
  exponential = BlockComponents.Sources.Chirp(law = BlockComponents.Sources.ChirpLaw.Exponential()) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 320, "x2": 120, "y2": 420, "rot": 0}
      },
      "tags": []
    }
  }
relations
  "Connects the linear chirp output to its integrator"
  connect(linear.y, linear_integrator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  "Connects the quadratic chirp output to its integrator"
  connect(quadratic.y, quadratic_integrator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  "Connects the exponential chirp output to its integrator"
  connect(exponential.y, exponential_integrator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "tests": {
      "case1": {
        "stop": 100,
        "atol": {
          "linear.y": 0.001,
          "quadratic.y": 0.001,
          "exponential.y": 0.001,
          "linear_integrator.x": 0.01,
          "quadratic_integrator.x": 0.01,
          "exponential_integrator.x": 0.01
        },
        "expect": {
          "initial": {"linear.y": 0, "quadratic.y": 0, "exponential.y": 0},
          "signals": [
            "linear.y",
            "quadratic.y",
            "exponential.y",
            "linear_integrator.x",
            "quadratic_integrator.x",
            "exponential_integrator.x"
          ],
          "final": {
            "linear.y": 0,
            "quadratic.y": 0.866,
            "exponential.y": 0.9995,
            "linear_integrator.x": 1.12,
            "quadratic_integrator.x": 1.66,
            "exponential_integrator.x": 1.58
          }
        }
      }
    }
  }
}
end
```

## Test Cases {#Test-Cases}

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

```julia
plt
```

![](dfklyze.svg)

```julia
plt
```

![](anwtsqr.svg)

```julia
plt
```

![](hmekwut.svg)

```julia
plt
```

![](xhpxypw.svg)

```julia
plt
```

![](mgbrbet.svg)

```julia
plt
```

![](mzynriu.svg)

## Related {#Related}

* Examples

* Experiments

* Analyses

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

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

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