Semaphore-twinsoft-manual Ojo

101
TWinSoft 8.32 - Getting started Revision: USA 8.32

Transcript of Semaphore-twinsoft-manual Ojo

Page 1: Semaphore-twinsoft-manual Ojo

TWinSoft 8.32 -

Getting started Revision: USA 8.32

Page 2: Semaphore-twinsoft-manual Ojo

Table of Contents 1. INTRODUCTION ............................................................................................................................... 5 2. STARTING TWINSOFT .................................................................................................................... 6

2.1. System requirements ............................................................................................................6 2.2. Starting the CD-ROM of TWinSoft......................................................................................7 2.3. Programs of ‘TWinSoft Suite’ .............................................................................................8

3. TWINSOFT PROTECTION ............................................................................................................... 9 3.1. The Evaluation mode ...........................................................................................................9 3.2. The Dongle ..........................................................................................................................9 3.3. The Code (License)..............................................................................................................9 3.4. The TWinSoft LITE ..............................................................................................................9

4. WIZARD......................................................................................................................................... 10 5. PRESENTATION ............................................................................................................................. 13 6. COMMUNICATION (PC SET UP) .................................................................................................... 14

6.1. Sending a program ............................................................................................................15 Compile + test of available memory. .................................................................................................15 Upload................................................................................................................................................15

6.2. Saving the source...............................................................................................................15 6.3. Working modes of TBox....................................................................................................16

Mode 1a: the program is running .......................................................................................................16 Mode 1b: the program is running and in alarm mode ........................................................................16 Mode 2: the program is stopped (Global Reset) ................................................................................16 Mode 3: The Operating System is stopped ........................................................................................17

7. RTU PROPERTIES ......................................................................................................................... 18 7.1. General ..............................................................................................................................18 7.2. Communication ports ........................................................................................................19

8. CREATING TAGS ........................................................................................................................... 20 9. THE RESOURCES........................................................................................................................... 21

9.1. Creating a block of I/O......................................................................................................22 Creating a Remote block of I/O: ........................................................................................................22 Creating Remote modules RM-xx .....................................................................................................23

9.2. Creating a card..................................................................................................................23 9.3. Creating a Tag from a list of I/Os .....................................................................................23

10. PROGRAMS.................................................................................................................................. 24 10.1. Ladder – Principle...........................................................................................................24

Inputs..................................................................................................................................................24 Outputs ...............................................................................................................................................24 Cycle time ..........................................................................................................................................25

10.2. Ladder - Modes................................................................................................................25 Display mode .....................................................................................................................................25 Edit mode ...........................................................................................................................................26

10.3. Ladder - Toolbar .............................................................................................................27 Display mode .....................................................................................................................................27 Edit mode ...........................................................................................................................................28

10.4. Variables..........................................................................................................................29 Local Tags..........................................................................................................................................29 Global Tags ........................................................................................................................................29 The colors of the Tags........................................................................................................................29

10.5. Create Ladder Diagram ..................................................................................................30 Inserting items....................................................................................................................................31 The colors of the Tags........................................................................................................................31 The Keys ............................................................................................................................................31

TWinSoft: 8.32 – Getting Started 2

Page 3: Semaphore-twinsoft-manual Ojo

10.6. Step by step creating of Ladder .......................................................................................32 10.7. Mathematical Block.........................................................................................................36

Introduction........................................................................................................................................36 Assignments .......................................................................................................................................36 Arithmetic operations.........................................................................................................................37 Comparisons.......................................................................................................................................37 Bit manipulations ...............................................................................................................................38 Boolean operations.............................................................................................................................39 Conversion + Indirect addressing.......................................................................................................39 PID regulation ....................................................................................................................................41 Miscellaneous.....................................................................................................................................42 Floating point functions .....................................................................................................................43

10.8. POU (Program Organization Units)...............................................................................44 10.8. POU (Program Organization Units)...............................................................................44 10.9. POU – Program...............................................................................................................45

The 'main'. ..........................................................................................................................................45 Creating a POU Program ...................................................................................................................45 Calling a POU Program in another Program......................................................................................46

10.10. POU – Function.............................................................................................................47 Creating a POU Function ...................................................................................................................47 Example of a Function .......................................................................................................................49 Calling a POU Function in a POU Program ......................................................................................50

10.11. POU - Function block....................................................................................................51 Creating a POU Function Block ........................................................................................................51 Example of a Function Block.............................................................................................................53 Calling a POU Function Block in a POU Program............................................................................54 Debugging of a Function block..........................................................................................................55

11. LIBRARY MANAGEMENT............................................................................................................. 56 11.1. Import of POUs (saving POUs in a Library) ..................................................................56 11.2. Export of POUs (retrieval of POUs from a library) .......................................................57 11.3. Use of a Library in a TWinSoft document .......................................................................57

12. ALARMS ...................................................................................................................................... 58 12.1. Introduction .....................................................................................................................58 12.2. Digital Tag Condition......................................................................................................59 12.3. Analog Tag Condition .....................................................................................................60 12.4. Recipients.........................................................................................................................61 12.5. Examples of recipients.....................................................................................................62

To a GSM...........................................................................................................................................62 To an e-mail address ..........................................................................................................................62

13. DATALOGGING............................................................................................................................ 65 13.1. Introduction .....................................................................................................................65 13.2. The Chronologies ............................................................................................................66 13.3. Sampling tables ...............................................................................................................67

14. REMOTE TAG.............................................................................................................................. 68 14.1. Introduction .....................................................................................................................68 14.2. Block communication ......................................................................................................69 14.3. Description of fields.........................................................................................................71

15. WEB & REPORT FILES................................................................................................................ 77 15.1. Procedure to work with TBox as a Web Server...............................................................77 15.2. Report Studio ...................................................................................................................78

Different ways to use a report ............................................................................................................78 16. TBOX ACCESS SECURITY............................................................................................................ 79

16.1. TBox configuration..........................................................................................................79 16.2. Password utility ...............................................................................................................80

TWinSoft: 8.32 – Getting Started 3

Page 4: Semaphore-twinsoft-manual Ojo

16.3. Login/Logout ...................................................................................................................81 16.4. Deactivating protection ...................................................................................................81

17. COPY/PASTE - DRAG'N'DROP .................................................................................................... 82 17.1. General rules ...................................................................................................................82 17.2. Examples..........................................................................................................................82

Create Tags in the list of Tags (Copy/Paste)......................................................................................82 Copy a POU in the same document (Copy/Paste)..............................................................................83 Move or copy Ladder from one POU to another POU (Drag’n’Drop or Copy/Paste).......................83 Copy Ladder from one document to another document (Drag’n’Drop) ............................................83 Copy entries of any list (Recipient, Alarm condition, Remote Tags, ...) from one document to another document (Copy/Paste) .........................................................................................................83 Modifying the sequence of the elements in all lists (Drag'n'Drop). ...................................................83

18. IMPORT / EXPORT....................................................................................................................... 84 18.1. Export ..............................................................................................................................85

Example files......................................................................................................................................86 Export - Tags......................................................................................................................................87 Export - Alarm conditions..................................................................................................................89 Export - Alarm message.....................................................................................................................91 Export - Chronologies ........................................................................................................................92 Export - Sampling tables....................................................................................................................93 Terminal Tags ....................................................................................................................................94 Analog Units ......................................................................................................................................95 Digital States ......................................................................................................................................96

18.2. Import ..............................................................................................................................97 Working with an Empty Document ...................................................................................................97 Exact replace ......................................................................................................................................98 Replace...............................................................................................................................................98 Append ...............................................................................................................................................98

19. PACK & GO................................................................................................................................. 99 19.1. Presentation.....................................................................................................................99 19.2. Pack .................................................................................................................................99 19.3. Unpack...........................................................................................................................100

Disclaimer Every effort has been made to ensure the accuracy of the information in this guide. However, Techno Trade S.A. assumes no responsibility for the accuracy of the information. Product information is subject to change without notice. AB is a registered trademark of Axeda. MODBUS is a registered trademark of Gould Modicon. TSOFT , TVIEW , TWinSoft, WebForm Studio and A are registered trademarks of Techno Trade s.a. Windows ’95, ’98, NT, 2000, XP are trademarks of Microsoft Corp. Internet Explorer is a trademark of Microsoft Corp. Copyright © 1999-2004 by Techno Trade s.a. All rights reserved. Edition: November 2, 2004 (original 8.32)

TWinSoft: 8.32 – Getting Started 4

Page 5: Semaphore-twinsoft-manual Ojo

1. Introduction TWinSoft is the software necessary to create running application for A RTU and Low Power RTU. It also allows communicating with your RTU to visualize its process. This manual helps you to understand the concept of A and to create basic configurations as:

Tags (the variable of the A). Programs (the automation programs in Ladder programming). Alarms. Data logging criteria. Remote Tags. A Access Security.

Concerning Low Power RTU a specific manual is available. A is presented as the “6 in 1” Tele-control system. It means A can be configured for all those features without needing supplementary software or hardware. What are those six features?

1. A is a Web Server: TCP/IP has been implemented as standard protocol. A can be called by a Browser to display HTML images, saved in the A. It is also able to send e-mail through a provider and send a file to a FTP site. This feature is available from versions TWinSoft 7.00 and OS 5400.

2. A is a multi-port system: A is equipped with different communication ports

that allow local communication with other equipment. A also allows remote communication through different types of modems (ISDN, PSTN, GSM, Cellular, Radio…). A supports as standard, ModBus RTU protocol, TCP/IP protocol and Minitel protocol on all ports. A is able to handle concurrent communications on different ports in multi-tasking and at different speeds. An Ethernet card is also available (10 Base/T).

3. A is a PLC: with the help of the IEC1131-3 standard Ladder programming,

automation programs can be developed; including mathematical functions, PID loops and user definable function blocks.

4. A is an alarming system: on alarm conditions (digital and/or analog), A is able

to send messages to printer(s), to pager(s), GSM and other cellular systems, to call a supervisor, to send email, etc…

5. A is a Data logger: in order to memorize events of your process, you can define

criteria of recording values of Tags. Those values can be stored “on event” and/or periodically. Recording can be FIFO (circular buffer – continuous) and event driven.

6. A is protocol converter: with the help of external “C” drivers that you can write,

A can be used to translate a proprietary protocol to ModBus protocol for a connection to a standard supervisor package or translate between devices of different manufacture.

TWinSoft: 8.32 – Getting Started 5

Page 6: Semaphore-twinsoft-manual Ojo

2. Starting TWinSoft 2.1. System requirements Hardware: Pentium or higher. Memory: 16-MB minimum. We recommend 32 MB. Hard Disk: 10 MB required plus the application files. Display: VGA, SVGA with a minimum resolution of 640 x 480. We recommend 800 x 600. Mouse: any Windows compatible mouse. Parallel port: required in case of dongle protection. (A software license is also available) Serial port: required for a local connection to Aor for an external modem. Modem: any PCMCIA or external modem properly configured in Windows. Operating system: Windows 95, Windows 98 or Windows NT (service pack 3 or higher),

Windows 2000, Windows XP. • To Browse A:

Internet Browser: as ActiveX is used, Internet Explorer only can be used. Version 5.00 or higher

is recommended to take benefit of the dialer. The CD-ROM of TWinSoft includes MSIE version 5.00.

TWinSoft: 8.32 – Getting Started 6

Page 7: Semaphore-twinsoft-manual Ojo

2.2. Starting the CD-ROM of TWinSoft When inserting the CD-ROM of ‘TWinSoft Suite’ into the PC, the following software’s are available from the Setup:

• TWinSoft 8.32

TWinSoft is the software required for developing an application for the A RTU. The basis for configuring a A application is explained in this manual. Installation of TWinSoft includes ‘WebForm Studio’: HTML editor dedicated to RTU), ‘Report studio’: Report editor dedicated to RTU and ‘WebForm Viewer’: Internet Explorer ‘TBox Dialer’ and ActiveX (see next).

• WebForm Viewer

This software contains the tool TTBBooxx DDiiaall IItt !! used to dial a A with Internet Explorer. It also contains the ‘ActiveX’ used to display RTU dedicated objects. It needs to be installed on the PC used by a operator to dial A with Internet Explorer, when TWinSoft is not required.

• TBox Mail

This software is used to display a Chart view from datalogging attached to an e-mail. • DreamWeaver Trial version • Report Studio for DreamWeaver

Dreamweaver is a standard HTML editor. It can be used with the plug-in ‘Report Studio for Dreamweaver’ to develop standard HTML pages that do not use the ActiveX.

• Acrobat Reader

Software needed to read our documentation.

TWinSoft: 8.32 – Getting Started 7

Page 8: Semaphore-twinsoft-manual Ojo

• Internet Explorer 5

Minimum version required to dial A and display properly the ActiveX. • Explore this CD-ROM

You will find on the CD-ROM many information related to A and accessories: datasheets, manuals, …

2.3. Programs of ‘TWinSoft Suite’ During installation of TWinSoft, a group of programs is created where TWinSoft can be started.

figure 1 Other programs and menus: • TBox drivers: when 'C' custom drivers have been installed. The ‘on line’ help of the driver

configuration is available in this folder. • Samples: group with TWinSoft documents installed as example. • Accessories: group containing the utility ‘Password generator’ and ‘Reset User preferences’:

reset of registry information to restore the default configuration of TWinSoft. • Documentation: group containing the various documents associated to TWinSoft and RTU. • Report Studio: to create reports dedicated to A. • TWinSoft: to start TWinSoft. • WebForm Studio: to start the HTML editor, dedicated to A when it is used as a Web

Server.

TWinSoft: 8.32 – Getting Started 8

Page 9: Semaphore-twinsoft-manual Ojo

3. TWinSoft Protection The software itself is not protected; it can be installed on any PC and used to develop TWinSoft documents Offline or to monitor/control a running program locally or remotely. The only protected operation is the insertion of an application in the A. In order to find the best way for you we offer different possibilities: 3.1. The Evaluation mode You don't need any software or hardware dongle. You are able to develop a complete TWinSoft document without any restriction, but when you send the application to the A, it will stop after 2 hours. This is a good solution for testing programs or creating a demo. 3.2. The Dongle It is a hardware device placed on the parallel port of your PC. TWinSoft regularly checks the presence of it. It allows you to send applications to as many A’s as you want, with any PC. 3.3. The Code (License) Available from the menu ‘Help’ ‘License Register.’ Using information of the PC (the Company name, the User name, the Serial Number), we create a code that you enter in the 'License' field. Once entered, you can send any application as if you had a dongle (see previous). The only restriction is that it must always be on the same PC. If you wish to use another PC, you have the possibility to remove registration on the first PC and register back on the second. 3.4. The TWinSoft LITE Available from the menu ‘Help’ ‘TWinSoft LITE configuration.’ This protection mode is ideal for users having one or two A units. The A dongle or a code might be too expensive. TWinSoft LITE code is linked to one A; it allows you to send an application to the A for which you have the code.

TWinSoft: 8.32 – Getting Started 9

Page 10: Semaphore-twinsoft-manual Ojo

