TWinSoft Training Uk 20220301 Ovarro

Download as pdf or txt
Download as pdf or txt
You are on page 1of 135

February, 2022

TWinSoft / TBox Training


Jean Burton

1
Tip & Trick

2 Table of Contents
Introduction 3 IP Parameters 70
General structure of an application 4 TCP/IP Debug 80
Description of TBox-MS 5 IP Security 81
Description of TBox-LT2 8 Runtime parameters 84
Description of TBox-TG2 9 ModBus “Master” Transactions 86
Description of TBox Nano 10 Periodic Events 92
Description of RM2 11 Access protection 93
Powering TBox 12 Automation – Introduction 97
TWinSoft Installation 13 Sequence of Tasks 98
Presentation of TWinSoft 15 Ladder 99
Communication with TBox 19 Ladder – Timer 102
Tracelog – Diagnostics 24 BASIC 107
RTU Properties 27 BASIC – Timer 112
Resources 30 POU 115
Resources – GSM/3G 33 Libraries 120
Tags 37 Utilities and Miscellaneous 122
Datalogging – Chronologies 41 Start-up 123
Datalogging – Sampling Tables 43 Advanced Properties 124
Datalogging – Consolidating data 46 TBox Web Server 127
Alarms 48 WebForm Studio 2.0 128
Alarms – Configuration 49 TConnect 133
Alarms – Recipients 53 Monitor32 134
Alarms – Acknowledgment 61 Information 135
Report Studio 64

Support
The following pages provide valuable information when developing,
analyzing and monitoring TBox features:

LEDs……………………………………………………..12
License .…………………………………………………16
RTU identification……………………………………… 19
Global Reset…………………………………………… 23
Trace Log - Diagnostics……………………………. 24
GSM: monitoring with communication variables…… 34
GSM: testing communication with PING addon……. 36
Datalogging tools……………………………………….45
Alarms tools……………………………………………. 62
Report: test generation of report…………………….. 69
TCP/IP debugging……………………………………...80
ModBus communication tool………………………… .91
Ladder tools……………………………………………101
BASIC tools……………………………………………109
Pack & Go, Plug & Go………………………………. 122
Monitor32………………………………………………134

2
3 Introduction

WEBSERVER
Control and Monitoring
CYBER SECURITY
using PC, tablet, Smart Firewall, SSL, OpenVPN,
Phone … Brute force attack
protection, …
IP INTERFACE
SMTP, HTTP, FTP, ... ALARMS
Router, Gateway,
Firewall, SSL, ... SMS, E-mail, Image
...
TBOX
COMMUNICATION
Ethernet, GSM, DATALOGGING
RS485,
Chronologies (SoE)
ModBus, SNMP, ...
PLC Sampling Tables
IEC-60870, DNP3, …
Ladder, BASIC

TBox is a RTU offering a wide range of possibilities in various applications,


only depending on people ’s imagination.
TBox is an open system. It provides all the tools to control a process, locally
as well as remotely, to generate alarms, to carry on multiple communication, to
log data, …
It can be used in any kind of applications: Water, Oil & Gaz, Electricity,
Railways, Buildings, Street Lightning, Tunnels, Irrigation, Power generators,
Refrigerators, … and is the ideal solution to monitor unmanned sites.

3
4 General Structure of an Application

TBox (any model)


▪ I/O process, multi-Coms, Datalogging, Webserver, alarming

TWinSoft (+Webform 1.0/2.0 & Report studio)


▪ Programming tool for TBox

TConnect
▪ Tool for connecting to TBox

TView, TBox mail, Browser, SMS, SCADA, …


▪ Supervisors: display of the process, analysis and control of the application, alarm handling.

4
5 Presentation

Modular System using Racks and Cards


Racks
▪ 3, 5, 10, 15, 20 slots
▪ Installation on DIN rail, on a wall or in 19’’ cabinet
Cards
▪ Power Supply: 230 VAC, -48 .. +24 VDC
Includes battery charger (max. 7 A/h)
▪ CPU: MS-CPU32-S2
▪ VDC power supply (if no Power Supply needed)
▪ Modem: PSTN, GSM/GPRS/3G/4G/LTE
▪ GPS
▪ I/Os: DIs, DOs, AIs, Relays

Example:

Exemple:

Power Supply

CPU I/Os Ethernet Switch

GSM 4G/LTE

5
6 TBox-MS32-S2

Industrial grade 32 bits processor


▪ ARM 32 bits, 400 MHz
Power Supply
▪ Direct 8..30 Vdc or through MS-PS-xxx
▪ Internal Lithium battery: 4 years out of power
Communication ports
▪ 1 x RS232 , 1 x RS485
▪ 2 x separate Ethernet
▪ 3 x USB
• PC, memory stick, Wifi (Access Point), Serial
▪ Additional ports
• 7 x serial cards (modem, serial)
• 2 x Ethernet cards
Protocols
▪ ModBus, SNMP, IEC-60870, DNP3, OPC-UA, MQTT, …

6
7 TBox-MS – I/Os

DIs/DOs
▪ MS-16DI, MS-48DI: digital inputs
▪ MS-10DIHS: high speed digital inputs (> 50 kHz)
▪ MS-16DO: digital outputs “transistor”
▪ MS-8DOR: digital outputs “relay”
▪ MS-16DIO: digital input or output individually
AIs/AOs
▪ MS-8AIVC: analog inputs: 2 x PT100, 6 x current or voltage
▪ MS-4AI420, MS-8AI420: analog input 4..20 mA isolated 1/1
▪ MS-8RTD: temperature probes: Pt100, Pt1000, Ni100, Ni1000
▪ MS-4AOVC: analog outputs current or voltage
COMBO
▪ MS-COMBO: 8 x DIs, 4 x DOs "transistor", 3 x AIs (4..20 mA)
▪ MS-IO-SIMUL: simulation of DIs, DOs, AIs, AOs

7
The power of
MS-CPU32-S2
in a single module

8 TBox-LT2

All-in-one module.
• Battery Charger
• DI/O
• DI Counter (< 10kHz)
• AI - 4..20mA, 0..10V
• AI - Pt1000
• RS232 and RS485
• Ethernet
• USB (stick, WiFi as access point, Serial)

Optional Communication port


▪ Version -G: GSM 4G/LTE
▪ Version -S: Full RS232 port

Several combinations of I/Os

Reference DIO From DIO: AI AI AO


DI (Counter) (4..20mA) (PT 1000) (4..20mA)
> 10 Khz or (0..10V)

LT2-530 16 3 8 - -

LT2-532 16 3 8 - 2

LT2-540 16 3 6 2 -

LT2-542 16 3 6 2 2

LT2-562 24 3 1 - 1

8
All communication power of
TBox in a single module

9 TBox-TG2

TBox « Gateway »
Supports all standard functions of TBox LT-2
• Communication: ModBus, IEC, DNP3, SNMP, OPC-UA, MQTT, …
• IP forwarding, Virtual Server, Firewall, VPN, …
• Alarms, Datalogging, PLC
• …
Hardware in standard
• Backup battery charger
• RS232 and RS485
• Ethernet
• USB
• NO Inputs / Outputs
Communication in option
• Version -G: GSM 4G/LTE
• Version -S: Full RS232 port

9
Years of data without
maintenance

10 TBox-Nano – (Retired)

Ultra Low Power RTU


• IP68
• Power Supply
o Embedded 21.6 V battery (13 A/h)
o External 12 V battery
• Communication
o USB (programming)
o 3G modem
o RS485 (ModBus-RTU)
• I/Os
o 4 x DI (with associated Counter, up to 8 Hz)
o 1 x DO
o 3 x AI (2 x 4..20mA; 1 x 0..5V)
• Consumption
o Sleep: 10 µA
o DI : 5 uA
o CPU: 10 mA
o GSM: 50 mA
• Autonomy
o Several years according to application (see EXCEL sheet for estimation)

10
To monitor RM2 module(s)
from a TBox, you use
‘ModBus Transactions’.

11 Remote Modules (RM2)

Remote I/Os. Five models


▪ RM2-530
▪ RM2-532
▪ RM2-540
▪ RM2-542
▪ RM2-562
Communication
▪ Ethernet, RS485, RS232
Configuration
▪ Online, through web pages
Protocol
▪ ModBus-RTU, ModBus/TCP
Embedded Web Server for config. and maintenance

Reference DIO From DIO: AI AI AO


DI (Counter) (4..20mA) (PT 1000) (4..20mA)
> 10 Khz or (0..10V)

RM2-530 16 3 8 - -

RM2-532 16 3 8 - 2

RM2-540 16 3 6 2 -

RM2-542 16 3 6 2 2

RM2-562 24 3 1 - 1

