TWinSoft Training Uk 20220301 Ovarro
TWinSoft Training Uk 20220301 Ovarro
TWinSoft Training Uk 20220301 Ovarro
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
3
4 General Structure of an Application
TConnect
▪ Tool for connecting to TBox
4
5 Presentation
Example:
Exemple:
Power Supply
GSM 4G/LTE
5
6 TBox-MS32-S2
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)
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)
10
To monitor RM2 module(s)
from a TBox, you use
‘ModBus Transactions’.
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
LED status during start-up sequence with LT2, TG2 and MS-CPU32 - Led: color (freq)
Steps MS-CPU32 -LT2 (-TG2)/MS-CPU32-S2
Other Status:
Status MS-CPU32 MS-CPU32-S2 -LT2 (-TG2)
12
TWinSoft Suite is free !
Upgrades too !
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)
13
14 TWinSoft – Installation (2)
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
RTU
Properties
Resources
Tags
ModBus
Alarms Datalogging Process
Transactions
WebForm Report
15
16 Starting TWinSoft - License
▪ When a program has been sent without license, the information is available doing a « RTU
identification »
RTU indentification:
TBox running in
« Evaluation mode »
16
17 Starting TWinSoft – Dialing Rules
▪ If Dialing rule is missing, TWinSoft pops up a message at each making of new application:
17
18 Starting TWinSoft - Wizard
18
Press <Ctrl+Alt+O> to toggle
communication
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
19
20 Windows Ethernet IP Setup
20
21 Windows USB Setup
Fix IPs:
▪ PC: 10.8.10.2
▪ TBox: 10.8.10.1
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
Compilation results:
22
It is possible to convert a
model of TBox into another
one in the same family
(see TWinSoft → Tools)
23
24 Trace Log (1)
24
25 Trace Log (2)
25
26 Diagnostics
Advanced diagnostics
http://<Ad_IP>/api/diag
26
TBox handles automatically
day light saving. Current
setting is available as a
Digital System Variable.
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
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
31 Resources (2) - hardware
Architecture
▪ Cards --> Groups --> Channel
▪ CPU
• Group 0 : communication ports
▪ I/O card
• different types of I/O divided in groups
31
To create multiple Internal
Variables automatically
indexed, use Copy/Paste
32
33 Resources (4) – Com. Port GSM (4G/LTE/3G…)
33
34 Resources (5) – Com. Port 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
▪ 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
With PING Addon, one can dynamically check connection and reset the modem
when needed
36
Export and Import of Tags
allow manipulating Tags with
external editor (.cvs, .txt)
37 Tags (1)
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)
▪ 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
Send Program
Modbus Address
40
41 Datalogging – Chronologies (1)
Digital Chronologies
Analog Chronologies
41
Recording in Chronologies
can be launched from
BASIC/Ladder.
Ideal to debug process.
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
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.
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)
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)
Checking Recording
▪ « Communication »
-> « Retrieve … »
MS-CPU32(-S2), -LT2/TG2
Chronologies +
Stack of Events
Sampling Tables
45
46 Datalogging – Consolidating Data (1)
46
47 Datalogging – Consolidating Data (2)
47
48 Alarms – Principle
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
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
49
50 Alarm – Sending a SMS
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
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)
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.
58
59 Time Tables
Combination of:
▪ - Time slices
• 08:00 - 12:00
▪ - Holidays
• 1 January – every year
59
60 Messages
TBox : The
RTU is in
mode AUTO
60
61 Alarms - Acknowledgment
▪ 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.
When there is no ‘notify end of alarm’ condition selected, ‘auto ack’ is immediately filled.
End Ack.
condition
63
64 Report studio
64
65 Report studio (1)
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
67
68 Report studio (4)
Advanced Properties
▪ ‘unique file name’: important when sending report by FTP, to avoid overwriting
existing files.
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:
69
70 IP Parameters (1) - Introduction
70
71 IP Parameters (2) – ISP - FTP
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.
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
75
76 IP Parameters (7) – Virtual Server
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
192.168.1.254
192.168.1.80
192.168.1.99
78
79 IP Parameters (10)
79
80 TCP/IP Debugging
80
81 IP Security (1)
▪ 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)
From the tab “Runtime Parameters” you see parameters that can be associated
to a Tag.
84
85 Runtime Parameters (2)
85
86 Modbus “Master” Communication
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)
▪ 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
87
All timing parameters can be
accessed from the Advanced
properties of the com. port
88
To communicate with
different conditions, you
create several Remote
Devices with different
Triggers
89 ModBus Transactions (3)
▪ External Source:
• Device: the slave
• Type: format of the variable to
read/write
• Address: of the variable in
the slave
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
Remote Tags
Example:
Four transactions to exchange the following data between “Master” and “Slave”
Read
6 x internal “Int” or “Word” 6 x addresses of Time Variables
Read
8 x internal “Digital” 8 x addresses of Digital Inputs
Write
8 x Digital Inputs 8 x addresses of Digital Outputs
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, …
ModBus
telegram
91
92 Periodic Events
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
Login
▪ in TWinSoft, in Browser (if HTTP protected
• Login: name + password + global code (in TBox) = an access level
94
95 Access Protection – List of Users
95
96 Document Protection
Document protection
▪ Once Access Protection is activated, the document is also protected and requires a login at
opening:
96
Take a look at examples:
Start -> Programs ->
Semaphore -> Samples
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
97
98 Task Sequence of Process
▪ 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
….
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
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)
102
103 Ladder (5)
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
105
106 Ladder (8)
106
During Basic edition, press
<F7> to open the list of Tags
Comments
▪ REM: at the beginning of a line
▪ ’ : anywhere in the line
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
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
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)
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)
▪
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
The Tag ‘valid’ activates the timer ‘timer0’ during 2.5 seconds.
113
114 Counter in BASIC
Counter function
Syntax
▪ CountUP (Name, Start, Preset)
▪ CountDown (Name, Start, Preset)
▪ CountRing (Name, Start, Preset)
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
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.
Global
Local
116
PID function blocks are
available in a library (PID.lib).
See PID documentation in
TWInSoft directory
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
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)
120
121 Library (2)
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
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
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.
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”
Add “Web” file (from the list of “Web and Report Files”)
Double-
click .twa
file
129
130 WebForm Studio 2.0 (2)
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
131
132 WebForms 2.0 Demonstration
http://demo.tbox.ovarro.com
132
133 TConnect (Introduction)
133
134 Monitor32
134
135
Internet:
▪ www.ovarro.com
e-mail:
▪ [email protected]
135