4. Wizard When starting TWinSoft the first time or when creating a new document, the Wizard helps you to define the basic configuration:

According to the hardware you want to program, select the proper type of RTU. Warning : you cannot change later from one type to another type : LP100 to LP200 for instance.

figure 2 This configuration can be modified using the RTU properties dialog boxes.

Telephone information the location where the A will be placed. According to this data TwinSoft will dial country, area code or prefix when calling the A.

figure 3

TWinSoft: 8.32 – Getting Started 10

Page 11: Semaphore-twinsoft-manual Ojo

In case you have selected a modem (see previous page), the Wizard offers to define a connection to an ISP, in order to send e-mail.

Available ‘dial up entries’ to ISP existing on your PC. OR Select ‘New connection…’

You type these data according to the information received from the ISP.

figure 4

Part of the data appear automatically according to the ‘dial up entry’. You type the other data according to the information received from the ISP.

figure 5

TWinSoft: 8.32 – Getting Started 11

Page 12: Semaphore-twinsoft-manual Ojo

The Wizard then asks you whether you use an Ethernet card and offers to configure it.

figure 6

TWinSoft: 8.32 – Getting Started 12

Page 13: Semaphore-twinsoft-manual Ojo

5. Presentation Using TWinSoft, you can easily create all needed items such as Tags, alarm recipients, alarm conditions, data logging criteria, and more using lists.

figure 7

To open a list of items, simply select the type of item you want to see in the project workspace (the tree in the left panel of the main window). TWinSoft opens a view (new window) showing these items. You can open several views to see more than one list at a time: In the Window menu, choose New. The window in the bottom can be selected to display utility information. It can be opened (or closed) by pressing the accelerator keys: <ALT + 1>: Open / Close the Project Workspace. <ALT + 2>: Build results (results of the compilation and use of the memory of the A). <ALT + 3>: Watch (to display a custom design list of values of Tags). <ALT + 4>: Cross-reference (gives complete information of 1 Tag). The status line indicates the type and status of the communication.

TWinSoft: 8.32 – Getting Started 13

Page 14: Semaphore-twinsoft-manual Ojo

6. Communication (PC set up) Communicating with your A is necessary to send a program or to visualize the process. The development of a document can be done “off line”. A communication can be carried out locally or remotely. It is defined in the PC set up configuration.

• The Off line option is selected to avoid sampling a A that is not connected.

• In case of a local connection, select the port of the PC that is used to communicate with the A. The Baudrate must fit with the speed of the port of the A to which your PC is connected. If you don’t know the Baudrate of A, you can set it to a default configuration (see chapter 6.3: Working modes of A)

figure 8 • To communicate with your A in TCP/IP (typically with a A equipped with an

Ethernet card), you select the option ‘TCP/IP (Ethernet…). TWinSoft will then establish a communication with the IP address specified in the tab ‘TCP/IP – LAN’ (see chapter 7: ‘RTU Properties’).

• Communicating with your A using a modem is easier than ever since TWinSoft takes full advantage of Windows' built-in modem support: Simply install your modem in the control panel's Modems applet and you are ready to call your A.

After having selected the communication mode, you can check the communication doing a ‘RTU identification’ from the ‘Communication’ menu.

For more information, click ‘Help’.

TWinSoft: 8.32 – Getting Started 14

Page 15: Semaphore-twinsoft-manual Ojo

6.1. Sending a program Compile + test of available memory. Compile the program before sending to A. This can be done to test the integrity of a TWinSoft document or to check the memory available in the A

To compile without sending the TWinSoft document use the icon from the Main Toolbar, or from the main menu bar: 'File' -> 'Compile' or directly the key <F9>. The result of compilation is available in the 'Results' window. This window is automatically opened if the compilation fails, otherwise you can open it with the accelerator keys <ALT + 2>, or from the main menu bar 'View' -> 'Build Results':

Information: Indicated in black Warning: Indicated in bold dark green. Error: Indicated in bold red

Available information:

OS Version: TWinSoft reads the OS version of the A, to test if the TWinSoft document fits with the material. Program + Chrono: RAM memory available for Program, chronologies and Sampling

Tables. Sampling Tables: RAM memory available for Sampling Tables. ROM: EEPROM memory for the program sent by TWinSoft. When the A starts, a

part of program is copied in (battery-backed) RAM. Upload Upload means transferring information from the PC to the A, locally or remotely. To access Upload features, click 'Communication' -> 'Upload' from the main menu bar. Upload of the program. The PC sends the current TWinSoft document (program) to the A. The document is first compiled then sent to the A. It is carried out by the icon on the main Toolbar or by pressing the keys <CTRL + F9>. It must be executed every time a modification is implemented within your document, in order to apply it to the A. 6.2. Saving the source The source is the TWinSoft document. It can be sent at the same time as the compiled program: check the box ‘Also upload Program source’ in the dialog box when sending a program (see previous). You can therefore have a back-up of the application saved inside the A. To copy it back to the PC, click from the main menu Bar: ‘Communication’ ‘Download’ ‘Program source’.

TWinSoft: 8.32 – Getting Started 15

Page 16: Semaphore-twinsoft-manual Ojo

6.3. Working modes of TBox A has three working modes:

The program is running. The program is running and in alarm mode. The program is stopped (via a global reset). The Operating System is stopped.

If you don’t know the communication parameters of the A you are connected to, you will not be able to communicate with it. In order to set the A to a known configuration, you need to do a global reset of the A(see mode 2 below). Mode 1a: the program is running

USR LED blinks twice per second If you wish to restart the program: • Press the RST button, and then release it. Restarting the program has the following effects:

Current alarms are stopped and the stack is erased Data logging is maintained Values of counters are maintained Timers are reset Reset (to 0) of the DIR, AIR, STO, according to the start up conditions (see the ‘RTU

properties’ dialog box ‘Advanced’ tab) Reset (to 0) or do not reset the physical digital outputs, according to the start up

conditions

The 3 digital outputs of the CPU are always reset (hardware reset) Mode 1b: the program is running and in alarm mode

USR LED blinks 8 times / sec. There is currently one (or more) alarm(s) in A. Typically the sending of SMS, e-mail, call to a Supervisor, … Mode 2: the program is stopped (Global Reset)

USR LED blinks once every 2 seconds A global reset is used to stop, but not erase, the program in the A. Pressing RST again restarts the program (see previous). Procedure to stop the program:• Hold the PGM button pressed • Then press and release the RST button • Wait for TxD and RxD to blink once, then release PGM A is configured as follows:

COM1, COM2, COM3: 9600 baud + even parity + ModBus protocol (unprotected). COM4: V22, PSTN (protected if it was programmed). station address number: 1 (ModBus address).

TWinSoft: 8.32 – Getting Started 16

Page 17: Semaphore-twinsoft-manual Ojo

Mode 3: The Operating System is stopped Lighted USR LED and blinking ERR LED

The OS of the A contains all the features. In very rare situations it might be stopped. Procedure to stop the OS:• Hold the PGM button pressed. • Then press and release the RST button. • Wait for TxD and RxD to blink four times, then release PGM. The A is in 'loader' mode. A is configured as follows:

COM1, COM2, COM3: 9600 baud + even parity + ModBus protocol. COM4: V22, PSTN (non protected). station address number: 1 (ModBus address).

TWinSoft: 8.32 – Getting Started 17

Page 18: Semaphore-twinsoft-manual Ojo

7. RTU properties Setting the parameters of the A to specific values has never been so easy thanks to a new set of comprehensive dialog boxes. To open the RTU Properties dialog boxes, use the icon of the Main Toolbar:

figure 9 7.1. General If the Wizard was used, the information entered is displayed. Information can be updated.

figure 10

For more information, click ‘Help’.

TWinSoft: 8.32 – Getting Started 18

Page 19: Semaphore-twinsoft-manual Ojo

7.2. Communication ports Each communication port can be configured independently.

figure 11 • COM1 and COM2 are RS232 communication ports for any local connection to a supervisory PC,

printer, ModBus equipment, or to an external modem (PSTN, ISDN, GSM, RADIO, HF,). The maximum distance is 12 m.

• COM3 is an RS485 communication port for network connection to other A (maximum 32) to

RM modules (maximum 255) or to any other ModBus equipment having an RS 485 port. The maximum distance, depending on line quality, can be up to 10 km.

• COM4 is an option. An internal modem can be used on PSTN lines (in modes V21, V22, V22b or

V23) or on leased lines (in mode V22). • COM5 is an option that can be equipped with a PCMCIA modem (PSTN, ISDN or GSM) or with a

network modem for network connection of A (maximum 10). The maximum distance, depending on the number of A and the line quality, can be up to 50 km.

• COM6 is an Ethernet interface. It allows to connect A to a Hub, Router, … in order to establish

a local connection (LAN) or a remote connection (WAN). Click ‘Parameters’ to configure the Ethernet card.

TWinSoft can use any port for the visualization or sending of a document.

For more information, click ‘Help’.

TWinSoft: 8.32 – Getting Started 19

Page 20: Semaphore-twinsoft-manual Ojo

8. Creating Tags Configuration is carried out using Tags. Tags are of all variables that the A program recognizes : digital inputs to the CPU, analog outputs of an extension rack, a register, … To declare a Tag, open the list of ‘Tags’ and click ‘Add a Tag’, and then choose Digital or Analog:

figure 12 • Type: for physical input/output select I/O. Other types are internal registers of the CPU. • Select: opens from ‘Resources’, the list of variables associated to the current type. It allows

you to check easily which I/O or Registers are still free. • Address: it is the location of the physical I/O (rack number, card number and channel

number). For registers, it is the number of a specific register. • Format: According to the address selected, different formats are available. • Export: allows export of the Tag definition in external, ASCII files, either in AB format or

in ‘text’ format. This option is available while being in the ‘Tags’ folder, click in the main bar ‘File’ ‘Export’. You can choose between:

All list: all the Tags. Selection: only the Tags that have the option ‘export’ checked (not implemented yet).

From the TAG definition box, any configuration requiring the Tag can be accessed, i.e. alarms, data logging, etc.

For more information, click ‘Help’.

TWinSoft: 8.32 – Getting Started 20

Page 21: Semaphore-twinsoft-manual Ojo

9. The Resources The resources represent the list of all variables that are available for your application. It relates to the I/O of your A and any extension racks or external equipment. When starting a new document, the default startup only shows the variables of the CPU that are available. Click ‘Resources’ then ‘CPU’ to list the variables. Project workspace Physical I/O Registers

8 DIGITAL INPUTS. • 3 digital outputs. • 2 analog inputs (8 bits). • 1 external battery check • 1 internal lithium battery

check

The different groups of I/O of the CPU appear as cards. Click the card to see the list of I/Os. Clicking an I/O opens the box of ‘Creating a Tag’.

• 2048 digital registers. • 256 analog registers. • 4096 storage digital registers. • 6144 storage analog registers

(16 bits). • 64 Floating point registers. • 256 timers. • 256 counters. • Digital special registers. • Analog special registers. • 64 totalizers

figure 13

TWinSoft: 8.32 – Getting Started 21

Page 22: Semaphore-twinsoft-manual Ojo

9.1. Creating a block of I/O Under the folder ‘I/O’ you see the CPU as the default block of I/O. Double click ‘I/O’ to add additional blocks of I/O – as per your hardware configuration: List of I/O Blocks Blocks of I/O

• Rack4 and Rack8 are extension racks of the CPU (local).

• Multi I/O card is a custom design card within the CPU (local).

• RM-10 and RM-21 are remote modules (remote). • Remote TBox is a distant A (remote). • ModBus device is any ModBus equipment (remote).

figure 14 Creating a Remote block of I/O: Remote blocks of I/O are equipment connected to A through a communication port (RS485, RS232, modem, …). From the moment a A needs to communicate with other equipment, the latter become part of its Resources. The A being Master and the Remote equipment Slave(s). The A communicates to Remote equipment with the help of ‘Remote Tags’ (see chapter 14: ‘Remote Tags’). When creating such equipment you must specify the following parameters: Example for a ‘Remote TBox’:

figure 15

• Name: you type any name. It will be available in a list of available equipment when creating ‘Remote Tags’.

• Address: it is the ModBus address of the Remote equipment. It must be different from the Master A and possible other equipment on the same network.

• RTU Port: the communication port used by the Master to communicate with the equipment.

• IP address: in case the communication port of the Master is COM6 (Ethernet card), the IP address of the Remote equipment must be specified here. Available for Remote A only.

TWinSoft: 8.32 – Getting Started 22

Page 23: Semaphore-twinsoft-manual Ojo

Creating Remote modules RM-xx The different groups of I/O of the RM modules appear as cards. Click the card to see the I/O list. Double-clicking an I/O opens the ‘Creating a Tag’ box. 9.2. Creating a card After having created an extension rack, click on it to create cards. List of cards Cards description

• 4 Analog inputs (8 bits full isolated). • 2 Analog output card (8 bits full isolated) • 8 Analog inputs (12 bits). • 16 Digital inputs. • 16 Digital outputs - (transistor/PNP) • 16 Digital outputs (old) (transistor/NPN) No

longer available. • 8 Digital output (Relays 250 VAC).

Figure 16 9.3. Creating a Tag from a list of I/Os Example of I/O of an 8 Analog Input card:

For each channel 2 variables are available: • The I/O (analog). • Test the I/O (digital). Double-clicking an I/O opens the box of ‘Creating a Tag’.

figure 17

TWinSoft: 8.32 – Getting Started 23

Page 24: Semaphore-twinsoft-manual Ojo

10. Programs

10.1. Ladder – Principle Introduction The principle of the Ladder diagram is based on an electrical description of the process or machine, using relay logic. To the left of the screen are the inputs (they are conditions for which an action will be undertaken) and to the right are the outputs (which result from these actions).

Inputs All inputs, whether digital or analog, can be combined to create logical equations (two inputs follow on the same line for an <AND>, and one above the other and linked by a vertical bar for an <OR>). All analog comparison functions and/or digital inputs on the same program line will represent true or false. The result defines the actions of the output (will or will not be performed). The different types of Input conditions are accessible in the LD Toolbar.

Outputs Digital output functions are engagements (SET relay) or disengagement (RESET relay), they can be the image or the opposite of the result of the tested input conditions (OUTPUT relay and NEGATIVE relay). Other functions have been introduced proper to telemetry like transmission of alarms, data logging or sending of DTMF tone. To process analog outputs, many mathematical functions and POU (Program Organization Units) functions have been implemented. The selection of different types of outputs is accessible in the LD Toolbar.

figure 18

TWinSoft: 8.32 – Getting Started 24

Page 25: Semaphore-twinsoft-manual Ojo