11
12 Powering TBox-MS32

Check the LED « On »


▪ CPU powered by « Vin » or a MS-PS-xxx
Check the LED « Run »
▪ 2 Hz: program runs (see more status below)
Check the LED of the communication ports
▪ Ethernet
• Lk: connected to a device (switch, router, PC, …)
▪ Serial
• Rx – Tx: reception – transmission of data
▪ MS-GSM-4G/LTE
• Network: SIM card connected to the network
• On: « Online ». With means it has received an IP address (4G/LTE, 3G, GPRS)
• Rx – Tx: reception – transmission of data

LED status during start-up sequence with LT2, TG2 and MS-CPU32 - Led: color (freq)
Steps MS-CPU32 -LT2 (-TG2)/MS-CPU32-S2

Starting Boot strap (See below) Run: red 1 flash


Starting UBOOT (See below) Run: red ON +- 3 sec.
Starting LINUX Run: - OFF +- 10 sec. Run: orange ON +- 6 sec.
Starting OS Run: green ON +- 4 sec. Run: green ON +- 4 sec.
After sending, installation of packages,
Ala / Run: alternatively Run: green/red alternatively
updating app. to SD or USB stick (Plug&Go)
Program runs Run: green 2 Hz Run: green 2 Hz

Other Status:
Status MS-CPU32 MS-CPU32-S2 -LT2 (-TG2)

CPU powered On: green On: green -


Program stopped Run: green ½ Hz Run: green ½ Hz Run: green ½ Hz
Factory program (“Failsafe”) Run: green 8 Hz Run: green 8 Hz Run: green 8 Hz
Alarm active Ala: red 8 Hz Run: red 8 Hz Run: red 8 Hz
Error on the BUS Err: red ON Err: red ON -
Loading application from SD -> CPU Err: red Run: red/green alternat. Run: red/green alternat.
LINUX stopped Run: - OFF Run: red ON Run: red ON
OS stopped Run: green ON Run: green ON Run: green ON
Error accessing SD card,
Err: red ON Err: red ON Run: red ON
NO SD card

12
TWinSoft Suite is free !
Upgrades too !

13 TWinSoft – Installation (1)

TWinSoft Suite
▪ TWinSoft + WebForm Studio (ver.1 and 2.0)
+ Report Studio + WebForm Viewer
▪ WebForm Viewer
• ActiveX components of the WebForms 1. Needed on the PC used to display HTM pages
RM-xxx Configurator
TConnect
▪ Device Manager, access centralization, automatic deployment
Tview = TBox Data Aggregator
▪ TBox mail
• Tools to display historical data attached to e-mail
Hardware Dongle Driver
▪ Driver to handle hardware license (dongle)

You must be Administrator to install software

13
14 TWinSoft – Installation (2)

Programs of ‘TWinSoft Suite’, in group of Programs “Semaphore”:


▪ Accessories
▪ Documentation
▪ Samples
▪ TBox drivers
▪ Report studio
▪ TWinSoft
▪ Webform Studio

14
TWinSoft runs without license,
but it is required to send a
program to the TBox on site.
The license is unlimited in time.

15 TWinSoft - Presentation

Tool to develop & adjust applications


▪ Locally or Remotely
• Hardware needed
▪ PC, Ethernet, connection to Internet, ...
• License
▪ Evaluation mode, hardware dongle, software license
• Project workspace, multi-windows
• Programs
▪ Ladder: graphical programming language
▪ BASIC: text language
▪ => User’s Guide ‘BASIC & LADDER’ for TBOX

Typical sequence to create a TBox application:

RTU
Properties

Resources

Tags

ModBus
Alarms Datalogging Process
Transactions

WebForm Report

15
16 Starting TWinSoft - License

▪ Without License, all features of TWinSoft/TBox are available.

▪ Starting TWinSoft without license, a message informs about the licences

▪ Sending a program to TBox without License, TBox stops after 2 hours

▪ When a program has been sent without license, the information is available doing a « RTU
identification »

RTU indentification:
TBox running in
« Evaluation mode »

To register a software License: Hardware license:

16
17 Starting TWinSoft – Dialing Rules

▪ TWinSoft needs « Dialing Rules » of Windows to be configured, to select a default country


where TBox is installed

▪ The Country is defined in « General RTU Properties »

▪ If Dialing rule is missing, TWinSoft pops up a message at each making of new application:

▪ Go to Windows Control Panel -> Phone and Modem

17
18 Starting TWinSoft - Wizard

New RTU Document Wizard

ONLY way to select the type of RTU

18
Press <Ctrl+Alt+O> to toggle
communication

19 Communication with TBox-MS

PC Communication Set up
▪ Local: through a RS232 port.
▪ TCP/IP (Ethernet,…): through a Ethernet card, 3G stick, …
▪ USB: LT2 and MS32-S2
▪ Modem: through a modem properly installed in Windows.

To test communication
▪ Use the menu: “Communication” → “RTU identification”
• Modbus station address of a TBox
• General information

Default settings via global reset--> See next

19
20 Windows Ethernet IP Setup

To configure TBox through Ethernet…

Ethernet of PC needs to be configured with FIX IP address


▪ TBox is not a DHCP Server !

IP settings of PC in the same subnet as IP of TBox

Possibility to declare two IP addresses !


▪ Allows defining an IP in the range 192.168.1.xx (factory IP address of TBox ethernet)

Go to Control Panel -> Network Configuration:

20
21 Windows USB Setup

To configure TBox through USB…


▪ TBox-LT2, -TG2, -MSCPU32-S2, TBox Nano

Fix IPs:
▪ PC: 10.8.10.2
▪ TBox: 10.8.10.1

Driver installed automatically during TWinSoft Setup.

Driver signed and therefore compatible with recent versions of Windows (W8,
W10)

21
To open/close compilation
‘Results’ window, press
<Alt+2>

22 Basic Notions

▪ Reset and Global Reset (see next)


▪ Save: Template or document (‘File’ -> ‘Save as…’)
▪ Compilation & Results + Test of available memory
▪ Sending of program
• Compilation + Send
• Automatic Set RTU time
▪ Upload program source into TBox
• Including webpages, reports, add-ons
▪ On-line Help
• for each window
• menu ‘Help’ --> ‘Help Topics’
• .chm format
▪ Accelerator keys
• Fast access to features

Compilation results:

Example of accelerator keys:


<ALT + 2>: open/close the result window
<F9>: compilation
<Ctrl F9>: send program
<Ctrl + T> : TBox properties

