Engee documentation

DSP Sine Wave

Generates a discrete sinusoid.

sine wave

Description

Unit DSP Sine Wave generates a multi-channel real or complex sinusoidal signal with independent amplitude, frequency and phase in each output channel.

The unit supports floating-point and fixed-point data types with sign (sign bit).

The block generates a valid sinusoidal signal, if the parameter Output complexity is set to Real.

A valid sinusoidal signal is defined by an expression of the type:

,

where

  • - parameter value Amplitude;

  • - parameter value Frequency (Hz) in Hz;

  • - parameter value Phase offset (rad) in rad.

The unit generates a complex exponential signal, if the parameter Output complexity is set to Complex.

The complex exponential signal is defined by an expression of the type:

.

Generation of multichannel outputs

For both real and complex sinusoids, the values of parameters Amplitude, Frequency (Hz) и Phase offset (rad) ( , , and ) can be scalars or vectors of length , where is the desired number of channels in the output. When you specify at least one of these parameters as a length vector , the scalar values specified for the other parameters are applied to each channel.

For example, to generate a three-channel output containing the following valid sine waves, set the block parameters as shown:

уканалканалканал

  • Output complexity = Real.

  • Amplitude = [1 2 3].

  • Frequency (Hz) = [1000 500 250].

  • Phase offset (rad) = [0 0 pi/2].

Ports

Output

# OUT_1 — sinusoidal signal
scalar | vector | matrix

Details

Outputs a sinusoidal signal as a scalar, vector or matrix.

To output fixed-point data types, you must set the parameters to Sample mode value Discrete and for Computation method value Table lookup.
Data types

Float64

Complex numbers support

No

Parameters

Parameters

# Amplitude — sinusoidal amplitude
Scalar / array of real numbers

Details

A vector of length , containing the amplitudes of the sinusoids in each of the output channels, or a scalar applied to all channels. The vector must be the same length as the vectors specified in the parameters Frequency (Hz) и Phase offset (rad).

Default value

1

Program usage name

Amplitude

Tunable

No

Evaluatable

Yes

# Frequency (Hz) — sinusoid frequency (for each separately)
Scalar / array of real numbers

Details

A vector of length , containing the frequencies (in Hz) of the sinusoidal signals in each of the output channels, or a scalar applied to all channels. The vector shall be the same length as the vectors specified in parameters Frequency (Hz) и Phase offset (rad). You can specify positive, zero, or negative frequencies.

Default value

100

Program usage name

Frequency

Tunable

No

Evaluatable

Yes

# Phase offset (rad) — sinusoidal phase shift
Scalar / array of real numbers

Details

A vector of length , containing the phase shift (in radians) of the sinusoids in each of the output channels, or a scalar applied to all channels. The vector must be the same length as the vectors specified in parameters Frequency (Hz) и Phase offset (rad).

Default value

0

Program usage name

Phase

Tunable

No

Evaluatable

Yes

# Sample mode — count mode
Discrete

Details

Only discrete counting mode is realised Discrete. In discrete mode, the unit can generate a discrete time output signal by direct calculation of trigonometric function or table lookup.

Values

Discrete

Default value

Discrete

Program usage name

SampleMode

Tunable

No

Evaluatable

No

# Output complexity — real or complex waveform
Real | Complex

Details

The type of signal to be generated: Real specifies a real sine wave, Complex sets a complex exponential sine wave.

Values

Real | Complex

Default value

Real

Program usage name

Outcomplex

Tunable

No

Evaluatable

No

# Computation method — method for calculating discrete-time sinusoids
Trigonometric fcn | Table lookup

Details

A method by which discrete-time sinusoids are generated: Trigonometric fcn or Table lookup.

To generate fixed-point sinusoids, you must set the Computation method to Table lookup.
Values

Trigonometric fcn | Table lookup

Default value

Trigonometric fcn

Program usage name

CompMethod

Tunable

No

Evaluatable

No

# Optimize table for — speed optimise
Speed

Details

Optimises the table of sine values by speed.

When optimising for speed, the table contains elements, and when optimising for memory, the table contains elements, where is the number of input samples in one full period of the sine wave.

Dependencies

To use this parameter, set the parameters to Computation method value Table lookup.

Values

Speed

Default value

Speed

Program usage name

OptimizeTable

Tunable

No

Evaluatable

No

# Sample time — interval between calculation steps
SampleTime (real number / vector of two real numbers)

Details

The sampling period of the sinusoidal signal, . The period of the block output frame is equal to , where is the value of the parameters Samples per frame.

Default value

1/1000

Program usage name

SampleTime

Tunable

No

Evaluatable

Yes

# Samples per frame — counts per frame
Int64 integer

Details

The number of consecutive samples from each sinusoid to buffer into the output frame.

The output of the block is a matrix to with frame period , where is the value of the parameters Sample time.

Default value

1

Program usage name

SamplesPerFrame

Tunable

No

Evaluatable

Yes

# Resetting states when re-enabled — state behaviour within the included subsystems
Restart at time zero

Details

This parameter defines the behaviour of the unit *DSP Sine Wave*when an enabled subsystem is re-enabled. The unit is reset to the initial state.

Dependencies

This parameter only applies when the block is DSP Sine Wave is located inside the enabled subsystem, and the parameters of the block are set to States block parameter Enable is set to reset.

Values

Restart at time zero

Default value

Restart at time zero

Program usage name

ResetState

Tunable

No

Evaluatable

No

Parameters

# Output data type — output data type
Float64 | Float32 | Fixed-point

Details

Specify the type of output data.

Values

Float64 | Float32 | Fixed-point

Default value

Float64

Program usage name

OutDataTypeStr

Tunable

No

Evaluatable

No

# Output fixed-point type — fixed-point output data type
Data type

Details

Specify the fixed-point output type.

Dependencies

To use this parameter, set parameter Output data type value Fixed-point.

Default value

fixdt(1, 16, 0)

Program usage name

OutDataTypeStrFixed

Tunable

No

Evaluatable

Yes