Cycle time Ladder Logic is executed on a fixed basis; contacts, relays, functions; math calculations, etc are executed while they are scanned (read). Lines are scanned from left to right and from top to bottom. When bottom is reached, it starts again from top. The cycle time is displayed when doing a A Identification from the main Toolbar menu 'Communication'. The cycle can never be greater than 1 second. If this occurs, an internal watchdog timer resets the A automatically. 10.2. Ladder - Modes Introduction The Ladder programming operates in two different modes. The first is display mode, which allows you to see the entire program, one page at a time. It is in this mode that you can see the state or the value of variables in real time. The second mode is edit mode, which allows inserting a new line anywhere in the Ladder, at the beginning, at the end or between two existing lines. This mode also allows modifying an existing line. To see an example, load the TWinSoft document 'Ladder.tbox' that you find in the 'Samples' directory of TWinSoft. Display mode To access the Ladder in Display mode, click in the Project Workspace on the 'Programs' folder. The last Ladder that was opened is displayed. The white tab underneath indicates the active program. The 'MAIN' tab is the main program, that is automatically executed by A; the other POUs having to be called from the ‘MAIN’. The Ladder diagram appears in red lines with the Tags associated at each input contact, output relay or IN/OUT of functions. The Comment lines appear as gray blocks. When a jump (JUMP) is programmed, the jump’s mnemonic appears at the right side of a double arrow. The mnemonic is a LABEL that appears in black text. A call to another program appears in a red block with one IN/OUT line. The state of the digital input contacts is displayed as a green overlay if the condition represented by the contact is true (in the case of a trigger contact, the result represents the last level attained). Similarly, if the result of an analog comparison is true, a green overlay on the function is used. Moreover, for digital outputs, the green overlay represents the status of the associated Tag. When moving the cursor on analog Tags in Functions or Math blocks, the current value is displayed in the bottom left corner of the screen. For digital gates the display indicates <On> or <Off> according to the current value.

TWinSoft: 8.32 – Getting Started 25

Page 26: Semaphore-twinsoft-manual Ojo

Edit mode The Edit mode is used when inserting a new line or modifying an existing line. To insert a line, use the LD Toolbar. Three types of lines can be inserted using the following buttons:

to insert a line of Ladder

to insert a line of Comment

to insert a Label that will be called by a JUMP

The Ladder diagram is made of several lines that are numbered starting at 1. Only one line at a time can be edited with only one rung (a rung is a set of Input conditions connected to only one set of Outputs). When editing is finished, the line must be compiled to proceed with the next one:

To save and compile a line. If an error occurs, a dialog box informs you on the error. The key <+> can also be used to save and compile a line. If you were editing an existing line, you return to display mode. If you were inserting a new line, you stay in edit mode.

To quit editing and discard changes. The key <ESC> can also be used.

To select any item (line, contact, relays or Functions) of a Ladder line. Once selected it can be edited by a double click to replace Tags. You can also erase the selected item by pressing the key <Delete> or insert a new contact, relay or Function by selecting the proper icon in the LD Toolbar.

Inserting a new line as last line To insert a new line as last line, place the cursor at the end of the last line and click the icon corresponding to the type of line you wish to insert. Inserting a new line between 2 existing lines To insert a line between 2 existing lines, place the cursor on the existing line that the new line will correspond to. The new line will move the existing line to next position after it is inserted. When a line is selected, it is surrounded. Then click the icon corresponding to the type of line you wish to insert. The line you placed the cursor on will be moved downwards. Using the keyboard UP and DOWN arrows moves the selected line. Modifying an existing line To modify an existing line, place the cursor on the line you wish to modify. Then double-click it. The arrow icon of the LD Toolbar is automatically selected.

TWinSoft: 8.32 – Getting Started 26

Page 27: Semaphore-twinsoft-manual Ojo

10.3. Ladder - Toolbar The LD Toolbar is the panel of tools necessary to edit Ladder. Different icons are active according to the current mode of Ladder: Display mode Clicking one of the following icons lets you enter in the edit mode:

To insert a line of Ladder.

To insert a line of Comment.

To insert a Label that will be called by a JUMP.

TWinSoft: 8.32 – Getting Started 27

Page 28: Semaphore-twinsoft-manual Ojo

Edit mode

To Select any item (line, contact, relays or Functions) of a Ladder line. Once selected it can be edited by a double click to replace Tags. You can also erase the selected item by pressing the key <Delete> or insert a new contact, relay or Function by selecting the proper icon in the LD Toolbar.

To Save and Compile a line. If an error occurs, a dialog box informs you of the error. The key <+ >can also be used to save and compile a line.

To Quit editing and discard changes. The key <ESC> can also be used.

To insert a Normal input contact for digital input. The condition will be true if the input is active.

To insert an Invert input contact for digital input. The condition will be true if the input is inactive.

To insert a Positive input trigger for digital input. The condition will be true only once when the input passes from an inactive level to an active level.

To insert a Negative input trigger for digital input. The condition will be true only once when the input passes from an active level to an inactive level.

To insert a Digital output normal. Output is activated if the results of the input condition(s) are true.

To insert a Digital output inverted. Output is activated if the results of the input condition(s) are false.

To insert a Digital output set. Output is set and memorized if the result of the input condition(s) are true; this type of output is typically used with a 'trigger' input

To insert a Digital output reset. Output is reset and memorized if the result of the input condition(s) are true; this type of output is typically used with a 'trigger' input

To draw continuous horizontal or vertical lines. To join inputs conditions together to create logical equations and to possibly connect to many outputs. WARNING: a set of inputs can only lead through one horizontal line to only one set of outputs. It is called a rung.

To insert a Function or Function Block. A list opens with the standard Functions (under the folder 'Standard') and with the user defined Functions (under the folder 'This file')

To insert a Mathematical block. In this block, mathematical functions can be inserted by clicking on 'New Math Function' . See chapter 10.7 for a list of available functions.

Initiates a Jump to the line whose label corresponds to the one that is entered here (to enter a label, see above in the list of icons of 'Display mode').

TWinSoft: 8.32 – Getting Started 28

Page 29: Semaphore-twinsoft-manual Ojo

10.4. Variables Introduction Variables can be physical I/O or internal registers: Analog registers (AIR, STO, and ASPE...) Digital registers (DIR, DSPE...). Any variable is available, but only when it is declared, we consider it as a Tag. According to the use we make of the variables in Ladder programming, there are two families of Tags:

Local Tags Global Tags

Local Tags A Local Tag is a non-specific register used as temporary value in a calculation. When compiling the TWinSoft document a free register (DIR, AIR or STO) is assigned to it according to the registers that are already used. Local Tags are only used in the POU where they have been created. They appear in the list of Local Tags, above the Ladder diagram of the POU (see next). Global Tags A Global Tag can be of two types: A specific register (DIR, AIR, and SPE...) that you wish to use. A physical I/O of the CPU created in the List of Tags. Global Tag-Names can be used in POU Program and in POU Function Block (see next). The colors of the Tags The color used to display the Tag in Ladder programming informs you of its type:

Black: Global Tag. Blue: Local Tag. Brown: Special register (analog or digital) it is always considered as Global

Tag

TWinSoft: 8.32 – Getting Started 29

Page 30: Semaphore-twinsoft-manual Ojo

10.5. Create Ladder Diagram Introduction Creating Ladder diagram consists of 'drawing' program lines with input contacts or functions and output relays or functions placed between 2 vertical Power Rails. The two rails can be considered as electrical wires between which items are placed. The lines as a whole represent your local automation.

In the LD Toolbar click - - to insert a new Ladder Line. In the window of Ladder programming, a rectangle appears with a line number. Only one line at a time can be edited with only one rung (a rung is a set of Input conditions connected to only one set of Outputs). The grid shows you the places where you can place contacts, relays and functions. The Ladder is executed from left to right and from top to bottom. Every contact, functions and relay is treated when it is read. Be careful when using an output at different places of the Ladder, unless you do SET and RESET. To help you, check the Cross reference of the Tags.

figure 19 According to the item you wish to use, select the proper icon in the Toolbar.

TWinSoft: 8.32 – Getting Started 30

Page 31: Semaphore-twinsoft-manual Ojo

Inserting items When inserting an item, you must declare the variable(s) associated to it: Digital Tag for a contact and a relay, Digital or Analog Tags for Functions. You have to work with Tags; it is not possible to select the number of a register in the list of registers. A Tag (local or global) can be created while inserting an item. There are two possibilities to select a Tag:

The Tag exists

- You know the name of the Tag: you type its name. TWinSoft is not case sensitive, so you can type it in capital or small letters.

- You don’t know the name of the Tag: you click the button to open the list of Tags. You have the choice between Global Tag, Local Tag and Special registers (see previous chapter ‘Variables’).

The Tag does not exist You type its name and press <ENTER> to create it. The Tag can be either Local Tag or Global Tag (see previous chapter ‘Variables’).

According to the field you are in, you can select a Tag or type a constant. A constant

is a 16-bit variable that will be considered as Signed (-32768 -> 32767) or Unsigned (0 and 65535) according to the Function where it is used.

The colors of the Tags The color used to display the Tag in Ladder programming informs you of its type:

Black: Global Tag. Blue: Local Tag. Brown: Special register (analog or digital) it is always considered as Global

Tag The Keys

<+> To compile a line. Use also the icon

<ESC>

- When a line is selected: to quit edit mode. Use also the icon .

- When an item is selected: to release the item and return to selection mode (arrow).

- When Tag box is opened: to carry on without specifying a Tag. '???' will be inserted instead. To enter a Tag afterwards, double click '??? '

<DEL> To delete the selected item.

TWinSoft: 8.32 – Getting Started 31

Page 32: Semaphore-twinsoft-manual Ojo

10.6. Step by step creating of Ladder We assume that Tags already exist and that we work with global Tags. Suppose we are controlling a Reservoir LEVEL. When it reaches the value 150, we start the PUMP to remove water. At the same time, we start an INTEGRAL timer that memorizes the number of minutes the pump has been working. The PUMP can also be started manually. When 6000 minutes are reached, the timer - status TIMER - is at 1 and activates the output MAINTENANCE. We will create the following lines:

figure 20 We use the following Tags (see chapter 8 ‘Creating Tags’): LEVEL analog input. MANUAL digital input. PUMP digital output. TIMER digital state of the timer (DTI.10) MAINTENANCE digital output. RESET digital input.

TWinSoft: 8.32 – Getting Started 32

Page 33: Semaphore-twinsoft-manual Ojo

1st line of Ladder:

1. In the program ‘MAIN’, click the icon to insert a line of comment. Type you text and click ‘OK’.

2nd line of Ladder:

2. Click the icon to insert a new line. The edit block is ready to create the second line. The grid shows the position where you can place the items.

3. Click the icon to insert the function A>B then click close to the left Rail.

figure 21 4. Enter the Tag name LEVEL or select it from the list of Tags and then enter the constant 150.

5. Click the icon to insert a digital contact, then click the comparison Function and close to the left rail.

6. Enter the Tag name MANUAL or select it from the list of Tags.

7. Click the icon and draw a horizontal and vertical line to join the output of the comparison Function.

8. Click the icon to insert an output relay, then click on the output of the comparison Function. A horizontal line is automatically drawn to the right rail.

9. Enter the Tag name PUMP or select it from the list of Tags.

TWinSoft: 8.32 – Getting Started 33

Page 34: Semaphore-twinsoft-manual Ojo

10. Click the icon to insert the timer Integral with a basis time in minutes (TI_min) then click under the relay PUMP.

figure 22 11. Enter an ID number (between 0 and 255); in our example: 10, then the preset (number of

minutes), in our example 6000.

12. Click the icon and draw a horizontal and vertical line to join the timer Function to the right rail and to the output of the comparison Function.

13. Press the key <+>, or click the icon to compile the line. Doing this, the edition block is ready to create the third line.

3rd line of Ladder:

14. Click the icon to insert a Positive edge trigger contact, then click close to the left rail.. 15. Enter the Tag name TIMER.

16. Click the icon to insert a SET output relay, then click close to the left side of the contact TIMER. A horizontal line is automatically drawn to the right rails.

17. Enter the Tag name MAINTENANCE or select it from the list of Tags.

18. Press the key <+>, or click the icon to compile the line. Doing this, the edition block is ready to create the fourth line.

4th line of Ladder:

19. Click the icon to insert a Positive edge trigger contact, then click close to the left rail. 20. Enter the Tag name RESET or select it from the list of Tags.

21. Click the icon to insert the reset timer Function, then click close to the contact RESET. 22. Enter 10, the ID of the timer to reset (in our example: 10).

TWinSoft: 8.32 – Getting Started 34

Page 35: Semaphore-twinsoft-manual Ojo

23. Click the icon to select and move the reset timer function, then click the reset timer Function and drag it on step to the right.

24. Click the icon and draw a horizontal between the RESET contact and the reset timer Function.

25. Click the icon to insert a MAINTENANCE output relay then click under the reset timer Function. A horizontal line is automatically drawn to the right rail.

26. Enter the Tag name MAINTENANCE or select it from the list of Tags.

27. Click the icon and draw a horizontal and vertical line to join the input contact to the output relay MAINTENANCE.

28. Press the key <+>, or click the icon to compile the line. Doing this, the edition block is ready to create the next line.

29. Press <ESC> to come back in Display mode.

TWinSoft: 8.32 – Getting Started 35

Page 36: Semaphore-twinsoft-manual Ojo

10.7. Mathematical Block A mathematical Block allows to carry out analog output operations like addition, subtraction, multiplication, division, bit manipulation, indirect addressing...

To insert a Math block, in the edit mode of Ladder Programming, click the icon of the LD Toolbar. Introduction There are 8 categories of mathematical functions available (to use in math blocks):

• Assignment functions. • Arithmetic operations. • Comparisons. • Bit manipulations. • Boolean operations. • Conversion (PID, BCD, etc.), and indirect addressing. • Text and miscellaneous functions. • Floating point.

In the functions, the Arguments to replace by Tags (or constant) are represented as follows:

- A, B, C, and D: Analog Tags. - Ptr: Pointer in indirect addressing; analog Tag. - BOOL, Bit: Digital Tag. - Tot1, Tot2: Analog double word. - Flt: Floating point

The equality operations are always executed from the right to the left. In other words, we have: result = operation

or: output = input (means the value of Input variable is copied in the Output variable).

16 bit analog numbers on are always worked out as signed values in TBox, even if they have

been defined as 'Unsigned' Tags. If used in 'Indirect addressing' functions, an analog variable of the pointer is considered as

'Unsigned', even if it appears 'Signed'. In edit mode, to insert a 'Math function' between 2 functions in a Math block, place the

cursor at the position you want to insert the function, and press the key 'Insert' of keyboard. Assignments A = B 'A' contains a copy of the value of 'B' A = -B 'A' contains the invert value of 'B' A = Low(B) 'A' contains a copy of the 8 lowest bits of 'B' A = High(B) 'A' contains a copy of the 8 highest bits of 'B' A = Abs (B) 'A' contains a copy of the absolute value of 'B' A = Swap(B) 'A' contains the inversion of the 8 highest bits and the 8 lowest bits of 'B' inc (A) increase the value of Tag 'A' by 1 bit dec (A) decrease the value of Tag 'A' by 1 bit

TWinSoft: 8.32 – Getting Started 36

Page 37: Semaphore-twinsoft-manual Ojo