… (see more in TWinSoft help ->

22
It is possible to convert a
model of TBox into another
one in the same family
(see TWinSoft → Tools)

23 Global Reset (TBox-MS32, -LT2)

TBox-MS32, -LT2 run on LINUX


The software levels are:
▪ U-Boot
▪ LINUX
▪ OS (Telecontrol Stack)
▪ Application

Global Reset (TBox-MS32(S2), -LT2/TG2): to return to a factory, known configuration.


It does not delete the running program, it stops it. A single reset restarts the running program.
* Maintain Switch to ‘Reset’ position.
* Let LED flash 3 times green
* Release Switch
# LED Mode Communication Protocol LED « Run »
flashing

1 Restart As available in the application As available in 2 Hz


program (*) the application

3 Global Reset Serial=9600, N, 8, 1 ModBus-RTU ½ Hz


Program Ethernet (COM3)=192.168.1.99 ModBus/TCP
stopped Modem GSM/PSTN=available if properly
declared in the application (see LED CS) Firewall stopped
ModBus Station Address= 1

9 OS stopped, NO serial SSH, Ping, TFTP ON


LINUX Ethernet=192.168.1.99
running NO modem

11 U-BOOT Serial RS232=115200, N, 8, 1 Text, TFTP MS32: OFF


NO Ethernet MS32-S2: Red
NO modem LT2/TG2: Red

(*) Restarting the program has the following effects:


- Current alarm is stopped and the stack of alarms is erased.
- Data logging is maintained.
- Variables with init. values are reinitialized; other values are maintained.
- Process is restarted.
- Timers are reset (Status and Value).
- Counters are maintained (Status and Value).

23
24 Trace Log (1)

Provides system, modem, communication, file, … logs

Filtering at recording using Analog System Variables


▪ “LogClass” and “LogLevel”
▪ Tasks like « ModBus Transaction » communication or display of WebForm 2.0 may polute
the logs and be excluded from recording

24
25 Trace Log (2)

Another example, with « Restart Cause »:


▪ 0: Power Up
▪ 1: Reset
▪ 2->4: Reset in Stop Program (depending how many LED flashing)
▪ 5: Watchdog
▪ 10: New Application and OS
▪ 11: New Application
▪ 13: Started from TWinSoft

25
26 Diagnostics

Advanced diagnostics
http://<Ad_IP>/api/diag

• logviewer : tracelog (see above)


o Logviewer (last watchdog): in case there has been a watchdog, log before
the watchdog
• dmesg : hardware handling at LINUX level
• process: list of running LINUX processes
• ifconfig: configuration of IP interfaces
• netstat: list of open sockets
• syslog: log of connections
• …

26
TBox handles automatically
day light saving. Current
setting is available as a
Digital System Variable.

27 TBox-MS Properties (1)

General
▪ Type of RTU (TBox -MS CPU32, -LT2, ...)
• ONLY when creating a new document
▪ ModBus (Address) Station Number (1-254)
▪ Sub-Address (0-15). (Allows handling more than 254 stations. Handled only with software's
dedicated to TBox)
▪ Country where TBox is installed. Necessary to display the SMS systems of the country
concerned (--> Alarms)
▪ Size of the chronologies (--> Datalogging)
▪ Time zone
• All timestamped data is recorded with UTC time. Time zone is then required to convert UTC time to
local time

RTU properties are available from the Tool bar or from the menu bar: ‘File’ -> ‘RTU
properties’.

27
Look at the LED of each
communication port to check
their communication status.

28 TBox-MS Properties (2)

Add-on (MS-CPU32(-S2), -LT2/-TG2)

To communicate with specific protocols:


• SCADA (IEC-60870, DNP3, SNMP, OPC-UA, …)
• PLC (Siemens, Allen Bradley-DF1, Ethernet IP, …)
• IEDs (IEC-60870, DNP3, …)
• IIoT (MQTT)
• TEXT (ASCII)
• Card reader, Proximity reader, …(access control)
• Alarm systems
• Gaz devices
• Electrical Meters (DLMS, IEC-62056, …)
A folder with examples is accessible from the group of Programs -> Semaphore

Each add-on is available as a separate Setup.


On-line help available when configuring the add-on (Click “Properties”
after having selected the add-on):

28
29 TBox-MS Properties (3)

Protection
• Provides Security access for each port
• 3 levels of security: engineer, monitoring, read only
IP Security
• Firewall, HTTS, SSH password
Info
▪ Additional information on the application
• versioning, name of the programmer, …
Advanced
• Startup, Alarm headers, Remote Tags, Sampling Table, Temperature, …
Runtime Parameters
• Provides online changing of parameters

29
Look at the LED ‘CS’ to
check the cards have been
detected by the CPU.

30 Resources (1) - hardware

The hardware handled by TBox MS


▪ Cards
• Power Supply
• CPU
• Communication
• I/O
▪ Remote device
• TBox CPU-3 (Legacy TBox)
• ModBus device (TBox-MS, TBox-LT2/-TG2, RM2 or any ModBus equipment)

Click “Add an I/O Card”

After having inserted a communication card and sent to


TBox, a reset of TBox is required (com. driver at LINUX level)

30
31 Resources (2) - hardware

Architecture
▪ Cards --> Groups --> Channel

▪ CPU
• Group 0 : communication ports

▪ I/O card
• different types of I/O divided in groups

▪ Very easy for creating Tags


• double-click the ones you need in the list

Each card is divided in


Groups

31
To create multiple Internal
Variables automatically
indexed, use Copy/Paste

32 Resources (3) - Variables

In addition to physical I/Os, TBox provides several types of variable:


▪ Internal Variables
• analog, digital and text are created from the list of Tags
▪ System Variables
• general predefined functions (Analog and Digital)
▪ Communication Variables
• functions attached to a com. port (Analog and Digital)
▪ Timers
• timers (Global) used in BASIC/Ladder
▪ Counters
• counters (Global) used in BASIC/Ladder

32
33 Resources (4) – Com. Port GSM (4G/LTE/3G…)

GSM has 2 modes of working:


CSD (Data) or GPRS (=IP: 4G/LTE/3G/GPRS)

For IP (4G/LTE/3G/GPRS) configuration, you have to type the “apn” corresponding to


your SIM card account:

SIM Card insertion Example : insertion in TBox-LT2/-TG2:


At the back of the module
Format accepted: only Standard (or Mini)

33
34 Resources (5) – Com. Port Variables

Each communication port has two sets of communication variables


▪ DCV=Digital Communication Variables
▪ ACV=Analog Communication Variables

The list of variables is the same for all ports. Depending on the model of ports,
some will be useless

Those variables must be used to diagnose the port, to monitoring its status and
can even be used to reset the port

34
35 Communication Control: Com. Variables

▪ Use Communication Variables to monitor connection


• Signal level, IP address, Modem State, …

▪ Checking IP connection is a real issue

▪ One can never be 100% sure the connection is valid, even if


TBox has an IP address; the operator might have
disconnected the IP address

▪ The modem configuration provides an option to automatically


reset modem based on a period

▪ One can also reset the modem using communication variable « Comx_HookLink

▪ The ultimate solution is testing the communication with PING add-on (see next)

35
36 Communication Control: PING Addon

Addons are supplementary TBox features, not embedded in standard firmware.


Typically they are communication protocols, like DNP3, IEC-60870, PING, …
▪ They are available at https://servicedesk.ovarro.com/servicedesk/

With PING Addon, one can dynamically check connection and reset the modem
when needed

Example Pinging Google DNS IP address

Example: Pinging GOOGLE DNS address

36
Export and Import of Tags
allow manipulating Tags with
external editor (.cvs, .txt)

37 Tags (1)

Tag = any variable which is declared


Indispensable to all configuration (Alarms,
Datalogging, Ladder, Basic …)

Physical I/O (DIG=binary or ANALOG)


Internal Variables
▪ Analog & Digital & TEXT Internal Variables
System Variables
▪ Analog & Digital System Variables
Communication Variables
▪ Analog & Digital Communication Variables

37
From the list of Tags, right
click a Tag and select its
display format:
decimal, hexa, …

38 Tags (2)

Creation
▪ From the list of Tags: only way for internal variables (AIV, DIV)
▪ From the ‘Resources’ (Recommended and easiest way for I/O, System variables,
Communication variables)

Groups
▪ Tags can be sorted in different groups

38
39 Tags (3)

Definition
▪ Name (max. 15 characters).
▪ Type.
▪ Address.
▪ Format.
▪ ModBus address (see next)
▪ Comment.
▪ Initialization (start up value). If none the value is maintained.
▪ I/O scaling (min, max): to work with real value
Internal variables can only be created from the list of Tags

39
Any changing in the
program must be sent to the
RTU

40 Tags (4)

ModBus address (highest value is 64767)

▪ Each Tag has it’s own Modbus address


• Address can be the same for a Tag “Analog” and “Digital”
• Link to the outside world, TView, TWinSoft, Scada,…
• It becomes available after the program has been sent to the RTU

▪ System variables have a second HIDDEN Modbus address too, so that their value can be
visible without Tagging them
• It’s not possible to change that hidden address

▪ By default TWinSoft proposes a Modbus address


• Can be changed, except the hidden ones

Send Program

Modbus Address

40
41 Datalogging – Chronologies (1)

Recording ‘On event’ (“Sequence of Event”)


▪ 1 table for digital Tags
• Recording of positive and/or negative edge
• Size defined in the RTU properties  General  Dig. Chronologies
▪ 1 table for analog Tags
• Recording of a variation
• Size defined in the RTU properties  General  Ana. Chronologies
Resolution
▪ MS-CPU32(-S2), TBox-LT2/TG2 : 1 millisecond

Recording principle: ‘ FIFO ’

Digital Chronologies

Analog Chronologies

41
Recording in Chronologies
can be launched from
BASIC/Ladder.
Ideal to debug process.

42 Datalogging – Chronologies (2)

Digital Chronologies
▪ Tags to store events from rising and / or falling edge
▪ One record = 12 bytes (MS-CPU32(-S2), -LT2/TG2)
▪ Max. 32 000 records

Analog Chronologies
▪ Tag to store events from Variation. The value of the variation is based on the scale of the
input (see Tag definition)
• Recording in case of variation <> previous record
▪ One record = 12 bytes (MS-CPU32(-S2), -LT2/TG2)
▪ Max. 32 000 records

SRAM memory available


▪ MS-CPU32(-S2), -LT2/TG2: 768 kbytes

Handling:
Enabled: always recorded.
Disabled: never recorded.
PowerF: recording disabled in case of main power failure (see RTU
advanced properties)
DisCRD/DisCRA: recording disabled when the system variable
‘DisCRD’ or ‘DisCRA’ is at 1.

 The size of chronologies tables


are defined in RTU properties  General

Digital Analog

42
43 Datalogging – Sampling Tables (1)

Periodical recording
• Happens at regular interval
• According to the clock of the TBox (min. interval 1 second)
• Each tag is recorded in a separate table
Memory
• MS-CPU32(-S2), LT2/TG2: 1 MB of SRAM (expansion to 4 Mbytes with SD card)
• Regarding SD card, it is highly recommended to use Industrial SD card (our reference ACC-SDIN-1GB
and ACC-uSDIN-1GB)

• MS-CPU32(-S2) /-LT2 /TG2: SD card formated in FAT32

Recording principle: FIFO


Size of 1 record:
• 1, 2 or 4 bytes depending on the format of Tags recorded.

The Sampling Tables.


Sampling tables use ‘Periodical’ recording (minimum period = 1
second).
Recording in Sampling tables happens at regular intervals and does
not depend on signal variations; it uses the clock of the CPU to
determine the recording.
Only the date and time of the last recording are stored, and therefore,
Sampling Tables require less memory than chronologies do.
Previous time stamps are rebuilt while sending based on the period
and the last time stamp.

43
44 Datalogging – Sampling Tables (2)

Tag
▪ Only analog Tags
Period
▪ Minimum 1 second
Size / Duration
Type
▪ Min, Max, Average, Instant,
Incremental
Trigger
▪ Acts on recording :
(auto/manual - stopped/active)

Type of recording
TBox is able to execute calculations on a minimum time base of 1 second. The
result of the calculation is written in the sampling table after the selected period.
The value can be:
Minimum: minimum value during the period.
Maximum: maximum value during the period.
Average: average value calculated during the period. For each period a new
average is calculated.
Instantaneous: value at the moment of the recording.
Incremental: TBox records the difference between the current value and the
value at the moment of previous recording.

Trigger:
When used, there are 2 options:
- Synchronize each sample on external trigger
Trigger Frequency must fit with an existing period. Downloading and
therefore rebuild of database is carried out based on the period selected.
- No sampling when trigger = 0
Table is reset and recording activated at the rising of the Tag Trigger

TBox records the timestamp of the last record ONLY. When generating
data, upon request it then rebuilds the previous timestamps using the period.

44
45 Datalogging – Tools (1)

Test of available memory


▪ Quantity of memory still available displayed in the window ‘Results’ after compiling
▪ Run « Compilation »

Checking Recording
▪ « Communication »
-> « Retrieve … »

MS-CPU32(-S2), -LT2/TG2

Chronologies +
Stack of Events

Sampling Tables

45
46 Datalogging – Consolidating Data (1)

Using “PUSH” technology


Datalogging sent by e-mail or FTP:
▪ Datalogging content sent as .TMA file:
• File handled by TView
• File handled by TBox mail
• Data displayed in a chart or in a table.

▪ Datalogging sent in .CSV, .XML, .JSON:


• File handled with an external, proprietary SW.

Using time stamped protocols and events reporting


▪ IEC-60870, DNP3
• Those protocols have their own stack of events

▪ OPC UA (DA and HA)

Export to .csv, .txt

46
47 Datalogging – Consolidating Data (2)

Using “PULL” technology


Datalogging retrieved from a Top End
▪ WebForms (HTM pages)
• Accessing TBox as web server using a Browser displaying
▪ HTTP APIs
▪ TView
• Connecting to TBox, collecting, aggregating and displaying data in different views
▪ SCADA
• Existing SCADA supporting datalogging retrieval: Control Maestro, Wonderware, Panorama, CIMVIEW,
Topkapi, … using dedicated driver based on TComm.dll
▪ TComm.dll
• Allows developing any Windows driver or application based on C, C++, .NET or VB environment

Using time stamped protocols


▪ IEC-60870, DNP3
▪ OPC UA (DA and HA). TBox is « Server » (DA and HA)

47
48 Alarms – Principle

Alarm = connection to outside world

General principles
▪ Condition = Tag Digital or Analog.
▪ Recipient or group of recipients = SMS, e-mail, FTP, SD card, ...
▪ Data to send = Message or Report.
Mechanism of acknowledgment
▪ “Acknowledgment” vs. “Condition”: NO relation !
▪ Not Ack, Ack’ed and Auto-Ack’ed in the Events Table
Time tables
▪ Associated to the Recipient

In TBox we use alarms to carry on sending out of data. According to


the type of recipient it requires a dial-up modem or an IP connection.
Once the connection is established, data transfer is possible: SMS, e-
mail, FTP, ...

Condition:
The ‘alarm condition’ will activate the connection. It is a Tag that can be
the result of a complex Ladder/BASIC process.

Recipient:
Mobile number, e-mail address, FTP directory, SCADA, tel. number, …

Data:
Message or report that may include historical data.

Acknowledgment:
Here we consider if an alarm has successfully been transmitted by
TBox. There is NO relation with the condition that generates the
alarm.

48
49 Alarms – Configuration

Digital Alarm condition


▪ ‘Positive’ or ‘Negative’ edge condition
Analog Alarm condition
▪ ‘Max.’ or ‘Min.’ condition, with hysteresis
Configuration
▪ Recipient
▪ Message or report
▪ Filter
▪ Handling & severity
▪ Notify End of alarm
▪ Call All Recipients

49
50 Alarm – Sending a SMS

SMS service available according to the country


▪ See RTU properties

Alarm Condition
▪ Tag from which a variation generates the sending
of SMS

Recipient
▪ Mobile number of the recipient

Message
▪ Text to send. One can add the value of a Tag: $TagName$

50
51 Alarm – Sending a mail

In IP parameters, configure a SMTP Server


Alarm condition
▪ Tag from which the variation generates the sending
of e-mail

Recipient
▪ E-mail addresse(s) of therecipient(s)

Report
▪ File to send. Can be in .txt, .csv, .xml or .json.
Can include an image and historical data of TBox

51
52 Alarm – Sending a File (FTP)

In IP parameters, configure a FTP Server


Alarm condition
▪ Tag from which thevariation generates the sending
of File

Recipient
▪ A directory

Report
▪ File to send. Can be format .txt, .csv, .xml or .JSON.
Can include an image and historical data of TBox

52
53 Recipients (1)

Internal
▪ Alarm is not sent but saved in the stack of events
▪ Useful to test or log alarm conditions w/o communication

Modbus - Slave
▪ The TBox dials a ‘Master’ (typically a SCADA). The latter monitors the communication.
Example: Dialing TView
• recipient --> SCADA tel. number

Modbus - Master
▪ The TBox dials a ‘Slave’ AND monitors the communication via Remote Tags
• recipient --> TBox tel. number

Modbus-Slave connection:
TBox dials an equipment, and further doesn’t do anything else. The
control over the communication is taken by the Master which will
further handle the modem connection , sample, acknowledge and
finally will hang up communication.
Example: Dialing TView

Modbus-Master connection:
TBox dials another equipment (typically another TBox), and samples
variables (using ModBus transactions).
The TBox dialing will be responsible for hanging up (automatic or
manual using communication variables) and for acknowledgment
(using system variables).

53
54 Recipients (2)

SMS
▪ Services :according the country selected in RTU properties  General
• recipient --> recipient’s mobile number

Email
▪ SMTP server: previously created in IP Parameters  SMTP
• recipient --> e-mail address

FTP
▪ FTP server: previously created in IP Parameters  FTP
• recipient --> Directory at FTP Server where to send the files

54
55 Recipients (3)

NTP
▪ TBox synchronizes its clock with an NTP Server, previously created in IP Param.  NTP
• recipient --> the reference to the NTP server

POP3
▪ TBox connects to the POP3 server, previously created in IP Parameters  POP3
• recipient --> the reference to the POP3 server

EXTERNAL MEMORY
▪ TBox sends reports to the SD card (if present) or on a USB stick (–LT2/TG2 or MS-CPU32-S2)
• recipient --> a directory in the external memory

55
56 Recipients (4)

HTTP
▪ TBox send a HTTP POST to a Server.
▪ It sends a report (a .php script for instance)
• recipient --> a directory including a script

56
57 Recipients (5)

Error handling
▪ Number of tries, time out between tries

Redundancy
▪ In connection to ISP, sending e-mail and FTP
• if several STMP servers are created in the list, they are executed one after each other in case of error

Scheduling
▪ Based on Time tables (more info in next slides)

57
58 Recipient Groups

Groups
▪ Organizing recipients in groups
▪ Allows redundancy in sending messages
(=chain):
• In the Alarm condition, select a group of recipients
• Alarm sent to the first on the list, if failed, sent to the
second on the list, … until success.

▪ - Allows sending the same alarms to several Recipient (=link):


• In the Alarm condition, select a group of recipients
and check the option “Call all recipients”
• Alarm sent to all recipients of the group

When working with a group of recipients


Chain: (‘Call all recipients’ unchecked)
If TBox fails to send the alarm, it dials the following recipient
If not in the ‘time table’ of the recipient, it tries the next one in the list.

Link: (‘Call all recipients’ checked)


When ‘Call all recipients’ is checked, then all recipients in the group
will receive the alarm

58
59 Time Tables

Combination of:
▪ - Time slices
• 08:00 - 12:00
▪ - Holidays
• 1 January – every year

Time tables are used in scheduling of recipient


• Alarms  Recipients  scheduling

59
60 Messages

User specific messages


▪ Max 120 characters
▪ Try to avoid special characters (ö, é, à, …) in SMS (if there is one special character, max. 60 characters)
▪ Messages may contain values of Tags: digital, analog, Text. Two possible syntax:
• ~Tag~ : value when message is sent
• $Tag$ : value when alarm was created

▪ Possibility to send a string of characters (~-Tag~)

▪ A ‘Header’ can be defined for SMS message.


• RTU properties --> Advanced --> Alarms

TBox : The
RTU is in
mode AUTO

60
61 Alarms - Acknowledgment

Alarm in TBox = outgoing connection


Acknowledgement = monitoring of the connection

▪ Not-Ack: alarm generated and currently processed by the TBox

▪ Ack: connection succeeded


• SMS center, SMTP, FTP, POP3 and NTP Servers: automatically handled by the O.S.
• ModBus « Slave »: must be handled by the calling device. Automatically done in TView
• ModBus « Master »: must be handled within the process, using system variable [AlaRec]

▪ Auto-Ack: the connection failed after the number of tries, the TBox acknowledges itself the
alarm.
• System variable [AlaErr] is set to 1.

61
62 Alarms - Tools

Stack of events
▪ Displays list of Alarms and internal events with current status (FIFO principle)
▪ Establish a communication with the TBox
• Communication  Download  Alarms
▪ Shows also system events (start up, Reset, …)

System variables
▪ AlaOn : indicates that TBox is currently in alarm
• (=Led Alarm)
▪ AlaErr : indicates that TBox has generated an auto-acknowledgment (not possible to send
the alarm)

62
63 Alarms Table

Start Timestamp : Moment that the alarm condition appears ( it is the trigger + time defined by
the filter)
End Timestamp : Moment that the alarm condition disappears.

Message: The message or report (file name).

 System Events are between brackets.


Recipient: Name of the recipient.

 In case of system event there is no name.


Start: Status of the alarms handling at the moment the alarms table is downloaded.
Not ack: The alarm is still processed ( depends from tries, timeouts, severity,…)
Ack’ed: The alarm has been processed successfully.
Auto Ack: The alarm has not been processed successfully after all tries.

 system events are Aut Ack.


End: Acknowledgement status of the ‘Notify end of alarm’ condition ( See Notify end of alarm)
Not ack: there is a ‘notify end of alarm’ condition and it’s still in process
Ack’ed: the end of alarm notification was successfully processed
Auto ack: the end of alarm notification is NOT successfully processed,
OR, there is NO ‘notify end of alarm’

 When there is no ‘notify end of alarm’ condition selected, ‘auto ack’ is immediately filled.

filter sending Ack. End

End Ack.
condition

63
64 Report studio

64
65 Report studio (1)

Tool to develop reports dedicated to TBox


▪ Default formats is .txt
▪ Other formats available: .csv, .xml, .json
• When creating the file, type the corresponding extension
Uses of Reports
▪ sent to a printer (serial)
▪ sent as e-mail ‘body text’
▪ sent as file in FTP
▪ sent with POST HTTP
▪ sent to SD card, USB stick
Possibility to attach files
▪ Datalogging & Alarms
• When received as e-mail, datalogging file (.tma) can be displayed with ‘TBox mail’.
▪ Any other file (.csv, .txt, …)
▪ URL to a camera, to send Image

Dynamic objects Attachments, URL

Attachment file(s)

65
66 Report studio (2)

Add “Report” file (from the list of “Web and Report Files”)
▪ Recommended to be in the same directory as where the application file .tws is (extension .trep)
▪ Reports must be listed to be considered by TWinSoft
▪ Double-click on the report opens Report Studio
▪ Tags and datalogging must be configured in TWinSoft to be accessible in the report

Report Studio
▪ Add text by just typing in the window
▪ Notes (text in blue color) are not sent

Double-
click

66
67 Report studio (3)

Adding objects
▪ Tags
▪ Date & Time
▪ Grid (tables with several Tags)
▪ Table of Alarms
▪ Table of datalogging
▪ HTML form

Insert value of a Tag


Insert the Date
Insert the Time
Insert a grid of Tags
Insert a list of Alarms
Insert a single table of historical data
Insert a comment
Insert a multiple column table of historical data

67
68 Report studio (4)

Advanced Properties
▪ ‘unique file name’: important when sending report by FTP, to avoid overwriting
existing files.

Advanced properties of the Report:

Advanced Properties of the RTU:

68
69 Report studio (5)

To test the generation of the report, you can connect to TBox directly with a
browser
In the address bar, type the URL of TBox + the name of the report
▪ To display .trep report, replace the extension by .txt
• For instance, to display « report.trep » from TBox, type:
http://IP_ADDRESS/report.txt

• Example:

Example of testing the generation of


XML report using Firefox:

In the page, right-click and select View Page Source

69
70 IP Parameters (1) - Introduction

LAN Ethernet address: Properties in:


Resources -> ..card.. -> Group 0 -> Ethernet

Global configuration for


▪ Connecting to an ISP: Dial-up connection only
▪ Sending files (FTP)
▪ Sending e-mail (SMTP)
▪ Reading e-mail “object” (POP3)
▪ Time synchronization (NTP)
▪ Resolving “name” into IP address (DynDNS)
▪ Virtual server
▪ Bridge
▪ HTTP Post

70
71 IP Parameters (2) – ISP - FTP

ISP Configuration: Dial-up connection only (obsolete)


▪ Connecting to an ISP
• Dial Prefix: don’t change it unless the modem requires a particular configuration
• The outside line prefix must be defined in the modem properties (--> See the Resources)

FTP(S) Configuration
• Server name: mnemonic to use further in alarm recipients
• Server address (IP or name), connection, login
• Data encryption supported (with MS-CPU32(-S2)/-LT2/-TG2)

71
72 IP Parameters (3) - SMTP

SMTP(S) Configuration
▪ SMTP Service
• Used to send e-mail
• SMTP mail server
• e-mail Reply address: appears in the field “from” when the TBox sends an alarm. If empty it could be
considered as Spamming from an unknown sender
• Authentication if required, PLAIN and LOGIN authentication are supported
• Data encryption supported (with MS-CPU32(S2)/-LT2/-TG2)
• Multiple SMTP servers -> Redundancy (see Recipients)

72
POP3 can be used to ack.
SMS, e-mail or monitor
TBox.

73 IP Parameters (4) – POP3

POP3(S) Configuration
▪ POP3 Service
• Used to read “object” field of an e-mail
• POP3 server only
• Can be used to acknowledge an alarm and to monitor TBox by sending an e-mail
• Authentication: your e-mail address and password
• Data encryption supported (with MS-CPU32(-S2)/-LT2/-TG2)

73
74 IP Parameters (5) - NTP

NTP Configuration
▪ NTP Server
• Stands for Network Time Protocol
• Internet standard protocol to set automatically time of TBox.
• Examples of Servers:
o time.windows.com ; europe.pool.ntp.org

74
75 IP Parameters (6) - DynDNS

DynDNS Configuration
▪ Dynamic Domain Name Service
• Useful in GPRS connection with dynamic IP address
• Allows accessing a TBox through Internet using a name instead of its IP
o 1. when IP changes, TBox refreshes the DynDNS server
o 2. when the PC wants to access TBox, it uses its name
o 3. PC connects to DynDNS server which transforms the name into IP address

▪ Subscribe an account to www.dyndns.org or www.noip.com


▪ Declare this account in TBox (IP Parameters)
▪ Associate the account to the GSM
• Tab TCP/IP -> Advanced

75
76 IP Parameters (7) – Virtual Server

Virtual Server (= Ports Forwarding)


• TBox = Router (MS-CPU32(-S2)/-LT2/-TG2)
• Allows to connect to an IP device through TBox
(IP Camera, PLC, TBox...)
• It uses incoming TCP/UDP port to forward data
• Virtual server is active on all IP interfaces
(listening on all IP ports)

76
77 IP Parameters (8) – Bridge configuration

Bridge IP Configuration
• With MS-CPU32(-S2)/-LT2/-TG2
• Allows to merge IP ports as one port, with one IP address.
• The ports bridged act as an IP switch.
• All frames arriving on a port are forwarded to the bridged port(s)
• The bridge becomes a new communication port, with its own communication variables (DCV & ACV)
• Support Bonding and Spanning Tree
1. Declare the bridge
2. Associate the bridge to the ports concerned, through their configuration

77
78 IP Parameters (9) – Bridge example

Using Ethernet ports of MS-CPU32(-S2) as a Switch


Cabling a camera directly to TBox
Both Ethernet are configured on the same Bridge

192.168.1.254

192.168.1.80

192.168.1.99

78
79 IP Parameters (10)

HTTP(S) Server Configuration


▪ TBox = HTTP Client (with MS-CPU32(-S2)/-LT2/-TG2)
▪ Allows to send files (=report) through HTTP protocol
▪ TBox uses the command POST on the same way as a web form does when you post a file on
internet
▪ On the Server, a script PHP or ASP (or other) is required to receive the file
(see help in TWinSoft)
▪ Compared to FTP, HTTP post is simpler in term of security (firewall) because only one
socket is required (2 sockets for FTP transfer)
▪ Can be used to send Tag values using HTTP Post
▪ TLS/SSL supported (HTTPS)

79
80 TCP/IP Debugging

Communication from a PC to TBox:


▪ Wireshark: www.wireshark.org

Communication From TBox to …outside


▪ Addon « TCPDump »
• Records TCP/IP communication in a file with wireshark format
• The log is by default in director /tmp and can be retrieved using WinSCP
o http://winscp.net/eng/download.php
• With GPRS/3G/4G/LTE communication, Addon must be triggered only when IP connection is
established (does not work at PPP level)

80
81 IP Security (1)

Configuration from RTU Properties


Tab IP Security
▪ Firewall
• When activated, make sure you create « exceptions » (see next topic)

▪ HTTP session authentication


• Allows controlling each incoming HTTP connection individually, using a session ID (cookie)

▪ SSH password
• SSH is an encrypted protocol used as console protocol to access TBox at LINUX level.
• You cannot have a « root » access level; only a « user » level

81
82 IP Security (2) - Firewall

Firewall Configuration
▪ Allows to block incoming IP access to TBox (Ethernet, GPRS/3G4G/LTE, XDSL)
▪ Must be activated in « RTU properties -> IP Security »
▪ When firewall is activated, ALL IP incoming connection is blocked. Make sure to create
exceptions to allow connections.
▪ Exceptions based on:
• Protocol
• Port TCP
• IP address
• Communication port
• Mac Address
• Limit: max. connections per second, against brute force attack
SSH password
▪ Login to access TBox-MS-CPU32(-S2) and –LT2/TG2 in terminal mode with SSH protocol
(using PuTTY for instance)
▪ In “user” mode only

82
83 IP Security (3) – Open VPN

OpenVPN Configuration
▪ TBox = Client or Server OpenVPN in mode routing
(with MS-CPU32(-S2)/-LT2/TG2)
▪ Supports up to 4 clients and 1 server simultaneously
▪ When TBox is server, it supports dozens of client connections
▪ Authentication is based on certificates generated by OpenSSL.exe. (Procedure available on
demand)
▪ As OpenVPN connection is considered as a communication port in TWinSoft, it becomes
accessible for any kind of connection: ModBus Transactions, IP services, …
▪ Communication Variables available to trace the connection

83
84 Runtime Parameters (1)

Provide a dynamic access to parameters (mobile number, e-mail address,


datalogging handling, …), using Tags.

When available for a configuration, a tab "Runtime Parameters" is available.

From the tab “Runtime Parameters” you see parameters that can be associated
to a Tag.

84
85 Runtime Parameters (2)

A Tag can be associated to the parameters.


▪ Check the format of the Tag required (Text, Byte, Word, Float)

As the parameter is now associated to a Tag, it has a ModBus address and


therefore be modified from a WebForm, a SCADA, …

Changings are maintained in case of power cycle and reset

Changings are erased in case of sending a new program. Parameters returns as


configured in the TWinSoft application

85
86 Modbus “Master” Communication

General principles of ModBus “Master” communication:


▪ MASTER / SLAVE(S) communication.
TBox being “Master” (or “Client”)
▪ “Master” notion linked to a “port” (NOT to a station)
▪ Only ONE Master per serial communication port (ModBus-RTU and ModBus ASCII)
▪ “Master” Reads and Writes. Slave(s) need no specific configuration
▪ Point to point network : Modem to Modem, RS232
▪ Multipoints network : RS485, Ethernet
▪ Each station in a network needs DIFFERENT ModBus station addresses

Data exchanges are carried out using « ModBus transactions »

Example:
TBOX connected through Ethernet to a SCADA : Slave operation
TBOX connected through RS485 with other TBox(s): Master
operation.

86
87 ModBus Transactions (1)

▪ Used to execute ModBus communication with Slave(s)

▪ A ModBus transaction associates a Tag of the TBox (=Master) to an address in the slave, to
write to this address, or to read the content of this address

▪ One ModBus transaction = one data exchange between the Master and one slave

▪ ModBus transactions are executed sequentially on a serial port but simultaneously on


different ports and IP interfaces (max. 64 simultaneous ModBus contexts)

▪ Use as much as possible ‘Block communication’ (quantity > 1)

Sequence for configuring ModBus transactions:


The configuration is done in the “Master”:
• From the ‘Resources’, add a remote device
You need to know its “Station address”, its configuration settings
• Make sure you have created the Tags you need to exchange data with
the Slave(s):
‒ Tags that will contain data read in the slave(s)
‒ Tags that you want to write to the slave(s)
• You go to the folder “ModBus Transactions” to associate Tags with a
remote device (=slave) and ModBus addresses of the variable of the
slave
• Any communication port can be used to execute Modbus transactions

87
All timing parameters can be
accessed from the Advanced
properties of the com. port

88 ModBus Transactions (2)

Creating a remote device


Add an I/O Rack and select: “Modbus Device”
▪ Name
▪ Address (ModBus station address)
▪ RTU Port
▪ Trigger: Digital Internal Variable
• To activate the communication.
Can be controlled by the program or by Periodic Events

88
To communicate with
different conditions, you
create several Remote
Devices with different
Triggers
89 ModBus Transactions (3)

Creating a ModBus transaction


▪ Select the Tag

▪ Operation : Read / Write and Quantity


If quantity > 1, Tags of successive addresses to successive addresses in
Remote device)

