PitchReference PitchReference Icon

Examples.PitchReference

Square-wave reference signal for the pitch angle.

The output is zero before start_time and alternates between amplitude and -amplitude with period period thereafter.

Usage

DiscreteComponents.Examples.PitchReference(amplitude=0.1, period=20, start_time=1)

Parameters:

NameDescriptionUnitsDefault value
amplitudeAmplitude of the square wave [rad]–0.1
periodPeriod of the square wave [s]–20
start_timeTime at which the square wave starts [s]–1

Connectors

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

Behavior

using DiscreteComponents #hide
using ModelingToolkit #hide
@variables amplitude #hide
@variables period #hide
@variables start_time #hide
@named sys = DiscreteComponents.Examples.PitchReference(amplitude=amplitude, period=period, start_time=start_time) #hide
full_equations(sys) #hide

Source

"""
Square-wave reference signal for the pitch angle.

The output is zero before `start_time` and alternates between `amplitude` and `-amplitude` with period `period` thereafter.
"""
component PitchReference
  "Reference pitch angle [rad]"
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Amplitude of the square wave [rad]"
  parameter amplitude::Real = 0.1
  "Period of the square wave [s]"
  parameter period::Real = 20
  "Time at which the square wave starts [s]"
  parameter start_time::Real = 1
relations
  y = ifelse(time < start_time, 0.0, ifelse(sin(2 * pi * (time - start_time) / period) >= 0, amplitude, -amplitude))
metadata {"Dyad": {"icons": {"default": "dyad://BlockComponents/Pulse.svg"}}}
end
Flattened Source
"""
Square-wave reference signal for the pitch angle.

The output is zero before `start_time` and alternates between `amplitude` and `-amplitude` with period `period` thereafter.
"""
component PitchReference
  "Reference pitch angle [rad]"
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Amplitude of the square wave [rad]"
  parameter amplitude::Real = 0.1
  "Period of the square wave [s]"
  parameter period::Real = 20
  "Time at which the square wave starts [s]"
  parameter start_time::Real = 1
relations
  y = ifelse(time < start_time, 0.0, ifelse(sin(2 * pi * (time - start_time) / period) >= 0, amplitude, -amplitude))
metadata {"Dyad": {"icons": {"default": "dyad://BlockComponents/Pulse.svg"}}}
end


Test Cases

No test cases defined.

  • Examples
  • Experiments
  • Analyses