Arithmetic operations A = B + C 'A' is the addition of 'B' and 'C' A = B - C 'A' is the subtraction of 'B' and 'C' A = B * C 'A' is the multiplication of 'B' and 'C' A = B / C 'A' is the division of 'B' and 'C' A = B AND C 'A' is the result of the logical AND between 'B' and 'C'

Example: 0001000011111111 AND 0001100000001111 0001000000001111

A = B OR C 'A' is the result of the logical OR between 'B' and 'C' Example: 0000000011111111 OR 1111000000001111 1111000011111111

A = B XOR C 'A' is the result of the logical XOR between 'B' and 'C' Example: 0000000011111111 XOR 1111000000001111 1111000011110000

A = B MOD C 'A' contains the rest after the division of 'B' and ‘C’. Example: 2 = 17 MOD 3

Comparisons BOOL = B == C 'BOOL' is TRUE if 'B' equal 'C', otherwise it is FALSE BOOL = B < C 'BOOL' is TRUE if 'B' is smaller than 'C', otherwise it is FALSE BOOL = B > C 'BOOL' is TRUE if 'B' is greater than 'C', otherwise it is FALSE BOOL = B <= C 'BOOL' is TRUE if 'B' is smaller than or equal to 'C', otherwise it is

FALSE BOOL = B >= C 'BOOL' is TRUE if 'B' is greater than or equal to 'C', otherwise it is

FALSE BOOL = B <> C 'BOOL' is TRUE if 'B' and 'C' are different, otherwise it is FALSE BOOL = odd B 'BOOL' is TRUE if the value of 'B' is odd, otherwise it is FALSE A= conv 0/20 4/20 (B) 'A' is the conversion from 0..20mA to 4..20mA of 'B'. It is a

scaling in order to start binary counting at 4 mA instead of 0 mA

TWinSoft: 8.32 – Getting Started 37

Page 38: Semaphore-twinsoft-manual Ojo

Bit manipulations Wraparound means that the bits scrolling from one side of a byte (8 bits) or word (16 bits) are replaced at the other side of the byte or word. bit (A,BitNb) = Bit The status of digital 'Bit' will be copied in the analog 'A' at the

position indicated by 'BitNb', starting with ' 0 ' for Lsb. Example: Bit: 1 BitNb: 3 A: 0011010011001001

Bit = bit( A,BitNb) The status of the bit of the analog 'A' indicated by 'BitNb' will be copied in the digital 'Bit', starting with ' 0 ' for Lsb. Example: A: 1100101000010010 BitNb: 5 Bit: 0

A = shl(B,shift) 'A' has the number of Bits indicated by 'shift' shift to the left (max. 15) of the word 'B' (without wraparound). Example: B: 0000000011111111 Shift: 4 A: 0000111111110000

A = shr(B,shift) 'A' has the number of Bits indicated by 'shift' shift to the right (max. 15) of the word 'B' (without wraparound). Example: B: 0000000011111111 Shift: 4 A: 0000000000001111

A = rol byte(B,shift) 'A' has the number of Bits indicated by 'shift' shift to the left (max. 7) of the byte 'B' (with wraparound).

A = ror byte(B,shift) 'A' has the number of Bits indicated by 'shift' shift to the right (max. 7) of the byte 'B' (with wraparound).

A = rol word(B,shift) 'A' has the number of Bits indicated by 'shift' shift to the left (max. 15) of the word 'B' (with wraparound). Example: B: 0000000011111111 Shift: 4 A: 0000111111110000

A = ror word(B,shift) 'A' has the number of Bits indicated by 'shift' shift to the right (max. 15) of the word 'B' (with wraparound). Example: B: 0000000011111111 Shift: 4 A: 1111000000001111

TWinSoft: 8.32 – Getting Started 38

Page 39: Semaphore-twinsoft-manual Ojo

Boolean operations Bit = not(Bit) the inverse of the digital Tag of the right is assigned to the digital

Tag of the left Bit = bit AND Bit the result of the logical AND between the two digital Tags of the

right is assigned to the digital Tag of the left Bit = Bit OR Bit the result of the logical OR between the two digital Tags of the right

is assigned to the digital Tag of the left Bit = Bit XOR Bit the result of the logical XOR between the two digital Tags of the

right is assigned to the digital Tag of the left A = B * C / D (Unsigned)

'A' is the result of the 32 bits multiplication of Words 'B' and 'C' then divided by 'D'

A = B * C / D (Signed) A' is the result of the 32 bits multiplication of Integers 'B' and 'C' then divided by 'D'

put Bit in dig chrono Writing of the digital Tag 'Bit' in the Digital Chronology. put A in ana chrono Writing of the analog Tag 'A' in the Analog Chronology.

Conversion + Indirect addressing A = bcd(B) transforms the word 'B' to a BCD format and transfers the result to

the word 'A'. 'B' must be less than 10000 to prevent an overflow condition.

A = 16 x (Bit) places the 16 digital variables of successive addresses, starting with the digital Tag 'Bit' in the word' A'.

Example: to copy 16 digital inputs of an extension card in a word.

This function cannot be used with the 8 digital inputs of the CPU, because there is not 16 successive addresses, but 8. If it is needed, first copy the 8 inputs in successive registers that have 8 free registers after those used for the copy of the inputs

16 x (Bit) = A places the 16 bits of the word 'A' in the 16 digital variables of successive addresses, starting with the digital Tag 'Bit'.

Example: to SET or RESET 16 DO of an extension card using an analog variable.

Bit = indirect (Ptr) the Tag or Constant 'Ptr' contains the absolute ModBus address of the digital variable that will have its status assigned to the digital Tag 'Bit'.

Example: to read the status of the output 'Q0' of the CPU (ModBus address 32): dir0 = indirect (32).

TWinSoft: 8.32 – Getting Started 39

Page 40: Semaphore-twinsoft-manual Ojo

Indirect (Ptr) = Bit the status of the digital Tag 'Bit' will be copied in the digital

variable whose ModBus address is defined in the Tag or Constant 'Ptr'.

Example: to write the status of dir0 in the output 'Q2' of the CPU (ModBus address 34): Indirect (34): dir0.

A = indirect (Ptr) the Tag or Constant 'Ptr' contains the absolute ModBus address of the analog variable that will have its value assigned to the analog Tag 'A'

Example: to read the value of the input 'ana1' of the CPU (ModBus address 65): air0 = indirect (65).

indirect (Ptr) = A the value of the analog Tag 'A' will be copied in the analog variable whose ModBus address is defined in the Tag or Constant 'Ptr'.

Example: to write the value of ana0 of the CPU in the analog output: Rack 1, Card 1, Channel 0 (ModBus address 288): Indirect (288) = ana0.

TWinSoft: 8.32 – Getting Started 40

Page 41: Semaphore-twinsoft-manual Ojo

PID regulation Function available in the group ‘Conversion + Indirect addressing’

Out = PID(Input, AIR,..)

Out: Tag associated to the output of PID function. Input: Tag associated to the input of PID function. AIR: index number of the AIR associated to the 'Set-point'. This function performs a PID regulation according to the formula: y = R * (x-w) + 1/TI � (x-w) + TD * d(x-w) / dt where:

y: value of output. x: value of the measurement. w: value of set point. R: proportional coefficient. TI: integral coefficient. TD: derivative coefficient.

NOTES:

1. PIDs require knowledge of this type of regulation. 2. An example is available on web site: www.tbox.biz -> Support -> Examples

Application of the PID to the TBoxThe maximum number of PIDs per TBox is 64, but this number can be limited due to the size of the memory A and the availability of analog registers. A PID in a mathematical formula occupies 5 supplementary bytes for calculation. A PID is computed in less than one millisecond. Values and coefficients are placed in variables and registers:

'Output' = y: output value, between -2047 and 2047. 'Input' = x: input value, between -2047 and 2047. 'AIR' = w: set point value, between -2047 and 2047. 'AIR+ 1' = R x 32: proportional coefficient, between 0 and 2047. 'AIR+ 2' = 1 / (1024 x TI): integral coefficient, between 0 and 2047. 'AIR+ 3' = TD x 8: derivative coefficient, between 0 and 2047.

Those 3 last calculations must be implemented in the Ladder diagram. For example:

R=20 'AIR+ 1'=640 TI=0,0001 'AIR+ 2'=10 TD=100 'AIR+ 3'=800

'AIR', 'AIR+ 1', 'AIR+ 2', 'AIR+ 3' represent 4 analog internal registers of successive addresses. It is therefore only necessary to enter the first of these registers in the mathematical function. The PID is calculated every cycle for as long as the condition that precedes the mathematical block in the Ladder diagram is true. It is therefore necessary to link the PID calculation to a timer to obtain a time cycle different from that of the Ladder diagram. The PID can also be stopped or single stepped. The fact that the proportional coefficients, integral, and derivative are stored in internal registers allows dynamic modification following some conditional changes specified in the Ladder diagram. Calculations have 24-bit precision, the intermediate results of each group (proportional group, integral group and derivative group) are limited to the range -2047.+2047. The global result has the same range limits.

TWinSoft: 8.32 – Getting Started 41

Page 42: Semaphore-twinsoft-manual Ojo

Miscellaneous Send Text: Text Sending of the text indicated in the field 'Text' to a

communication port. The Latter must be specified with a mathematical function 'Select Port # Port' (see next function). The text is sent in ASCII protocol. Maximum: 30 characters

It is possible to ,insert a control character into the string, for instance a LF or a CR. ^M = CR ^J = LF

Select Port # Port Selection of a communication port for sending text (see previous function). The available ports are:

1: COM1

2: COM2

3: COM3 Call Driver With (A) call of the custom driver loaded in the TBox by passing it the

ModBus address of the variable defined in ''A' as an argument. It allows to use 'A' as an input and/or an output.

You must, before calling this function, write in the Special Analog register <Drvld> the unique ID number of the driver.

Clear Totalizer (Tot) sets to 0 the totalizer 'Tot'. Inc Totalizer (Tot, A) increments the totalizer 'Tot' with the value contained in the

analog Tag 'A' Tot1 = Tot2 copy of the value of totalizer 'Tot2' in the Totalizer 'Tot1'

NOTE: With Totalizer registers, supplementary mathematical functions, like arithmetic operation and comparison, can be executed using the 'C' driver Fcthmath2. See the web site: www.tbox.biz -> Support -> Drivers

TWinSoft: 8.32 – Getting Started 42

Page 43: Semaphore-twinsoft-manual Ojo

Floating point functions A = FloatToInt (Flt * 10 E Const) conversion from the Float 'Flt' to the Integer 'A'

, with a possible scaling from 10E-4 to 10E+4. The exponent must be a constant:'Const'.

Flt = IntToFloat (A) * 10 E Const) conversion from the Integer 'A' to the Float 'Flt', with a possible scaling from 10E-4 to 10E+4. The exponent must be a constant:'Const'.

Flt A = Flt B + Flt C Float 'A' is the addition of Float 'B' and Float 'C'. Flt A = Flt B - Flt C Float 'A' is the subtraction of Float 'B' and Float 'C'. Flt A = Flt B * Flt C Float 'A' is the multiplication of Float 'B' and Float 'C'. Flt A = Flt B / Flt C Float 'A' is the division of Float 'B' and Float 'C'.

TWinSoft: 8.32 – Getting Started 43

Page 44: Semaphore-twinsoft-manual Ojo

10.8. POU (Program Organization Units) IEC1131-3 Ladder programming is organized not only with contacts and relays, but also with different POUs and functions. Three types of POU are available, all of which use the same Ladder programming tools: List of POU Equivalence in TSoft (DOS Editor) POU program: sub-program that is called in the ‘Main’ program or any other POU program.

Modules

POU function: standard functions (comparison, math. Functions, timers,...) or user defined functions.

No equivalence

POU function block: user defined small 'applet' that performs a function (start of a pump, regulating temperature...)

Macros

For users accustomed to work with TSoft (the DOS editor), we have kept mathematical functions in order to execute analog operations.

TWinSoft: 8.32 – Getting Started 44

Page 45: Semaphore-twinsoft-manual Ojo

10.9. POU – Program Introduction POU programs allow you to structure your Ladder program into several sub-programs. In practice, you have a main Ladder program, which calls sub-programs. These sub-programs contained within a Ladder diagram precisely define an action such as; start pump, intrusion control, alarms management...etc, and can be called from anywhere in the ‘Main’ program or any other POU program. They give you a clearer view of the whole automation program, they can be tested individually and allow you to make things easier for changing. A POU program can call another POU Program that can call another POU Program etc... If you use POU Programs that call other POU Programs, be careful to avoid loops: like

Program 1 calling Program 2 calling Program 3 that calls Program 1. The 'main'. The POU program 'main' is the main Ladder program. This program must be unique and called ‘main’, to be used to call other POU programs (sub-programs). It is the default POU program when starting a new TWinSoft document. Creating a POU Program To create a POU Program, click the 'Programs' folder in the Project Workspace. In the right window appears the list of existing POUs (all types of POU). When starting TWinSoft the first time, the only one is the 'main'.

figure 23 Double click 'Add a POU', type a Name (accents and space are not supported) and check 'Program'. Click OK. You have created a POU Program and it appears in the 'Programs' folder.

TWinSoft: 8.32 – Getting Started 45

Page 46: Semaphore-twinsoft-manual Ojo

When you double click the name of the Program in the list, the window for Ladder programming appears with a new Tab for the current Program.

figure 24 Now you can create a Ladder Diagram for the Program you have defined. Calling a POU Program in another Program To call a POU Program, click the icon in the LD Toolbar. In the folder, 'This File' select the POU Program you wish to insert. All POU Programs have the following parameters:

- EN:

Enable Input: Connection to the Ladder line. EN must be TRUE to run the Program. If it is connected directly to the left rail, it will be executed at each cycle of the Ladder, otherwise it can be connected to an input condition.

- ENO:

Enable Output: it is the image of EN. If EN is TRUE, ENO is TRUE. It is usually connected to the right rail but can be also connected to a contact or a relay, a Mathematical block or a Function.

Calling a POU Program is like calling a sub-routine. The program associated to it is executed at the position where it is called.

TWinSoft: 8.32 – Getting Started 46

Page 47: Semaphore-twinsoft-manual Ojo

10.10. POU – Function Introduction A POU Function is a user-defined piece of Ladder that executes a calculation ending in one result. It is useful when a calculation you regularly need to execute does not exist in the list of Standard Functions. You use it in POU Programs every time you need to execute the calculation. It has one or many inputs and only one output. When a Function is used many times in a POU Program, the same code is always executed.

Example: You need regularly to execute the calculation: y= [(a+b) * (c+d)] /2. You will not find this formula in the Standard Functions or in the Mathematical Function block. You will then create your own Function that will execute your calculation every time you call it.

According to the type of the output, there are 4 types of Functions:

BOOL: digital output. WORD: analog output 16 bits unsigned. LONG: analog output 16 bits signed. FLOAT: floating point output.