▪ External Source:
• Device: the slave
• Type: format of the variable to
read/write
• Address: of the variable in
the slave

Types of operation (--> correspond to ModBus Functions):

There are several Modbus functions according to the operation (read / write / analog /
digital / single / multiple). Check with the Remote device you will communicate with.
About the address:
This is the Modbus address of the variable in the remote device, from which you want to
read, or write to.
A read operation copies the value at the address in the remote device into the Tag defined
in the ModBus transaction.
A write operation copies the value of the Tag defined in the Modbus transaction to the
address of the variable in the remote device.
Those variables in the remote device do have their own Modbus addresses. Do not mix up
with ModBus addresses of the Tags of the TBox; there is no link.
Make sure you associate identical formats: Digital with Digital, Float with Float, …

89
90 ModBus Transactions (4) - Exercises

Master “1” Slave “2”

Tags Addresses of Variables

Remote Tags

Example:
Four transactions to exchange the following data between “Master” and “Slave”

Read 6 x Time variables of “Slave”

Read
6 x internal “Int” or “Word” 6 x addresses of Time Variables

Read 8 x Digital Inputs of “Slave”

Read
8 x internal “Digital” 8 x addresses of Digital Inputs

Write 8 x Digital Input of “Master” into 8 x Digital Output of “Slave”

