![ProSoft Technology MVI69E-LDM-MQTT Quick Start Manual Download Page 50](http://html1.mh-extra.com/html/prosoft-technology/mvi69e-ldm-mqtt/mvi69e-ldm-mqtt_quick-start-manual_1618947050.webp)
MVI69E-LDM-MQTT ♦ MQ Telemetry Transport
MQTT-LDM Library
CompactLogix® Platform
Quick Start Guide
ProSoft Technology, Inc.
Page 50 of 54
10.3 Logging
The logging feature uses the standard Linux daemon syslog. The script S10-syslog,
which configures and starts the feature, is located in the folder of the sample application
(
mqtt-ldm-sample-app-mvi69e
). It is included in the firmware and installed in the
module’s folder
/etc/init.d
and starts syslog daemon at system boot.
Messages are logged into the file
/www/html/log/messages.txt
, under the web
server’s public files folder. Therefore, this file can be accessed via the module’s web
server:
http://192.168.0.250/log/messages.txt
Logging is configured to limit the file size to 32 Kb, with a maximum number of files set
to
1
. When the log file size exceeds 32Kb, the active log file is archived into file
messages.txt.0
, and logging continues 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 47. The orange lines in the diagram illustrate
data flow.
In order to read data from the PLC and publish it to the 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.