Package voltage.sources

# Class DigitalOscillator

java.lang.Object
voltage.sources.OscillatorBaseClass
voltage.sources.DigitalOscillator

public class DigitalOscillator extends OscillatorBaseClass
A digital oscillator class. Oscillators return values from -5.0 to 5.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DigitalOscillator()`
  Construct an DigitalOscillator

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `AdvanceSample()`
  Move to the next sample.
  `double`
  `GetCosineValue()`
  Gets the cosine wave value.
  `double`
  `GetPulseValue()`
  Gets the pulse wave value.
  `double`
  `GetRampValue()`
  Gets the ramp wave value.
  `double`
  `GetSampleAndHoldValue()`
  Gets a random value.
  `double`
  `GetSawtoothValue()`
  Gets the saw tooth wave value.
  `double`
  `GetSineValue()`
  Gets the sine wave value.
  `double`
  `GetSquareValue()`
  Gets the square wave value.
  `double`
  `GetTriangleValue()`
  Gets the triangle wave value.
  `void`
  `ResetCycle()`
  Resets the wave cycle.
  `void`
  `SetFrequency(double frequency)`
  Set the Frequency of the oscillator
  `void`
  `SetPulseWidth(double width)`
  Sets the pulse width of the pulse wave.

  ### Methods inherited from class voltage.sources.OscillatorBaseClass

  `GetCycle, GetCyclesPerSample, GetPureSineValue, SetCycle`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DigitalOscillator

    public DigitalOscillator()
    Construct an DigitalOscillator

- ## Method Details

  - ### SetFrequency

    public void SetFrequency(double frequency)
    Set the Frequency of the oscillator
    Specified by:
      `SetFrequency` in class `OscillatorBaseClass`
    Parameters:
      `frequency` - a frequency from 0 to 20,000 Hz.

  - ### SetPulseWidth

    public void SetPulseWidth(double width)
    Sets the pulse width of the pulse wave.
    Specified by:
      `SetPulseWidth` in class `OscillatorBaseClass`
    Parameters:
      `width` - (0 to 1.0)

  - ### GetPulseValue

    public double GetPulseValue()
    Gets the pulse wave value.
    Specified by:
      `GetPulseValue` in class `OscillatorBaseClass`
    Returns:
      the value of the pulse wave.

  - ### GetSquareValue

    public double GetSquareValue()
    Gets the square wave value.
    Specified by:
      `GetSquareValue` in class `OscillatorBaseClass`
    Returns:
      the value of the square wave. (-5.0 to 5.0)

  - ### GetSawtoothValue

    public double GetSawtoothValue()
    Gets the saw tooth wave value.
    Specified by:
      `GetSawtoothValue` in class `OscillatorBaseClass`
    Returns:
      the value of the saw tooth wave. (-5.0 to 5.0)

  - ### GetRampValue

    public double GetRampValue()
    Gets the ramp wave value.
    Specified by:
      `GetRampValue` in class `OscillatorBaseClass`
    Returns:
      the value of the ramp wave.

  - ### GetTriangleValue

    public double GetTriangleValue()
    Gets the triangle wave value.
    Specified by:
      `GetTriangleValue` in class `OscillatorBaseClass`
    Returns:
      the value of the triangle wave. (-5.0 to 5.0)

  - ### GetSineValue

    public double GetSineValue()
    Gets the sine wave value.
    Specified by:
      `GetSineValue` in class `OscillatorBaseClass`
    Returns:
      the value of the sine wave. (-5.0 to 5.0)

  - ### GetCosineValue

    public double GetCosineValue()
    Gets the cosine wave value.
    Specified by:
      `GetCosineValue` in class `OscillatorBaseClass`
    Returns:
      the value of the sine wave. (-5.0 to 5.0)

  - ### GetSampleAndHoldValue

    public double GetSampleAndHoldValue()
    Gets a random value.
    Returns:
      a random value. (-5.0 to 5.0)

  - ### AdvanceSample

    public void AdvanceSample()
    Move to the next sample. Call this once per ProcessSample function.
    Specified by:
      `AdvanceSample` in class `OscillatorBaseClass`
    See Also:
      - `VoltageModule.ProcessSample()`

  - ### ResetCycle

    public void ResetCycle()
    Resets the wave cycle.
    Overrides:
      `ResetCycle` in class `OscillatorBaseClass`