1. Terms of Use
Because of the variety of uses of the information described in this manual, the users of, and those responsible for applying this information must satisfy themselves as to the acceptability of each application and use of the information. In no event will SoftPLC Corporation be responsible or liable for its use, nor for any infringements of patents or other rights of third parties which may result from its use.
SOFTPLC CORPORATION MAKES NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE CONTENTS HEREOF AND SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE.
SoftPLC Corporation reserves the right to change product specifications at any time without notice. No part of this document may be reproduced by any means, nor translated, nor transmitted to any magnetic medium without the written consent of SoftPLC Corporation.
SoftPLC, and TOPDOC are registered trademarks of SoftPLC Corporation.
© Copyright 2026 SoftPLC Corporation ALL RIGHTS RESERVED
| First Printing |
August, 2013 |
| Latest Printing |
February, 2026 |
SoftPLC Corporation 25603 Red Brangus
Drive Spicewood, Texas 78669
USA Telephone: 1-800-SoftPLC
Fax: 512/264-8399
URL: http://softplc.com
Email: support@softplc.com
2. Overview
TagWell™ is a powerful, configurable IIoT (Industrial Internet of Things) platform for monitoring, maintaining, and administration of remote systems.
TagWell provides an efficient, low cost, and bi-directional pathway to remote systems for applications such as alarming, data acquisition, and control. The TagWell user interface is customer specific web page(s) which are viewable via any browser.
2.1. Introduction
The TAGWELL TLM is a free firmware option for the SoftPLC runtime control software (versions 4.6, and later) that adds the capability of receiving and sending data messages to the TagWell Web Portal.
This capability is implemented as a TOPDOC Loadable Module (TLM), written in C++ and implements a driver that receives data messages from TagWell and a ladder instruction (TLI) which queues data messages to be sent. This document describes the installation, usage, and functionality of the TAGWELL TLM.
2.2. Concepts
The SoftPLC runtime engine software supports TLM’s, which are shared library extensions to SoftPLC. A TLM may be loaded either as a DRIVER or as a MODULE. The difference between a DRIVER and a MODULE is that a DRIVER is called once per SoftPLC scan, and optionally an additional number of times per scan. A MODULE is only called when the control program decides to call it and not as an inherent part of the scan. TLM’s are made known to SoftPLC in the MODULES.LST file which may be edited by TOPDOC NexGen by traversing to: PLC | Modules.
This TAGWELL TLM is to be used as a DRIVER, not as a MODULE. It looks for incoming messages every scan and it provides one (1) TOPDOC Loadable Instruction (TLI) to send a data message.
2.3. Features
-
Communicates with the TagWell Web Portal via cell modem on VPN or over Internet.
-
Receives unsolicited messages from the TagWell Web Portal.
-
TagWell shared data lists are created using Tags rather than data table addresses.
-
Tag lists may be created using regular expressions. (See http://regexlib.com for information on regular expressions.)
2.4. Requirements
-
Gatecraft Linux (version 3.6 or greater)
-
SoftPLC Runtime (version 4.6 or greater)
-
TagWell Web Portal Account
3. Installation
The TLM is named tagwell.tlm.so, and the configuration file is TAGWELL.LST. Both of these files will be pre-installed on your SoftPLC for you. To use it you simply have to enable and configure it using TOPDOC NexGen’s PLC | MODULES editor. Select Use for TAGWELL.TLM, then click on the Configure button to edit the TAGWELL.LST file.
3.1. Editor Usage
|
Load button will load the configuration file from the development system’s
disk. |
After you edit the configuration file, the next step is to restart or cycle power on the SoftPLC in order for the changes to take effect.
| As an alternative to cycling power, you may enter "Remote Program" mode using NexGen, then select "Remote Program" a second time. This pseudo transition from Remote Program to Remote Program is a signal to the TLM that it should reload its configuration file. This way you can load the new configuration without cycling power, although it does require you enter "Remote Program" mode (twice!). |
3.2. Ladder Instruction
3.2.1. TAGWELL SEND
This instruction is used to send a data message containing the current values of the defined 'DataSet' (i.e., group index - per TAGWELL.LST). The instruction is edge triggered and will send a message when it is not busy. A total of three (3) attempts will be made to send the message.
The instruction has three (3) parameters:
-
“Control:” Control Element (R) address. When the rung goes TRUE, a message will be queued and the Enable (EN) and Enable Unload (EU) bits will come ON. Upon completion, the “EN” and “EU” bits will go OFF and either the Done (DN) or Error (ER) bit will come ON. If the ER bit comes ON, the Control Elements Position word (.POS) will contain an error code. When the rung is FALSE and the EU bit is OFF, the control bits are cleared (.CTL = 0).
Upon completion, the Control Element “.POS” will be set to one of the following values:
0
Success
1
Timeout
2
No Memory
3
Bad Message Type
4
Old Request
5
Missing File
6
Bad Config File
7
Undefined Tag
8
Missing Tag
9
Invalid PLC Address
10
Nonexistent PLC Address
11
Bad XML
12
Bad XML Text
-
“Result:” String element (ST) that will return a text string indicating success or failure. When a message is sent successfully: “Send to TagWell succeeded.”. When a message send fails: “Send to TagWell failed.”
-
“DataSet:” The group index number asserted via the configuration file 'TAGWELL.LST'.
- Example
-
When the change bit (TWS_Change=B3/0) is set to 1, the TAGWELL_SEND TLI will queue a message and set the EU bit (TWS_Busy=R6:2/EU). On the rising edge of the EU bit, the change bit is reset to zero (0) (2nd rung). Upon message success (DN) or failure (ER), the TLI’s rung state will go false, the control bits will be cleared and the instruction will be ready to send another message if or when the change bit is ON. It is recommended, to reset the control bits upon transition to run mode (and on startup).
3.2.2. TAGWELL FETCH
This instruction is used to fetch data from the Tagwell service. The instruction is edge triggered and will fetch a message when it is not busy. A total of three (3) attempts will be made to fetch the message.
The instruction has three (3) parameters:
-
“Control:” Control Element (R) address. When the rung goes TRUE, a message will be queued and the Enable (EN) and Enable Unload (EU) bits will come ON. Upon completion, the “EN” and “EU” bits will go OFF and either the Done (DN) or Error (ER) bit will come ON. If the ER bit comes ON, the Control Elements Position word (.POS) will contain an error code. When the rung is FALSE and the EU bit is OFF, the control bits are cleared (.CTL = 0).
Upon completion, the Control Element “.POS” will be set to one of the following values:
0
Success
1
Timeout
2
No Memory
3
Bad Message Type
4
Old Request
5
Missing File
6
Bad Config File
7
Undefined Tag
8
Missing Tag
9
Invalid PLC Address
10
Nonexistent PLC Address
11
Bad XML
12
Bad XML Text
-
“Result:” String element (ST) that will return a text string indicating success or failure. When a message is successful: “TAGWELL_FETCH succeeded.”. When a message send fails: “TAGWELL_FETCH failed.”.
-
“DataSet:” Destination for the data, which is harvested during the 'fetch', to land.
- Example
-
When the change bit (TWS_Change=B3/0) is set to 1, the TAGWELL_FETCH TLI will queue a message and set the EU bit (TWS_Busy=R6:2/EU). On the rising edge of the EU bit, the change bit is reset to zero (0) (2nd rung). Upon message success (DN) or failure (ER), the TLI’s rung state will go false, the control bits will be cleared and the instruction will be ready to send another message if or when the change bit is ON. It is recommended, to reset the control bits upon transition to run mode (and on startup).
4. Configuration
|
Section 4.2 pertains to SoftPLC firmware 5.X, and later. Section 4.3 pertains to SoftPLC firmware 4.6, and earlier. |
4.1. Configuration Editor Usage
To configure the driver, connect to your SoftPLC. Load the PLC | MODULE editor. Highlight the TAGWELL.TLM by clicking on this entry; then, click on the Configure button. From the new TAGWELL.LST configuration window, click 'Fetch' to edit the TAGWELL.LST file.
After editing the configuration file, execute a 'Save' to record the changes to your development/local PC. Then, execute a 'Send' to record the changes to your SoftPLC/remote device.
The next step is to restart (or cycle power on) the SoftPLC for the changes to take effect. To restart, navigate to the 'Startup' tab and click 'Restart SoftPLC Runtime Now'.
| If your TOPDOC NexGen does not include the 'Restart SoftPLC…' button; your TOPDOC installation must be updated. Contact SoftPLC Support for update information. |
As an alternative to both restarting and power cycling, you may enter 'Remote Program' mode using 'Edit Remotely', and then select 'Remote Program' a second time. This pseudo transition from Remote Program to Remote Program is a signal to the TLM that it should reload its configuration file.
4.2. TAGWELL.LST (SoftPLC firmware 5.X, and later) Configuration File Sample
# TagWell Driver Configuration for SoftPLC Runtime Software.
# This file uses an "s-expression" format, which is like XML but uses
# parentheses instead of angle bracketed keywords. The syntax of s-expression
# files is well documented and can be googled. The grammar, on the other hand,
# unlike the syntax, is application specific. SoftPLC uses '#' to indicate
# a single line comment. If the first non-blank character is #, then this
# line is a single line comment. Single line comments cannot follow
# any other token on the same line. Multiline 'C' style comments are also
# supported. Its best to use these also only as the first non-blank combo:
# /* followed by an eventual */
#
# S-expressions are thought to be more human readable than XML
# and are easy to parse with a programming language. Parentheses are balanced.
#
# The supported grammar is documented in the next several lines of comments.
# Grammar rules are declared like this, for example:
# (timeout_mult <4 | 8 | 16 | 32 | 64 | 128 | 256 | 512 > )
# This means "timeout_mul" is a keyword and it can be followed with
# 4, 8, 16, 32, 64, 128, 256, or 512. The '|' means "or". e.g. (timeout_mult 4)
#
# If something is wrapped in square brackets [] in a grammar rule, this means
# whatever appears in the brackets is optional. If omitted, then a default value
# will be used and the default is defined in the grammar rule by a comment following
# a ':'. The square brackets, being only part of the grammar definition,
# are never actually used in real configuration statements.
#
# If something is wrapped in angle brackets <> in a grammar rule, this means
# it is a grouping. Only one of the choices in a grouping may actually be used.
# Angle brackets, being only part of the grammar definition, are never actually
# used in real configuration statements.
#
# White spaces includeing tabs and newlines (CR, LF, etc.) are all ignored.
# Numbers may be provided either in decimal or in hex with a prefix of 0x.
#------ Grammar Rules: ----------
# (tagwell ` is the master containing element and it may contain
# ` the indicated top level nested elements.
# ` Every nested element is contained within this
# ` master element.
# (driver_version ...) ` configuration file revision, use 2 : 2 is default
# (debug ` marks the start of optional flags whose presence
# ` enables various debug print statements.
# [config] ` show tag regex resolution and group membership
# [sockets] ` show usage of ethernet sockets
# [payload] ` show details (xml) of packet payloads
# )
#
# (group ` indicates the start of tag group
# ( name <group_name>) ` the name of the group
# [(on_poll [tags_only])] ` When Tagwell polls,
# ` tags_only means respond without data, only
# ` include tags in the response. Omit it if
# ` you want a normal full response.
# <tag_regex> ... ` a sequence of tag names or tag regexs that
# ` indicate which tags are included in this group
# ` Those tags that match any regular expression
# ` will be included in the group payload.
# ` see http://regexlib.com/CheatSheet.aspx?AspxAutoDetectCookieSupport=1
# )
# : ` optional additional (group) elements
# :
# ) /* end of "tagwell s-expression element */
# Each group will be assigned a zero based group index that can be referenced
# in the TLI. Commenting out a group will renumber the group indices for groups
# which follow it. The group indices are contiguous. At this time group (name <>)
# is required but is not used. A future TLI may use this instead of the group index.
(tagwell
(driver_version 2)
(debug
#config
#sockets
#payload
)
# group index 0
(group
(name outputs)
(on_poll tags_only) /* tags in this group flow FROM tagwell to remote */
tgw_out.+ /* any tag name starting with "tgw_out" */
oops_and_this_one_too
"sexpr_strings_can_be_quoted" /* quotes may be necessary if a regex confuses the lexer */
)
# group index 1
(group
(name inputs)
tgw_in.+
)
)
4.2.1. TAGWELL.LST (SoftPLC firmware 5.X, and later) Configuration Elements
Let’s examine each configurable element of the TAGWELL.LST configuration file:
- driver_version
-
Configuration file (TAGWELL.LST) revision number.
-
Possible value is 2.
-
- debug
-
Marks the start of 'debug' element.
- config
-
Including the optional 'config' flag within the 'debug' element enables the system logs to display tag regex resolutions and group memberships.
- sockets
-
Including the optional 'sockets' flag within the 'debug' element enables the system logs to display usage of ethernet sockets.
- payload
-
Including the optional 'sockets' flag within the 'debug' element enables the system logs to display details of packet payloads.
|
All flags (config, sockets, and payload) within the 'debug' element may either be omitted and/or included. For example, to include all three flags within the debug element: (debug config sockets payload) |
- group
-
Indicates the start of the 'group' of tags element. There may be one, or more, group(s) of tags. Each group will be assigned a group index. The first group stated in this configuration file will always be zero; incrementing up, from there.
- name <group_name>
-
To assign an identifying title to a particular group of tags; replace '<group_name>' with a customized, descriptive label.
- on_poll [tags_only]]
-
When Tagwell polls, 'tags_only' means; respond without data, only include tags in the response. Omit it if you want a normal full response.
- tag_regex
-
A sequence of tag names or tag regexs that indicate which tags are included in this group. Those tags that match any regular expression will be included in the group payload.
4.3. TAGWELL.LST (SoftPLC firmware 4.6, and earlier) Configuration File Sample
The configuration file for the TAGWELL TLM is /SoftPLC/tlm/TAGWELL.LST. This file is used to set the debug level and provide a list of tags to be shared. To share a particular data-space from your ladder program, a tagname must be associated with said data-space. How to accomplish this step is mentioned in TOPDOC NexGen’s user manual.
After the tagname is established in the ladder program, that tagname may be shared with the Tagwell service via regular expression format, which itself, is established in TAGWELL.LST. See TOPDOC NexGen’s “Regular Expressions” Help Topic for a summary of legal regular-expression constructs.
The default entry in TAGWELL.LST is:
.+ ; matches all defined tags.
For example:
TWD_.+ ; would include all tagnames that begin with the characters “TWD_”.
4.3.1. NETWORK.LST Changes Required for TAGWELL (SoftPLC firmware 4.6, and earlier)
If you are using the Tagwell Portal over the cellular VPN, you also need to do the following:
-
The wired ethernet network’s DNS and Routing GATEWAY setting must not be assigned. In the PLC’s Network tab, the option box should should show the following:
-
The Tagwell domain’s private IP address must also be defined in the “hosts” file on the PLC. (/etc/hosts). From the Gatecraft Linux console, you can use the built-in text editor “nano” as follows (replace SMART with your PLC name):
root@SMART[/home/root]# nano /etc/hosts
Once the text editor is displayed (after the command above), the contents of '/etc/hosts' should include the information below:
127.0.0.1 localhost.localdomain localhost 54.187.51.15 tagwell.net
4.4. Example Ladder Program
This ladder program example can be used to send a message to TagWell when any of the defined Tags in the list changes state or value.
For this example, the following tags are shared with the Tagwell Portal.
B0013/000000 TWD_Open
B0013/000001 TWD_Pump
B0013/000002 TWD_Fan
B0013/000031 TWD_Alarm
N0027:0000 TWD_AValue
Simply specifying “TWD_.+” in the TAGWELL.LST file will match all of the above tags. In TAGWELL.LST, enter the following:
[REGEXS] ;.+ ; match all tags TWD_.+
-
When SoftPLC first starts or transitions from PROGRAM to RUN mode, the First Scan bit in the Status File (S1/15) is TRUE for one scan only. You can use it to reset all Control Elements (R*.*) and Counters (C*:*).
In this example, the data change bit (TWS_Change) is also set which will initialize the Tagwell Portal.
-
The next three (3) rungs contain the logic to determine if any Tags shared with the Tagwell Portal have changed.
In this example, the DDT instruction is used to detect whether any Bit Tags have changed and a “NEQ” test is used to determine if any Word Tags have changed. If any Tags are determined to have changed, latch the change bit (TWS_Change).
You could use other tests to trigger a message if a value goes outside of high or low limits, or changes by a certain amount. Similarly, you could use other logic to send messages based on time of day, etc. -
These rungs send the messages, and check for TagWell message errors.
If a Tag has changed, send a TagWell data message. When a new request is queued, the EU bit will turn ON and the change bit (TWS_Change) will be reset. The DN and ER counters should be increment before the TAGWELL_SEND TLI, as the Control Element’s Control Word (.CTL) will be cleared when the rung is FALSE and the EU bit is OFF.