Function generator module "functiongenerator"
Description
THE "functiongenerator" MODULE IS MERELY A TEST MODULE FOR INTERNAL PURPOSES!
It is used for the temporally correct production of channel data.
Production here is based on complete data blocks.
Interfaces & protocols used
- NONE
JSON configuration
The following section describes the entire JSON configuration of the module and explains the individual parameters.
Example configuration (typical configuration)
{
"module": "FunctionGenerator",
"factory": "functiongenerator",
"config":{
"maximumProductionCount":-1,
"maximumTimestampDeviation":-1,
"rtPriority":80,
"samplesPerBlock":1,
"timeoutSeconds":1,
"timeoutNanoseconds":0,
"startDate":"1970-01-01T00:00:00Z",
"channels":[
{
"name": "Some Sine Channel",
"dataType": "float",
"bufferSize":1024,
"function": "sine",
"amplitude":1.0,
"offset":0.0,
"frequency":1.0,
"onOffRatio":0.5
},
{
"name": "Some Message Channel",
"dataType": "string",
"function": "messages",
"messages":[
{
"timestamp":"1970-01-01T00:00:05Z",
"text": "Hello, "
},
{
"timestamp":"1970-01-01T00:00:10Z",
"text": "World!"
}
]
},
{
"name": "Some Data Points",
"dataType": "int32",
"function": "datapoints",
"datapoints":[
{
"timestamp":"1970-01-01T00:00:01Z",
"value":42
},
{
"timestamp":"1970-01-01T00:00:02Z",
"value":24
}
]
},
{
"name": "Some Gps Locations",
"dataType": "gpslocation",
"function": "gpslocations",
"gpslocations":[
{
"timestamp":"1970-01-01T00:00:01Z",
"latitude":60.1234567,
"longitude":15.7654321,
"altitude":123.4
},
{
"timestamp":"1970-01-01T00:00:02Z",
"latitude":61.1234567,
"longitude":16.7654321,
"altitude":234.5
}
]
}
]
}
}
Global module parameters
Parameter name | Required | Data type | Meaningful value range | Default | Description |
---|---|---|---|---|---|
maximumProductionCount | No | INT | -1, 1 - | -1 | Maximum number of produced samples (-1 - infinite) |
maximumTimestampDeviation | No | INT | -1, 1 - | -1 | Maximum timestamp deviation [ns] from which the current smartCORE timestamp is used as the new starting point for the production of contiguous blocks (-1 - the start time is ALWAYS used as the time base) |
rtPriority | No | INT | 20 - 80 | 80 | Priority of the production thread |
bufferSize | No | INT | 1 - | 1024 | Global buffer size of samples for all channels |
samplesPerBlock | No | INT | 1 - | 1 | Number of samples produced within a block |
timeoutSeconds | No | INT | 1 - | 1 | Production clock (specification of seconds) |
timeoutNanoseconds | No | INT | 1 - | 0 | Production clock (specification of nanoseconds) |
startDate | No | STRING | UTC Zulu String or "now" | "now" | Production start time. For reproducible results and in the context of "messages", "datapoints" and "gpslocations", a constant specification as a UTC Zulu string is appropriate, while "now" specifies the current smartCORE timestamp as the start time. |
channels | JA | JSON Array of JSON Objects | see below |
Configuration of a channel (JSON object within "channels")
Parameter name | Required | Data type | Meaningful value range | Default | Description |
---|---|---|---|---|---|
name | YES | STRING | name of the channel | ||
dataType | YES | STRING | see below | data type of the channel | |
bufferSize | No | INT | 1 - | global "bufferSize" of the module | buffer size of the created channel |
function | YES | STRING | see below | function to be produced | |
... | additional parameters (see below) |
Supported channel data types 'dataType'
Note: Not all data types can be used in combination with all function specifications "function".
- string (UTF-8 encoded)
- bytearray
- double
- float
- int64, int32, int16, int8
- uint64, uint32, uint16, uint8
- bool
- gpslocation
Supported functions 'function'
- linear
- sine
- sawtooth
- triangle
- rectangle
- messages
- datapoints
- gpslocations
Mathematical functions
The following functions represent mathematical functions
- linear
- sine
- sawtooth
- triangle
- rectangle
They have the following parameters in common
Parameter Name | Required | Data Type | Meaningful Value Range | Default | Description |
---|---|---|---|---|---|
amplitude | No | FLOAT | - 0.0 - | 1.0 | The amplitude (or multiplicative scaling) of the function |
offset | No | FLOAT | - 0.0 - | 0.0 | The additive offset of the function |
frequency | No | FLOAT | 0.0 - | 1.0 | The frequency of the function [Hz] |
onOffRatio | No | FLOAT | -1.0 - 1.0 | 0.5 | The ratio between the on and off state of a rectangular function within a period; if the value is negative, the function is switched off at the start of a period |
Function for the production of messages
This function can generally be used to produce several specified string or byte array messages. For this purpose, it is advisable to specify the global parameter "startDate" as a UTC Zulu string and thus an absolute time base, as the production times of the messages are also specified in absolute terms.
A single JSON array "messages" of JSON objects is specified, these objects are parameterized as follows:
Parameter Name | Required | Data Type | Meaningful Value Range | Default | Description |
---|---|---|---|---|---|
timestamp | YES | STRING | Zulu UTC String | Absolute production time | |
text | JA | STRING | Text of the message (always UTF-8 encoded) |
Function for the production of discrete data points 'datapoints'
This function can generally be used to produce several specified data points (samples) of SCALARER and DATA TYPES SHOWABLE IN JSON. For this purpose, it is advisable to specify the global parameter "startDate" as a UTC Zulu string and thus an absolute time base, as the production times of the data points are also specified in absolute terms.
A single JSON array "datapoints" of JSON objects is specified, these objects are parameterized as follows:
Parameter Name | Required | Data Type | Meaningful Value Range | Default | Description |
---|---|---|---|---|---|
timestamp | YES | STRING | Zulu UTC String | Absolute production time | |
value | YES | ... | Value of the data point represented in JSON |
Function for the production of 3D GPS locations 'gpslocations'
This function can usually be used to produce several specified GPS locations. For this purpose, it is advisable to specify the global parameter "startDate" as a UTC Zulu string and thus an absolute time base, as the production times of the GPS locations are also specified in absolute terms.
A single JSON array "gpslocations" of JSON objects is specified, these objects are parameterized as follows:
Parameter name | Required | Data type | Meaningful value range | Default | Description |
---|---|---|---|---|---|
timestamp | YES | STRING | Zulu UTC String | Absolute production time | |
latitude | JA | FLOAT | latitude | ||
longitude | JA | FLOAT | longitude | ||
altitude | JA | FLOAT | geographic altitude |
Module information
Information | Value |
---|---|
Authors | optiMEAS Measurement and Automation Systems GmbH |
since smartCORE | 0.1 |
Module type | Producer |
Dependencies | NONE |