Write
8 x Digital Inputs 8 x addresses of Digital Outputs

Read 4 x Analog Inputs of “Slave”

Read
8 x internal “Float” 4 x addresses of Analog Inputs

90
91 ModBus Transactions (5) - Tools

In case you have doubt about the remote device communicating with TBox, you
can use « ModBus simulator » to test different functions, different format,
different addresses, quantities, …

It provides a window with the detail of the telegram

From the web site


▪ https://servicedesk.ovarro.com/servicedesk/

Available is serial version (ModBus-RTU) and IP version (ModBus/TCP)

ModBus
telegram

91
92 Periodic Events

Possibility to execute event(s) independently from any other condition


▪ Datalogging, Alarms, any process, …

Digital Tag is used


▪ TBox sets the Tag at well defined time intervals
▪ TBox Resets the Tag when all tasks have been launched

The task(s) associated to the Tag are automatically executed


▪ Alarm, Datalogging, Remote device trigger, Ladder/BASIC, ...

Tag Digital
(Internal Variable)

92
93 Access Protection - Introduction

Principle of protection
▪ Protection against programing and changing values in ModBus
• Each port individually can be protected
▪ Protection at HTTP level (when displaying webform)
▪ 4 access levels:
• 3 = Engineer: sending of program & monitoring.
• 2 = Read/Write: monitoring.
• 1 = Read only
• 0 = Not logged in
Configuration (from RTU properties -> tab ‘Security’)
▪ Protection based on a global code
▪ Protection based on a list of users
Additional Protection
▪ SMS to protect against control through SMS
▪ FTP (to provide access SD card as “Client” FTP)