An example of user defined Function is available in the TWinSoft document ‘Ladder.tbox’, in the 'Samples' directory of TWinSoft. The Function executes the scaling of an 8-bit analog input. Creating a POU Function To create a POU Function, click the 'Programs' folder in the Project Workspace. In the right window appears the list of existing POUs (all types of POU). When starting TWinSoft the first time, the only one is the 'main' POU Program.

figure 25 Double click 'Add a POU', type a Name (accents and space are not supported) and check 'Function'. Select the type of the output (result of the calculation): BOOL , WORD, LONG or FLOAT. Click OK. You have created a POU Function and it appears in the 'Programs' folder.

TWinSoft: 8.32 – Getting Started 47

Page 48: Semaphore-twinsoft-manual Ojo

When you double click the name of the Function in the list, the window for Ladder programming appears with a new Tab for the current Function.

figure 26 By default, the name of the Output is the name of the Function. You can rename the output

by using the context menu on its name (mouse right clicking on the name). POU Functions can be exported in a Library to be used in other TWinSoft documents, using

the Library manager menu. Now you can create Ladder Diagram for the Program you have defined.

TWinSoft: 8.32 – Getting Started 48

Page 49: Semaphore-twinsoft-manual Ojo

Example of a Function The following Function is an analog Function (it means the output is analog). It performs a scaling of an 8-bit analog input.

figure 26A The Tags : Inputs and the Output of a Function are the arguments to be replaced when calling the Function. The way a POU Function works, involves that one can define only local Tags in a POU

Function.

Scaled: the output of the Function. It is unique and is the result of the calculation.

IN, MIN,MAX: are the Inputs of the Function.

Delta, tmp0: local analog Tags used as temporary variables necessary to calculate the scaling.

The Ladder : A math block using 3 functions is used.

TWinSoft: 8.32 – Getting Started 49

Page 50: Semaphore-twinsoft-manual Ojo

Calling a POU Function in a POU Program To call a Function, click the icon in the LD Toolbar. The folder, 'This File' contains Functions and Function Blocks created in the current document. If the Function owns to a Library, the latter appears as a Folder. Select the Function you wish to insert. All Functions have the following parameters:

- EN:

Enable Input: Connection to the Ladder line. EN must be TRUE to perform the Function. If it is connected directly to the left rail, it will execute at each cycle of the Ladder, otherwise it can be connected to an input condition.

- ENO:

Enable Output:

if the Function is Analog: it is the image of EN. If EN is TRUE, ENO is TRUE. It is usually connected to the right rail but can be also connected to a contact or a relay, a Mathematical block or another Function.

if the Function is Digital: ENO and the Output of the Function are linked inside the Function. It is TRUE if the result of the calculation AND EN are TRUE. It must then be connected to contact or a relay, a Mathematical block or another Function.

figure 26B When calling the Function in a POU Program, you must assign to the (unique) Output a Tag and for each Input a Tag or constant. All inputs are at the left side of the Function Block; the output at the right side. In this example, we wish to have an 8-bit analog input 'ANA0' scaled between MIN '0' and MAX '1000'. The result is copied into the Internal Analog register 'AIR0'.

TWinSoft: 8.32 – Getting Started 50

Page 51: Semaphore-twinsoft-manual Ojo

10.11. POU - Function block Introduction POU function Blocks are user defined small 'applets' that performs a function (start of a pump, regulating temperature...). If this function is repetitive in your program & you don't wish to define it every time you need it, then you create it once, with Input and Output arguments and it is then a POU Function Block. You use it in POU Programs every time you need to execute the function and you assign Tags of the POU Program to it. We advise you against using POU Functions in a POU Function Block. In fact, a POU Function exists only once and always has the same variables that are used when inserting the POU Function. A POU Function Block has new Tags (local and global) assigned every time it is called in a POU Program. Creating a POU Function Block To create a POU Function Block, click the 'Programs' folder in the Project Workspace. In the right window appears the list of existing POUs (all types of POU). When starting TWinSoft the first time, the only one is the 'main' POU Program.

figure 27 Double click 'Add a POU', type a Name (accents and space are not supported) and check 'Function Block'. Click OK. You have created a POU Function Block and it appears in the 'Programs' folder.

TWinSoft: 8.32 – Getting Started 51

Page 52: Semaphore-twinsoft-manual Ojo

When you double click the name of the Function Block in the list, the window for Ladder programming appears with a new Tab for the current Function Block.

figure 28 POU Function Blocks can be exported in a Library to be used in other TWinSoft documents,

using the Library manager menu. Now you can create Ladder Diagram for the Program you have defined.

TWinSoft: 8.32 – Getting Started 52

Page 53: Semaphore-twinsoft-manual Ojo

Example of a Function Block The following Function Block performs the start of a digital output with a programmable delay.

figure 28A The Tags: Inputs and Outputs of a Function Block are the arguments to be replaced when calling the Function Block.

INPUT is a digital input that will start the OUTPUT after the DELAY.

OUTPUT is a digital output. It will be connected to a motor, for instance when calling the Function Block.

DELAY is an analog input containing the number of seconds of the delay. It must be associated to the timer used in the Function Block.

preset is a Local analog Tag of the type 'Timer Preset'.

timer is a Local digital Tag of the type 'Timer Status'. The Ladder : The DELAY is copied in the preset of the timer. When INPUT changes to 1, it starts the timer Single Shot with a base time in seconds

(SS_sec). (Note: when working with an external Preset (the local variable 'preset'), the Preset of the timer can be set to any value; here 0). When the timer has finished counting AND the INPUT is still active, the output is set to 1. A negative edge on INPUT resets the OUTPUT.

TWinSoft: 8.32 – Getting Started 53

Page 54: Semaphore-twinsoft-manual Ojo

Calling a POU Function Block in a POU Program To call a Function Block, click the icon on the LD Toolbar. The folder, 'This File' contains Function Blocks and Functions created in the current document. If the Function Block owns to a Library, the latter appears as a Folder. Select the Function Block you wish to insert. All Function Blocks have the following parameters:

- EN:

Enable Input: Connection to the Ladder line. EN must be TRUE to perform the Function Block. If it is connected directly to the left rail, it will execute at each cycle of the Ladder, otherwise it can be connected to an input condition.

- ENO:

Enable Output: it is the image of EN. If EN is TRUE, ENO is TRUE. It is usually connected to the right rail but can be also connected to a contact or a relay, a Mathematical block or another Function.

figure 28 B When Calling the Function Block in a POU Program, you are asked to enter an 'FB Instance name'. This name allows TWinSoft to distinguish between Function Blocks, when multiple calls of similar Function Blocks are defined. Afterwards you must assign to the Output(s) and Input(s) Tags or constant. All inputs are at the left side of the Function Block, all outputs at the right side. In this example, the FB is called ‘Motor1’, the input ‘D0’ activate the output ‘Q2’ with a delay of 5 seconds. Each call of Function Block is unique and different from each other; local Tags of the Function Block as well as timer ID and counter ID, will be assigned to free registers, timers and counters when compiling. When a Function Block is called many times in POU Program, its code is inserted every time

it is called. It makes development easier but it increases the code size. Execute compilation regularly to test A memory.

A maximum of 16 timers and counters can be used in a POU function.

TWinSoft: 8.32 – Getting Started 54

Page 55: Semaphore-twinsoft-manual Ojo

Debugging of a Function block As explained above, the same piece of Ladder of the POU FB can be called several times (several instances). In order to debug a function block, to check values and status of the local Tags, it is not sufficient to enter the code of the FB, because TWinSoft needs to know which instance concerned is. IMPORTANT: 1. The document must have been sent to TBox.with the last changes 2. If TWinSoft is opened after the document has been sent, the document must be compiled, to

allow TWinSoft assigning registers to the local Tags. 3. The complete path from the Program 'main' must be followed to access the FB. Example: 'Main'

-> 'Motors' -> FB 'Motor1'. To debug the FB, while in 'Vizualization mode', double click the call of the FB from the POU program it is used:

The source code (Ladder) of the FB is then opened and dynamized according to its instance. In the list of POU Tags, the column 'Value' displays values of each local Tag.

TWinSoft: 8.32 – Getting Started 55

Page 56: Semaphore-twinsoft-manual Ojo

11. Library management TWinSoft offers the possibility to save POU Functions and POU Function Blocks in external files called ‘Libraries’ in order to use those POU in other TWinSoft documents. A library can contain several POUs. It corresponds for instance to a customer or to a category of functions. It is a file with the extension .LIB saved by default in the directory of TWinSoft.

POU programs cannot be saved in a Library. 11.1. Import of POUs (saving POUs in a Library) To access the Import menu, click 'Tools' on the main menu bar and select 'Library manager'

figure 29 Only POU Functions and Function Blocks can be saved in a library.

1. You select an existing library ('File' -> 'Open'), or you create a new library ('File' -> 'New'). 2. You open the list of available POUs of the current document ('Edit' ->'Import POU...'). 3. You select the POUs you wish to save in the Library; you repeat operations 2 and 3 for

each POU. 4. You save the Library ('File' -> 'Save').

Libraries can be protected by a password, so that it is impossible to ‘Export’ it into a

TWinSoft document, to see the internal code.

TWinSoft: 8.32 – Getting Started 56

Page 57: Semaphore-twinsoft-manual Ojo

11.2. Export of POUs (retrieval of POUs from a library) To access the Export menu, click 'Tools' on the main menu bar and select 'Library manager' (see import of POUs here above) Export is necessary if you wish to edit a POU in the current document that has been saved in a Library.

1. You open a library ('File' -> 'Open'); the POUs appear in the top window. 2. You select the POU and export it ('Edit' -> 'Export'); you repeat this operation for each

POU. 3. The POUs are then available in the list of 'Programs', in the Project Workspace.

11.3. Use of a Library in a TWinSoft document To access the 'Libraries' menu, click 'File' on the main menu bar and select 'Libraries...'

figure 30 The ‘Available Libraries’ are the Libraries present in the directory of the current TWinSoft document or in the directory of TWinSoft. When a library appears in the list, all its POU Functions, and POU Function Blocks are available to be used in Ladder programming: in the list of Functions, the Libraries appear as Folders, each containing their own POUs. To add a Library to the current TWinSoft document, select it from the list of ‘Available Libraries’ and click 'Add'. The button 'Manager' jumps to the creation of Library menu. To remove a Library from the current TWinSoft document, select the Library and click 'Remove'. This operation is available only if you don’t use POU of the concerned library in the current document.

TWinSoft: 8.32 – Getting Started 57

Page 58: Semaphore-twinsoft-manual Ojo

12. Alarms 12.1. Introduction Alarm module of A is the gate to the outside world, through the different communication ports. Via alarms, you are able to send messages to pagers, to print events, to call a SCADA... With the alarm module, your process is 'under control' ! The initiation of alarms in the A relies on the variation of digital or analog Tags, or on a combination of conditions defined in the Ladder diagram. For example, an intrusion contact or an alarm level at a reservoir will send a message to the world beyond A. It is also possible to remotely call a PC utilizing SCADA software, the latter can then monitor the A. Alarms can be sent to a printer (local or remote) in order to print current events, or even a complete report of activity, e.g. every day at midnight. Alarms can be sent to different recipients depending on the day or hour (this is called time slice management). Recipients can be linked or chained. There are two means of activating an alarm:

By a condition: an edge on a digital Tag or the value of an analog Tag that exceeds a minimum or maximum threshold, with adjustable hysteresis. By the Ladder diagram: a complex Ladder sequence generates an alarm through a

specific function. The first option affords a simple and quick way to create alarms (a state change of a digital Tag or the variation of an analog Tag value to activate the alarm). The Ladder diagram allows you to create a complex automated alarm condition by using (for example) priorities or a set of analog or Boolean conditions. Each new alarm is immediately entered into a 48-alarm queue (maximum) and processed according to its type (printer, pager etc...) and the communication port it uses. The order in which these alarms will be processed will not necessarily be the order of their arrival. For example, if an alarm requires the internal modem, it will need to wait until the modem is available before it can be transmitted. If the alarm is time stamped, this data accompanies the alarm message.

TWinSoft: 8.32 – Getting Started 58

Page 59: Semaphore-twinsoft-manual Ojo

12.2. Digital Tag Condition To access the definition of Conditions, click the folder 'Alarms' in the Project workspace and select 'Conditions'. 256 digital alarm conditions can be created.

figure 31 • The Tag. • The type on which the alarm is going to be started (rising, falling or both). • The recipient (printer, pager, e-mail, supervisor,…see below). • The message or report. • The filter (the time in minutes and seconds, before the alarm is started, once the alarm

condition is present). • The inhibition (the alarm will always be started or disabled according to certain conditions).

• SMS acknowledgment : from TWinSoft 7.10, alarms of type ‘e-mail’ and ‘Pager/SMS’, may be configured to be acknowledged from a SMS sent to A. This feature is handled by a ‘C’ driver (see RTU Properties → ‘Modules’). This type of acknowledgment is only possible with a A equipped with a GSM data modem !

TWinSoft: 8.32 – Getting Started 59

Page 60: Semaphore-twinsoft-manual Ojo

12.3. Analog Tag Condition 256 analog alarm conditions can be created.

figure 32

• The Tag. • Type: The maximum or minimum threshold for which the alarm will be started (if the value of

the analog Tag passes under or over this threshold, the alarm is started). If an alarm must be generated for both a maximum and a minimum threshold, 2 alarms must be declared with the same Tag.

• Hysteresis: the amount that the value must fall or rise below or above the Max. or Min. set

point before an alarm can be re-started • Recipient: printer, pager, e-mail, supervisor,…see below • Message: the value of a Tag can be sent within the message (see Message below) • Filter: the time in minutes and seconds, before the alarm is started, once the alarm condition is

present It is always possible to choose a FILTER equal to '0 min. - 0 sec.', which means that the alarm will be activated immediately. • Inhibition: the alarm will be transmitted or inhibited according to certain conditions • Notify of the end of alarm: An alarm is automatically sent when the condition is over • SMS acknowledgment : from TWinSoft 7.10, alarms of type ‘e-mail’ and ‘Pager/SMS’, may

be configured to be acknowledged from a SMS sent to A. This feature is handled by a ‘C’ driver (see RTU Properties → ‘Modules’). This type of acknowledgment is only possible with a A equipped with a GSM data modem ! For more information, click ‘Help’.

TWinSoft: 8.32 – Getting Started 60

Page 61: Semaphore-twinsoft-manual Ojo

12.4. Recipients To access the definition of Recipients, click the folder 'Alarms' in the Project workspace and select 'Recipients'. 64 recipients can be declared, to different pager or GSM addresses, printer, SCADA, remote A, with the help of any of the available communication ports (see Chapter 7 ‘RTU Properties’). According to the type of recipient, local or remote ports are available: Internal: the alarm is saved in the alarm stack and not sent anywhere.

ModBus: it can be slave or master. The ports available are modems ports.

Pager/SMS: sending of a message to a pager or a GSM. The ports available are modems

ports. Printer: sending of message(s) or report to a printer. The ports available are modems and

local ports. Minitel: for France only. Calling of a Minitel. The ports available are modems ports.

E-mail: sending of e-mail. The only information needed is (are) the e-mail address(es); the

