Skip to content
LIBRARY
Sources.LogFrequencySweep.md

Sources.LogFrequencySweep

Logarithmic frequency sweep.

The output y performs a logarithmic frequency sweep. The logarithm of frequency w performs a linear ramp from log10(wMin) to log10(wMax). The output uses wMin * (wMax/wMin)^x instead of the equivalent 10^(log10(wMin) + (log10(wMax) - log10(wMin)) * x) to help with unit-checking.

For time < startTime the output equals wMin. For time > startTime + duration the output equals wMax.

This component extends from BlockComponents.Interfaces.SO

Usage

BlockComponents.Sources.LogFrequencySweep(wMin, wMax, startTime=0, duration=1.0, eps0=eps(Float64))

Parameters:

NameDescriptionUnitsDefault value
wMinStart frequency
wMaxEnd frequency
startTimeStart time of frequency sweeps0
durationDuration of ramp (= 0.0 gives a Step)s1.0

Connectors

  • y - This connector represents a real signal as an output from a component (RealOutput)

Behavior

Source

dyad
"""
Logarithmic frequency sweep.

The output `y` performs a logarithmic frequency sweep. The logarithm of
frequency `w` performs a linear ramp from `log10(wMin)` to `log10(wMax)`.
The output uses `wMin * (wMax/wMin)^x` instead of the equivalent
`10^(log10(wMin) + (log10(wMax) - log10(wMin)) * x)` to help with unit-checking.

For `time < startTime` the output equals `wMin`.
For `time > startTime + duration` the output equals `wMax`.
"""
component LogFrequencySweep
  extends BlockComponents.Interfaces.SO
  "Start frequency"
  parameter wMin::Real(final min = eps(Float64))
  "End frequency"
  parameter wMax::Real(final min = eps(Float64))
  "Start time of frequency sweep"
  parameter startTime::Time = 0
  "Duration of ramp (= 0.0 gives a Step)"
  parameter duration::Time(min = 0.0) = 1.0
  "Machine epsilon guard (matches Modelica.Constants.eps)"
  final parameter eps0::Real = eps(Float64)
relations
  y = ifelse(time < startTime, wMin, ifelse(time < startTime + max(duration, eps0), wMin * (wMax / wMin) ^ min(1, (time - startTime) / max(duration, eps0)), wMax))
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/LogFrequencySweep.svg"}
  }
}
end
Flattened Source
dyad
"""
Logarithmic frequency sweep.

The output `y` performs a logarithmic frequency sweep. The logarithm of
frequency `w` performs a linear ramp from `log10(wMin)` to `log10(wMax)`.
The output uses `wMin * (wMax/wMin)^x` instead of the equivalent
`10^(log10(wMin) + (log10(wMax) - log10(wMin)) * x)` to help with unit-checking.

For `time < startTime` the output equals `wMin`.
For `time > startTime + duration` the output equals `wMax`.
"""
component LogFrequencySweep
  "Real-valued output connector for the component"
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0},
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      }
    }
  }
  "Start frequency"
  parameter wMin::Real(final min = eps(Float64))
  "End frequency"
  parameter wMax::Real(final min = eps(Float64))
  "Start time of frequency sweep"
  parameter startTime::Time = 0
  "Duration of ramp (= 0.0 gives a Step)"
  parameter duration::Time(min = 0.0) = 1.0
  "Machine epsilon guard (matches Modelica.Constants.eps)"
  final parameter eps0::Real = eps(Float64)
relations
  y = ifelse(time < startTime, wMin, ifelse(time < startTime + max(duration, eps0), wMin * (wMax / wMin) ^ min(1, (time - startTime) / max(duration, eps0)), wMax))
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/LogFrequencySweep.svg"}
  }
}
end


Test Cases

No test cases defined.