TBoxMS Programming 2.13
TBoxMS Programming 2.13
TBox-MS
Programming Guide
Version: 2.13
TBox-MS Programming Guide
The document contains confidential and proprietary information of Ovarro SA and must be kept strictly confidential. It may not be
disclosed in whole or in part under any circumstances without the express prior written consent of Ovarro SA.
Revision History
Version Date Description
2.13 28/01/2022 Logo Ovarro
Updated to TWinSoft 12.6
Version: 2.13
Contents
IMPORTANT SAFETY INSTRUCTIONS ................................................................................................................... 10
ENVIRONMENTAL CONSIDERATIONS ................................................................................................................... 11
GENERAL PRECAUTIONS IN CABLING ................................................................................................................... 11
APPROVALS ......................................................................................................................................................... 12
PRESENTATION .................................................................................................................................................... 13
OVERVIEW OF TBOX MS POSSIBILITIES ................................................................................................................ 14
1 HOW TO USE THIS MANUAL? ......................................................................................................................... 15
1.1 WHAT IS IN THE MANUAL?.......................................................................................................................................... 15
1.2 WHAT IS NOT IN THE MANUAL? ................................................................................................................................... 15
2 THE HARDWARE CONCEPT ............................................................................................................................ 16
2.1 THE RACKS ............................................................................................................................................................. 16
2.2 THE CARDS ............................................................................................................................................................. 17
3 INSTALLATION OF TWINSOFT .......................................................................................................................18
3.1 SYSTEM REQUIREMENTS............................................................................................................................................ 18
3.2 CONTENT OF THE USB STICK ..................................................................................................................................... 19
3.3 PROGRAMS OF ‘TWINSOFT SUITE’ .............................................................................................................................. 21
4 STARTING TWINSOFT .................................................................................................................................... 22
4.1 WIZARD.................................................................................................................................................................. 23
4.2 COMMUNICATING WITH TBOX MS .............................................................................................................................. 25
4.3 PC COMMUNICATION SET UP ..................................................................................................................................... 25
4.3.1 Communication possibilities of TWinSoft ......................................................................................................... 26
4.3.2 IP setting of PC .............................................................................................................................................. 26
4.3.3 IP setting of TWinSoft .................................................................................................................................... 28
4.4 FACTORY IP ADDRESS - CHANGING IP ADDRESS ............................................................................................................. 30
4.5 TESTING COMMUNICATION ........................................................................................................................................ 31
4.6 RESET OF TBOX MS ................................................................................................................................................ 32
4.7 GLOBAL RESET OF TBOX MS .................................................................................................................................... 32
4.7.1 MS-CPU16 : Global Reset Configuration .......................................................................................................... 32
4.7.2 MS-CPU32(-S2) : Global Reset Configuration .................................................................................................. 33
4.7.3 Working Modes Available with Toggle Switch .................................................................................................. 33
4.8 LED « RUN » ......................................................................................................................................................... 33
4.8.1 MS-CPU16 ..................................................................................................................................................... 33
4.8.2 MS-CPU32(-S2) .............................................................................................................................................. 34
4.9 SENDING ‘OPERATING SYSTEM’ .................................................................................................................................. 35
4.10 SAVING AND SENDING A PROGRAM ............................................................................................................................. 35
4.10.1 Saving a document – Backup document .......................................................................................................... 35
4.10.2 Compiling an application ................................................................................................................................ 36
4.10.3 Test of Memory .............................................................................................................................................. 36
Canada
The TBOX MS must be mounted in a suitable protective enclosure, which incorporates means to allow for field wiring
connections in accordance with section 18 of the Canadian Electrical Code (CEC), Part I, where the suitability of the final
combination is to be determined by CSA or the Inspection Authority having jurisdiction.
Environmental Considerations
Battery Disposal
! CAUTION: There is a danger of a new battery exploding if it is incorrectly installed. Replace the battery only with the
same or equivalent type recommended by the manufacturer. Do not dispose of the battery along with household
waste. Contact your local waste disposal agency for the address of the nearest battery deposit site.
Your TBox uses a lithium coin cell battery. The lithium coin cell battery is a long-life battery, and it is
very possible that you will never need to replace it. However, should you need to replace it, see in
manual TBoxMS Technical Specifications for instructions.
Approvals
SAFETY IEC 62368-1:2018
Presentation
CYBER SECURITY
WEB SERVER
Firewall, SSL, OPenVPN,
Control and Monitoring Brute force attack protection, …
using PC, Smart phone,
tablet, …
IP INTERFACE ALARMS
SMS, e-mail, FTP,
SMTP, HTTP, FTP, …
Pictures, …
IP forwarding, Router,
Gateway, …
COMMUNICATION DATALOGGING
Chronologies (SoE)
Ethernet, GSM, RS485 …
Sampling Tables
ModBus, SNMP, …
IEC-60870, DNP3, …
PLC
Ladder (IEC 1131-3) BASIC
Consulting
process through
HTM pages
Programming :
locally or
remotely
Sending of
Alarms
HTM
Page e-mail, SMS, report, …
HTM
Page
HTM Communication
Page to a remote site
HTM RS485, Ethernet, GSM, …
Page
WEB Server
Retrieving data
remotely, Consulting Process Process
process
Data
logging
Retrieving
data locally
TConnect, SCADA,
TView, …
Then it brings you to the programming of TBOX MS using TWinSoft. All features are explained using plenty of snapshots for
an easy understanding.
➢ Starting TWinSoft ➢ chapter 4
➢ Properties of TBOX MS ➢ chapter 6
➢ Resources ➢ chapter 7
➢ Tags ➢ chapter 8
➢ IP Services Configuration ➢ chapter 9
➢ IP Security Services ➢ chapter 10
➢ Alarms ➢ chapter 11
➢ ReadSMS ➢ chapter 12
➢ Datalogging ➢ chapter 13
➢ ModBus Transactions ➢ chapter 14
➢ Periodic events ➢ chapter 15
➢ Access Security ➢ chapter 16
All technical specifications of the different models of TBOX MS and cablings are presented at the end of this manual.
All along this manual, I inform you with Notes and Remarks: “What a nice manual!”
One major topic you will not find in this manual concerns the Logic Programming. TBOX MS supports BASIC and Ladder
languages for developing any advanced process. These languages are detailed in another manual: BASIC and LADDER for
TBOX
Another important feature, which is not presented into this manual, concerns the development of HTML pages, to use
TBOX MS as web server. This subject is explained in on-line help of WEBFORM STUDIO 2.0.
Another software part of the TWinSoft Suite is Report Studio, for creating e-mail report or files to send. It is explained in the
‘On line’ help of Report Studio.
Depending on your needs in communication(s) and in Inputs/Outputs, you select the cards required.
➢ 3 slots
➢ 5 slots
➢ 10 slots
➢ 15 slots
➢ 20 slots
➢ Power supply
➢ CPU
➢ Communication ports
o GSM
o RS232/RS485
o Ethernet
o …
➢ Input/output
o Digital inputs, outputs
o Analog input
o Analog outputs
o Combination of digital/analog I/O
o …
3 Installation of TWinSoft
3.1 System requirements
Hardware PC running Windows. 32 bits or 64 bits.
Memory 32 MB minimum.
Hard Disk 350 MB required plus the application files.
Display VGA, SVGA with a minimum resolution of 1024 x 768.
Mouse Any Windows compatible mouse.
USB Port Required in case of license with dongle for ‘USB’ port and/or to communicate with
TBOX MS through USB.
Serial Port Required for a local connection to TBOX MS . If no serial port available, you can use
USB or Ethernet on PC.
Ethernet Port 10/100 Mbps required for a connection to TBOX MS through a LAN
Modem To access TBox through dial-up connection from any modem properly configured in
Windows.
Operating System Windows 2008, 7, 8, 10
32bits or 64 bits
To Browse TBOX MS
Working with WebForm 2.0, any browser or smart phone supporting SVG and Ajax can be used. Note that a minimum
version of browser and smart phone is required (see “help” in WebForm Studio 2.0).
The USB stick of the Suite TWinSoft Suite includes also the following software’s accessible from the
setup:
TWinSoft 12.xx
TWinSoft is a Suite of software required for developing an application for TBOX MS . The basis for configuring a TBOX MS
application is explained in this manual.
WebForm Viewer This setup contains the ‘ActiveX’ used with legacy HTML page used to display dynamic
objects dedicated to the RTU. It must be installed on the PC used by operators using IE to
display legacy HTML pages. In such case, TWinSoft Suite is not required; only the ActiveX
needs to be installed.
(It is highly recommended to use WebForm Studio 2.0 in new project based on
TBOX MS .)
TConnect TBox Devices Manager. To connect easily to TBox, to centralize connection to TBox and
update of configurations.
TBox Drivers List of add-ons available. Mostly communication protocols (IEC-60870, DNP3, SNMP, …
Hardware Dongle Driver If using a TWinSoft hardware license, (through USB dongle) you have to install a dedicated
USB driver.
TView TView is a data aggregator software. It collects TBox data using “pull” or “push”
technologies. Data can be displayed in chart, list and synoptic (using WebForm 1).
TBox Mail This software is used to display a Chart view from data logging attached to e-mail. To store
data in a global database, you should use TView (call your local distributor).
Explore the USB stick You will find on the USB many information related to TBOX MS and accessories:
datasheets, manuals, add-ons.
4 Starting TWinSoft
I am the Wizard of TWinSoft!
When you start TWinSoft the first time, or when you create a new document, I
help you with some basic configurations.
The use of TWinSoft is free, but sending of a program to TBOX MS is protected. For more
info about Licenses go to Appendix A at the end of this manual.
4.1 Wizard
The “New Document Wizard” helps you getting started with a new application by gathering information about your
hardware and some basic configuration.
Except for the “Type of RTU”, settings can be modified latter from the “RTU properties” {XE “RTU Type”}
IP configuration of Ethernet
The possible communications are serial, Ethernet, USB or modem, according to the media used to connect to TBOX MS .
See details chapter 7.1.1 RTU Communication Ports.
• Serial: check the Baudrate you have given to the serial port in your application
(by default 9600, N).
• Ethernet: check the IP address you have given to your TBOX MS and that it is in the same subnet of the PC or
accessible to the PC.
• USB: Communication happens in TCP/IP. TBOX MS acts as a DHCP server and provides to the PC an IP in the
range 10.8.10.xxx. TBOX MS itself uses the IP address 10.8.10.1.
• Modem: check the tel. Number of TBOX MS .
It is also possible to specify another IP address, for instance if communicating to the TBOX MS through GPRS.
(See details chapter 4.3.3 below) { XE "Ethernet:on PC " }
• USB: You intend to access TBOX MS through a USB port of your PC.
The USB driver is installed upon TWinSoft setup. Driver is available in ..\Program Files\Semaphore\TBoxUSB\
name TBoxUSBDriver.inf.
IP address of TBox is 10.8.10.1. { XE "USB:PC driver"}.
• Modem: to establish a remote connection to the TBOX MS . TWinSoft takes full advantage of Windows' built-in
modem support: simply install your modem in the control panel's Modems applet of Windows and you are
ready to call your TBOX MS . { XE "Modem:on PC" }.
You can develop your application without being connected to TBOX MS , but it will be mandatory to
send it to have the RTU running !
The program can be sent through any media: RS232, RS485, USB, Ethernet, modem, GSM, …
4.3.2 IP setting of PC
When communicating to TBOX MS through Ethernet, you have to make sure your PC is configured with fix IP. Go to
“Network” -> “Local Area connection” -> “IPv4 properties”:
Example of subnet:
172.25.110.xxx
255.255.255.0
In case you intend to change IP address of TBOX MS , you can define several IP addresses in Windows.
In IPv4 properties, click “Advanced...”, then “Add...” to add an IP address in the subnet corresponding to the current IP
address of TBox, or to the one you want to change TBOX MS to:
You check “Don’t change TCP port…” when sending a program using a TCP port which is not the
one declared in the application. For instance when sending a program through a router which
does PAT (Port Address Translation)
To communicate using Ethernet, make sure your PC is configured in the same subnet as TBOX MS (see chapter 4.3.2.
above).
If you have changed IP address of TBOX MS to another subnet (as illustrated chapter 7.1.4) you must use the settings as
described point 2 above.
In case you have not declared the 2 subnets in your PC (as described in chapter 4.3.2. above), to restore the communication
do the following:
• Send program to TBOX MS . At the end of sending the RTU restarts with its new IP address. TWinSoft will lose
communication and will not be able to start TBOX MS .
• Change the IP settings of your PC to the same subnet as TBOX MS .
• Go to TWinSoft “Communication” -> “PC Setup” and check the IP address selected is the new one.
• Click “OK” and check in the status bar you are connected.
• Go to TWinSoft “Communication” -> “Running mode” -> “Start/Stop Program”.
When you don’t know the IP address of TBOX MS , you can set its communication setting to the factory configuration (see
chapter 4.6 below).
Available information:
• Name of the RTU
• Type of Hardware
• Version of Operating System
• Status of the process
• ModBus address of the Station
• Sub-address of the Station
• Access level of the current user
• Date/Time in the RTU
• IP configuration of the Ethernet
• General information about the program
• Process cycle time
The communication media used by the PC is indicated as well as the access level of your connection (see chapter 16
‘Security’).
If a connection cannot be established with TBOX MS , it might be because the configuration of its port does not fit with the
PC setup you use (different Baudrate, different IP address, protocol other than ModBus, …).
This is very useful when you take a CPU from the shell and you have no idea how the port you want to communicate with is
configured.
The global reset is achieved using the toggle switch on the front side of TBOX MS .
Procedure:
• Push and maintain the toggle switch to “Reset” side
• The LED turns red for about ½ second
• Let the LED flash “green” 3 times
• Release the toggle switch
The global reset mode is indicated by the LED flashing green at 0.5 Hz (instead of 2 Hz in RUN mode). In this mode, TBOX
MS is configured like as following:
The Global Reset does not erase the current program. Doing a single reset will restart the program
(1) as of OS 3.05.xxx
4.8.1 MS-CPU16
Status MS-CPU16
Program runs 2 Hz
Program stopped 0.5 Hz
Program “Failsafe” runs -
OS Stopped 8 Hz
4.8.2 MS-CPU32(-S2)
Status MS-CPU32 MS-CPU32-S2
Starting Bootstrap “PGM”: OFF (+- 10 sec.) “PGM”: red (1 flash)
Starting UBOOT “PGM”: OFF (+- 10 sec.) “PGM”: ON red (+- 1 sec.)
Starting LINUX “PGM”: OFF (+- 10 sec.) “PGM”: ON orange (+- 4 sec.)
Starting OS “PGM”: ON green (+- 4 sec.) “PGM”: ON green (+- 4 sec.)
After sending, installation of packages, “Ala/PGM alternatively “PGM”: toggle green/red
Plug&Go on SD card or USB stick
Program runs PGM: flashing at 2 Hz PGM: flashing at 2 Hz
Other Status:
Status MS-CPU32 MS-CPU32-S2
CPU Powered (Vin or MS-PSxxx) “On”: green “On”: green
Program stopped “PGM”: ½ Hz “PGM”: green ½ Hz
LINUX stopped “PGM”: OFF “PGM”: ON red
OS stopped “PGM”: ON green “PGM”: ON green
Factory program (“failsafe”) “PGM”: 8 Hz “PGM”: green 8 Hz
Alarm active “Ala”: 8 Hz “Ala”: 8 Hz
Error on the BUS “Err”: ON red “Err”: ON red
Loading program from SD card -> CPU “Err”: ON red “PGM”: toggle green/red
Saving a document creates a file with the extension ‘.tws’ which is your TWinSoft application.
But each time a TWinSoft project ‘.tws’ is opened successfully; it is saved in a back up file ‘.tbk’. If you encounter some
problem retrieving your ‘.tws’ file, you can just replace the ‘.tbk’ extension by ‘.tws’ and use the back up.
During development of the application, it can be sent at any time to TBOX MS , for testing purpose.
When sending an application to TBOX MS , it is first compiled and then sent, in the same sequence.
The result of the compilation is available in the Results window. This window automatically pops up when there is a
compilation error but it can be opened manually:
• from the main menu: ‘View’ → ‘Results’
• using the accelerator keys <ALT + 2>
The Results window provides useful data: Information: indicated in black
Warning: indicated in bold dark green
Error: indicated in bold red
MS-CPU32 Flash: 16 MBytes SDRAM: 64 MBytes SRAM: 1 MBytes SD: Max. 2 GBytes
Features Boot Loader, LINUX; Running part of 768 KB: Datalogging 2 GB: Sampling Table
OS, Application, LINUX, OS and 256 KB: log file, Tags and Plug&Go
Sources, Web & Reports Application values backup
MS-CPU32-S2 Flash: 32 MBytes SDRAM: 64 MBytes SRAM: 1 MBytes SD: Max. 32 GBytes
Features Boot Loader, LINUX; Running part of 768 KB: Datalogging 2 GB: Sampling Table
OS, Application, LINUX, OS and 256 KB: log file, Tags and Plug&Go
Sources, Web & Reports Application values backup
TBOX MS keeps running during sending. At the end of sending, there is a de-installation/re-installation
controlled by TWinSoft. In case communication is lost during this period, TBOX MS will still be available
with its IP address of the application.
DO NOT RESET TBOX DURING INSTALLATION AND START PROCEDURE
5 Introduction to Programming
TWinSoft uses the standard look and feel of “Windows Explorer”, with at the left side a list of folders and at the right side the
content of the folder selected.
For instance, the list of “Tags”, or in the ‘Alarms’ folder the list of “Recipients” or in the ‘Datalogging’ folder the list of
“Sampling tables”, …
The sequence in which those tasks are executed is not fixed, but at least RTU properties, Resources and Tags should be
configured first, as being required for all other programming.
6 RTU Properties
Setting the properties of TBOX MS has never been so easy thanks to a set of comprehensive dialog boxes, available from
the main tool bar.
• General: the type of the RTU, station ModBus address, RTU location, size of the chronologies, …
• Add-ons: configuration of external software modules written in ‘C’, typically to communicate with advanced
protocols like DNP.3 and IEC-60870, or to execute specific task like AGA calculations.
• Info: to type any info about your program, its different versions, …
• Advanced: for some features, advanced parameters are available: during start-up, when sending alarms, about
sampling tables, TCP/IP, …
Configuration of TCP/IP services is done from the ‘Workspace’ and folder IP parameters.
RTU Type: The type of RTU you have selected with the Wizard. It cannot be changed!
Name: type a free name for TBOX MS . It will be displayed when doing a ‘RTU identification’ and used by the data
aggregator software, TView.
Maximum 11 characters.
Don’t use space.
ModBus address: with ModBus protocol, each device must have a Station number. It is its ModBus address.
Enter a number between 1 and 254 (default=1).
Sub address: if more than 254 x TBox must be installed in one project, you need to define a Sub address. As this is not
ModBus standard, it is only supported by ‘TComm.dll’ based software (TWinSoft, TView,… please call your
distributor for further information).
Sizes: Number of records of Digital and Analog chronologies. Chronologies represent the “on event” method of
recording data in TBOX MS , also known as “Sequence on Event” recording (see chapter 13: Data logging).
Timestamped data are recorded internally in TBOX MS with universal UTC time (Universal Coordinated
Time). When data is generated from TBOX MS the latter uses this setting to convert UTC time into local
time.
See Appendix B : Time in the RTU for more information.
Summer/Winter: Allows automatic management of day light saving. This selection has to be made according to
the location where TBOX MS is installed.
See Appendix B : Time in the RTU
6.2 Add-ons
An add-on is a module written in ‘C’ that executes a dedicated task not embedded in Operating System.
Typically, it is communication to SCADA using protocols like DNP.3, IEC, OPC-UA, … or communication to PLC like Siemens
(ISO TCP) AB (Ethernet IP, DF1), OMRON, ...
6.3 Protection
Access security is discussed at chapter 16.
6.4 IP Security
6.4.1 Firewall
TBOX MS embeds a Firewall.
Once activated it gives access to exception rules in folder "IP Security" -> "Firewall" (see chapter 10.2).
Once Firewall has been activated, make sure to define rules! In case you activate Firewall
without declaring any rules, all IP access to TBOX MS will be blocked.
• Doing a global reset, the rules are deactivated while TBox is in stop mode and access restored.
• Doing a stop from TWinSoft, the rules stay active, also when sending a program.
6.4.3 HTTPS
HTTPS, with "S" for "secured", is an alternative to HTTP but protected with the use of SSL and TLS protocols. It provides
protection on data when accessing TBox as Web Server.
When the Browser connects to TBox, it must identify using a certificate or a key (see below)
6.4.3.1 Certificate
When the browser connects to TBOX MS using HTTPS, it must identify the server using a certificate.
Either you have a certificate, public or private. A public certificate is authenticated by Certified Authorities like Thawte,
Verisign, DigiCert, …
Or you don’t have a certificate. In this case you can generate one from TWinSoft. Click “Generate”.
It is generated using SHA 256 (Secure Hash Algorithm). If generated using OpenSSL, use “Server” certificate: <server>.crt
6.4.3.2 Key
Either you have your own key or you let TWinSoft generate the key (see above).
If generated using OpenSSL “Server” key: <server>.key
6.4.3.3 Generate
In case you do not have certificate or key, you can use TWinSoft to generate them (see above).
6.4.4 SSH
SSH stands for "Secure Shell". It is a secured protocol you can use to access TBox in Console mode.
SSH requires a login.
As of OS 1.35, SSH login name can be changed in TBOX MS . You cannot use the name "root", which has highest privileges
and a full system access. This is not allowed.
With older Operating System, the fixed name used previously is still used, even when it appears differently in TWinSoft.
Accessing TBox using console software, like PuTTY, make sure you start it "As Administrator".
Depending on the Windows version, login might be rejected if not running as administrator.
6.4.5 Certificates
This list constitutes the TBox store of certificates. It can be used:
For instance, connecting in SSL to a server, like sending mail to GMAIL in SMTPS.
By default when TBox connects to the server it does not check the authenticity of the certificate and "continues anyway" as
you can see in tracelog:
SMTPS: SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
- To receive certificates deployed by external sources: this can be from add-on OPC UA (as of ver. 1.05)
A sequence of wizards helps you in configuring three features that are concerned by cyber security:
• Firewall
• HTTPS
• SSH
• Application Signature
When sending your application, you are informed on the status of those four features:
According to the features already configured, click next to carry on with configuration:
6.4.6.1 Firewall
You can activate the firewall (all incoming IP will be blocked) and define some basic exceptions to filter access to TBox.
More exceptions can be configured in TWinSoft folder “IP Security” → “Firewall” → “Input”.
Click “Next”.
6.4.6.2 HTTPS
HTTPS secures communication from a browser. It encrypts all communication from/to TBox.
Click “Next”
6.4.6.3 SSH
SSH protocol is used to access TBox in console mode, at LINUX level.
Click “Next”
Click “Next”
6.6 Advanced
6.6.1 Start/Stop
By Start-up we mean:
• Reset of RTU (HW or SW).
• Sending of Program
START
Activate Plug & Go: Plug & Go feature allows storing the complete TWinSoft project into a SD card. See chapter TBox-MS
Technical Specifications.
To use the feature, check this option.
Cycle Time: The frequency at which the process cycle is executed can be adjusted from here.
The choices are:
– Full Speed (default). By default it is executed as fast as possible, with no delay between the cycles.
– 20, 50, 100, 250, 500 ms.
The current time of one cycle can be checked in the RTU identification window.
STOP
Reset All physical outputs at program stop: When this option is active, the RTU reinitializes the outputs to '0' at stop. This
is particularly useful if you want to reset the outputs when sending a new program, and you want to be sure they
stay at '0' during the sending and restarting sequence. After that, outputs are monitored according to the
process.
Disconnect ModBus address at program stop: All variables will have their ModBus address disconnected, which means
that external equipment accessing the RTU will receive communication error.
This feature has been implemented to allow a SCADA detecting immediately a TBox is stopped: as the ModBus
addresses are not available, the RTU stays in communication but returns an 'Exception' error.
Stop program with toggle switch stop: When this feature is active, you have to select the Tag corresponding to the toggle
switch 'Stop' in front of the CPU (See in the Resources -> CPU -> Group 1).
Pressing the toggle switch will stop the program (Process, Alarms, Datalogging, ModBus Transactions, ...)
NO other digital input than 'Stop' toggle switch can be used, but any internal digital register can.
6.6.2 Alarms
Event stack: Is a public stack, accessible by users, where alarms are available with date, time, recipient, message, status.
The Event stack can be displayed from the main menu: ‘Communication’ → ‘Retrieve from TBox’ → ‘Alarms’.
The object ‘Alarms’ used in a WebForm displays the Event stack. It corresponds also to the list of Alarms sent
to TView.
Alarm stack :Is an internal stack used to buffer alarms when there are several to handle at the same time or when the
communication port is not available or when retries are required.
SMTP From When receiving an e-mail from TBOX MS , the field ‘From’ indicates the origin of the e-mail. It accepts any text
and the following parameters:
• %station% : replaced by the name of the station (see General properties)
• %email% : replaced by the e-mail address of the RTU
SMTP subject: When receiving e-mail from TBOX MS , the field 'Subject' can be dynamized like following:
When sending a message, the field ‘Subject’ contains the message.
In addition, it accepts any fix text and the following dynamic data:
• %station% : replaced by the name of the station (see General properties)
When sending a report, the subject field contains the Title of the report (see Report Studio); title that can contain
the parameter %station% (see above)
GSM & Printer message: When TBOX MS sends SMS, you can add information to the message. This information is sent in
front of the message. You can type any text and the following parameters:
• %station% : replaced by the name of the station (see General properties)
• %time% : the time of the RTU when SMS (or printing) was generated
• %condition% : It will result in an exclamation mark (!) in the message if the condition of the alarm is still
active when the alarm is sent.
End of Alarm prefix: Allows specifying a text that will be sent in front of the message, when the alarm condition ends, to
indicate it corresponds to the End of the alarm
Example: END:
Check the total length of SMS message according to the coding used (TEXT or UCS-2) as explained
chapter 11.6.1 SMS coding.
Process alarm even when com. port not available: An alarm corresponds always to a communication (at the exception of
"Internal" alarms). When an alarm condition is activated, by default, it waits the availability of the com. port to be
handled (Ethernet cable connected, GSM present, PSTN line detected, ...). This can lead to problems in handling
escalation: if a media is not present, the alarm process will be stopped.
This option allows carrying on alarms, even when the port is not available.
Alarm filter on both transitions: This option allows computing the filter of alarm condition during both transitions: when
the Tag value goes to alarm condition AND when it leaves alarm condition.
This option will be applied to all alarm conditions.
This is particularly useful to filter interferences on inputs.
Delay alarm processing when recipient's time table not available: This feature is associated to the "Scheduling" and time
table attached to the recipient. If the time table is not active when the alarm is initiated, this feature provides 2
options:
• the alarm is auto-acknowledged (by default)
• the alarm is maintained in the alarms stack until the time table becomes active. The "Start" timestamp is the
one at the moment the alarm condition was generated.
Example: the alarm condition happens at 2:35 AM, but it is not an urgent alarm. It is an SMS meant to inform the
technician. The "recipient" is configured with a time table starting at 8:00 AM (corresponding to the technician
work shift). Therefore, the technician will receive the message at 8:00 AM, but with a timestamp of 2:35,
informing him when the event happened
Display alarm calls in alarm table: This feature is associated to the alarm condition sent to a group of recipients. When this
feature is active, the alarms table displays the event having initiated the alarm and all the calls generated (see
below).
Event stack displaying also alarm calls: Working with group of recipients, it is also possible to display each call with its
acknowledgment status:
Display logon/logoff events in alarm table: Logon/Logoff are events logged when a user logs in on a communication port
which is protected.
These events can be removed from the list, to avoid events not being real alarms.
Check Alarm Inhibition after filter time: For each alarm condition, one can declare a filter before the alarm will be
computed. For each condition, an option "handling" allows inhibiting the alarm according to external
circumstances: flag Disala or power failure.
This option allows checking the inhibition condition after the filter has elapsed. This is particularly useful
working with “Power Failure” detection; the latter might be detected after the sensors have been in error which
will then generate an alarm. In such case, you declare a filter of some seconds on the alarm condition and check
this option; the alarm on the sensor will be inhibited properly in case of power failure.
Display time set events in alarms list:When one sets TBox time, the information is logged in the list of alarms. When there
are regular time settings it risks polluting the table with unwanted information.
By checking this option, you prevent time setting to be stored in the list of alarms.
These configurations
concern all sampling tables.
• Daily: When ‘daily’ is selected in sampling table, it is the time of the day the recording is executed.
• Weekly: When ‘weekly’ is selected in sampling table, it is the day of the week and the time the recording is
executed.
• Monthly: When ‘monthly’ is selected in sampling table, it is the day of the month and the time the recording is
executed.
Behavior in case of time Synch: Those options relate to the principle of recording sampling table in TBox: at each sampling,
TBox records the value but ONLY the timestamp of the LAST record. When sampling table is generated by TBox
(sending out a report or pulled from TWinSoft, TView, a SCADA, ...) timestamps are rebuilt based on the last
timestamp minus the period.
It means if you update the time of TBox, at next sampling it will use the current timestamp which means all
previous timestamps will be different from the original ones.
Those features determine what mechanism will be used to "rebuild" previous timestamps:
• update timestamps "slowly"
• timestamp of last record updated to the current timestamp and therefore all previous records.
• delete sampling table.
Differentiate between big time gap and time synchronization: This option allows checking the time difference between
current and new time set (manually or by synchronization). Different options are possible depending whether this
option is checked or not. You still have the original mechanism that will update the timestamp each seconds or
you can update to the last record, or select a DELTA with associated action.
When the option “Differentiate...” is not checked, we have 2 choices:
• Fill Sampling Tables: current cases which update timestamp slowly (each second)
• Update timestamp of records: the time stamp of last record is updated, then automatically all records
When the option “Differentiate...” is checked, we can select a DELTA and an action. When the DELTA is > than
selected, the action is taken:
• Reset Sampling Tables: Sampling Tables are deleted
• Update timestamp of records: the time stamp of last record is updated, then automatically all records
Sampling Table on SD card: In some applications, the size of datalogging might be an issue, more specially Sampling Table
recording. Micro SD memory card can be used with TBOX MS to store Sampling Tables. The maximum size of
one table is not increased (max. 65535 records), but the quantity of tables can now be highly increased (max.
2000 sampling tables)
As the micro SD memory card can also be used for Plug & Go, an option allows you to activate Plug&Go (see
chapter 6.6.11 Plug&Go)
Sampling Table handling will be done seamlessly to the RAM and micro SD card. It will be on an application point
of view totally transparent, to send data by e-mail, to display data in WebForm, to retrieve data from TView, a
SCADA, ...
1. Keep in mind that the goal of datalogging is to retrieve data stored in the RTU.
The more data you store, the longer connections to the RTU will be, which can be an issue with GSM,
GPRS connections.
2. To avoid overwriting on the micro SD card (limited number of writings on Flash memory), data is
buffered in 4 kbytes buffer before it is stored on the SD. A very small risk exists of micro SD corruption
if you stop during writing to the card. We then advise to stop the RTU before switching it off or
resetting it. (Identical precaution on PC when removing a memory stick).
Fill Tables with "0": Sampling Tables mechanism records data based on the clock of TBox.
If the TBox is switched off for a period longer than the period of recording, it will miss data. Therefore TBox adds
automatically missing records.
By default, it fills records with the last known value.
Check this option to fill with value=0.
6.6.4 Temperature
For Temperature analog input (Pt1000), you can define a unit: Celsius, Fahrenheit or Kelvin.
Remote device inactivity delay: This option allows defining a quarantine delay when a Remote device is in communication
error.
As a standard then we cannot mix different formats of variable to avoid mixing data.
This option bypass this security when doing ModBus Master communication.
It means that in ONE transaction it is possible to access 16 bits, 32 bits and Float variables
Make sure variables are listed with identical format between Master and Slave:
32 bits with 32 bits, 16 bits with 16 bits, Floats with Floats
6.6.6 Ports
HTTP(S): port used to access TBOX MS as WebServer. (by default= 80 & 443)
Changing of TCP port is automatically applied to 'WebForms 1.0' as it uses ModBus for data communication.
ModBus/TCP-Master: port used when TBOX MS is ‘Master’ to access a remote device (by default=502)
ModBus over TCP: port used by ModBus RTU encapsulated into TCP (by default= 7701)
ModBus over UDP: port used by ModBus RTU encapsulated into UD (by default= 49152)
SMTP(S): port used by TBOX MS to send e-mails (by default=25 & 587).
POP3(S): port used by TBOX MS to collect subject of e-mail (by default=110 & 995).
Modbus over TCP: ModBus over TCP is a ModBus RTU frame encapsulated into a TCP frame. Compared to ModBus/TCP, in
which there is no station address neither CRC. TCP port used by TBox MS to communicate in ModBus over TCP
(default=7701)
Modbus over UDP: ModBus over UDP is a ModBus RTU frame encapsulated into a UDP frame. Compared to TCP, it is faster
than TCP because it does not require any acknowledgement. With UDP, packets are just pushed without
verification. TCP port used by TBox MS to communicate in ModBus over UDP (default=49152)
SSH: used to carry on a secure connection, for instance to access LINUX in console mode. (default= 22)
6.6.7 TCP/IP
Avoid using addresses in the same range as the IP address defined for the LAN card of the PC used as
Browser.
TCP/IP miscellaneous
To access these features you have to enable advanced IP configuration (see chapter 16.1.8)
See also the sequence of configuration Appendix F.
Once checking one of the above features, a login corresponding to the code typed when enabling advanced IP configuration
is required.
Longname Type any long name The name typed here will be used in TView, instead of the one
declared in the ‘General’ properties, which is limited to 8 characters
From the list of DI available with the card, you Tag the one indicating the Power Fail.
This power fail information will then condition the execution of alarm and chronology condition where you have specified a
handling associated to “Power Failure”: in case of power failure, alarm and chronology conditions will not be executed (see
chapters related to Alarm and Chronology conditions further in the manual).
In addition, the above Tag (in this example “PowerFail”) can be used to send an alarm and can be recorded into chronologies
(datalogging).
Store Web Files on SD card: This option requires a SD card in TBox ...
When selected, only webfiles that have changed (based on a md5 signature on the files) will be updated
into TBox, upon TWinSoft sending of the application.
6.6.11 Plug&Go
Activate Plug&Go: Plug & Go is associated to the SD card. When Plug & Go is activated, the complete project including
webforms, reports, OS, ... is backed up on the SD card and loading upon CPU powering. Program is restored
when the program on SD card is different from the one running in the CPU.
This allows easy deployment and maintenance when CPU must be changed on field.
Global Tags Backup: To backup on SD card "Global Tags" periodically (see below), or using digital system variable [55 -
RuntimeBackup].
Tags are restored when the program on SD card is different from the one running in the CPU.
DB Backup: To backup on SD card "Sampling Tables and Chronologies" periodically (see below), or using digital system
variable [55 - RuntimeBackup]
DB are restored when the program on SD card is different from the one running in the CPU.
Backup and restore of Tags and DB are not applicable when doing a stop/start of the TBox or when
sending a new application. Only when putting SD card into a new CPU, it will restart with the image
of data backed up.
Period: Period for automatic backup of Global Tags and DB (see above) on a hour base period.
6.6.12 Security
Brute Force Protection: Programming TBox can be disabled for each communication port individually. When the port is
disabled, Programming through TWinSoft is not available anymore through this port.
• Maximum Failures: number of unsuccessful attempts before a connection is blacklisted.
• Failures Interval: maximum interval in seconds between failed attempts. If no additional failures occur after
this time, the counter is reset.
• Blacklist timeout: when the number of failed attempts is reached, authentication is blocked for the specified
amount of time. Timer is restarted at each attempt (good or bad). This means there should have no attempt
during this timeout to allow new login attempt.
• When serial communication port is blacklisted, only authentication is blocked. It is still possible to read
data through this communication port.
• This would not prevent a SCADA communicating through a radio modem connected to a serial port of
TBox to still read data through this serial port, even if it has been attacked.
• In TCP (or UDP), the IP address is blocked for all authentications. One can still read data and open new
socket, but any new demand of authentication from the IP address will be blocked and timeout
restarted, even if login is correct. This limits the possibility of discovering a login.
• ModBus-RTU over TCP or over UDP is also protected.
• There is no report sent to a user who has been blacklisted. Any further authentication will fail as if
password was incorrect.
Device Administrator: This login provide a “super user” level (level 4) when accessing TBox using HTTP APIs. See
documentation about TBox HTTP APIs for more information.
7 Resources
The resources represent the list of the hardware that your TBOX MS has to its disposal.
The communication ports of the CPU with their associated configuration and the I/O of the CPU are part from the resources
of the CPU:
DCV: Digital Communication Variables. Special variables with a pre-defined function (communication error,
modem online, …). (see chapter 7.3.1)
ACV: Analog Communication Variables. Special variables with a pre-defined function (time-out,
user ID, …). (see chapter 7.3.2)
Advanced: mainly ‘timing’ parameters required when CPU is ‘Master’ or ‘Slave’ in a ModBus communication.
To enter the configuration of the communication port, double click the port in ‘Group 0’.
Data bits: 7 or 8
Stop bits: 0, 1 or 2
Protocol:
ModBus (RTU/ASCII), Printer,
NMEA, SLIP
7.1.4 Ethernet
Subnet mask: the subnet mask defined by the subnet the TBOX
MS will be included in (given by the network administrator).
In case you use multiple Ethernet interfaces with your TBOX MS check they are configured in
different subnets
TWinSoft does not detect the cards automatically. You have to add the cards manually, using the menu
"Add an I/O card"
Example:
CHANNEL
CARDS
GROUPS
When connected to a TBOX MS , the column ‘value’
displays the current value in the RTU, when the
channel has been declared as a Tag and sent to the
RTU.
When adding a Card, its ID number must correspond to its position in the Rack. Check the slot
index written in the Rack.
See examples in the manual “TBoxMS – Technical Specifications”, chapter 3.4.
See also technical details on I/O cards in the manual ”TBox-MS technical specifications”.
The numbering of communication ports starts after the communication ports of the CPU:
MS-CPU32, starts at COM4
MS-CPU32-S2, starts at COM8
The numbering is automatically incremented at each insertion of a communication card.
Initialization: The initialization string is sent at power up of the modem and after each connection.
You should not change it, but if changed, it is saved in the TWinSoft document.
Outside line prefix: if TBOX MS is placed behind a telephone switch (PABX), it is the number to get the outside line.
This prefix will be applied automatically each time TBOX MS dials out.
Default Initialization and prefix can be modified from the file ‘ModemProfiles.xml’.
Changes will be applied to all new document created.
Auto Answer: Number of rings after which the modem will go off hook.
Periodic Modem Reset: This feature allows resetting modem automatically when it is not in communication. When the
option is checked, the period between resets can be configured between 60minutes and 43200 minutes
(30days).It also resets the UART.
Debug Modem: (available with MS-CPU16). Allows displaying all communication flowing through the modem. Very
useful to debug a communication (see details in Appendix G.1.)
The numbering of communication ports starts after the communication ports of the CPU:
MS-CPU32, starts at COM4
MS-CPU32-S2, starts at COM8
The numbering is automatically incremented at each insertion of a communication card.
CSD-DATA
OR
IP (GPRS, 3G…)
Modem Type
• Autodetected GSM: you let TBox detects itself the modem and the right configuration. It requires TBOX MS
to run OS firmware >=1.42.455.
It is mandatory for MS-GSM-3G, MS-GSM-3E, all 4G/LTE versions. For 2G version use manual configuration
(see next)
In case you want to run OS firmware < 1.42.455 or run a MS-GSM (2G), you have to select the model and its initialization
string (see below "Advanced"). Available models (Look at the side sticker the exact modem type):
• HiLo 3G : corresponds to MS-GSM-3G
• Gemalto-3E: corresponds to MS-GSM-3E
PIN Code: If the SIM card you have inserted requires a PIN code, type it here (max. 4 digits)
If you type the wrong PIN code, or you type a PIN code when the SIM card does not require one, there is
a risk of blocking the SIM card.
It must then be restored with the PUK code using a mobile.
Auto Answer: number of RINGS before the modem picks-up the line.
Disable ReadSMS: According to the modem or GSM service, it may not support incoming SMS (ASTRID, ...). Therefore, to
avoid the modem state machine to be disturbed accessing a service not supported by the SIM card, the reading
of SMS has to be disabled.
Periodic mode reset: This feature allows resetting modem automatically when it is not in communication, or not busy with
the event of an alarm. This is important especially with GSM modem in case it not available anymore and cannot
send data or be accessed anymore.
It is also possible to do this reset using ComX.Hooklink variable. This feature makes it automatic.
When the option is checked, the period between resets can be configured between 60 minutes and 43 200
minutes (= 30 days).
Advanced: Running MS-GSM (2G) or an OS firmware < 1.42.455, you have to select the modem type (see above) and select
the manual initialization string.
Dialing a GSM-data: The SIM card of a GSM has three telephone numbers: VOICE (the one you use to speak), DATA and
FAX. To dial TBOX MS , you have to be sure that data service has been activated and you dial the DATA
number (please call your GSM operator).
In some countries, like in US for instance, GSM operators do not provide DATA service.
DATA communication is then only available in IP mode (see below)
Modem Type
• Autodeteected GSM: you let TBox detects itself the modem and the right configuration. It requires TBOX MS
to run OS firmware >=1.42.455. It is mandatory for MS-GSM-3G, MS-GSM-3E, all 4G/LTE versions. For 2G
version use manual configuration (see next)
In case you want to run OS firmware < 1.42.455 or run a MS-GSM (2G), you must select the model and its initialization
string (see below "Advanced"). Available models (Look at the side sticker the exact modem type):
• HiLo 3G : corresponds to MS-GSM-3G
• Gemalto-3E: corresponds to MS-GSM-3E
APN: APN stands for "Access Point Name". It is a URL of your operator the GSM will connect to get an IP address.
PIN Code: If the SIM card you have inserted requires a PIN code, type it here.
If you type the wrong PIN code, or you type a PIN code when the SIM card does not require one,
there is a risk of blocking the SIM card.
It must then be restored with the PUK code using a mobile.
Disable ReadSMS: According to the modem or GSM service, it may not support incoming SMS (ASTRID, ...). Therefore, to
avoid the modem state machine to be disturbed accessing a service not supported by the SIM card, the reading
of SMS has to be optional.
Periodic mode reset: This feature allows resetting modem automatically when it is not in communication, or not busy with
the event of an alarm. This is important especially with GSM modem in case it not available anymore and cannot
send data or be accessed anymore.
It is also possible to do this reset using ComX.Hooklink variable. This feature makes it automatic.
When the option is checked, the period between resets can be configured between 60 minutes and 43 200
minutes (= 30 days).
Advanced: Running an OS firmware < 1.42.455, you must select the modem type (see above) and select the manual
initialization string.
Connection at start up: when this option is selected (by default) TBOX MS handles the modem to keep the connection
permanently. When this option is removed, TBOX MS handles the connection according to communication
variables: GPRSCon (see below)
Server requires authentication: Some TCP/IP connection requires authentication. Check with your ISP.
Authentication Protocol: When requiring authentication to connect in IP (GPRS, 3G, ...) the authentication protocol can
be selected. By default it is set to "Automatic" as it is negotiated with the Operator during connection.
Keep PPP alive: PPP is a low level TCP/IP protocol, used to establish the connection.
For safety reason, to be sure to keep the connection always active, TBox MS can keep sending regular
requests (LCP ECHO REQUEST).
PPP Echo Timeout: When the option is active, frequency in minutes with which the requests are sent.
Take into account that it uses around 50 bytes, and that with GPRS connection, you are charged for
each bytes sent or received.
TCP/IP settings
4G, 3G or GPRS connection represents a TCP/IP connection using GSM network. It then requires an IP address
which is provided from the operator.
Whichever account you have subscribed, you must not change its TCP/IP configuration.
In order to have a reliable communication, you might have to increase some timing parameters in TWinSoft:
menu ‘Communication’ -> ‘PC Setup’; select ‘Ethernet’ and click ‘Advanced...’.
Before sending a program through IP (GPRS, 3G, 4G), check the PC setup settings of TCP/IP, like
explains chapter 4.3.3. IP address settings, point 3.
7.2.4 USB
TBOX MS-CPU32-S2 is equipped with 3 x USB ports. It can be used as "Device" as well as "Host".
USB as Device
Connection
You need a USB A/A male cable (host to host). The USB driver (TBoxUSBDriver.inf) is installed on PC during TWinSoft setup.
Communication
Communication is carried out in TCP/IP. TBOX MS acts as a DHCP server and provides to the PC an IP in the range
10.8.10.xxx. TBOX MS itself uses the IP address 10.8.10.1. In PC Setup, you select "USB".
USB as Host
All three USB ports run as "Host", it expects to communicate with a "Device".
USB1 and USB2 support USB 2.0
USB3 supports USB 1.1
When configured as communication port, a new port is available with its Communication Variables (DCV, ACV).
According to the drivers installed in LINUX, check below device chipsets accepted.
In the recipient, you chose "external memory" and select USB Mass Storage
The use of WiFi is having TBox acting as Access Point, to access it locally without cabling for
reprogramming or displaying WebForm, on a smartphone, tablet or PC..
WiFi configuration:
Serial configuration:
A Modem Profile is required, then this is not a plug&play solution. Please contact your distributor.
When used as Alarm Recipient, you should check TBOX MS is not in alarm anymore (Ala_on=0) and then
demount the USB Memory stick using the Digital System Variable 53 [USBStorage]
Those variables are divided into 2 tabs, Digital Communication Variables (DCV) and Analog Communication Variable (ACV).
When you need one, double click it from the list and click <OK>! It becomes a Tag and then available in any feature of
TBOX MS .
COMx.ModemState - MODEM: gives current status of the modem. Possible values are:
1: PIN code sent (GSM only when PIN code activated)
4: Init string accepted
7: Idle mode
9: outgoing call. Waiting CONNECT
26: registered to the network
… more values in TWinSoft Help -> How to Debug modem communication.
The last value is maintained, until the next status changing.
COMx.CallerID * MODEM: variable which indicates the caller ID of the current incoming modem connection, 32
bits format, giving the 9 last digits of the calling number. It can be used in the program to
trace and control who is calling
Init string of GSM modem: Caller ID identification must be activated. ^AT+CLIP=1
COMx.ModemPoT * LowPower: used only with Low Power RTU.
COMx.StationAdd - General: Station address of the RTU (see general RTU properties).
LOW BYTE: ModBus station address.
HIGH BYTE: Sub address.
Doing ModBus Transactions through modem, useful to detect the calling “Slave“ station, by
doing a request to station “0” and read this variable. From there, the “Master” can activate the
proper Trigger.
COMx.CurNetwork - GPRS/3G/4G: Indicates the network the GSM is connected to
0 : GPRS or EDGE
1 : 3G
2 : 4G
COMx.UsbState - USB: Gives current status of the USB port:
0 = does not do anything (never visible)
10 = USB port in mode "device", waiting for a Host (PC)
11 = Something is connected in mode "device"
20 = USB port in mode "host" waiting for a device (USB stick)
21 = Something is connected to TBOX MS
WARNING: this could be a device not recognized by TBox like a mouse, a keyboard, ...
Without anything connected to the USB, the variable toggles 10, 20, 10, 20, ….
COMx.ByteCount - GPRS/3G/4G: returns all bytes (sent and received) during a IP communication. It counts bytes
at PPP level. It is reset at each start/stop of the program, then to sum the bytes up you should
use the following BASIC code:
When the action (SET) is specified, it means that TBOX MS maintains the variable at 1 to be sure it is detected. Such a
variable needs to be reset using Ladder/BASIC logic.
Index Name R/W Description
0 TikSec 0 Tik Second: Changes of state every second. Useful for counting time.
1 PrgRun - Program run: At each starting of TBOX MS , this register changes to 1 and stays at
1 as long as the BASIC/Ladder program runs.
This register is used in BASIC/Ladder to execute operations only at the start of the
program, with the help of a positive edge trigger function.
2 NewPro - New program: Start of a program flag. Changes to 1 if TBOX MS has started after
having received a new program. Changes to 0 after a reset of the TBOX MS
3 Reboot 1 Reboot: complete restart of TBOX MS . It is equivalent to hardware reset.
4 RstWat 1 Reset Watchdog: the watchdog checks the cycle time of BASIC/Ladder program.
In case it is longer than 1 second, it resets TBOX MS . This Watchdog can be reset
to reinitialize the 1 second timer in case of cycle time longer.
5 Ala_On 0 Alarm on: this register indicates that alarm is active (not acknowledged). Writing
0 in this register causes a global acknowledgment of all alarms.
It corresponds to a reset of the alarm stack.
6 Alaerr 0 Alarm in error: TBOX MS SET this register 1 when an alarm failed to be sent. This
means that after the number of tries, the alarm has been auto-acknowledged.
Must be Reset by User.
7 RstAla - Reset Alarm: Not used. See ‘Ala_On’ above.
8 EnaDCr * Digital Chronology: General enable of recording in digital chronology.
9 EnaACr * Analog Chronology: General enable of recording in analog chronology.
10 EnaSam * Sampling Tables: General enable of recording in sampling tables (not available).
11 EnaAla * Enable Alarm: General enable of generating alarms.
12 DisCrd * Flag digital chronology: can be associated to any digital chronology configuration
to inhibit recording. When at value ‘1’, inhibits recording in Database.
13 DisCra * Flag analog chronology: can be associated to any analog chronology configuration
to inhibit recording. When at value ‘1’, inhibits recording in Database.
14 DisSam - Not used
15 DisAla - Alarm: flag that can be associated to any Alarm condition. When at value ‘1’,
inhibits the sending of alarm.
16 DaySav - Time: 1 = summer time (the ASV “ZoneBia” increments or decrements with.
0 = wintertime. the number of seconds according to the time zone)
The value of these two "Log" variables is maintained in case of all different start-ups of
TBOX MS (new program, reset, ...)
59 Http - HTTP: Indicates the number of users that have logged in HTTP to TBox.
Session This requires HTTP protection to be activated as well as HTTP session Authentication (See
RTU properties-> Protection and IP Security)
(*) System variable 15. ‘Week of the year’ :. This system variable indicates the week of the year according to the date in the
RTU.
The rules are the following:
– the changing of week happens on Monday, 00:00 AM
– if January 1 is a Friday, the week will change at that day
– if January 1 is a Saturday, Sunday, the week does not change
– In other cases, the week does not change
Examples:
Month Mon Tue Wed Thu Fri Sat Sun Week
dec 21 22 23 24 25 26 27 51
dec / jan 28 29 30 31 1 2 3 52 / 53
jan 4 5 6 7 8 9 10 1
jan 11 12 .. .. .. 2
Month Mon Tue Wed Thu Fri Sat Sun Week
dec 22 23 24 25 26 27 28 51
dec / jan 29 30 31 1 2 3 4 52 (or 53)
jan 5 6 7 8 9 10 11 1 (or 2)
jan 12 13 .. .. .. 2 (or 3)
Timers and Counters are described in the manual BASIC & Ladder for TBox
Any variable of the TBOX MS that you want to use in any configuration has to be available as a Tag.
The Tags are gathered in the folder Tags of the Project Workspace:
GROUPS OF
TAGS
Details about the different I/O are available in manua TBoxMS Technical Specifications
Type: depending on the model of Analog Input card, there may have different types of signal available (1..5V;
4..20mA; 0..10V, ...)
Scaling: the I/O can be scaled to real value by defining a MIN (corresponding to the smallest signal) and a MAX
(corresponding to the highest signal). The resolution defines the number of steps of the scale (MAX – MIN /
RESOLUTION).
The internal variables can only be created from the list of Tags.
Select ‘Digital’:
The initial value is the value the Tag will have at the start-up of
TBOX MS .
If you select ‘None’ the value is maintained at start-up.
Select ‘Analog’
You type a Tag Name, a Comment and select as Type: ‘Internal Register’
For each Analog Register, the formats available are:
• 8 bits (Signed or Unsigned)
• 16 bits (Signed or Unsigned)
• 32 bits (Signed or Unsigned)
• Float (32 bits, IEEE 754)
The initial value is the value the Tag will have at the start-up of TBOX MS .
To create a Tag TEXT (string of characters), from the list of Tags, click ‘Add a Tag’ .
Select ‘Text’
Each Tag has a unique ModBus address. By default TWinSoft proposes a ModBus address.
Presentation settings can also be used when the value of the Tag is included into message (SMS or e-mail).
• Report: file edited with ‘Report Studio’ and used for instance as text body when sending e-mail.
To start Report Studio open the list of ‘Web and Report files’ from ‘Project Workspace’, double-click an existing
report or "Add a new Report…"
• WebForm: file edited with ‘WebForm studio 2.0’. Used to display values of Tags in a HTML page.
To start WebForm Studio 2.0, open the list of ‘Web and Report files’ from ‘Project Workspace’, double-click an
existing webform or "Add a new WebForm 2.0…"
• Message: with Digital Tags, the ‘states’ defined in Presentation will be used and with Float Tags, the number of
decimals.
(See also chapter 11.6.2. Value of Tag in message)
Presentation Makes the following information available to ‘Report’, ‘WebForm’, 'Message' and TView
Description In a Report, text displayed as ‘Header’ in sampling table or as Tag information in chronologies
when the data is retrieved.
Units (With analog Tags) text displayed as ‘Unit’ in datalogging when the data is retrieved. It can also
be displayed when selecting as format ‘Value + unit’ in the report or WebForm.
# dec (With analog Tags) the quantity of decimals of the value displayed
State On/Off (With digital Tags) Text appearing when value = 1 / 0
Write allowed If the Tag is declared in a WebForm, allows defining a writing access to the Tag, within a specific
range.
For instance, to change a tel. number of a SMS recipient, the e-mail address of a recipient, the address of SMTP server, the
handling of alarm condition, …
When a configuration provides access to run time parameters, a tab is attached to the configuration.
In the Recipient, configuration, you go to the tab “Runtime You associate the Tag, to the parameter you want to
Parameters” modified “on line” from TWinSoft, a WebForm, a SCADA, ...
The format of the Tag depends on the parameter (Bool, Byte, Word, Float, Text)
Changing of parameters is maintained in case of power cycle, reset, reboot and watchdog.
Original configuration is restored in case of sending new program or OS and doing stop/start from TWinSoft.
Alarm Recipient
Parameter Recipient Type Tag Format
Phone Number ModBus, SMS, Printer, RAS, Custom Text (20)
E-mail To Email Text (120)
E-mail Cc Email Text (120)
Tries All Byte
Path FTP Text (120)
Name All Text (16)
Alarm Holidays
Parameter Tag Format
Day Byte
Month Byte
Year Word
8.5.4 IP Parameters
ISP
Parameter Tag Format
Phone Number Text (20)
User Name Text (30)
Password Text (30)
FTP
Parameter Tag Format
Host Text (120)
TCP Port Word
User Name Text (30)
Password Text (30)
SMTP
Parameter Tag Format
Server Text (120)
TCP Port Word
E-mail From Text (50)
Authentication Bool
Login Text (40)
Password Text (40)
POP3
Parameter Tag Format
Server Text (120)
TCP Port Word
Authentication Bool
Login Text (40)
Password Text (40)
NTP
Parameter Tag Format
Server Text (120)
DynDNS
Parameter Tag Format
URL Text (120)
Authentication Bool
User Name Text (30)
Password Text (30)
HTTP
Parameter Tag Format
Server Text (120)
TCP Port Word
Authentication Bool
Login Text (40)
Password Text (40)
VPN
Parameter Tag Format
Server Text (120)
TCP Port Word
Authentication Bool
Login Text (40)
Password Text (40)
To prevent sending the wrong PIN code to TBox, the procedure should be:
• Let the field in TWinSoft empty
• Associate an "INTEGER” Tag to the Runtime parameter “PinCode”
• Compile and send program to TBox
• The Tag will automatically be assigned a value of -1 meaning there is no PIN code; indeed !
• Assign the PIN code corresponding to the SIM card to the Tag
• Reset the digital communication variable by setting COMx_HookLink=0
When changing the APN in runtime mode, a reset of the GSM is required to run the new APN by setting
COMx_HookLink=0.
The AT custom is sent at each "AT Check", which occurs every minute.
If AT custom is empty no command is executed.
9 IP Parameters
IP parameters consist in the global configuration for TCP/IP services:
• Connecting to an ISP (dial-up connection)
• Sending files: FTP(S), SFTP
• Sending e-mail: SMTP(S)
• Reading e-mail subject: POP3
• Time synchronization: NTP
• DynDNS: handling of public, dynamic IP addresses
• Configuring Virtual Server rules
• Configuring IP Bridges
• Configuring HTTP POST to a server
• Configuring a connection to TConnect through Ethernet
The FTP Server, SMTP Server, POP3 Server and NTP configurations correspond to connections to the appropriate servers. It
is done for once, and called when creating a recipient of alarms.
In other way round, when TBOX MS sends an e-mail, it sequences the tasks like following:
– Connection to a the GSM network (APN) → connection to a SMTP Server →sending to a recipient (e-mail address).
It represents the connection to the company you call to access an Internet service, like sending e-mail or files (FTP).
When you want TBOX MS to send e-mail or send files to a FTP site through a dial-up connection, you subscribe an account
to an ISP.
Using the button ‘Import…’ you
access an existing ISP
configuration you have tested
successfully on the PC.
DNS : A DNS converts names in IP address. It is needed in case the Server (SMTP, FTP, NTP, POP3) is indicated in 'text' and
not with an IP address.
Most ISPs support dynamic DNS , they provide the DNS addresses when connecting.
If this is not the case, they provide you with a ‘Preferred’ and ‘Alternate’ DNS address.
The FTP server represents the target when sending files. The directory where the files are sent is defined in the Recipient
(see chapter 11.4).
The sending is generated through an alarm recipient “FTP”. TBOX MS connects to Internet (through a connection: ISP,
Ethernet or GPRS/3G) and then connects to the FTP server.
TCP port: Each TCP/IP service has its own unique TCP
port. It provides a logical location for the delivery
of TCP data.
TCP port used by TBOX MS to establish FTP
connection (default=21).
FTP: If required by the server, TBOX MS supports FTPS, for secure encrypted connection. It uses SSL as cryptographic
protocol
Login: Depending on the account you have subscribed, you have a login or work with ‘Anonymous login’.
Account: Some Servers require an account name. If it is not the case, leave this field empty.
This is the basic configuration to connect to the ‘FTP site’. You do not declare a directory in this
configuration, but when declaring the ‘Recipient’ (see chapter 11.4. The Recipients).
This allows creating any combination:
- several ‘FTP recipients’ to one FTP site
- several ‘FTP recipients’ to different FTP sites.
-…
The SFTP server represents the target when sending files. The directory where the files are sent is defined in the Recipient
(see chapter 11.4).
The sending is generated through an alarm recipient “SFTP”. TBOX MS connects to Internet (through a connection: ISP,
Ethernet or GPRS/3G) and then connects to the SFTP server
Login: Depending on the account you have subscribed, type the name and password.
Concerning e-mail, TBOX MS is able to send e-mail (through SMTP server) and to read e-mail (through
POP3 server)
The SMTP Server represents the mail server used for sending e-mail (typically the one of the ISP where we have subscribed
and account).
The sending is generated through an alarm recipient “SMTP”. TBOX MS connects to Internet (through a connection: ISP,
Ethernet or GPRS/3G) and then connects to the SMTP server.
Name: It is a free name, to recall when you create
the alarm recipient.
Mail Server (SMTP): It is the IP address (or the
name) of the outgoing e-mail Server. It is the
unique mail Server needed to send e-mails.
E-mail address: It is the e-mail address of the
TBOX MS . You can usually choose it when
you subscribe an account. This address will
appear in the 'From:' when receiving the e-
mail.
Connection: You select the way to connect to the
Server (ISP, GPRS/3G, Ethernet).
TCP Port: Each TCP/IP service has its own unique
TCP port. It provides a logical location for the
delivery of TCP data.
TCP port used by TBOX MS to establish
SMTP connection (default=25).
SMTPS: If required by the server, TBOX MS
supports SMTPS, for secure encrypted
connection. It uses SSL as cryptographic
protocol.
In order to protect the mail sever (and you) against spamming, the ISP risks to refuse sending e-mail if the
address of the originator is not known. Therefore, be careful to indicate here the e-mail address you have
received from your ISP
TBOX MS supports two SMTP authentication protocols: PLAIN and LOGIN Authentication.
Check with your ISP
The POP3 Server represents the mail server used to read mails previously sent to the attention of TBOX MS .
The use of POP3 is not to retrieve e-mail, but to read the field "Subject" and take some actions.
The checking of e-mail is generated through an alarm recipient “POP3”. TBOX MS connects to Internet (through a
connection: ISP, Ethernet or GPRS/3G) and then connects to the POP3 server.
Name: It is a free name, to recall when you create the alarm recipient.
POP3 Server: It is the IP address (or the name) of the POP3 Server to which TBOX MS connects to read e-mails
Connection: You select the way to connect to the Server (ISP, GPRS/3G, Ethernet).
TCP Port: Each TCP/IP service has its own unique TCP port. It provides a logical location for the delivery of TCP
data.
TCP port used by TBOX MS to establish POP3 connection (default=110).
POPS: If required by the server, TBOX MS supports POPS, for secure encrypted connection.
It uses SSL as cryptographic protocol
Host Validation: see Appendix I, Handling Certificates
The Server requires authentication: If authentication is required to connect to the server: Login and Password.
With TBOX MS sending a SMS through a GSM, it is possible to acknowledge the alarm by sending back a SMS to TBOX MS
In some countries, SMS can only be sent through email. A POP3 connection can then be used to acknowledge the alarm.
Sequence of connections
1. TBOX MS sends an e-mail. The alarm condition has been configured with the option "POP3 Ack". It is important you
have a dedicated e-mail account for your RTU. The data sent by e-mail can be a report or a message.
2. The recipient retrieves its e-mail. The field "Subject" of the e-mail is preceded with internal data: RTU Id (I)
Alarm index (A)
Example of message: #I460000020107,A00004# MyTBox: PUMP stopped
3. The user sends back the e-mail. Typically, he will make a "Reply" and sends back the e-mail to the address as specified in
point 1. above, in the SMTP server
4. TBOX MS generates a POP3 connection (through alarm condition) and checks the presence of e-mail with specific data
in field "Subject". With this data, TBOX MS knows which alarm for which RTU it can acknowledge.
The POP3 connections have to be handled into your process and can be checked from System Variables (see below)
Illustration with a TBox MS
Supplementary information
1. The time between phases 1 and 4 can be determined in RTU properties --> Advanced Alarms properties
2. System Analog Variable: #40 [AlaPop3] indicates the quantity of alarms needing to be acknowledged by POP3
connection and #43 [Pop3State] indicates the state of connection.
3. If escalation is required, Group of recipients can be associated to the alarm condition
4. Like other alarms, failure in sending SMTP alarms can be checked using System Digital Variable:
#06 [AlaErr] and System Analog Variable: #10 [AlaRec]
5. Error in POP3 connection can be detected also using System Digital Variable: #48 [POP3Err]
The time synchronization is generated through an alarm recipient “NTP”. TBOX MS connects to Internet (through a
connection: ISP, Ethernet or GPRS/3G) and then connects to the NTP server.
Examples of Servers:
– time.windows.com
– europe.pool.ntp.org
You will find valuable information, like lists of Servers with open access at:
www.ntp.org → public time server list
The organization pool.ntp.org proposes servers using DNS round robin, which make a random selection from a pool of
open access time servers. This is good enough when working with TBOX MS .
Round Robin DNS technique is used when the number of access to a server is unpredictable, to balance the use of IP
addresses (load balancing technique).
9.7 DynDNS
DynDNS stands for Dynamic Domain Name System.
It is a service, provided by companies like www.DynDNS.org or www.noip.com, offering the handling of dynamic IP
addresses.
When working with GPRS connection, using public dynamic IP addresses, it is not possible to access the RTU directly, as you
don't know its IP address.
The DynDNS service solves this problem: each time the RTU detects a changing of its IP address, it informs the DynDNS
server.
You then connect to the DynDNS Server that will redirect you to the RTU.
Example of Topology : connecting with a browser to a RTU having a GPRS dynamic IP address
Sequence:
1. Detecting a changing in its IP address, the RTU informs the DynDNS Server.
2. The browser connects to the DynDNS Server
(example: http://waterloo.dyndns.org). The DynDNS Server resolves the name and sends back the corresponding IP
address.
3. The browser connects to the IP address it has received.
Url: You type the host address you have creating when
subscribing the DynDNS account.
Example: waterloo.dyndns.org
Virtual Server Parameters allow defining specific routes (in <--> out) based on IP protocol and TCP port
Accessing a Camera with IP address 192.168.1.100 connected to Ethernet, through a 3G connection using TCP port=81
Any request arriving with TCP port =81 will be redirected to IP address 192.168.1.100.
Example: http://78.25.56.126:81/jpg/image.jpg
Incoming Protocol The incoming protocol that has to be routed.
Incoming Port The incoming IP Port that has to be routed.
Destination IP address The IP address to which data coming with above settings has to be routed.
Destination Port The IP port used for data sent to the destination IP address.
Activate Allows activating/deactivating a Virtual Server rule
9.9 IP Bridge
9.9.1 Introduction
What is a Bridge ?
A Bridge is a device that connects two or more networks as a seamless single network. It supports any protocol as it
operates on MAC-layer addresses, and then protocol independent. The bridge passes packets according to the destination
and its internal table of addresses.
To share 2 x IP interfaces with the same IP address. See an example below with MS-CPU32-X.
From the IP Parameters folder, go to "IP Bridges" you create a Bridge and define an IP address.
Then you attach this Bridge configuration to the communication ports you want to bridge (see TCP/IP configuration).
The IP address of the bridge has then priority on the one originally defined for the communication port.
9.9.2 Configuration
Type – Bridge: A Bridge is a device that connects two networks as a seamless single network. It supports any protocol as it
operates on MAC-layer addresses, and then protocol independent. The bridge passes packets according to
the destination and its internal table of addresses.
Type - Bonding: With MS-CPU32, connecting network interfaces together for redundancy purpose or to increase
throughput. The bonding implies a division of the traffic at low level either per packet (Layer 3) or data link
(Layer 2), using the same socket (Layer 4).
With MS-CPU32-S2, bonding status is available through the “HookLink” variable associated to the
communication ports. It informs not only on the physical link to the device it is connected to, but also to
interface activity (an interface may be inactive even if link is up, as the link may be broken behind the
switch). Because of difference in LINUX version and ARP monitoring, bonding status is not available with
MS-CPU32 , only the link status to the device it is connected to.
Spanning Tree: It is an option of bridged Ethernet network, to ensure a loop-free topology. This protocol ensures a unique
path between 2 devices, to prevent broadcast radiation and overloading of the network.
Required when connecting 2 Ethernet ports bridged to two routers connected together, to avoid loops
between the 2 routers. Spanning tree will define one way for communicating.
In IP ports you want to bridge, select the bridge you have configured as above.
The IP of the bridge will be applied to each port.
By default in TBox, each IP port in TBox is separated from each other. The bridge represents a virtual connection between
the ports.
When you need to access devices through different connections, you bridge the ports.
The easiest is to draw the connections needed to access the devices and then you visualize which ports to bridge together.
A HTTP request "Post" consists in a URL to the HTTP server, typically to a page <myfile>.php.
When received by the server, it executes the script associated. Typically copy files into a directory.
TBox uses the Content-Type: multipart/form-data . This allows sending multiple files in one connection, when sending a
report including attachments (other reports, camera image, ...)
– With the above example, the .php file should be declared into the root of HTTP server.
– Then create a sub-directory ..\upload from the root.
– The report sent by HTTP POST will be copied in the ..\upload directory.
The HTTP Server represents the target when sending files. The directory where the files have to be sent is defined in the
Recipient (see chapter 11.4).
First, TBOX MS connects to Internet (through a connection: ISP, Ethernet or GPRS) and then to the HTTP server.
TBOX MS is able to send, on demand or on a regular base a file (typically a report) to the HTTP server. Sending is generated
from an alarm condition associated to a HTTP recipient.
Host name: It is a free name, to recall when you create the alarm recipient.
Server Address: Address of the server. It can be in IP format or in 'text' format. In this last case, the DNS must be specified
for the communication port used to send the file(s).
Connect: Connecting through dial-up modem, you select the ISP you have previously created. Connecting through Ethernet
or GPRS, select directly the corresponding COM port
TCP Port: Each TCP/IP service has its own unique TCP port. It provides a logical location for the delivery of TCP data.
TCP port used by TBox MS to establish FTP connection (default=80).
HTTPS: The server requires a secure connection: TBox MS supports HTTPS, for secure, encrypted connection. It uses SSL as
cryptographic protocol
Authentication: The Server requires Authentication: depending on the target on HTTP server, authentication might be
needed to post files
Example:
In case TBox can be accessed from a LAN it might not require a VPN connection, but we might need to centralize access to
TBox through TConnect, to centralize access control to TBox.
If we want to access TBox through Ethernet but it requires to be configured in DHCP; one does not know IP address of TBox.
TBox will be accessible through TConnect.
Working with an existing OpenVPN server. TConnect and TBox are clients of the OpenVPN server. No need to double the
VPN configuration. Just a link to TConnect through the existing VPN connection is required to centralize access to TBox
through TConnect
This configuration will allow TBox to initiate a connection to TConnect, when VPN is not required.
When you are online with your TBOX MS , it can be accessed from the menu 'Communication' -> 'Retrieve from TBox' ->
'Trace Log'.
Many events, related to many tasks are stored in the log. To adjust the analyses, TWinSoft provides 2 filters:
Level: The level allows you selecting the kind of messages (verbose, warning, info, ...). You can also select 'All' to display
all levels of messages.
Class: The Class allows you selecting the feature for which you want to display message (modem connection, sending e-
mail, ...).
Log can be filtered at recording level, using the analog system variable [LogClass]. See chapter 7.4.2.
TBOX MS can store 64 kbytes of data for Trace Log. When this amount is reached, newer data replaces older
data.
9.12.1 Diagnostics
By connecting with a browser to a specific URL of your TBOX MS , you can retrieve many system data from TBox, like the
log viewer (equivalent to the trace log) or the running processes:
Some Examples
LogViewer
IF Config
SysLog
Some LINUX level tasks are stored in a log and can be accessed using the Syslog protocol.
Example of Logs
Jul 19 11:28:19 tbox-cpu32 user.notice tbox[4639]: modbus: 172.25.110.34 auth succeed for 'MAYA'
Jul 19 11:28:19 tbox-cpu32 daemon.notice proftpd[4654]: 0.0.0.0 - ProFTPD 1.3.3(stable) (built Tue
Sep 25 2012 15:17:28 CEST) standalone mode STARTUP
Jul 19 11:28:19 tbox-cpu32 user.notice tbox[4639]: modbus: 172.25.110.34 auth succeed for 'MAYA'
Jul 19 11:29:16 tbox-cpu32 user.notice tbox[4639]: http session: 172.25.110.34 auth succeed for
'MAYA'
Jul 19 11:29:49 tbox-cpu32 authpriv.info dropbear[4549]: Exit (twinsoft): Exited normally
Jul 19 11:29:49 tbox-cpu32 user.notice tbox[4639]: modbus: 10.8.10.2 auth succeed for 'MAYA'
Jul 19 11:29:50 tbox-cpu32 authpriv.info dropbear[4672]: Child connection from 10.8.10.2:60631
Jul 19 11:29:51 tbox-cpu32 authpriv.notice dropbear[4672]: Pubkey auth succeeded for 'twinsoft'
with key md5 c8:f8: . . . from 10.8.10.2:60631
Jul 19 11:30:10 tbox-cpu32 authpriv.info dropbear[4672]: Exit (twinsoft): Exited normally
Jul 19 11:30:11 tbox-cpu32 user.notice tbox[4639]: modbus: COM1 auth succeed for 'MAYA'
Jul 19 11:32:35 tbox-cpu32 user.notice tbox[4639]: http session: 10.8.10.2 auth succeed for 'MAYA
10 IP Security
IP security services are:
• VPN
• Firewall (must be activated from the RTU properties -> IP security)
10.1 VPN
10.1.1 Introduction
This feature provides secure connections using OpenVPN.
Any physical media can be used (Ethernet, 3G/4G, …). The VPN connection represents a new communication port, including
its communication variables.
When "Client" connects to the server, they exchange their certificate, which are checked using the CA certificate.
Each party receives the other one certificate, it checks whether the certificate is signed by the master root certificate as
specified in its CA certificate.
If the verification succeeds, the symmetric key (DH key) is exchanged between parties.
Each partner is now able to encrypt data and the VPN tunnel is up.
Symmetric Encryption
Once parties have authenticated each other, meaning the VPN is up and secured, each client uses the symmetric key (DH
key) to encrypt and decrypt data.
OpenVPN is relying on a proper time consistency between Client and Server. If the time between
Client and Server is too high, the connection might fail.
Connection:
When TBOX MS is "Client": you indicate
which communication port is used to connect
to the server.
Server Address When TBOX MS is "Client": you indicate the IP address of the server.
In case you access the Server through Internet, you indicate the public IP address (or name if
accessing through dyndns for instance).
When TBOX MS is "Server": The Server acts as DHCP server, therefore, when VPN tunnel is built, it
attributes an IP address to the “Client” in the range of VPN subnet (see below).
This address is available in the ACV [OpenVPN.IPaddress].
Regarding DNS address, to access sites using names through the VPN connection, TBOX MS receives it
from the server.
Digital Communication Variable [VPN.HookLink=1] indicates the VPN is up. Writing [VPN.HookLink=0]
disconnects properly VPN connection.
VPN Subnet When TBOX MS is "Server": you have to indicate the IP subnet of VPN tunnel.
TBOX MS "Server" acts as DHCP server: the client(s) connecting to TBOX MS will receive an IP
address in the range of the subnet.
TBOX MS "Server" uses the first address of the subnet.
Protocol Two transport protocols can be encrypted to build VPN tunnels: UDP or TCP.
Select the one used in the tunnel.
CA Certificate: The certificate signed from a Certification Authority. It is used to check the authenticity of the
partner certificate.
Working in an internal network, you have to create your own self-signed CA.
After having generated certificates using OpenSSL, copy the content of CA.crt here
(file generated with build-ca.bat).
Certificate Partner certificate.
Working in an internal network, you have to create your own certificate.
Client: After having generated certificates using OpenSSL, copy the content of <client>.crt here
(file generated with build-key.bat)
Server: After having generated certificates using OpenSSL, copy the content of <server>.crt
here (file generated with build-key-server.bat).
Key It is the private key required for Authentication, associate to the certificate.
Client: After having generated certificates using OpenSSL, copy the content of <client>.key here
(file generated with build-key.bat)
Server: After having generated certificates using OpenSSL, copy the content of <server>.key
here (file generated with build-key-server.bat).
DH Key To declare on the Server only. It is used to encrypt and decrypt data transferred in the tunnel.
After having generated certificates using OpenSSL, copy the content of dh1024.pem here
(file generated with build-dh.bat).
Advanced the default parameters are:
Parameters persist-key
persist-tun
comp-lzo
keepalive 10 120
By selecting the type of connection “TConnect Client”, you will let TBox requests an OpenVPN configuration from
TConnect.
One restriction, TConnect must be accessible to TBox, either through a public IP or in the same LAN (WAN) of TBox.
10.2 Firewall
To access Firewall rules, make sure you have activated Firewall from the “RTU properties” -> “IP
security” (see chapter 6.4)
By defining rules, you will control access for displaying HTM files, for access with TWinSoft, with SSH console, ....
Services Any: all IP services have access to TBox. You filter access based on source IP only (see below).
Custom: you select the protocol and the TCP port yourself (see below).
ModBus, FTP, HTTP, HTTPS: server services available in TBox. Protocol is set by default to "TCP" and the
port as defined in "RTU properties" -> "Advanced TCP /IP".
Protocol If you have selected "Custom" as service (see above)
Any: all protocols (UDP, TCP, ICMP) have access to TBox. You can filter access based on TCP port and/or
source IP (see below).
UDP, TCP, ICMP: you select the protocol yourself.
PING protocol is supported by TBOX MS . It works on ICMP protocol for which there is no TCP port.
Port When selecting a "Custom" service, you can type a TCP port.
When selecting a specific service, the TCP port is automatically set as defined in "RTU properties" ->
"Advanced TCP /IP".
IP Source Any: Any source IP address can access TBox.
Single: you type a unique IP address.
Subnet: you type an IP address and a subnet mask, to filter on a group or IP addresses.
Examples:
IP: 172.25.110.0 Subnet: 255.255.255.0 ALL IP addr. in the range 172.25.110.xxx
IP: 172.25.110.80 Subnet: 255.255.255.224 ALL IP addr. in the range 172.25.110.64...96
Mac Source Any: Any Mac address can access TBox.
Single: you type a unique source Mac address (of PC, HMI, ...) that is allowed to access TBOX MS .
Syntax: xx:xx:xx:xx:xx:xx -> with xx in hexadecimal
Example: F8:B1:56:AB:56:F6
Limit This will limit the number of incoming connections per second for the service selected above. Beyond
the limit the frames are rejected, until next second.
• Regarding UDP the limit is the number of frames per second.
• Regarding TCP the limit is the number of incoming SYN per second.
This protection participates to the protection against DoS (Denial of Service) by limiting the incoming
traffic.
Connected Port Select in the IP ports available in the TBOX MS the port you want to
Activate Uncheck the box in case you don't want the rule to be applied but don't want to delete the rule neither.
Example of Rules
Access authorized:
1. ModBus-TCP on COM3 from IP 172.25.110.80 only
2. HTTP on COM3 from any IP in the range 172.25.110.xxx
3. SSH on COM3 from 172.25.110.80 only
4. FTP Server on COM3 from any IP
5. PING on COM3 from any IP
6. HTTPS only on COM4 (3G) from any IP
A rule defines an exception: the control of interconnection between ports is based on:
• 2 x IP communication ports (IN -> OUT)
• Protocol
• TCP Port
• Source IP address
• Destination IP address
The Forward entries provide automatically Firewall rules to the outgoing port.
Concerning the incoming port, make sure you have defined input rules (see above).
Communication Ports: Select both ports concerned by data forwarding (From .. To)
Services Any: all IP services have access to TBox. You filter access based on source IP only (see below).
Custom: you select the protocol and the TCP port yourself (see below).
ModBus, FTP, HTTP, HTTPS: server services available in TBox. Protocol is set by default to "TCP" and the
port as defined in "RTU properties" -> "Advanced TCP /IP".
Protocol If you have selected "Custom" as service (see above)
Any: all protocols (UDP, TCP, ICMP) have access to TBox. You can filter access based on TCP port and/or
source IP (see below).
UDP, TCP, ICMP: you select the protocol yourself.
PING protocol is supported by TBOX MS . It works on ICMP protocol for which there is no TCP port.
Port When selecting a "Custom" service, you can type a TCP port.
When selecting a specific service, the TCP port is automatically set as defined in "RTU properties" ->
"Advanced TCP /IP".
IP Source Any: Any source IP address can access TBox.
Single: you type a unique IP address.
Subnet: you type an IP address and a subnet mask, to filter on a group or IP addresses.
Examples:
IP: 172.25.110.0 Subnet: 255.255.255.0 ALL IP addr. in the range 172.25.110.xxx
IP: 172.25.110.80 Subnet: 255.255.255.224 ALL IP addr. in the range 172.25.110.64...96
Mac Source Any: Any Mac address can access TBox.
Single: you type a unique source Mac address (of PC, HMI, ...) that is allowed to access TBOX MS .
Syntax: xx:xx:xx:xx:xx:xx -> with xx in hexadecimal
Example: F8:B1:56:AB:56:F6
Destination Any: Any destination IP address TBox is communicating with.
Single: you type a unique destination IP address TBox is communicating with.
Subnet: you type a destination IP address and a subnet mask, to filter on a group or IP addresses.
Limit This will limit the number of incoming connections per second forwarded per interface to prevent
brute-force attack. Beyond the limit the frames are rejected, until next second.
Regarding UDP the limit is the number of frames per second.
Regarding TCP the limit is the number of incoming SYN per second.
This protection participates to the protection against DoS (Denial of Service) by limiting the incoming
traffic.
When forwarding Modbus transaction to multiple devices, take this traffic into account.
Activate Uncheck the box in case you don't want the rule to be applied but don't want to delete the rule neither.
Forwarding authorised:
1. ModBus-TCP forwarded through COM4-COM3, from any IP address (on COM4) to any IP address (on COM3)
2. HTTP forwarded through COM4-COM3, from any IP address arriving on COM4 to 192.168.1.98 connected to COM3. For
instance a camera with IP address 192.168.1.98 connected to COM3 of TBox
11 Alarms
11.1 Introduction
Alarm module of TBOX MS is the gate to the outside world.
An alarm consists in a communication event, not only for sending warning messages but to establish a connection, like we
will see.
Via alarms, you are able to send SMS message to Mobile phone, send e-mail, send files to a FTP site, to dial another TBox
or a SCADA, …
Alarms can be used also to send historical data (datalogging) on regular base using e-mail or FTP. The historical data is
sent as the attached file of a report, developed using Report Studio.
TView, the data aggregator software can then be used to collect data from a mail box or a FTP site.
The initiation of alarms in the TBOX MS relies on the variation of digital or analog Tags.
The alarm queue represents the alarms stack: if several alarms happen at the same time or if a communication port is not
available when the alarm happens.
The Events stack (also called Alarms table) is discussed in chapter 11.8.
To access the definition of Conditions, click the folder ‘Alarms’ in the Project workspace and select ‘Conditions’.
According to the Tag you select, you define a digital alarm condition or an analog alarm condition.
Handling The handling option allows blocking each alarm condition, manually or automatically.
Enabled: alarm condition always active.
Disabled: alarm condition always de-activated.
PowerF:alarm condition disabled when there is a main power failure.
DisAla: alarm condition de-activated when the system variable ‘DisAla’ =
Severity Each alarm can be assigned a level of severity: Low, Normal or High. When several alarms
are still present in the queue and then not processed yet, TBOX MS generates the calls
according to the highest severity.
Notify End of Alarm When the alarm condition is finished, the alarm is automatically re-sent to the same
recipient with the same message preceded with a prefix (see chapter 6.6.2).
Example: for a ‘positive edge’ alarm, it is when the Tag returns to ‘0’.
It is also useful when the alarm condition is active when TBOX MS starts up. When ‘end of
alarm’ is checked, an alarm is automatically generated when the alarm condition
disappears (see illustration chapter 11.8: Alarms table).
SMS acknowledge See chapter 12.2
POP3 acknowledge See chapter 9.5.1
Handling The handling option allows blocking each alarm condition, manually or automatically.
Enabled: alarm condition always active.
Disabled: alarm condition always de-activated.
PowerF: alarm condition disabled when there is a main power failure.
DisAla: alarm condition de-activated when the system variable ‘DisAla’ = 1.
Severity Each alarm can be assigned a level of severity: Low, Normal or High. When several alarms are
still present in the queue and not processed yet, TBOX MS generates the calls according to the
highest severity.
Notify End of When the alarm condition is finished, an alarm is automatically sent to the same recipient with
Alarm the same message preceded with a prefix (see chapter 6.6.2).
Example: for a ‘maximum’ alarm, it is when the value returns below maximum - hysteresis.
It is also useful when the alarm condition is active when TBOX MS starts up. When ‘end of alarm’
is checked, an alarm is automatically generated when the condition of alarm disappears (see
illustration chapter 11.8: Alarms table).
SMS acknowledge See chapter 12.2
POP3 See chapter 9.5.1
acknowledge
11.4 Recipients
To access the definition of Recipients, click the folder ‘Alarms’ in the Project workspace and select ‘Recipients’.
FTP: TBOX MS is able to send files to a FTP Host (see chapter 9.2. FTP Server). In the recipient configuration you only
need to indicate the directory where you want to send the files Do not indicate front and end " / ".
SFTP: TBOX MS is able to send files to a through Secure FTP (see chapter 9.3. SFTP Server). In the recipient
configuration you only need to indicate the directory where you want to send the files.
NTP: TBOX MS is able to synchronize its clock with an external NTP server. In the recipient, you only select a server
you have created in the list of NTP Servers (see chapter 9.5. NTP Serve).
POP3: allows reading e-mail to acknowledge e-mail or to operate TBox with a message (see details chapter 12)
HTTP: To Post files (=reports) to a HTTP server using a HTTP request "Post". Indicate the URL on the HTTP Server.
Then previous to creating groups of recipients, you have to create first the recipients (see above).
11.6 Messages
To access the definition of Alarm messages, click the folder 'Alarms' in the Project workspace and select 'Messages'.
Message number : ID of the message from the list of messages. Type a message of maximum 120 characters. This message
is user specific:
When characters in a message are not in the table, with an accent or from another alphabet than Latin, like Hebrew, Greek,
Cyrillic, … TWinSoft encodes the message in UCS-2 format. This format uses 2 bytes of 8 bits per character, which limits the
total length of SMS message to 70 characters.
The value will be the value of the Tag at the moment the alarm is accessed: the SMS is sent, the alarm list is displayed in a
WebForm, the alarms retrieved from TView, ...
The syntax is: ~TAG~ (with TAG=the name of the Tag).
The value will be frozen to the one at the moment the alarm is stored in the stack of events.
The syntax is: $TAG$ (with TAG=the name of the Tag).
Remarks:
• With MS-CPU16: ONE $Tag$ can be inserted in a message. No limit with ~Tag~
• With MS-CPU32(-S2): TWO $Tag$ (digital or analog) can be inserted in a message. No limit with ~Tag~
• Tag TEXT with MS-CPU32(-S2): ONE $Tag$ of maximum 80 characters
With a Digital Tag for which you have defined ‘States’ in the ‘Presentation’ menu, those states will
be used; otherwise, 0 and 1.
With a Float Tag for which you have defined a number of decimals in the ‘Presentation’ menu, this
number will be used; otherwise, fixed to 3 decimals.
The timetables are based on the specification of ‘Time Slices’ (time periods of the day) and on ‘Days’ (days of the week and
holidays).
11.7.2 Holidays
The holidays offer to flag specific days of the year; these days constitute a group that can be checked in the timetables (all at
once, not days separately) like if it was a specific day of the week (see Time Tables next).
11.7.3 Timetables
Based on the ‘Time Slices’, days of the week and ‘Holidays’ you create different ‘Timetables’ according to activity periods in
your company (day shift, night shift, holidays, week-end, …). A time table can then be associated to a recipient. You select
for each day of the week which time slice will be part of the timetable (Holidays being treated like a unique ‘day’).
If an alarm occurs when time table is active, the alarm will be sent.
Otherwise, the alarm will be handled according to “RTU properties” ->”Advanced alarms” settings:
If the option is checked, the alarm will be maintained in the queue and generated when the time table turns active,
otherwise it is auto-ack.
The Alarms table does not only display alarms generated in TBOX MS , but also system events like start-up of the program,
Reset of the TBOX MS , …
Columns description
Start Timestamp Date and Time when the alarm condition appears (‘Start’ condition).
Message Message (or name of the file) associated with the alarm. System events appear between brackets.
Start Acknowledgment status of the ‘Start’ condition.
The possibilities are:
Not ack.: the alarm is still in process.
Ack’ed: the alarm has been processed successfully.
Auto ack.: the alarm has not been processed successfully.
In case of ‘system events’, it is always the case as it is not an alarm but an event.
Recipient The name of the Recipient (from the list of Recipients).
The name is listed only if the alarm was sent successfully. With chained alarms, this allows to
show the one that was used. In case of ‘system events’, there is no name.
End Timestamp Date and Time when the alarm condition disappears (‘End’ condition).
End Acknowledgment status of the ‘End’ condition.
When creating an alarm condition, there is an option ‘Notify end of alarm’. This option will
automatically generate an alarm when the condition generating the alarm disappears.
The possibilities are:
Not ack.: there is a ‘Notify end of alarm’ condition and the alarm is still in process.
Ack’ed: the ‘end of alarm’ has been processed successfully.
Auto ack.: the ‘end of alarm’ has not been processed successfully. When there is no ‘end of alarm’,
it is immediately indicated as ‘Auto ack.’
12 ReadSMS/POP3 Embedded
12.1 Introduction
ReadSMS/POP3 is the ability to TBOX MS to receive and interpret incoming SMS messages, and to read “subject” field of e-
mail in order to execute tasks.
For any incoming connection, either for acknowledgement or for controlling, the caller ID (phone
number of the caller for the last call received) is available in the communication variable
“ComX.Caller ID” (see chapter 7.3.2)
The incoming SMS must arrive within this time-out for the alarm to be acknowledged. If not, a retry will be executed
according to the definition in the Recipient. After the end of retries, the alarm will be considered as in error: “auto-ack” and
the system variable ‘AlaErr=1’.
Don’t set a time-out too short; to give time to the SMS Center to send the SMS back to the CPU, in case the
service is busy. Also, if the CPU is sending a SMS while an acknowledgment SMS is coming back, it may miss
the warning received from the GSM. The SMS will be stored in the SIM card and will be treated at next auto-
check from the CPU (max. 5 minutes).
Header:
# prefix (fixed).
A precedes the absolute identification number of the alarm.
00056 absolute identification number of the alarm.
# suffix (fixed).
Message:
Level too High message associated to the alarm condition.
The text sent back to the RTU does not matter, as long as the syntax #Axxxxx# is sent.
Some Tags can be very useful to monitor the acknowledgment of the alarms by SMS: AlaErr, SmsState,
CallerID (see chapters 7.3.2 and 7.4.1).
A message can combine several data: Password, acknowledgment ID, writing values directly to ModBus addresses,... It must
always start and end with the character #
Details of the different types of data that can be included in a message sent to TBOX MS :
Examples
#-START PUMP#
#P1568,A00056,-START PUMP,W20480=123#
A message must include the RTU Id of TBOX MS , preceded by the letter I and a pre-defined message. It may also include an
acknowledgment ID.
Examples
#I460000020107,-START PUMP#
#I460000020107,A00002,-START PUMP#
Examples:
#W20480=123#
This message sent to the RTU will write value 123 to the analog Tag with ModBus address 20480
#W1500=”jean@tbox.be”#
This message sent to the RTU will the text “jean@tbox.be” to the Text Tag with ModBus address 1500. This can be useful
for changing online runtime parameters (see chapter 8.5. “Runtime Parameters”)
Notes:
2. ReadSMS checks access protection level of the port before writing (see chapter 12.3.5. below)
The value at ‘modbus address’ corresponds to the ModBus address to write in.
Examples:
#N20480=123#
If ModBus address 20480 contains the value 1000, the value 123 will be written to the ModBus address 1000.
We make a distinction between Target address corresponding to an analog Tag and a digital Tag (see next).
With indirect addressing, ReadSMS does no check the access protection level of the GSM port.
The value at ‘modbus address’ corresponds to the ModBus address to write in.
Examples:
#D20481=1#
If ModBus address 20481 contains the value 512, the value 1 will be written to the ModBus address 512.
If ReadSMS protection is activated, a login is required in the incoming the SMS message or POP3 message. The login is
composed of the last 8 digits of telephone number of the mobile used to send the SMS and a password.
To obtain the Password, the utility 'Password Generator' is needed (Start -> Programs -> Semaphore -> Accessories ->
Password generator).
From the Password utility, you define:
– the global code used in the RTU
– as NAME: the last 8 numbers of the telephone number of the mobile which will be used to send the SMS.
– as Access Level: Engineer (Level 3).
Examples:
#P1568#
Examples:
#S32#
Note: ReadSMS checks access protection level of the port before writing (see chapter 12.3.5. above)
Examples:
#R32#
Note: ReadSMS checks access protection level of the port before writing (see chapter 12.3.5. above)
Examples:
#W20482=h#
If the message is received at 15:23, the value 923 will be written at ModBus address 20482
Note: ReadSMS checks the access protection level of the port before writing (see chapter 12.3.5. above) and also the 'Write'
configuration of the 'Presentation' of the Tag (see chapter 8.4)
Value Description
1 Accepted message received
2 acknowledgment received
10 Invalid message
11 Unknown command
12 Equality character (=) not found or incorrect
20 Incorrect password
21 Incorrect password or not supplied for a com. Port protected
30 Message received does not match a predefined message
31 Writing to an unknown address
32 Writing to an unknown address, using indirect addr. (address contained in the Tag not known)
33 Changing the telephone number of an unknown recipient
Tag Text: It will contain the date, time and the message. Make sure you define this text Tag with a minimum of 160
characters.
Examples:
11/03/25,10:29:14+04 Hello to TBox!
The date and time are the one given by the SMS-C (not from TBox, not from sender)
The +04 indicates the differences to GMT in quarters of an hour.
Tag Stack: This is a digital Tag. When changing to 1, it indicates message(s) is (are) on the stack. By writing "0", you bring up
a message from the stack to the Text Tag (see above). When it switches back to "1", it means there is at least one
more message in the stack.
– MS-CPU32, -LT2: stack of 50 messages. Circular buffer.
– MS-CPU16, -LITE, -WM, -LP: no stack. Message with a maximum length of 89 characters.
13 Datalogging
13.1 Introduction
Datalogging allows memorizing values of your process, in order to visualize its history.
TBOX MS contains memory for recording historical values of Tags and events (see technical specifications); the latter is
what we call the database of TBOX MS .
The Chronologies
Chronologies are 'On event' recordings, by means of changes in Tags (also known as “Sequence of Events”). Each event is
recorded with time, date, Tag and its status or value.
t
0
The changes of status of the Tag represent the events.
200
180
160
140
120
100
80
60
40
20
t
TBOX MS stores chronologies in 2 tables: one for digital data and one for analog data.
The size of the tables is defined in the General RTU properties, as described chapter 6.1.
Recording in sampling tables happens at fixed intervals and does not depend on signal variations; it uses the clock of the
CPU to determine the recording.
Date and time of only the last record is stored. This mechanism requires less memory than chronology does. Timestamps
are re-built when data is generated (by report or by polling).
t
9 :30 9 :45 10 :00 10 :15 10 :30 10 :45
Each Tag is recorded into a separate table. The maximum number of tables is 2000 and the size of each table is of maximum
65535 records. To increase quantity of data recorded, recording on micro SD card can be considered (see chapter 6.6.3. RTU
properties -> Sampling Tables)
The database information recorded in TBOX MS can be displayed directly on WebForm or retrieved with the use of SCADA
software such as TView or other HMI package running ‘TComm.dll’ based driver (please call your distributor).
By doing a compilation you can check the space of memory available (see chapter 4.10.2).
Handling:
• Enabled: always recorded.
• Disabled: never recorded.
• PowerF: recording disabled in case of ‘mains’ power failure.
• DisCRD: recording disabled when the system variable ‘DisCRD’ is at 1.
Variation: Recording in case of variation (higher or lower) in comparison with the previous recording. The weight of the
value corresponds to the scaling defined in the Tag definition (see chapter 8.1.1: Analog I/Os).
Handling:
• Enabled: always recorded.
• Disabled: never recorded.
• PowerF: recording disabled in case of ‘main’ power failure.
• DisCRA: recording disabled when the system variable ‘DisCRA’ is at 1.
Type: TBOX MS records data internally on a minimum time-base of 1 second. After the period selected (see next) the
selected type of data (min., max., ..)is recorded.
Example: if you select as period 5 minutes, the recording will be done at:
9:25:00; 9:30:00; 9:35:00; 9:40:00 ...
In case you wish to make recording every day, or even with a longer period, the options are:
• daily: recording once a day
• weekly: recording once a week
• monthly: recording once per month.
The hour of the day, the day of the week and/or the month are defined once for all sampling tables in the RTU
Advanced properties (see chapter 6.6.3)
To adjust the sizes check the available memory with the compile option. See chapter 4.10.2:
Compiling a program.
Trigger: Synchronize each sample on external clock: recording of the value is executed on the positive edge of the Tag
selected, and not with the clock of the CPU.
The period between 2 pulses of the Trigger must correspond to the period selected between 2
recordings (see above). The period selected with the timestamp of the last record to rebuild the
table.
No sampling if trigger = 0: the CPU clock is used to record data (see period above), but recording is only possible when the
Tag Trigger is in “high state”. When it is negative, recording stops. On the positive edge of the Tag, the table is
erased and a new recording starts.
Reset Tag after sampling: if this option is checked, the RTU automatically resets the register that has been recorded.
14 ModBus Transactions
14.1 Introduction
ModBus Transactions feature allow exchanging data between two or more ModBus stations via any communication ports
One often speaks of 'Master Network' because it is a ModBus Master communication: the Master (TBOX MS ) executes
reading and writing in slave(s) through any media (RS485, Ethernet, modem...).
Each ModBus Transaction corresponds to one transaction (reading or writing) with 1 slave.
When there are several stations, TBOX MS executes the different transactions of one station at a time, then transactions of
the following station, and so on ….
When a dial-up modem is used to execute ModBus Transactions, TBOX MS needs first to establish the connection using an
Alarm of type ‘ModBus’ (see chapter 11.4. Recipients)
Before creating a ModBus Transaction you have to create the equipment you are going to communicate with.
Trigger: Select a digital Tag that will trigger the communication, according to a ‘Condition’ (see next). Working with several
equipment, you declare different Tags and then control differently the communication to each equipment.
The Trigger must be a digital variable (DIV).
Condition: Condition of Tag ‘Trigger’ to start communication. Typically, you will work with a permanent connection (Trigger
in High or Low state). Or you can decide to execute one-shot communication, on edge changing of the Tag
Trigger.
The changing of state of the Tag can be controlled by BASIC, Ladder, or Periodic events.
Tag:
Select an existing Tag by clicking the button. Be sure you select a Tag of the same type than the
one you want to access in the ‘Slave’ (Byte, Word, DWord or Float).
If the Tag does not exist, you can create it after having clicked the button. It is the Tag of the Master;
it contains the value you want to write in a Slave or it is a register that contains the value that Master
reads in a Slave.
In case of block communication (with a quantity > 1), this Tag is the one of first ModBus address.
Operation Operations MASTER (Tag) SLAVE (Address)
READ Data
WRITE
Data
Read: The Master reads data from the Slave.
Write: The Master writes data to the Slave.
Quantity Quantity of variables of successive addresses that are read (or written) in the Slave. It depends on
the external source, the types of variable and the ModBus function used (see tables below).
ModBus protocol handles only words (16 bits). When working with 32 bits, TWinSoft adapts the quantity
to double the number of words. 32 bits variables are handled with:
<Hi word1><Lo word1><Hi word2><Lo word2>… It can be adapted from the “Advanced…” properties of
the remote device.
External Source. All the following parameters concern the Slave station:
Device: select an existing external device from the ‘Resources’. You can create one clicking the button
Type: select the type of the external variable. The choices are:
With external source ‘ModBus device’ (any TBox MS, TBox LT,, any ModBus device)
Types Connection in remote device ModBus Function
Digital input Only digital input(s) 2
Coil Digital output(s) or register(s) 1, 5 or 15
Analog input Only analog input(s) 4
Holding register Analog output(s) or register(s) 3, 6 or 16
Operations Types ModBus Functions Max. Quantity (*)
Read Digital Digital Input 2 1600 (see Warning below)
Read Digital Coil 1 1600 (see Warning below)
Read Analog Analog Input 4 125 (16 bits) - 62 (32 bits)
Read Analog Holding Register 3 125 (16 bits) - 62 (32 bits)
Write Single Digital Coil 5 1
Write Single Analog Holding Register 6 1 (word)
Write Multiple Digital Coil 15 800 (see Warning below)
Write Multiple Analog Holding Register 16 100 (16 bits) - 50 (32 bits)
(*): Maximum quantities for TBOX MS , TBox LITE, TBox MS. You also have to check the maximum quantities of the
‘Remote device’-they could be less.
(*): with quantity > 16, ModBus addresses and quantities must be multiple of 8
When accessing digital variables (DIV, DIR, …) into TBox CPU-3, make sure you use multiples of 8 for:
quantity and address of Variable in External Source
Address : The ModBus address must be typed according to the indication of the user’s guide of the Remote device.
Communicating to a TBox, you have to refer to the TWinSoft application and its configuration of Tags.
14.4.1 Diagnostics
It provides diagnostics information, through 3 Tags.
Communication Error Tag: This Tag provides a direct, immediate indication of communication error to the remote device,
without requiring any logic. Each transaction is tested, when it is in error, the Tag turns ON, when
communication is healthy it turns back OFF automatically.
14.4.2 Compatibility
Force Multiple Write even if there is only one register : With some remote device, only one Write function is supported:
– FC 15 = write multiple Coils
– FC 16 = write multiple Holding Registers
In the Modbus Transactions configuration, if the quantity of Tags = 1, by default TWinSoft uses the standard
function dedicated to single write. This option allows TWinSoft to always use the "Multiple Write" function, even
when there is a quantity of 1.
Working with Analog Tags 32 bits, even with a quantity=1, the function used is always FC=16, because
one 32 bits is built on TWO consecutive addresses of 16 bits
Changes in 32 bits handling: Modbus protocol standard does not describe how to communicate with 32 bits register.
Therefore, there are several ways of transferring 32 bits (DWord/Long and Float).
By default, TBOX MS uses Big Endian method for communicating. This method can be modified.
The option selected is applied to all transactions of 32 bits variables with the device.
Little Endian:
15 CD 5B 07
H2 L2 H1 L1
Swap of Words: This is the most common handling when Big Endian is not supported.
Examples of Bytes transfer:
Decimal value: 123456789
Hexadecimal Value: 07 5B CD 15
Swap of Words:
CD 15 07 5B
L2 H2 L1 H1
ModBus Enron: The difference with classical ModBus is that counting of variables is based on 32 bits variables and not 16
bits variables
With ModBus Enron, a quantity=1 corresponds to a 32 bits variables.
It provides a way to communicate with "Slave" supporting Modbus Enron. It requires TBox OS >= 1.24.
They are available from the tab ‘Advanced’ of the properties of the communication port.
ModBus Slave Properties: Interframe gap: after having received a valid request, time before sending the answer.
15 Periodic Events
When tasks have to be executed periodically, periodical events constitute an easy way of creating events to launch the
tasks, like ModBus Transactions, sending of test alarm, datalogging, a piece of Ladder/BASIC logic, etc..., and this,
independently from any other condition.
A digital Tag is Triggered periodically: it is automatically SET when the period has elapsed. All tasks associated to a positive
edge on this Tag will be launched, then the Tag will be automatically RESET, ready for the next period.
Several tasks can be associated to the Tag triggered. This implies for the OS to RESET the Tag when all tasks have been
launched.
In the project workspace of TWinSoft, a folder is available to declare the Periodic Events:
The Tag ‘Half_Hour’ (a DIV) will be automatically SET each 30 minutes, at each xx:15:00 and xx:45:00. The task(s) associated
to Tag ‘Half_Hour’ will be executed each 30 minutes, for instance a communication to a Remote Device, the Tag would be
the Trigger of the Remote Device.
Sending a SMS each Monday at 8:00 AM Sending a report each 1st of the Month at 6:00 AM
With the above examples, the digital Tags (DIV) “SMS” and “Month_Report” are associated to alarm condition.
Several protocols can be protected: ModBus, HTTP, FTP (server), ReadSMS. More protection can be implemented, like
Firewall (chapter 6.4.1), OpenVPN (chapter 10.1) or IEE802-1X though an add-on (see chapter 6.2. Add-ons).
Once you activate the “Access security” option, the TWinSoft document will also be protected, even if no port has been
selected!
There are three methods of activating access security. You select one:
• Global Code: You define a 4 digits hexadecimal code.
• Enhanced Global Code: The same as above but with maximum 8 of any characters.
• User list: You define your own list of Users/Password.
TWinSoft populates ports according to the model of TBOX MS you are configuring; you check the port(s) you want to
protect.
TWinSoft presents all the communication ports according to your hardware configuration:
Once HTTP security is activated, each file building the web site must be assigned an access level.
ALL files (.twa, .htm, .twf, .gif, ...) composing a view must be given an access level:
• Level 0: the file is always visible and does not require a login. Typically a home page.
• Level 1: the file is visible by user “Read only”, “Read/Write” and “Engineer”.
• Level 2: the file is visible by user “Read/Write” and “Engineer”.
• Level 3: the file is visible by user “Engineer”.
Once HTTP protection has been activated (and sent to the RTU), when connecting to TBOX MS using a browser you are
prompted to login to open a file with access level 1, 2 or 3.
A login at ModBus level will be also required if the port has been protected (see above).
Without the option checked: the protection is based on the com. port only:
When someone logs in to a communication port as “Engineer”, all users connecting after him will be
automatically logged as “Engineer” too …
TBox provides a way to protect against multiple, successive login attempts to the unit.
Protection is applied for every protocol where a TBox is the server and requires authentication such as Modbus/TCP, HTTP
and FTP. It is applied to all communication ports for which authentication is possible: GSM, Ethernet and serial port in the
case of ModBus-RTU with authentication.
SSH is a special case as this rely on dropbear; however, dropbear already includes such a mechanism and has its own
hardcoded parameters.
Brute Force protection settings are available in chapter 6.6.12 Advanced RTU Properties-> Security.
Activating protection is mandatory to delete files on the SD, using a FTP Client.
In case you have activated Access Security (see chapter 16.1. Access Security), this protection
replaces TWinSoft document protection through access security login.
- There is no distinction between access levels when opening a document. Any acceptable login will
be supported.
- By clicking ‘Cancel’, TWinSoft indicates the document is protected and opens a new one
When installing TWinSoft Suite a password-creation program named Password Generator is installed in the same directory as
TWinSoft. It can be started from the 'Start' button of Windows and is located in the group of programs “Techno Trade” ->
“Accessories” created while installing TWinSoft.
This program generates passwords needed to Login to TBOX MS when access security has been activated (see above).
A password is composed of 4 or 8 hexadecimal characters in response to information related to the user. It is based on a
complex algorithm using the global code (=key), the user’s name and the access level. A 5-digit number (User Id) allows
identifying the user accessing TBOX MS . This User Id can be used to trace users for example by inserting this number into
datalogging (chronologies), with the help of Analog Communication Variables (see chapter 7.3.2.).
Global Code This hexadecimal code of 4 or 8 characters is the basis for password generation. It is typed in the
‘RTU Properties’ (see above) of TWinSoft and sent to TBOX MS . When a user logs in, TBOX MS
checks whether NAME and PASSWORD fit with the global code. This means that if different users
with different access levels must communicate with TBOX MS , the global code used to generate
passwords must be the same.
When this information has been entered, click on the button "Get password".
16.4 Login/Logout
Login
If connected to a port of TBOX MS that is protected, you
need to Login to get an access level.
You type the Name you used in the ‘Password’ utility and the Password that was created (see previous). According to those,
you access in:
• Read only
• Read/write
• Engineer
If 'Save password' is checked and TWinSoft is connected to a protected port: when TWinSoft starts, it uses the access
level corresponding to the password saved (see the status line).
If it is not checked and TWinSoft is connected to a protected port: TWinSoft starts in 'Read only' mode. You need to do a
Login to get your access level.
Logout
If the TWinSoft is connected to a protected port, the Logout sets TWinSoft in 'Read only' mode.
In case HTTP protection has been activated, the browser will pop-up a login window.
If the ‘modem’ has been declared protected, it will still be protected even after a global reset. To
deactivate the protection, an unprotected TWinSoft document must be sent to TBOX MS (see
below).
If you have forgotten your access security login, but still remember the Global Code, you can generate a new login (see
chapter 16.3. above).
If you have forgotten your document password, we will not be able to open the application; there is
no backdoor password.
Appendices
A. Licences
TWinSoft software itself is not protected and can be installed freely on any PC to develop TWinSoft document (online or
offline) and to monitor TBOX MS .
In order to find the best way for you we offer different possibilities:
You need to install a driver to run the dongle. It is available in our website:
https://servicedesk.ovarro.com/servicedesk/
Using information of the PC (the Company name, the Username, a Serial Number), you receive a code that you enter in the
field “License”. Once entered, you can send any application as if you had a dongle (see previous).
This protection mode is ideal for users having one or two TBOX MS units. The dongle or a license might be too expensive.
TWinSoft LITE code is linked to one and only one TBOX MS ; it allows you sending an application to the TBOX MS for which
you have the code.
B. Time in RTU
One of the biggest issues in Telemetry and data logging equipment is the handling of time.
In order to have a universal solution wherever TBOX MS is used, TWinSoft, OS of the RTU and software’s collecting data,
share the same mechanism of time management.
UTC Time
UTC time is based on the number of seconds since 1/1/1970 at Greenwich latitude. It is used as internal timestamp to each
event (alarm, chronology, …)
UTC time is converted into Analog System Variables to give access to time information: second, minute, hour, day, month,
year, week.
Changing UTC time automatically updates the RTC.
When time information needs to be sent (in a report, as header of an e-mail, in the Analog System Variable), it is always
computed from UTC time to a local time according to TBox configuration Time Zone and Daylight Saving option as specified
in the “General” RTU properties.
RTU time can be checked anytime doing a RTU Identification, from the main menu -> “Communication”
Sampling Tables
In sampling tables, TBOX MS records the timestamp of the last record only. The previous timestamps are built up when
retrieving the data, based on the last timestamp and the period of recording. Conversion into local time is done as above
with chronologies. A choice had to be made concerning periods > 1 hour: either having always the same period of recording
or having always the same “hour” of recording. The latter case has been chosen. When daylight saving change occurs, the
target time is automatically updated for sampling tables having a period > 1 hour.
Example:
If recording a value once a day at 6.00 in the morning, the recording will always happen at 6.00, but when changing from
winter to summer (in Europe), the sampling period will be 23 hours and when changing from summer to winter the period
will be 25 hours.
Periodic Events
When a periodic event is defined with a period > 1 hour, its target time is automatically adjusted when a changing
winter/summer happens.
B.4. Summary
Summary of time handling in the different cases:
System variables in the RTU They display the local time where the RTU is installed, according to the
Regional settings declared in the “General” RTU properties
• Identification from TWinSoft The UTC time is computed according to Regional settings of the PC
• List of alarms in a report The time is computed according to RTU local time (see 1. above)
• List of alarms in TWinSoft See point 2. above
• Object ‘Time’ in WebForm See point 2. above
• System variables in WebForm Displays the value of the variables, as explained point 1. above
C. Plug & Go
Plug & Go allows storing the complete TWinSoft project into the micro SD card of TBOX MS or in a USB stick.
When required, micro SD card must be inserted at the back TBOX MS
Micro SD of max. 32 GBytes, formatted in FAT32.
As TWinSoft project, we mean all files, including TWinSoft compiled document with Web and Report files, OS and even
LINUX kernel; all ready to run in the RTU.
Plug&Go can also be used to generate the full TWinSoft project to the destination of TConnect. The latter will then update
TBox at a scheduled date and time.
Plug Click this button to create the Plug & Go directory repository.
The name is unique. It means if you want to create Plug & Go files for several RTU's, you have to
save each file in separate directories.
Once the Project is compressed, the window displays File Info (see example above)
Plug Info Click this button and select the parent directory of repository directory to display its Info
Extract Sources Once a repository has been selected (see Plug Info… above), allows extracting its content
Generate for TConnect Generates a .zip file for TConnect which will deploy in TBox according to a scheduled date and
time
System Variable
RTU identification
Data relative to MMC is available in RTU
identification window:
When an IP configuration is defined in System.xml, it has priority on the one declared for the Ethernet
ports of the CPU as well as in a possible ‘Plug&Go’ file.
Example of System.xml
D. Pack & Go
D.1. Presentation
Pack & Go is a tool that builds up one file with your complete project, including TWinSoft document, WebForms, Reports,
OS,... The goal is to backup or to transfer a complete project without missing files or to update an RTU with the complete
project without requiring advanced knowledge of TWinSoft. All files are compressed and packed into one file with the
extension .tpg (TWinSoft Pack & Go). Once a project is packed, it can be unpacked and/or updated to the RTU from a
double click on the .tpg file. TWinSoft needs to be installed on the machine used to update the RTU with .tpg file, but the
TWinSoft license is not required.
D.2. Pack
IF YOU ARE OFF LINE while compiling, TWinSoft uses the OS indicated as ‘Off line OS’ in the ‘General
RTU properties’. This OS, and only this OS, will be sent to the RTU.
Check the user running the .tpg file runs a version of TWinSoft equal or higher than the one used to pack the
files.
D.3. Unpack
To open the Unpack window, double click a file with the extension .tpg.
Unpack menu offers 2 features:
Restore a project
Extract a project into a
directory of your PC. This
option is very convenient for
backing up a project being
sure you don't miss any file.
Option available from the
main menu: ‘Tools’ →
Unpack.
Update RTU
Update a RTU with a
complete project, including
the application, OS,
WebForms, report, ...from a
unique file.
The button ‘PC Setup…’ gives
you access to the
configuration of the PC, to
communicate with the RTU.
If packed OS is different from OS in the RTU, Pack & Go updated the RTU with the OS
Languages supported by this interface are English, French and German. It cannot be selected from “Unpack” menu but
changed from TWinSoft main menu: “Tools” → “Language”.
E. ModBus Rerouting
E.1. Presentation
One of the nice communication features offered by TBOX MS is the ability to act as a ModBus router. That means that you
can use a TBOX MS to make a connection between 2 x ModBus devices that are not on the same communication channel.
ModBus Protocols
This feature creates a route between communication ports configured in ModBus protocol(s):
• ModBus-RTU <--> ModBus-RTU
• ModBus-RTU <--> ModBus/TCP
Concerning TCP/IP protocols, other redirections are possible using IP forwarding, NAT and Virtual Server
(see Appendix F.).
Communication Principle
The idea is that TBOX MS receiving frames, analyses the Station address: if it is for its own use, it keeps the frames;
otherwise they are pushed to the “routed” communication port.
The typical application is dialling an RTU to access a remote RTU connected to the RS485 network.
You access routing from the main menu of TWinSoft :
Communication → Routing
Example: A rerouting between COM4(…001000) and COM2 (…000010) corresponds to the decimal value =10 (…001010)
Doing a ‘local’ rerouting, for instance from a RS232 port to a RS485, we recommend using the
same Baudrate all ports.
If you have ‘ModBus Transactions’ running between ‘Master’ and ‘Slave’, we recommend
stopping them during rerouting, to avoid communication errors.
OUT: ports to which requests have to be sent if it does not concern the “local” RTU (different ModBus address).
OUT RS232 RS485 GSM (CSD) GPRS/3G/4G Ethernet
IN
RS232 - Routing Routing (*) Not avail. Not avail.
RS485 Routing - Routing (*) Not avail. Not avail.
GSM (CSD) Routing Routing - Not avail. Not avail.
GPRS/3G/4G Routing Routing Routing (**) - IP Forward (**)
Ethernet Routing Routing Routing (*) IP Forward (*) -
(**) : increase Time out (see above) to 10 seconds when communicating in GPRS.
The typical use is a remote access to an IP camera connected to the Ethernet port of the RTU: you connect through
GPRS/3G/4G and the request to the camera is forward to the camera.
This redirection feature requires enabling Advanced IP Configuration. As a matter of fact, if an Ethernet port of the RTU is
connected to a LAN, and the IP forwarding is activated, anyone can access the LAN from a modem connection!
To deactivate these features, you are also prompted to type the Advanced IP activation code.
Virtual Server rules can be configured as explained chapter 9.8.
G. Terminal mode
This feature allows accessing modem in AT command, for diagnostics or on-line configuration via a terminal window
through local IP communication (Ethernet or USB).
In this mode, you access the modem through its RS232 port.
For this port to be available, make sure BOTH internal communication ports of the modem (USB and RS232) are available;
make sure the following option is not checked:
To access the terminal window, go to main menu of TWinSoft “Communication” -> “Terminal” and select the internal GSM
modem.
When TBox MS restarts it resets its session ID's. TBox supports maximum 64 HTTP sessions.
When HTTP session authentication is activated, it replaces the login mechanism from the browser.
In index.twa, "MainObject", group « HTTP Session », type a script to open the login dialog box.
When typing the URL, you are prompted to login, because there is no access level defined yet at that moment:
In the page, only objects with visibility level = always are displayed in background. Type login and
password and click "Login"
As long as the session is opened, you can switch between pages without requiring any login.
To logout, you use script on a button.
For instance:
It will also appear when typing the URL of a report for instance to display its content in runtime when you have not logged in
yet: http://172.25.110.185/report.txt
This function allows launching a login without using the embedded login box.
You can define input boxes with name and password and then activate the login with a button running this function.
WebForms.SessionEnd()
This function allows to force ending of a session
WebForms.SessionLoginDialog()
This function allows to force opening of the login dialog box
WebForms.SessionLogoutDialog()
This function allows to force opening logout message box
WebForms.SessionGetCurrentState()
I.1. Introduction
A certificate contains data used in identification and encryption.
Take for instance a connection from a browser to a web server, using SSL. We recognize such a connection by the url
starting with https:// … with “s” like “secured”, like “SSL”.
When the connection must be secured, the client requires information from the server. The certificate on the server will
provide this information to the client: its identity, a date of validity, a signature of the certificate by an authority and a
public key that will be used to decrypt data coming from the server.
On its side, the client checks in its certificate store whether it recognizes the CA certificate that has been used by the server.
• When TBox is server it can provide CA certificate(s) to the client(s). This the case of HTTPS communication for
instance.
• When TBox is client it has a certificate store to validate CA certificate used by server(s), including support of
Certificate Revocation Lists (CRL)
Let’s take an example with TConnect, that TBox should check the validity of the certificate in TConnect before connecting.
Click “Add” and paste the content of the “Signing” certificate (<file>.crt):
When the client connects to a server it gets its certificate and information about the CA that has signed it. It checks its
validity and then checks in its CRL whether it has been revoked or not.
Then this verification with TBox can be carried out when TBox is “Client”, typically to TConnect.
This option provides also a verification on an application loaded using Plug&Go (through SD card or USB stick); each file of
Plug&Go will be signed by TWinSoft and checked by TBox upon installation.
To have keys signed by the CA that will be used by TWinSoft to sign the application. Those keys must be imported in the list
of certificates of a PC. This PC becomes a trusted computer that will be used to compile TWinSoft application.
The keys (private and public) can be exported from the certificate.
The certificate must then be declared in Windows. This can be done using Microsoft Management Console (mmc.exe).
Then in folder “Personal -> “Certificates” you import the certificate (file with extension .p12)
We can see which CA has issued this certificate. It must be the one we have declared in TBox store (see above)
Key: SigningCertificate
Data: the name of the Certificate
In case you wish to update a certificate in TBox, the procedure must be carried out with the following sequence.
Imagine you have been using a certificate “Old_CA” and wish to replace it with “New_CA”:
New after TBox restart New_CA New_CA + New_CA Old CA has been removed from
User_key TBox store
You can keep the same name for the “User_key” used to sign packages by TWinSoft. Therefore, the
Windows Registry does not need to be updated.
In case the date of validity has expire it will not be possible to update TBox or its certificate (see
below) !!
2. Doing a global reset, you reset TBox to its factory configuration. This is the only possibility when certificate has been
revoked in TBox.
When TBox start-ups, it checks the validity of signature in Plug&Go based on its certificate. When it fails, the application is
not updated and TBox keeps running with previous application.
Index
A D
Access level ..........................................................................179 Datalogging ......................................................................... 158
Access Security ..................................................................... 172 chronologies ................................................................... 160
deactivating.................................................................... 180 sampling tables ............................................................... 161
TWinSoft document ....................................................... 180 Debugging ........................................................................... 125
Add-ons................................................................................. 41 Diagnostics .......................................................................... 126
Alarms ..................................................................................136 Document
advanced parameters ....................................................... 51 backup .............................................................................. 35
analog condition ..............................................................139 Dongle ................................................................................. 182
chain ........................................................................ 137, 139 DynDNS............................................................................... 114
digital condition ............................................................... 137
e-mail ............................................................................. 142
end of alarm ..................................................................... 52
E
events stack .................................................................... 148 EDGE ..................................................................................... 72
FTP ..................................................................................143 e-mail ............................................................. 100, 137, 140, 142
group of recipients .......................................................... 144 SMTP from ....................................................................... 51
HTTP ...............................................................................143 Ethernet
internal ............................................................................141 on RTU ............................................................................. 66
link ........................................................................... 137, 139 Events stack ............................................................. 51, 136, 148
Message ......................................................................... 144
ModBus ...........................................................................141
NTP .................................................................................143 F
printer ............................................................................ 142
recipients .........................................................................141 Firewall ..................................................................... 39, 42, 132
SD card ............................................................................143 FTP ............................................................................... 108, 143
SFTP................................................................................143
SMS................................................................................ 142 G
time tables ..................................................................... 146
USB stick .........................................................................143 Global code .......................................................................... 178
Alarms stack ................................................................... 51, 136 Global Reset .......................................................................... 32
Alarms table ............................................................ 51, 136, 148 GPRS ..................................................................................... 72
Approvals .............................................................................. 12 GPS ....................................................................................... 87
Group of Tags ........................................................................ 93
GSM ...................................................................................... 70
B 3G/4G ............................................................................... 72
Bridge................................................................................... 117 communicating from TWinSoft ......................................... 29
Brute force protection..................................................... 62, 177 communication variables .................................................. 74
CSD-DATA settings........................................................... 71
IP and SMS ....................................................................... 74
C IP settings ......................................................................... 72
signal level ........................................................................ 81
Caller ID ................................................................................. 82 GSM message
Certificates .......................................................................... 204 header .............................................................................. 52
TBox store ........................................................................ 43
Chronologies ....................................................................... 158
analog ............................................................................ 160 H
digital ............................................................................. 160
Communication Hardware concept.................................................................. 16
CPU ports ......................................................................... 65 Historical data ...................................................................... 136
PC Setup........................................................................... 25 HSDPA .................................................................................. 72
status ............................................................................... 31 HTTP protection ...................................................................175
testing with TWinSoft ....................................................... 31 HTTP Server
to other RTU ....................................................................163 post to HTTP server ........................................................ 122
variables ........................................................................... 79 HTTP session ................................................................. 42, 198
Compiling an application ....................................................... 36 HTTPS ............................................................................. 39, 42