data of the ISP account are declared in the ‘RTU Properties’ → ‘TCP/IP’). FTP: refreshing of a Portal (Web Site) with HTML pages, report, …

Custom: sending of an alarm with the help of a custom driver.

TWinSoft: 8.32 – Getting Started 61

Page 62: Semaphore-twinsoft-manual Ojo

12.5. Examples of recipients

To a GSM

figure 33

To an e-mail address

figure 34

TWinSoft: 8.32 – Getting Started 62

Page 63: Semaphore-twinsoft-manual Ojo

12.6. Messages To access the definition of Alarm messages, click the folder 'Alarms' in the Project workspace and select 'Messages'. 256 different messages can be created.

figure 36 • Message number : indicates the index of message (between 1 and 255). Type a message of

maximum 30 characters. This message is user specific. If it is for a Digital Pager, it will consist only of numbers. If it is for a Text Pager or for a GSM, it will not contain accent (ü, é, à, ...)

In all cases, a message can contain the value of a Tag. The syntax is the following:

~Xyyyyy ~

~ : The first character indicates that what follows is the value of a ModBus address. The value sent is the value from the moment of the call.

X : represents the type of the variable:

Type Description I Integer (-32768.. 32768) W Word (0.. 65535) C Choice (for example edges: POS, NEG or DEL) S Text (comments, TEL number, scaled value of Terminal/.Minitel

Tags,…) R Real (only Factor an Offset of Terminal/Minitel Tags) B Byte (0.. 255, represented as 3 ASCII characters) t Time (represented as 2 ASCII characters) j Day of the week m month 0 (zero) Byte represented in binary format f Floating point D Double word - Character string d Digital state (represented as 0/1) o (small letter) Digital state (represented as ON/OFF) # Digital state (represented as --------/########) 1.. 9, a.. f Digital state (according to the definition of digital states, only valid

from 1 to 15) h Time: hh:mm

TWinSoft: 8.32 – Getting Started 63

Page 64: Semaphore-twinsoft-manual Ojo

yyyyy: represents the ModBus address of the variable.

Examples of message Messages sent ANA0=~B64~too high ANA0=234 too high

Register AIR0=~W20480~ Register AIR0=24563 Motor is ~o32~ Motor is OFF

• Next : Allows sending several successive messages (to a printer only). Specify the index

number of the message coming next. This feature allows you to define a number of lines to be printed followed by an empty line (the last message of the chain) ; to separate each printing.

For more information, click ‘Help’.

TWinSoft: 8.32 – Getting Started 64

Page 65: Semaphore-twinsoft-manual Ojo

13. Datalogging 13.1. Introduction Datalogging relies on the database in the A, it allows you to memorize events of your process, in order to visualize historical data. A contains 128 Kbytes of memory for its program and for recording events; the latter is what we call the database of A. A supplement of 512 Kbytes RAM is available in A as September 2002 and running OS 5512. This extended memory is only available for Sampling tables. There are two categories of databases: The Chronologies Chronologies are 'On event' recordings, by mean of changes in variables. Each event is recorded with the time, date, Tag and its status or value. Two tables are available, one for the digital events, one for analog events with a maximum of 256 Tags in each table. The minimum interval between two recordings is 1 second. The Sampling Tables Recording in Sampling tables happens at regular intervals and does not depend on signal variations. Only the date and time of the last recording are stored, and they therefore require less memory than do chronologies. Up to 64 sampling tables can be created with one Tag for each table. The minimum period between two recordings is 1 second. The database information recorded in the A can be retrieved with the use of SCADA software such as TView or other HMI\Scada package with A specific driver or generic RS-485 driver. (please call your distributor)

TWinSoft: 8.32 – Getting Started 65

Page 66: Semaphore-twinsoft-manual Ojo

13.2. The Chronologies Example of one Digital definition in the Digital chronology table.

figure 37 • Edges: recording on positive and (or) negative edge. • Inhibition:

Enabled: always recorded. Disabled: never recorded. Power failure: disabled if the supply voltage (230VAC or 8 56VDC) is broken

down. DisCRD: disabled if the Special register ‘DisCRD’ is at 1.

Example of one Analog definition in the Analog chronology table.

figure 38 • Variation: Recording in case of variation (higher or lower) in comparison with the previous

recording. The unit is expressed according to the binary format of the analog input, independent of a possible scaling in the Ladder programming.

• Inhibition:

Enabled : always recorded. Disabled : never recorded. Power failure : disabled if the supply voltage (230VAC or 8 56VDC) is broken

down. DisCRA : disabled if the Special register ‘DisCRA’ is at 1.

For more information, click ‘Help’.

TWinSoft: 8.32 – Getting Started 66

Page 67: Semaphore-twinsoft-manual Ojo

13.3. Sampling tables

figure 39 • Type: A is able to execute calculations on a minimum time-base of 1 second. The result

of the calculation is written in the table according to the period. This 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.

• Period: Period between 2 recordings. You may choose between 1sec; 2sec; 4sec; 5sec; 10sec;

15sec; 30sec; 1min; 2min; 4min; 5min; 10min; 15min; 30min; 1h; 2h; 4h; 6h; 12h. The recording happens at 'birthday' time of the period selected.

Example: if you select as period 30 seconds, the recording will be done every minute and minute 30 seconds: 9:25:00; 9:25:30; 9:26:00; 9:26:30...

• Size: The size can be expressed on two ways:

Size: the number of records of the table. The recording works on the FIFO principle. According to the size, the duration is updated (see next). It can be of maximum 32768 records. Duration : you may prefer to enter a number of days and hours, in this case the size

is automatically updated

