Skip to main content

Generic consumption module "fmconsumer"

Description

The generic consumption module fmconsumer allows channel data to be consumed, placed in a defined message and then sent via a socket module (such as a ``canbus``` module). Since the specification of the channels is optional, messages that are constant in time (such as periodic stimulus messages) can also be sent. The messages are sent either

  • once after the specified transmission interval
  • Periodically at the specified transmission interval
  • event-controlled

An event-controlled dispatch takes place here

  • after an event has occurred (and at the earliest after a configurable interval has elapsed)
  • after a configurable interval has elapsed, if NO event has occurred by then

An event occurs when a message specified using an identification key (messageKey) is received by the socket module.

Several messages to be sent can be configured.

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": "Consumer",
"factory": "fmconsumer",
"config":{
"fmd": "canbus",
"messages":[
{
"messageKey": 42,
"defaultMessage": "0102 03 04ff06",
"sendMode": "OnTimer",
"sendIntervalMs": 1000
}
]
}
}

Global module parameters

parameter namerequireddata typemeaningful value rangedefault valuedescription
fmdYESSTRINGName of the module instance of the socket module used
messagesYESJSON Array of JSON Objectsee below
channelsNoJSON Array of JSON Objectsee below

Configuration of messages

Messages are specified as JSON objects, each of these objects can contain the following parameters

parameter namerequireddata typemeaningful value rangedefault valuedescription
messageKeyYESINTUnique identification key of the message
defaultMessageYESSTRINGHexadecimal coded bytes of the message template (spaces are ignored)
sendModeYESSTRING"SingleShot", "OnTimer", "OnTriggerWhenTimeoutElapsed", "OnMissingTriggerWhenTimeoutElapsed"Message sending mode (one-time, periodic, event-driven)
sendIntervalMsYESINT0 -Delay/Interval [ms] with regard to message sending
triggeringMessageKeysNoJSON Array of INTEMPTY JSON ArrayIdentification key of all event-triggering messages

Configuration of channels "channels"

Note: Channel data is currently placed one-to-one within the message template, i.e. the data type ultimately placed corresponds exactly to the source data type of the channel. In addition, the user must define a sufficiently long message template. Optionally, it is possible to place a smaller number of bits using the bitLength (in this case, the right bits are discarded accordingly).

Channels are specified as JSON objects, each of these objects can contain the following parameters

parameter namerequireddata typemeaningful value rangedefault valuedescription
nameYESSTRINGName of the channel to be consumed
bitOffsetYESINTwithin the message templateOffset regarding placement of the channel within the message template
bitLengthYESINTso that bitOffset + bitLength is within the message templatelength regarding placement of the channel within the message template

Module information

InformationValue
AuthorsoptiMEAS Measurement and Automation Systems GmbH
since smartCORE0.110
Module typeConsumer
DependenciesSocket module with write access (such as canbus)