Operator Generator
The Generator operator generates a sine, triangular, sawtooth, or a pulse train representation of a time series.
The Generator operator generates sine, triangular, sawtooth, or a pulse train signals that you can use as input for testing operators in the TimeSeries Toolkit. The generated signals are represented as a univariate or a vector time series.
Behavior in a consistent region
- If the consistent region trigger is periodic, drain processing will only be able to occur
- If the consistent region trigger is operator-driven, drain process will occur at the end
Exceptions
The Generator operator throws an exception in the following cases:
- The value that is specified by the humpSize parameter is greater than 1.0 or less than 0.
- The value that is specified by the samplingRate, frequency, or iterations parameter is 0.
Examples
The following example shows how to generate a sine signal:
composite Main {
graph
stream<list<float64> data, list<int64> timeStamp> GenerateSineWaveListStream = Generator()
{
samplingRate: 60u;
frequency : 3.0;
typeOfSignal: sine;
output GenerateSineWaveStream:
data=generatedTimeSeries();
}
() as writer1 = FileSink(GenerateSineWaveStream)
{
param
file : "sineWave.result";
format : csv;
}
}
Summary
- Ports
- This operator has 0 input ports and 1 output port.
- Windowing
- This operator does not accept any windowing configurations.
- Parameters
- This operator supports 8 parameters.
Required: frequency, samplingRate
Optional: amplitude, humpSize, initDelay, iterations, triggerCount, typeOfSignal
- Metrics
- This operator does not report any metrics.
Properties
- Implementation
- C++
- Threading
- Never - Operator never provides a single threaded execution context.
- Assignments
- This operator allows any SPL expression of the correct type to be assigned to output attributes.
- Output Functions
-
- GenFunct
-
- <any T> T generatedTimeSeries()
-
Returns the generated samples either as a univariate or as a vector time series. The number of samples that are returned is equal to the sampling rate.
- <any T> T AsIs(T v)
-
The default function for output attributes. By default, this function assigns the output attribute to the value of the input attribute with the same name.
- Ports (0)
-
This port submits a tuple that contains the generated signal data. If the generatedTimeSeries output function is assigned to an attribute of type list<float64>, then a tuple that contains the entire generated signal is submitted. If the generatedTimeSeries output function is assigned to an attribute of type float64, then each tuple represents a single data point of the generated signal. Additional output tuple attributes are assigned from input attributes.
- Properties
-
- Optional: false
- TupleMutationAllowed: true
- WindowPunctuationOutputMode: Free
Required: frequency, samplingRate
Optional: amplitude, humpSize, initDelay, iterations, triggerCount, typeOfSignal
- amplitude
-
Specifies the amplitude of the generated wave. In the case of a pulse train wave, this will specify the height of the pulse.
- Properties
-
- Type: float64
- Cardinality: 1
- Optional: true
- ExpressionMode: AttributeFree
- frequency
-
Specifies the frequency (period) of the generated signal in Hertz. If the parameter value is 0, the compiler generates an error.
- Properties
-
- Type: float64
- Cardinality: 1
- Optional: false
- ExpressionMode: AttributeFree
- humpSize
-
Specifies the hump size of the generated pulse train wave. This parameter is valid only for pulse train signals and is ignored for other types of signals. The valid values are in the range 0 - 1.0. If the parameter value is 0, a flat pule train signal is generated with no hump.
- Properties
-
- Type: float64
- Cardinality: 1
- Optional: true
- ExpressionMode: AttributeFree
- initDelay
-
Specifies the initial waiting time in seconds before the operator starts generating the signals. The default value is 0f.
- Properties
-
- Type: float64
- Cardinality: 1
- Optional: true
- ExpressionMode: AttributeFree
- iterations
-
Specifies the number of signals to be generated. If this value is not specified, signals are generated indefinitely.
- Properties
-
- Type: uint32
- Cardinality: 1
- Optional: true
- ExpressionMode: AttributeFree
- samplingRate
-
Specifies the sampling rate of the generated signal. The sampling rate is defined as the number of input time series used to represent a signal of one second. If this parameter value is 0u, the compiler generates an error.
- Properties
-
- Type: uint32
- Cardinality: 1
- Optional: false
- ExpressionMode: AttributeFree
- triggerCount
-
Specifies the number of iterations that are submitted before the Generator operator starts to drain the pipeline and establish a conssitent state. The parameter must be greater than zero and must be set if the Generator operator is the start operator of an operatorDriven consisten region.
- Properties
-
- Type: uint32
- Cardinality: 1
- Optional: true
- ExpressionMode: AttributeFree
- typeOfSignal
-
Specifies the type of the output wave form. The supported values are:
- sine
- triangular
- sawtooth
- pulsetrain
The amplitude of the generated sine, triangular, and sawtooth waves varies between +1 and -1. The default value is sine.
- Properties
-
- Type: shapeOfSignal (sine, triangular, sawtooth, pulsetrain)
- Cardinality: 1
- Optional: true
- ExpressionMode: CustomLiteral
- Generator
-
stream<${schema}> ${outputStream} = Generator() { param frequency: ${frequencyExpression}; samplingRate: ${samplingRateExpression}; iterations: ${iterationsExpression}; output ${outputStream}: ${outputExpression}; }
- No description for library.
- No description for library.
- No description for library.
- No description for library.