Skip to content
LIBRARY
Sources.Tests.Chirp.md

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

BlockComponents.Sources.Tests.Chirp()

Behavior

[connect(linear+y,linearintegrator+u)connect(quadratic+y,quadraticintegrator+u)connect(exponential+y,exponentialintegrator+u)dlinearintegrator.x(t)dt=linearintegrator.klinearintegrator.u(t)linearintegrator.y(t)=linearintegrator.x(t)dquadraticintegrator.x(t)dt=quadraticintegrator.kquadraticintegrator.u(t)quadraticintegrator.y(t)=quadraticintegrator.x(t)linear.y(t)=linear.amplitudesin(linear.phase+6.283185307179586linear.phi(t))linear.phi(t)=t2(linear.fmaxlinear.fmin)2linear.T+linear.fmintquadratic.y(t)=quadratic.amplitudesin(quadratic.phase+6.283185307179586quadratic.phi(t))quadratic.phi(t)=t3(quadratic.fmaxquadratic.fmin)3quadratic.T2+quadratic.fmintdexponentialintegrator.x(t)dt=exponentialintegrator.kexponentialintegrator.u(t)exponentialintegrator.y(t)=exponentialintegrator.x(t)exponential.y(t)=exponential.amplitudesin(exponential.phase+6.283185307179586exponential.phi(t))exponential.phi(t)=exponential.Texponential.fmin(1+(exponential.fmaxexponential.fmin)texponential.T)log(exponential.fmaxexponential.fmin)]

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
Flattened 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


Test Cases

Test Case case1

julia
plt

julia
plt

julia
plt

julia
plt

julia
plt

julia
plt