93
94 Access Protection – Global Code

Two levels of global code


▪ Legacy: password based on 4 x HEXA characters
▪ Enhanced: password based on max. 8 x any characters

Utility ‘Password generator’


▪ Needed to calculate the passwords:
• Global code + name + access level = a password
• User Id: to check user connected using Com. Variable

Login
▪ in TWinSoft, in Browser (if HTTP protected
• Login: name + password + global code (in TBox) = an access level

TWinSoft Login Window

94
95 Access Protection – List of Users

You define your own list of Users with


▪ Any name
▪ Any Password
▪ An access level

95
96 Document Protection

Document protection
▪ Once Access Protection is activated, the document is also protected and requires a login at
opening:

▪ Supplementary protection on opening a document, based on a password and not anymore


on Global code

96
Take a look at examples:
Start -> Programs ->
Semaphore -> Samples

97 Ladder & BASIC

Ladder (IEC1131-3)
▪ Graphical language
▪ Preference for Boolean Operations
▪ Advantage: displays ‘on-line’ status

Basic
▪ Text Language
▪ Preference for making calculations
▪ Advantage: provides more advanced mathematical functions

BASIC & Ladder can be used together calling each other

97
98 Task Sequence of Process

Importance of process cycle time

▪ Physical inputs are copied before starting the program cycle (Ladder/Basic)
▪ Physical outputs are written at the end of the cycle
▪ Internal variables (global and local) are handled immediately within the cycle
▪ Datalogging and Alarms
• Conditions checked ‘on events’
▪ Sampling tables
• Conditions checked every new second, checked at the end of the cycle
▪ ModBus Transactions
• Handled at the end of the cycle

Timing sequence in regards to Ladder/BASIC cycle:


- Reading digital and analog inputs and copy to internal variables
- Execution of the code and use of internal variables for digital and analog outputs
- Writing of internal variables to physical outputs

Reading physical inputs

1st cycle of BASIC/Ladder is executed

At the end of the cycle, writing physical outputs


and analog outputs

If new second, handling of sampling tables.


Analysis of ModBus (Master) Transactions.

….

98
99 Ladder (1)

Working modes
▪ Edition, insertion, visualization
▪ Values and status ‘ on-line ’

Comment
Ladder Toobar Label
New Rung

Rung
Input Compilation
Contacts

Mathematical
Output
Block
Contacts

Function, Jump
Function Block,
Program

Functions

99
100 Ladder (2)

Input Conditions
▪ Input contacts
▪ Standard functions (analog comparison, …)
▪ Combination of conditions (AND, OR, ...)

Output Actions
▪ Relays for digital outputs
▪ Mathematical block

Input Contacts and Output Relays

100
101 Ladder (3)

Utilities
▪ Comments
▪ ‘ Watch ’ window <ALT + 3>
▪ Cross references: all references of a Tag
• from the list of ‘ Tags ’
• Right-clicking a Tag in the Ladder
▪ « Find Tags » from Main Menu -> Edit

101
102 Ladder (4)

Timers (see User’s Guide Basic & Ladder -> Timers)


▪ Single-shot (with reset)
▪ Mono-stable (without reset)
▪ Integral (measurement of a period with accumulation)
▪ On-delay (measurement of a period without accumulation)

Counters (see User’s Guide Basic & Ladder -> Counters)


▪ Up and Down
▪ Ring counter

102
103 Ladder (5)

Each timer function has 3 associated variables


▪ Value: current timer value in ms. (AIV, 32 bits).
▪ Preset: timer preset in ms. (AIV, 32 bits).
▪ Status: status of the timer (DIV)
• Mandatory to check the timer status
▪ Tags ‘Preset’ and ‘Value’ are optional
• Value and Preset can be monitored from the process if required

Timer Time basis


▪ In ladder function: ss.mmm (second.milliseconds)
▪ As Tag: AIV in 32 bits unsigned format, displaying ms.

Example with ‘Single Shot’ timer

103
104 Ladder (6)

Mathematical functions
▪ Assignments
▪ Arithmetic operations
▪ Comparisons
▪ Bit manipulations
▪ Boolean operations
▪ Conversions + Indirect
▪ Miscellaneous

104
105 Ladder (7)

Functions
▪ Standard
• Analog

• Special

• Timers

• Counters

• Mathematics (IEC 1131)

▪ Folder ‘This File’


• Contains POU configured in the application (Program, Function and Function Block)
• POU ‘Function’ and ‘Function Block’ can be saved in Libraries
(see later on during the training)

105
106 Ladder (8)

System & Communication Variables


▪ Analog and Digital
▪ Pre-defined functions (test modem, test alarms, test IP service, time variables, …)
▪ Initialization using DSV: [PrgRun] with a ‘positive edge’ input contact
▪ System Variables can be used directly in Ladder, without being Tagged (appear in brown
color)
▪ Communication Variables must be Tagged to be used in Ladder

106
During Basic edition, press
<F7> to open the list of Tags

107 BASIC (1)

Basic is not case sensitive

All variables must be declared


▪ Either in the List of Tags (Global Tag)
▪ Either in the List of POU Tags (Local Tags)
▪ Either with Dim Statement (Local Tag)

Comments
▪ REM: at the beginning of a line
▪ ’ : anywhere in the line

Statements and 'Line Feed'


The statements can be separated by a 'Line Feed' or by a colon ‘:’
Example with several assignments:
a=50
b=c
Or
a=50 : b=c
The statements must be on the same line.
Example with if .. then:
if a=50 then
b=c
endif

107
108 BASIC (2)

Constant Expressed in
▪ Decimal : a = 123456
▪ Hexadecimal : a = &H1E240
▪ floating : a = 123.456

Dim Statement
▪ Used to create local tags inside a program
▪ Bool, Byte, Integer, Word, long, Dword, Single

Types available Types’ description


BOOL 1 bit – Digital
BYTE 8 bits – Unsigned
INTEGER 16 bits – Signed
WORD 16 bits – Unsigned
LONG 32 bits – Signed
DWORD 32 bits – Unsigned
SINGLE 32 bits - Float IEEE 754

Examples
Dim Temperature as Single
Dim input2 as Bool
Dim table[4] as Word

108
During Basic edition, press
<F8> to open the list of
Functions

109 BASIC (3)

Colors
▪ Comment: ‘green’
▪ Constant: ‘red’
▪ Keyword: ‘blue’
▪ Variable: ‘black’

Keywords
▪ Avoid Tag names similar to Basic Keywords

Tools
▪ <F7>: open list of Tags
▪ <F8>: open list of Functions

Pressing <F8>:

109
110 BASIC (4)

Suffix for variables


• @: Global Tag second@
• #: Local Tag second#
• !: System variable second!

Order of resolution for Tags when No suffix defined


• First Local Tag
• Then Global Tag

Precautions
• When declaring local Tags or arguments to functions and function blocks, do no use the same name
as of global Tags
• Tags “value” and “preset” of a timer / counter must be of format DWord

110
111 BASIC (5)

Goto
▪ Label can be declared anywhere in a program
▪ Example: Alarms:
The colon indicates it is a label
Syntax
▪ GOTO label
▪ Example: GOTO Alarms
Precaution
▪ Avoid endless loop… Watchdog when cycle time reaches 1 second

111
112 Timer in BASIC (1)

Syntax
▪ Single Shot
• TimerSS (Name, Start, Preset)
▪ Monostable
• TimerMS (Name, Start, Preset)
▪ Integral
• TimerIN (Name, Start, Preset)
▪ On delay
• TimerOD (Name, Start, Preset)

Preset must be a constant, with time expressed in second.ms.


Example: 500 ms. is indicated 0.5

112
113 Timer in BASIC (2)

Timer function
Syntax
▪ Name: of the timer created previously in the ‘Resources’
▪ Start: Tag or expression that activates the timer (Bool)
▪ Preset: of the timer in Seconds: Constant float (seconds.ms)

Variables of Timer
▪ For each timer, 3 Tags can be associated:
• STATUS - VALUE – PRESET
▪ Dynamic Preset: declare a Tag in the timer instance. It has priority on the preset declared in
the call of the Function

timerss (timer0, valid, 2.5)


if triggerpos(timer0_status) then
inc(counts)
endif

The Tag ‘valid’ activates the timer ‘timer0’ during 2.5 seconds.

If a Tag ‘Preset’ is associated to the instance of the Timer (in ‘Resources’), it


has priority on the Preset defined in the function.
Trick to detect a dynamic preset: type ‘0’ or ‘9999’ as Preset in the call of the
Function
timer_Preset = var1
timerss (timer0, valid, 0)
if triggerpos(timer0_status) then
inc(counts)
endif

113
114 Counter in BASIC

Counter function
Syntax
▪ CountUP (Name, Start, Preset)
▪ CountDown (Name, Start, Preset)
▪ CountRing (Name, Start, Preset)

• Name: of the counter created previously


• Start: Tag or expression that activates the counter (Bool)
• Preset: of the counter in number of pulses

Variables of Counter
▪ For each counter, 3 Tags can be associated:
• STATUS - VALUE – PRESET

114
To execute the program
one cycle at a time, use
Digital System Variables
[PrgEnb]=0 and [PrgOnc]=1

115 Program Organization Unit (1)

POU (Program Organization Unit)

▪ POU Program ( sub-program)


▪ POU Function ( calculation)
▪ POU Function Block ( procedure, ‘functionality’)

POU Program ‘MAIN’ is the ‘head’ program.


It is unique and its name cannot be changed

Language of « Main » can be changed.


Make sure it is empty before changing the language …

115
116 Program Organization Unit (2)

TAGS

▪ Global Tag: it is a physical I/O or AIV, DIV, system or communication variables that can be
used in all POU.
It corresponds to a ‘public’ variable.
• Global Tags are listed into the folder “Tags” in TWinSoft. System Variables can be used in
Ladder/BASIC without being Tagged, but are considered as global Tags.

▪ Local Tag: it is a NON specific variable used as temporary variables.


Can be used only in the POU where it has been declared.
• Local Tags are listed in top of the POU

Global

Local

116
PID function blocks are
available in a library (PID.lib).
See PID documentation in
TWInSoft directory

117 Program Organization Unit (3)

Creation of a Sub-Program
Creation of a Function
▪ Result is ONE output (bool, word, long, float)
▪ Inputs to be created in the list of POU Tags
▪ Inputs represent arguments that will be replaced by Tags when calling the function
Creation of a Function Block
▪ Outputs & Inputs to be created in the list of POU Tags
▪ Inputs and outputs represent arguments that will be replaced by Tags when calling the
function block

117
118 Calling POU – in Ladder

Add a ‘Program’
▪ Select in the folder ‘This File’
▪ Appears as a block
▪ Close the line

Add a ‘Function/Function Block


▪ Select in the folder ‘This File’
▪ Declare Tags (local or global) to the Inputs / Outputs of the Function/Function Block

118
119 Calling POU – in BASIC

Program
▪ Syntax: call name_of_program
Function
▪ Syntax: Result=Function(Arg1, Arg2, Arg3, …)
• Result: Tag that receives the result of the function (output)
• Function: Name of the function
• Arg: Input Tags associated to the arguments, to be entered in the order the tags of the function have
been created
Function Block
▪ Syntax: Call Instance (Arg1, Arg2, Arg3,…)
• Instance: The name given to FB in the program list of Tags
• Arg: Input and output Tags associated to the arguments, to be entered in the order the local Tags of
the function have been created in the list of POU Tags.

119
120 Library (1)

POU that can be saved


▪ Function
▪ Function block

Save in an external file (Library .LIB)


▪ ‘Tools’ -> ‘Library manager’
▪ Password protection available

120
121 Library (2)

Import of library in any TWinSoft document


▪ (‘File’ -> ‘Library’)

Libraries available
▪ When present in the directory of TWinSoft
▪ When present in the directory of the opened TWinSoft application (.tws file)

121
122 Utilities & Miscellaneous

Management of Languages
▪ ‘Tools’ -> ‘Language’
Ladder diagram options
▪ ‘Tools’ -> ‘Ladder diagram’
Send OS (=firmware)
▪ ‘Communication’ -> ‘Send to TBox’
Pack & Go
▪ To backup a project
▪ To send a project without license and without opening TWinSoft (must still be installed on
the PC
▪ ‘File -> ‘Pack & Go’ (to create the .tpg file)
Plug & Go
▪ To store the project on SD card as one file
▪ ‘File -> ‘Plug & Go’ (to create the “Repository” dir.)

122
123 Start up

Start up means:
▪ Powering TBox
▪ Resetting TBox
▪ Sending new program

Menu available from RTU properties --> Advanced


▪ Reset all physical outputs
▪ Wait start of condition
▪ Configuration of a Tag “Stop”, typically the STOP button

Initial Value of Tags


▪ See Tag configuration

123
124 Advanced Properties (1)

Available from:
RTU Properties -> Advanced

Alarms
▪ Event & Alarm Stack Sizes
▪ SMTP and GSM Message headers

Sampling Tables
▪ Defaults for daily, weekly, monthly recording
▪ Recording on SD card

Temperature
▪ - Unit in degrees C, K or F

124
125 Advanced Properties (2)

TCP/IP
▪ IP address for INCOMING calls (dial-up)
• TBox MS uses the first address in the range, the following applies to the dialing equipment
• Check the IP address subnet is different from the LAN IP address subnet of the dialing PC

▪ NAT, Virtual Servers


• Give access to defining routes based on Protocol, IP address, TCP port

Ports
▪ Default TCP port numbers can be modified

125
126 Advanced Properties (3)

ModBus Transactions
▪ Reset of the trigger of the remote device only if success
▪ Keep socket open

Plug & Go
▪ Activate handling of Plug & Go
• Backup of the project on SD card
• Reading a project from the SD card
• Backup of global Tag values on SD card
• Backup of datalogging on SD card

126
Call your home page ‘index’.
It’ll make access easier as it
is known as default name by
IE.

127 TBox – Web Server

Web Server = Equipment hosting HTML pages


Point to point connection, in a LAN or through ‘WWW’
In TBox: HTML pages + associated WebForms

WebForm Editor
▪ WebForm Studio 2.00
• TBox-MS32(-S2) and TBox-LT2/-TG2
• Based on SVG, AJAX and JSON technologies
• HTML 5
• Supported on all platforms and by all browsers

127
128 WebForm Studio 2.0 (1)

128
To resize a WebForm, select
in “.twa” object the properties
Layout
-> “Height” and “Width”

129 WebForm Studio 2.0 (2)

Add “Web” file (from the list of “Web and Report Files”)

TWO files are created (.twa and .htm)


▪ Recommended to be in the same directory as where the application file .tws is
▪  Files must be listed to be considered by TWinSoft

Double-click the .twa file to open WebformStudio 2.00

Double-
click .twa
file

129
130 WebForm Studio 2.0 (2)

WebForm Editor. It creates 2 files per page


▪ A .htm file which calls a .twa file (the webform 2.00)

WebForm uses SVG, AJAX and JSON


▪ Any platform with any browser can be used to display HTM files

Library of Objects
▪ Industry, Gauges, Symbols, Electricity, …
▪ Direct access to TBox Tags

Easy to use

130
It is not possible to simulate a
script. One has to send the page
into TBox and use the debugger of
your browser. For instance
“Firebug” with Firefox.
131 WebForm Studio 2.0 (4)

Open to JavaScript

Using script:
▪ Access to Events: OnLoad, OnValueChanged, OnClick, …
▪ Dynamic changing of colors
▪ Make objects visible/invisible
▪ …

Open the
javascript editor

Select the Object

131
132 WebForms 2.0 Demonstration

http://demo.tbox.ovarro.com

132
133 TConnect (Introduction)

TConnect is a Device Manager


• You have TBox with GSM and don't know how to access it
• You have camera, Remote Module, any IP device hosting web pages you wish to access easily
• You have an existing SCADA and don’t know how to connect to TBox
• You want to reprogram your TBox, without worrying about the connection
• You want to get rid of Dynamic DNS service to access your TBox
• You want to get rid of OpenVPN configuration
• You want to easily access TBox configured in DHCP
• You want to deploy applications and users automatically

… and you want all access to be secured …

TConnect is for you !

133
134 Monitor32

Monitor32 is a tool that reinitiliazes TBox to factory settings


▪ Available for MS-CPU32(-S2), LT2, TG2
▪ Requires ethernet and serial communication to TBox
▪ Requires a TFTP server
▪ All packages are sent to TBox
▪ DO NOT RESET or CYCLE POWER untill the LED « Run » flashes
▪ The process can last more than 20 minutes

134
135

Question & support:

Internet:
▪ www.ovarro.com

Support and Download:


▪ https://servicedesk.ovarro.com/servicedesk/

e-mail:
[email protected]

135

You might also like