To adjust the sizes check the available memory with the compile option (see chapter 6.1 ‘Sending a program’.

For more information, click ‘Help’.

TWinSoft: 8.32 – Getting Started 67

Page 68: Semaphore-twinsoft-manual Ojo

14. Remote Tag 14.1. Introduction The A-Master network allows the exchange of analog and digital information between two or more ModBus stations via communication ports. It can be a A to A’s or any other ModBus equipment. Remote Tags allow to define the information to be exchanged between equipment. It is called 'Master Network' because it is a Master/Slave communication: the Master executes reading and writing in slave(s). The A defined as the master reads and writes the variables of all other devices using the ModBus protocol (RTU). Any communication port can be used to establish a Master/Slave communication as long as there is only one master for each communication port. Examples:1. A or RM modules can be connected to a master in RS485 communication (via COM3 of

the A). This can be a multi-point network. 2. If A are distant to each other, the COM5 (modem Network) is used to establish

communication between a Master and Slaves. This can be a multi-point communication. 3. A can be connected to other ModBus equipment via RS232 port (COM1 or COM2).

This is a point-to-point network. 4. The communication can be established via the public telephone network with another A;

in this case, the A Master will wait until an alarm of the type 'ModBus -Master' is activated to start the exchange with the slave. Stopping the communication is then handled by the Ladder diagram using the special digital variable [HltM-x], or the call can be disconnected automatically after a defined time delay (modifiable) in the field 'Auto Hang up' (located in the A Master advanced parameters).

TWinSoft: 8.32 – Getting Started 68

Page 69: Semaphore-twinsoft-manual Ojo

14.2. Block communication Block communication means the reading (or writing) of multiple variables at a time. It is advised whenever it is possible. This will speed up communication between Master and Slave(s). For a block communication you specify the first address you wish to read (or write) in the Slave and the first Tag of the Master where you save the read value (or that you write in the Slave). The addresses of the Slaves as well as the Tags of the Master must be successive ModBus addresses. It is important to keep it in mind when you determine the cabling of the I/Os. Example of differences between Block and Single communication: Number of Tags Speed Time for Query/Response 1 Tag analog (Single) 19200, N 8 msec. 100 Tags analog (Single) 19200,N 800 msec. 100 Tags analog (Block) 19200, N 245 msec. 1 Tag digital (Single) 9600, E 17 msec. 1000 Tags digital (Single) 9600, E 17000 msec. 1000 Tags digital (Block) 9600, E 158 msec.

TWinSoft: 8.32 – Getting Started 69

Page 70: Semaphore-twinsoft-manual Ojo

The variables to Read/write in the external equipment are declared using the Remote Tags definition:

figure 40 Important points : 1. Remote Tags are Tags that you wish to write to the Slave(s), or that contain a status or a value

that you read from the Slave(s). 2. The Slave(s) do not need specific configuration, only of course the configuration of the port

used to communicate that must fit with the one of the Master. 3. Each creation of a Remote Tag definition represents a transaction with a slave (Query +

Response). The whole list of Remote Tags represents the table of TBox-master Network. 4. The table is permanently examined and transactions are carried out according to their 'Trigger'

configuration (if defined). 5. The transactions with slaves are asynchronous in regard to Ladder cycle. 6. Block communication is possible and advised whenever it is possible. This will speed up

communication between Master and Slave(s).

TWinSoft: 8.32 – Getting Started 70

Page 71: Semaphore-twinsoft-manual Ojo

14.3. Description of fields • Local Tag: Select an existing Tag by clicking on the button. If the Tag does not exist,

you can create it after having clicked the button. It is the Tag of the Master; it contains the value you want to write in a Slave or it is a register that contains the value that Master reads in a Slave. In case of block communication (with a quantity > 1), this Tag is the one corresponding to the first ModBus address.

• Operation :

OPERATIONS MASTER (Tag) SLAVE (Address) READ WRITE

Read : the Master executes a reading in the Slave. Write : the Master executes writing in the Slave. Quantity : number of variables of successive addresses that are read (or written) in the

Slave. The maximum are:

DESCRIPTION TYPE MAXIMUM QUANTITY Digital I/O IOD, Test4ma 16 Analog I/O IOB, IOW, I4M 8 Digital registers DIR, STD 1600 (multiple of 8 for quantity, Tag

address and Remote address) Analog registers (8 bits) STB 8 Analog registers (16 bits) AIR, STO 100 Analog registers (32 bits) TOT, FLT 8 Timers ATP, ATV, DTI 16 Counters ACP, ACV, DCN 16 Special registers DSPE, ASPE 16 Register 'sampling table' ECH 16

• External Source : all the following parameters concern the Slave station:

Device: select an existing external device from the ‘Resources’. You can create one

with the button

Type: select the type of the external variable: Analog or Digital. See next: If it is a Remote A: the choice is Analog or Digital. According to the operation, TWinSoft selects automatically the proper ModBus function according to the operation. If it is a RM module: the type is not available. TWinSoft selects automatically the proper ModBus function according to the address.

TWinSoft: 8.32 – Getting Started 71

Page 72: Semaphore-twinsoft-manual Ojo

If it is a ModBus Device: the types correspond to the following ModBus functions:

Operations Types ModBus Functions

Read Digital Digital Input 2

Read Digital Coil 1

Read Analog Analog Input 4

Read Analog Holding Register 3

Write Single Digital Coil 5

Write Single Analog Holding Register 6

Write Multiple Digital Coil 15

Write Multiple Analog Holding Register 16

Address : There are different possibilities according to the type of device: - Remote A. 1. The address can be typed with its ModBus address (see the list of ModBus addresses in the ‘Help’ menu).

Examples:22016: seconds. 7: digital input 7 of the CPU. 32: digital output 0 of the CPU 20480: digital or analog register (according to the type).

2. The address can be typed according to a standard.

If it is a physical I/O: TTT.r.b.c.S TTT: is the type of variable. r: is the rack number.. b: is the card number. c: is the channel number. S: supplementary type information.

TTT r b c S Description. DI x x x Digital input. DI x x x 4m Test of an analog input. DO x x x Digital output. AIB x x x Analog input 8-bit resolution. AIB x x x 4m Input 0 20mA converted to 4 20mA. AIW x x x Analog input 12-bit resolution. AOB x x x Analog output 8-bit resolution. AOB x x x 4m Output 0 20mA converted to 4 20mA.

TWinSoft: 8.32 – Getting Started 72

Page 73: Semaphore-twinsoft-manual Ojo

Examples:DI.0.0.7: Digital input 7 of the CPU. DO.0.1.0: Digital output 0 of the CPU. AIB.0.2.1: Analog input (8 bits) 1 of the CPU. AIW.1.5.4: Analog input (16 bits) rack 1, card 5, channel 4. DI.1.5.4.4m: Test of the analog input rack 1, card 5, channel 4.

If it is a register: TTT.nnnn TTT: is the type of variable. nnnn: register number.

TTT Description. DIR Digital register. AIR Analog register. STO Storage 16 bits register. STB Storage 8 bits register. STD Storage digital register. FLT Floating point register. TOT Totalizer (32 bits). ATP Timer preset. ATV Time value. DTI Timer status. ACP Counter preset. ACV Counter value. DCN Counter status. DSPE Digital Special register. ASPE Analog Special register.

Leading Zeros can be omitted.

Examples:DIR.1000: Digital register 1000. AIR.128: Analog register 128. DTI.20: Digital state of timer 20. DSPE.2: Digital special variable 2.

TWinSoft: 8.32 – Getting Started 73

Page 74: Semaphore-twinsoft-manual Ojo

- RM 10.

1. Click the button to browse the list of available variables of the RM10. 2. The address can be typed according to a standard:

TTT.b.c.S TTT: is the type of variable. b: is the number of the block of I/O c: is the channel number. S: supplementary type information.

TTT b c S Description. DI 0 x Digital input (instantaneous). DI 0 x S+ DI Latched on positive edge and reset by the

communication. DI 0 x SM+ DI Latched on positive edge and reset by writing '0'. DI 0 x S- DI Latched on negative edge and reset by the

communication. DI 0 x SM- DI Latched on negative edge and reset by writing '0'. DI 0 x V Test of the digital output. DO 0 x Digital output. AIW 0 x C 16-bit Totalizer of pulse on a DI. AIW 1 x Analog input 16-bit resolution. DI 1 x 4m Test of an analog input.

Addressing the Digital Special registers

DSPE TTT b c Description TmpError DI 2 0 Temporary error on an output. Shortcut DI 2 1 Outputs disconnected. RstShortcut DO 2 2 Re-initialize the outputs after a short circuit

Examples:DI.0.0: Digital input 0. DO.0.1: Digital output 1. DI.0.1.V: Test of the Digital output 1. AIW.0.3.C: Totalizer of the pulse on DI 3. AIW.1.0: Analog input (16 bits) 0.

Auto-acknowledge: this feature concerns only the registers latched and reset by writing '0'

(with the switch 'SM'). You must check this option for A to execute automatically the writing '0' to the RM.

TWinSoft: 8.32 – Getting Started 74

Page 75: Semaphore-twinsoft-manual Ojo

- RM21.

1. Click the button to browse the list of available variables of the RM21. 2. The address can be typed according to a standard:

TTT.b.c.S TTT: is the type of variable. b: is the number of I/O . c: is the channel number. S: supplementary type information.

TTT b c S Description. DI x x Digital input (instantaneous). DI x x S+ DI Latched on positive edge and reset by the

communication. DI x x SM+ DI Latched on positive edge and reset by writing '0'. DI x x S- DI Latched on negative edge and reset by the

communication. DI x x SM- DI Latched on negative edge and reset by writing '0'. DO 1 x Digital output. DI 1 x Test of a Digital output. AIW 0 x C 16-bit Totalizer of pulse on the 8 first DI. AIW 2 x Analog input 16-bit resolution. DI 3 x 4m Test of an analog input. AOW 3 x Analog output.

Addressing the Digital Analog register

ASPE TTT B c Description RstCounter AOB 4 0 Counter of resets of the RM21.

Addressing the Digital Special registers

DSPE TTT B c Description TmpError DI 5 0 Temporary error on an output. Shortcut DI 5 1 Outputs disconnected. RstShortcut DO 5 2 Re-initialize the outputs after a short circuit. ReBoot DO 5 4 Reboot of the RM21. LEDs DI 5 7 Use of LEDs associated to DI:

0 : LEDs deactivated. 1 : LEDs used.

Examples:DI.0.0: Digital input 0. DO.1.1: Digital output 1. DI.1.1.V: Test of the Digital output 1. AIW.0.3.C: Totalizer of the pulse on DI 3. AIW.2.0: Analog input (16 bits) 0. AOW.3.1: Analog output (16 bits) 1.

Auto-acknowledge: this feature concerns only the registers latched and reset by writing '0'

(with the switch 'SM'). You must check this option for A to execute automatically the writing '0' to the RM.

TWinSoft: 8.32 – Getting Started 75

Page 76: Semaphore-twinsoft-manual Ojo

- ModBus device. The address must be typed (see the manual of your ModBus equipment). • Trigger : Each transaction must be triggered to be executed. This operation can be done

automatically (you don't need to declare it and leave the box cleared. In this case, the A will permanently execute the transaction). The triggering happens via a digital Internal register (DIR). When it is in the condition programmed (see below), the transaction happens. If you wish to select a condition yourself, check this box.

Tag : if Trigger is checked, select a Tag of a Digital Internal register multiple of 8 (DIR 0, DIR 8, DIR 16, ...). Condition : if Trigger is checked, select a condition: Positive Edge, Negative Edge or

High State.

TWinSoft: 8.32 – Getting Started 76

Page 77: Semaphore-twinsoft-manual Ojo

15. Web & Report files A can be used as a Web Server, meaning it contains HTML pages that can be called from Internet Explorer browser. The ‘Web files’ contained in this folder will be sent together with the TBox application. Three types of file can be sent to A:

- HTM pages with their associated WebForm, created with the WebForm studio. - Report files created with the Report Studio (see chapter 15.2: Report Studio) - Any file (.gif, .bmp, …)

15.1. Procedure to work with TBox as a Web Server 1. Define the TCP/IP properties of A (RTU properties TCP/IP).

2. From the ‘Web & Report files’ folder, create the HTM images (see ‘WebForm Studio - Getting started’ manual). All the files contained in this folder comprise the ‘Web Module’.

3. When sending the TWinSoft application to A, all files comprising the ‘Web Module’ are also sent .

To dial-up A, use ‘TBox Dial It!’ utility (see ‘WebForm Studio - Getting started’ manual).

TWinSoft: 8.32 – Getting Started 77

Page 78: Semaphore-twinsoft-manual Ojo

15.2. Report Studio

Report Studio, the report editor is available since version 7.10 of TWinSoft. Report Studio has been developed to make creation of reports dedicated to A easier than ever.

Report Studio can be started directly from the group of programs where TWinSoft is started (by default ‘Techno Trade’) or from the folder ‘Web and Report files’ by clicking a ‘.trep’ file.

Report Studio has the following features: A report is associated to a TWinSoft document. In this way, the selection of Tags is made

very easy. Inside the report, fields are declared to display dynamic data (Tags, alarms, databases, …) The Tags can be printed as single fields or in a table. By a single click, a list of alarms can be inserted. By a single click, a list of historic data can be inserted. Files can be attached to a report. The database of A (alarm & historic) can be attached to a report (TBox mail feature).

Different ways to use a report 1. Local print via a RS232 port, COM1 or COM2, with protocol 'printer'. On an alarm condition,

the report is printed (see in TWinSoft 'Alarms' Recipient). 2. Remote print through a modem port of the A. On an alarm condition, the report is sent.

The remote printer must be equipped with a specific modem (please call your distributor). (see in TWinSoft 'Alarms' Recipient).

3. Sending a report through e-mail. On an alarm condition, the e-mail, with its associated report is

sent (see in TWinSoft 'Alarms' Recipient). 4. Display of the report with Microsoft Internet Explorer. This is one of the features of ' TBox

Web Server'. When connected to A, you type the URL of the report (see in TWinSoft 'Web & Report files'). Example: http://1.2.3.0/report.txt For more information, start Report Studio and look at the online ‘Help’.

TWinSoft: 8.32 – Getting Started 78

Page 79: Semaphore-twinsoft-manual Ojo

16. TBox Access security This (optional) access security of the A prevents non-authorized persons from accessing the A. If the Access security option is validated, each port of the A can be independently protected; usually COM4 (internal modem) is the default-protected port. The others will be protected only if it is necessary to prevent on-site access. The protection is based on a four-digit hexadecimal global code that is saved in the A. This allows different access codes related to different users having different access levels to the same A. Three authority levels are available: • Level 1: Surveillance mode or VISUALIZATION MODE. The operator can view all A

values (local or remote), but can not execute any command. • Level 2: COMMAND MODE, the operator can view all the values and execute commands

(locally or remotely). • Level 3: ENGINEER MODE, the operator can view all the values and execute commands and

alter or send new TWinSoft documents (locally or remotely). 16.1. TBox configuration To access the A configuration click ‘RTU Properties’ ‘Security’ tab.

figure 41

For more information, click ‘Help’.

TWinSoft: 8.32 – Getting Started 79

Page 80: Semaphore-twinsoft-manual Ojo

• Access security: Check this box if you want to use access protection to the ports of the A. If it is cleared, all the security features are disabled.

• Global code: type in the code you used to generate the Access Codes with the utility PASSWORD.EXE (see next). Type it a second time in the Confirmation field, to be sure.

• Protected ports: Check the box of the COM port you want access protection. By default, when selecting access security features, only COM4 (Internal modem) is protected.

The access codes are generated by the utility software Password (see next). 16.2. Password utility When installing TWinSoft a password-creation program named PASSWORD is installed in the same directory as TWinSoft. It can be started from the 'Start' button of Windows and is located in the group of programs “Techno Trade” → “Accessories” created while installing TWinSoft. This program generates a password that will be necessary to Login to the A (see next). This password is composed of 4 hexadecimal characters in response to information’s related to the user. It is based on a complex algorithm using the global code, the user’s name and the access level. The password is accompanied by a 5-digit number that identifies persons who have accessed the A station. This information can be used to trace users for example by inserting this number into a database, with the help of Special analog variables. • Global code: This hexadecimal code of 4 characters is the basis for password generation. It

will be entered in the ‘RTU Properties’ → ‘Security’ menu of TWinSoft and sent to the A. When a user TWinSoft, the latter checks if the NAME and PASSWORD entered fit with the global code within A. This means that if different users with different access levels must communicate with A, the global code used to generate passwords must be the same.

• User name: The name you use when logging in logs into TWinSoft.

• Access level : Three access levels are available:

Level 1: Surveillance mode or VISUALIZATION MODE. The operator can view all A values (local or remote), but can not execute any command. Level 2: COMMAND MODE, the operator can view all the values and execute commands

(locally or remotely). Level 3: ENGINEER MODE, the operator can view all the values and execute commands

and alter or send new TWinSoft documents (locally or remotely). When this information has been entered, click on the button "Get password". Two codes have been created:

The PASSWORD: this password must be used toegether with the NAME when logging into TWinSoft. The USER ID: this number is available in a special analog variable when a user is

connected to a port of A that is protected.

TWinSoft: 8.32 – Getting Started 80

Page 81: Semaphore-twinsoft-manual Ojo

16.3. Login/Logout The Login feature allows users to connect to a protected port of the A according to their own access level. If a port is unprotected, the access level is automatically 3: Engineer. The Login/Logout can be executed from the main menu bar in the 'Tools'. Login When being connected to a port of A that is protected, you need to do a Login to get an access level.

figure 42 You type the Name you used in the ‘Password’ utility and the Password that was created (see previous). According to those, you are in:

Read only mode Read/write mode Read/write + send TWinSoft document

It is displayed in the Status bar.

If 'Save password' is checked and TWinSoft is connected to a protected port: when TWinSoft starts, it uses the access level corresponding to the password saved (see the status line). If it is not checked and TWinSoft is connected to a protected port: TWinSoft starts in 'Read only' mode. You need to do a Login to get your access level. Logout If the TWinSoft is connected to a protected port, the Logout sets TWinSoft in 'Read only' mode. 16.4. Deactivating protection There are two methods of deactivating A access protection: Global reset (see chapter 6.3) The first method is by performing a global reset, which must be done on site. When the program has stopped, the local port is longer protected.

If the internal modem was declared protected, it will still be protected even after a global reset. To deactivate protection, an unprotected TWinSoft document must be sent to A (see next). Sending an unprotected TWinSoft document The second method involves modifying the TWinSoft document and deactivating the Access Security option. The document must then be sent to the A after having done a Login as 'Engineer'.

TWinSoft: 8.32 – Getting Started 81

Page 82: Semaphore-twinsoft-manual Ojo

17. Copy/Paste - Drag'n'Drop These standard functions of Windows are supported since version 7.10. They allow to move or copy Ladder, Tags, Definition ...inside a document or to another document. It is then possible to open several sessions of TWinSoft to access different documents at the same time, and to copy from one document to another document.

17.1. General rules 1. If the creation of a new object needs the creation of other objects, those are automatically

created, except the creation of Resources (the I/O cards must already be declared). Example: you copy an alarm condition from one document to another: the recipient will be automatically created as well as the Tag used as condition (in case it is available in the Resources).

2. The creation of a new object is based on the name of the original object. TWinSoft looks for an existing name of the same type (for Tags: digital or analog). In case it exists, TWinSoft uses it. In case it does not exist, TWinSoft offers you to create the object. Exceptions: 1. In case the name must be unique, TWinSoft creates a new object and increments the name.

Example: you copy ‘Register’ many times, TWinSoft will increment name and address ‘Register_1’, ‘Register_2’,…

2. In case a special register is already declared, it is used with its original name. Example: <second> or <sec> if it concerns the ASPE - 0.

17.2. Examples

Following are examples how these features can be used in TWinSoft:

Create Tags in the list of Tags (Copy/Paste) Tags can be copied with automatic increment of - addresses, -number in name, -number in comment . The sequence is:

create the Tag (or select the Tag). Copy the Tag <CTRL + C>. Paste the new Tag <CTRL + V>.

NOTES: 1. The I/O cannot be automatically created, only registers (DIR, AIR, ....). 2. The increment on number in a comment only applies if the number is the last character. 3. If the name does not include a number as last character, TWinSoft automatically creates and

increments a number. Example: 'register' -> 'register_1' , 'register_2' , .....

TWinSoft: 8.32 – Getting Started 82

Page 83: Semaphore-twinsoft-manual Ojo

Copy a POU in the same document (Copy/Paste) The type of POU is the same and TWinSoft automatically increments the name. Example: 'My_Program' -> 'My_Program_1'

Move or copy Ladder from one POU to another POU (Drag’n’Drop or Copy/Paste) NOTES: 1. In case the types of POU are the same : The local Tags are automatically created in the list of

'POU Tags' of the POU target. 2. In case the types of POU are not the same, for instance from a 'Program' to a 'Function Block':

The local Tags are automatically created in the list of the 'POU Tags', and the global Tags are created as they are. You have to edit the Ladder and change the type of the local Tags: Input, Output or local, and replace the global Tags with local Tags if needed.

Copy Ladder from one document to another document (Drag’n’Drop) - If Tags already exist, with similar names and addresses, the Ladder is created with the existing

Tags. - If the Tags of I/O with similar addresses exist but with other names, the Ladder is not created. - If the Tags of register with similar addresses exist, TWinSoft automatically creates Tags of

similar type and increments the address. - If the Tags do not exist, they are automatically created.

Copy entries of any list (Recipient, Alarm condition, Remote Tags, ...) from one document to another document (Copy/Paste) - If Tags are needed and already exist, with similar names and addresses, the entries are created

with the existing Tags. - If Tags of I/O are needed and already exist with similar addresses but with other names, the

entries are not created. - If Tags of register are needed and already exist with similar addresses, TWinSoft automatically

creates Tags of similar type and increments the address. - If Tags are needed and do not exist, they are automatically created. Modifying the sequence of the elements in all lists (Drag'n'Drop).

It allows changing the sequence of entries in a list. This can be particular useful in the List of Remote Tags, as they are executed in the sequence of the indexes in the list.

NOTES: 1. The sorting (by name, address, ...) only applies to the display of the list. 2. Drag’n’Drop in a list is not allowed in the list of Tags.

WARNING: do not make copy/paste between different types of POU. For instance from a ‘Program’ to a Function block’, or from a ‘Function’ to a ‘Program’, … Even if it is possible, it is not allowed as the result is unpredictable.

TWinSoft: 8.32 – Getting Started 83

Page 84: Semaphore-twinsoft-manual Ojo

18. Import / Export TWinSoft supports since version 8.10 Import / Export of configuration file, in CSV format. This is very useful to edit list of configurations using an external software (Excel, Notepad, ...) or even to create full configuration with 'text' files (see Export following). The separator used in the CSV file depends on the regional settings configuration of windows. Typically it is ' ; ' or ' , ' according to the language. NOTE: Be careful when working on different PC that the regional settings (at least the separator) are configured on the same way. When working with an existing list that you wish to update with a file To avoid conflict between indexes of the TWinSoft document and those of the file, we advise you to follow the procedure:

Export Modify/add Import

TWinSoft: 8.32 – Getting Started 84

Page 85: Semaphore-twinsoft-manual Ojo

18.1. Export Export menu is available from the main menu of TWinSoft: 'File' -> 'Export'

The different possibilities are: • Export current view

You export the information contained in the list opened. The available lists are: Tags:

When exporting Tags and groups of Tags, From the group where you are: all the Tags, groups and sub-groups are exported. The above group(s) are not exported.

Alarm condition Alarm messages Chronologies Sampling tables Web/Minitel/Terminal Tags Analog Units Digital States

• Export current selection You export the lines you have selected (a serie of Tags, of alarm conditions, ...).

• Export of a list You select the list you want to export

TWinSoft: 8.32 – Getting Started 85

Page 86: Semaphore-twinsoft-manual Ojo

Example files Example files are installed with TWinSoft. There are available from the sub-directory of

TWinSoft: \Samples\CSV: - Tags.csv - AlarmConditions.csv - AlarmMessages.csv - Chronologies.csv - SamplingTables.csv - TerminalTags.csv - AnalogUnits.csv - DigitalStates.csv You can use them as basis for creating lists of configurations using external software (Excel, Notepad, ...)

TWinSoft: 8.32 – Getting Started 86

Page 87: Semaphore-twinsoft-manual Ojo

The following paragraphs give a detailed description of the syntax for creating your own file.

Export - Tags You export all the Tags and groups.

• Syntax If you want to modify or create your own file, with the 'separator' between each field. The syntax is:

Index Tag Address Comment Initial value

I/O Signed

Example:

Tag *Index,Tag,Address,Comment,Initial Value,I/O,Signed [\Tags] 0,Reg-0,AIR000,Analog Reg. 0,123,INPUT,NO 1,D0,DI.0.0.0,Digital Input 0 CPU,,INPUT, 2,ASPE000,Second,Second of CPU,,OUTPUT,NO

Title The title must be at the first line and must be Tag.

* Line of Comment Any complete line starting with ' * ' can be inserting anywhere in the file as comment. It will not be imported.

Path The path of the group where the Tags are located, starting with \Tags. The following Tags in the file are member of this group. Example: with a group 'Inputs', the path will be : [\Tags\Inputs]

Index When creating a file, any index can be used. The index is re-calculated when imported in the TWinSoft document.

Tag The name of the Tag (maximum 15 characters). If it is a Tag of a card of an extension rack, the card must be declared in the ‘Resources’ of the TWinSoft document.

Address Refer to the allowed address types (Help of TWinSoft)

Comment The comment associated to the Tag. WARNING: in case the comment includes the separator, it must be indicated bewteen brackets. Example: “This register, is my favorite”

Initial value If you wish to assign a value to the Tag at start-up of A.

TWinSoft: 8.32 – Getting Started 87

Page 88: Semaphore-twinsoft-manual Ojo

I/O Input or Output. With Registers : determines the format. With I/O : it is not used. The format depends of the physical address.

Signed Yes or No. With Register : determines the format. When nothing is mentionned, it is considered as a 'yes'.

Any field not needed must be left empty.

TWinSoft: 8.32 – Getting Started 88

Page 89: Semaphore-twinsoft-manual Ojo

Export - Alarm conditions You export the list of Alarm conditions.

• Syntax If you want to modify or create your own file, with the 'separator' between each field. The syntax is:

Index Tag Type Threshold (analog)

Recipient Message Filter Hysteres (analog)

Inhibit AutoEnd

Example: AlarmCondition *Index,Tag,Type,Threshold,Recipient,Message,Filter,Hyst,Inhibition,End 1,ON,POS,0,Motor,”Motor is started”,1:30:00,,0,Yes 2,FLOW1,Max,560,Temperature,”Temperature above 55 degree”,00:2:00,25,0,--

Title

The title must be at the first line and must be AlarmCondition.

* Line of Comment Any complete line starting with ' * ' can be inserting anywhere in the file as comment. It will not be imported.

Index The index in the list of conditions. Maximum 256 digital and 256 analog conditions can be defined.

Tag Maximum 15 characters. The Tag must exist in the TWinSoft document. Otherwise, the alarm condition cannot be imported.

Type POS or NEG ANALOG : Max or Min

Threshold DIGITAL : empty ANALOG : the value generating the alarm

Recipient The Recipient must exist in the TWinSoft document. Otherwise, the alarm condition cannot be imported.

TWinSoft: 8.32 – Getting Started 89

Page 90: Semaphore-twinsoft-manual Ojo

Message The message can be: - an index : a number between 1..256 - a text : a message of 30 characters. It must be typed between brackets. (Ex:“this is a text

message”). If the message does not exist, it will be created. - a report: if is not a message but a report. It must be typed between brackets.

(Ex:“ThisReport.trep”). The report must be declared in the folder ‘Web & Report files’.

Filter without filter: empty with filter: the time in MM:SS

Hysteresis DIGITAL: empty ANALOG: the value of hysteresis

Inhibit 0 Enabled (the alarm is always active) 1 Disabled (the alarm is always inhibited) 2 Power Failure (the alarm is inhibited when there is a main power failure) 3 Disabled if DisAla=1 (the alarm is inhibited when DisAla=1)

End Yes or No

Any field not needed must be left empty.

TWinSoft: 8.32 – Getting Started 90

Page 91: Semaphore-twinsoft-manual Ojo

Export - Alarm message You export the Alarm messages. • Syntax

If you want to modify or create your own file, with the 'separator' between each field. The syntax is

Index Message Next Example: AlarmMessage *Index,Message,Next 1,D0 Input has been activated, 2,This is a long message to send ,3 3,on a printer,

Title

The title must be at the first line and must be AlarmMessage.

* Line of Comment Any complete line starting with ' * ' can be inserting anywhere in the file as comment. It will not be imported.

Index The index in the list of messages. A maximum of 256 messages can be defined.

Message The message can be of maximum 30 characters. When it is longer, it will be truncated during import. In case the message must includes the separator (',' for instance), the complete message must be typed between brackets. Example:. 2,"This message, includes a coma",0

Next The index of the next message. Available for message to be printed, or with some 'C' driver.

Any field not needed must be left empty.

TWinSoft: 8.32 – Getting Started 91

Page 92: Semaphore-twinsoft-manual Ojo

Export - Chronologies You export the list of Chronologies. • Syntax

If you want to modify or create your own file, with the 'separator' between each field. The syntax is:

Index Tag Type Var Inhibit Example: Chronologies *Index,Tag,Type,Var,Inhibition 1,D0 ,DEL,,0 2,Level ,Var,5 ,2

Title

The title must be at the first line and must be Chronologies.

* Line of Comment Any complete line starting with ' * ' can be inserting anywhere in the file as comment. It will not be imported.

Index The index in the list of chronologies. Maximum 256 digital and 256 analog entries can be defined.

Tag Maximum 15 characters. The Tag must exist in the TWinSoft document. Otherwise, the chronology cannot be imported.

Type DIGITAL: POS, NEG ou DEL ANALOG: Var (for Variation. See next)

Var (Variation)

DIGITAL: empty ANALOG: Value of the variation

Inhibit 0 Enabled (the recording is always active) 1 Disabled (the recording is always inhibited) 2 Power Failure (the recording is inhibited when there is a main power failure) 3 DIGITAL : Disabled if DisCRD=1 (the recording is inhibited when DisCRD=1) ANALOG : Disabled if DisCRA=1 (the recording is inhibited when DisCRA=1)

Any field not needed must be left empty.

TWinSoft: 8.32 – Getting Started 92

Page 93: Semaphore-twinsoft-manual Ojo

Export - Sampling tables You export the list of Sampling tables. • Syntax

If you want to modify or create your own file, with the 'separator' between each field. The syntax is:

Index Tag Type Period Size Reset Tag Example: SamplingTable *Index,Tag,Type,Period,Size,Reset Tag 1,FLOW1,Mean,00:30:00,180,yes 2,FLOW2,Max,00:03:00,1200, 3,FLOW3,Min,01:00:00,60,

Title

The title must be at the first line and must be SamplingTable.

* Line of Comment Any complete line starting with ' * ' can be inserting anywhere in the file as comment. It will not be imported.

Index The index in the list of sampling tables. Maximum 64 sampling tables can be defined.

Tag Analog Tag of maximum 15 characters. The Tag must exist in the TWinSoft document. Otherwise, the sampling table cannot be imported.

Type Minimum: Min Maximum: Max Average: Mean Instantaneous: Inst

Period The period between 2 recordings. Check in the Sampling table configuration which are the available period.

Size

The number of Records you wish to save in A.

Reset Tag Yes or No Determine whether the Tag is reset after recording (with registers only).

Any field not needed must be left empty.

TWinSoft: 8.32 – Getting Started 93

Page 94: Semaphore-twinsoft-manual Ojo

Terminal Tags

Syntax If you want to modify or create your own file, with the ‘separator’ between each field. The syntax is: Index Tag Comment Write

allowed State1 State0 Min Max Meas.

Min Meas. Max

Conv. Min

Conv. Max

# dec.

Unit

Example: TerminalTagname *Index,Tag,Comment,Read Only,State 1,State 0,Minimum,Maximum,Measured Min,Measured Max,Converted Min,Converted Max,# dec.,Unit 1,ANA0,analog 0,No,,,0.000,1000.000,0,255,0.000,1000.000,3,m³ 2,ANA1,analog 1,No,,,0.00,1000.00,0,255,0.00,1000.00,2,liters 3,D0,Input 0,No,IN,OUT,,,,,,,,4,Q0,Pomp 0,Yes,ACTIVE,STOP,,,,,,,,

Title The title must be at the first line and must be TerminalTagname. * Line of Comment Any complete line starting with ' * ' can be inserting anywhere in the file as comment. It will not be imported.

Index The index in the list of Web/Minitel/Terminal Tags. Maximum 256.

Tag Maximum 15 characters. The Tag must exist in the TWinSoft document. Otherwise, the Terminal Tag cannot be imported.

Comment The comment associated to the Tag

Write allowed Yes: The Tag can be monitored No: Write not allowed

State 1 / State 0 The text associated to the digital Tags. State 1: the text when the Tag is '1' State 0: the text when the Tag is '0' If the states do not exist they are created.

Minimum / Maximum When the option 'write allowed' is selected (see above), the range in which a value can be written (analog Tags only). The number of decimals depends on the quantity selected (see below). The decimals can be omitted.

TWinSoft: 8.32 – Getting Started 94

Page 95: Semaphore-twinsoft-manual Ojo

Measured Min / Max Converted Min / Max To define a scaling converting a physical range (measured) to a real range (converted). Example: 8bits analog input (0..255) corresponds to 0..1000 mm Measured: 0 ... 255 Converted: 0 ... 1000 # dec. Number of decimals (maximum 3)

Unit The text associated to analog Tag. Any field not needed must be left empty. Analog Units Syntax If you want to modify or create your own file, with the 'separator' between each field. The syntax is:

Index Unit Example: TerminalAnalogUnit *Index,Unit 1,m³ 2,liters

Title The title must be at the first line and must be TerminalAnalogUnit. * LINE OF COMMENT Any complete line starting with ' * ' can be inserting anywhere in the file as comment. It will not be imported.

Index The index in the list of Analog units. Maximum 256. WARNING: An analog Tag Web/Minitel/Terminal refers to an index of an analog unit. If you change the text of an index, it will be updated in the Terminal Tags.

Unit The text associated to analog Tag. Maximum 8 characters.

TWinSoft: 8.32 – Getting Started 95

Page 96: Semaphore-twinsoft-manual Ojo

Digital States Syntax If you want to modify or create your own file, with the 'separator' between each field. The syntax is:

Index State 1 State 0 Example: TerminalDigitalState *Index,State 1,State 0 1,IN,OUT 2,ACTIVE,STOP

Title The title must be at the first line and must be TerminalDigitalState. * LINE OF COMMENT Any complete line starting with ' * ' can be inserting anywhere in the file as comment. It will not be imported.

Index The index in the list of digital states. Maximum 256. WARNING: A digital Tag Web/Minitel/Terminal refers to an index of a digital state. If you change the text of an index, it will be updated in the Terminal Tags.

State 1 The text associated to the digital Tags when it is at '1'. Maximum 8 characters.

State 0 The text associated to the digital Tags when it is at '0'. Maximum 8 characters. Both states fields have to be filled.

TWinSoft: 8.32 – Getting Started 96

Page 97: Semaphore-twinsoft-manual Ojo

18.2. Import After you have exported files for modification (see previous), or you have created your own file, you can Import them. Import menu is available from the main menu of TWinSoft: 'File' -> 'Import'.

The lists you can import are:

Tags Alarm condition Alarm messages Chronologies Sampling tables Web/Minitel/Terminal Tags Analog Units Digital States

Working with an Empty Document • Import of Tags

When doing an import into an empty document Tags & groups are created from the file. If the file contains I/O declared in extension blocks (Rack4 or Rack8), the racks and cards must be first created in the 'Resources'.

• Import of Messages When doing an import into an empty document Messages are created from the file.

• With Chronologies and Sampling tables The import is only possible when Tags exist.

• With Alarm Condition The import in only possible when Tags and Recipient exist. The Message are created.

TWinSoft: 8.32 – Getting Started 97

Page 98: Semaphore-twinsoft-manual Ojo

When doing an import, if the corresponding list in TWinSoft contains already at least one configuration, the following options appear: Exact replace You want to erase an exiting list and replace it with the file. The list of the TWinSoft document is replaced by the file. The list is first erased, and then replaced by the file. Not with Tags (see following) Be careful all indexes are re-defined according to the file. • With Tags

Tags within TWinSoft have an internal index, different from the one you see in the list of Tags. This index is used as internal reference for every configuration where the Tag is used (Alarm, Datalogging, Ladder, ...) When importing a list of Tags, if within the file, a Tag name is the same than the one present in the document, but with another index, the import cannot be done. A message box then informs you. That is why we advise you to always work with an Exported file.

Replace You have modified some entries and/or have added some entries in the file. The import will keep or modify the existing configuration, and add the new one. Each time there is an existing configuration with the same index as the one in the file, you are prompt to choose the one(s) you wish to save. Append You want to add some new entries to an existing list. The entries are added to the existing list. • With Tags

The indexes you have defined in the file have no importance. It can even be the same for each Tag. Groups of Tags are also created. If Tag names or addresses are already existing within the document, the import will be refused.

• With Messages, Alarm condition, Chronologies, Sampling tables

Check the last index in the TWinSoft document and use the next one when creating the file.

TWinSoft: 8.32 – Getting Started 98

Page 99: Semaphore-twinsoft-manual Ojo

19. Pack & Go 19.1. Presentation Pack & Go is a tool that builds up one file with your complete project, including TWinSoft document, WebForms, Reports, OS,... The goal is to backup a complete project without missing files or to update a RTU with the complete project without requiring advanced knowledge of TWinSoft. All files are compressed and packed into one file with the extension .tpg (TWinSoft Pack & Go). Once a project is packed, it can be unpacked and/or updated to the RTU from a double click on the .tpg file. 19.2. Pack To access Pack & Go menu, select from the main menu ‘File’ ‘Pack & Go…’

Select the button ‘Pack …’

TWinSoft: 8.32 – Getting Started 99

Page 100: Semaphore-twinsoft-manual Ojo

All Files of the project, TWinSoft document, WebForm, html pages, OS, … are packed in one file, with the extension .tpg

19.3. Unpack To open the Unpack window, double click a file with the extension .tpg. Unpack menu offers 2 features: 1. Restore a project Extract a project into a directory of your PC. This option is very convenient for backing up a project being sure you don't miss any file. Option available from the main menu: ‘Tools’ Unpack.

TWinSoft: 8.32 – Getting Started 100

Page 101: Semaphore-twinsoft-manual Ojo

2. Update a RTU Update a RTU with a complete project, including the application, OS, WebForms, report, ...from a unique file. The button ‘PC Setup…’ gives you access to the configuration of the PC, to communicate with the RTU.

The button ‘Update RTU’ sends the project and OS to the RTU.

Languages supported are English, French and German. It cannot be selected from 'Unpack' menu but changed from TWinSoft main menu: 'Tools'

'Language'

TWinSoft: 8.32 – Getting Started 101