![ProSoft Technology MVI56E-LDM-MQTT Quick Start Manual Download Page 51](http://html1.mh-extra.com/html/prosoft-technology/mvi56e-ldm-mqtt/mvi56e-ldm-mqtt_quick-start-manual_1618938051.webp)
MVI56E-LDM-MQTT ♦ MQ Telemetry Transport
MQTT-LDM Library
ControlLogix® Platform
Quick Start Guide
ProSoft Technology, Inc.
Page 51 of 55
10.3 Logging
The logging feature uses the standard Linux daemon syslog. The script S10-syslog,
which configures and starts it, is located in the folder of the sample application (
mqtt-
ldm-sample-app-mvi56e
). It is included in the firmware and installed in the module’s
folder
/etc/init.d
and starts syslog daemon at system boot.
It is configured to log messages into file
/www/html/log/messages.txt
, under the
web server’s public files folder. Therefore, it can be accessed via the module’s web
server:
http://192.168.0.250/log/messages.txt
It is configured to limit the file size to 32 Kbytes, with a maximum number of files set to
1
.
When the log file size exceeds 32Kb, it archives the active log file into file
messages.txt.0
, and continues logging in a new file
messages.txt
. The archived copy
can be accessed via URL:
http://192.168.0.250/log/messages.txt.0
10.4 Data Flow for Reading Tag Values
on page 48. The orange lines in the diagram illustrate
data flow.
In order to read data from the PLC and publish it to MQTT Broker, the user application
must periodically call the function
mqtt-ldm-poll
. In this function, MQTT-LDM iterates
over all configured tags: if the time specified by the
Scan Rate
parameter has elapsed
since last read call, it performs a reading of the current value from the PLC by calling
mqtt_ldm_read_value
. If this value is newer than the last read value, it is reported to the
MQTT Broker in a Publish message.
If the last Publishing of the tag value time is greater than
MaxPublishInterval
, then the
value is published, even if the value has not changed.
10.5 Data Flow for Writing Tag Values
During the connection, if there are writable tags, mqtt-ldm-lib subscribes to topics used
to receive publish messages. It then registers a callback function on AWS IoT SDK,
which is called when the corresponding publish message is received. If the received
value is different than the existing value, it is then written to the PLC.