FAI Designs Inc.

RTES32 - User's Guide

Getting Started
Step 1 Create a folder named RTES in the Program Files folder in drive C:
Step 2 Copy or download RTES32.EXE in the new folder C:\Program Files\RTES
Step 3 Create a shortcut for RTES32.EXE on your 'desktop'
Step 4 Create a "working" folder that will contain your RTES files. For instance C:\Controls
Step 5 Right-click the shortcut, click "Properties", enter the path of the new folder in the "Start in" line. Click OK to close the properties' window.
Step 6 Double Click the shortcut to start RTES32
Note You may copy the shortcut into the "Startup" program group to start RTES32 automatically whenever the computer starts.

Configuration File

RTES32 uses an optional configuration file named RTES32.INI that sets various parameters. This file must reside in the default (working) folder, where the RTES application is saved.

RTES32.INI is a text file, that you may create and edit using Notepad. You may also access it via a menu shortcut on the RTES32 menu bar (under Communications).

RTES32.INI is divided into sections. Each section starts with the name of the section between square brackets.

The following sections are defined at the moment:

[UNET]

[WEBHOST]

[ODBC]

Within each section, you define parameters using a 'key' followed by the "=" sign and followed by one or more alpha-numeric arguments.

Parameters within the section may be arranged in any order.

Multiple arguments must be separated by spaces, a dot, or a comma.

A comment line starts with "/".

The following keys are defined at the moment:

Section: [UNET]

Parameter

Description

Default value

NODE

Sets the station id on the UNET network for this computer.
The NODE consists of 1 number (between 0 and 255).

NODE=1

DELAY

Idle time in milliseconds between requests to other stations..

DELAY=10

RETRIES

Number of consecutive failed attempts to communicate with a remote station before setting on the associated ALERT register.

RETRIES=3

SWITCH

The index of Register that must be in the ON state for this station to respond to requests from the remotes.

none. This station always responds

TIMEOUT

The time in milliseconds that this station will wait for a response before trying again.

TIMEOUT=250

REMOTE

Specifies the IP of a remote station. Each remote is defined by 6 decimal numbers. The first number is the UNET node id. The next 4 are the IP of that station. The last number is the node type. A type 0 indicates that the node is a RTES or RTES32. A non-zero node type indicates that the node is an IP Based Device Server.

You may include up to 64 "REMOTE" lines in the file.

No remote station defined

BINARY

Defines a cluster of binary registers to be received from a remote station. Each "BINARY" definition consists of 6 numbers. You may include up to 64 "BINARY" definitions in the file.

FIRST, QTY, NODE, POS, ALERT, ENABLE

FIRST

the index of the first register of the block at the requesting RTES.

QTY

the number of registers to transfer, starting at and including the first register. The maximum number of register values that may be transferred is 16 per block.

NODE

the station id of the UNET in the computer that the values will be coming from (source).

POS

the index of the first RTES variable at the source computer.

ALERT

the index of the register to be set in case a communication error or time-out occurs when this particular block is transferred

ENABLE

the index of the register that will control transmission, or 0 if transmission is continuous. See "ENABLE" parameter.

No binary cluster

FLOAT

Defines a cluster of analog (floating point) registers to be received from a remote station. Each "FLOAT" definition consists of 6 numbers. You may include up to 64 "FLOAT" definitions in the file.

FIRST, QTY, NODE, POS, ALERT, ENABLE

FIRST

the index of the first register of the block at the requesting RTES.

QTY

the number of registers to transfer, starting at and including the first register. The maximum number of register values that may be transferred is 16 per block.

NODE

the station id of the UNET in the computer that the values will be coming from (source).

POS

the index of the first RTES variable at the source computer.

ALERT

the index of the register to be set in case a communication error or time-out occurs when this particular block is transferred

ENABLE

the index of the register that will control transmission, or 0 if transmission is continuous. See "ENABLE" parameter.

No analog cluster

ENABLE

Defines the behaviour of the ENABLE register, when used in FLOAT and BINARY. When set to 0, the data is exchanged as lomg as the enable register is on. When set to 1, setting the ENABLE register on intiates a data exchange and it is turned off automatically after a succesful data exchange.

ENABLE=0

Visit the IPS page for specific information about exchanging data with IP Based Device Servers that allow you to interface RTES32 with various I/O subsystems.

Section: [WEBHOST]

Parameter

Description

Default value

NAME

Defines an alphanumeric name for this web host.
This name appears as the "Realm" when a user id and password are requested to access this web host.

The name is blank.

RTES variables :
The parameter used in FIRST and POS is coded as follows to indicate which type of variable is used:

0-9999         R registers

20000-29999    O registers

Section: [ODBC]

Parameter

Description

Default value

NAME

Alphanumeric Data Source Name to use for ODBC operations associated with the WSQL RTES32 command.
You define this name in "Control Panel\Administrative Tools\Data Sources".

The name is blank.

USER

Alphanumeric user id for the Data Source to use for ODBC operations.

The name is blank.

PASS

Alphanumeric password for Data Source Name to use for ODBC operations.

The name is blank.

IP

IP address of a server that contains the Data Source Name to use for ODBC operations.

The IP is blank and the DSN is 'local'.

HANDLER

The name of the server side script that handles the ODBC operations.

Only used when the IP is defined

LOGS

The name of the table in the database that will receive the alarm and change of state events.

Events are not logged

Registers

The drop-down menu at "Window" on the task bar gives you access to the R and the O registers. Use the scroll bar to view all the registers, or the "Find.." to locate a register by name.

You may change the name, current value and text for the registers by clicking on the item. You must use the "Enter" key for the change to take effect. The "Esc" key allows you to abandon the editing. Note that while an editing window is open, the display is frozen.

You may also use the command line to name registers, assign text to them and set the values. (Commands : NAME, TEXT, LET, SET, START, STOP)

Rules

You may click on the R column to examine and edit the rules. You must use the "Enter" key for the change to take effect. The "Esc" key allows you to abandon the editing. Note that while an editing window is open, the display is frozen. When entering a new rule, make sure it starts with "=". When using the "FREE" selection to remove a rule, you must click on the text of the rule to be able to use the "Enter" or "Esc".

You may also use the commands RULE, EXEC, EXT, (etc.) and FREE on the command line.

The "greater than or equal" and "less than or equal" operators are entered and displayed as ">=" and "<=", respectively.

TABLE function

Reads a series of numbers from a given position in a file, into a set of consecutive registers, whenever an 'record number' register changes.

The following RTES command defines a TABLE function :

TABLE register=expression
registeris the name of the register that will be used as 'record number'
expressionis an arithmetic expression (just like a RULE) that will be used to determine the value of the register

The two register immediately following the 'record number' register are automatically used by RTES. Their values represent respectively the number of the first register of the set to receive the values from the file, and the quantity of registers to use - that is the 'record length'.

The text area of the 'record number' register must specify the name of the file name that contains the data. The file must have the .bin extension, but the extension is not shown in the text area.

An example to illustrate the TABLE function:

R0025 SET_RECORD    0.00   T  DATAFILE
R0026 DATA_REG     30.00   R
R0027 REC_SIZE      5.00   R
'
'
R0030 DATA1         0.00
R0031 DATA2         0.00
R0032 DATA3         0.00
R0033 DATA4         0.00
R0034 DATA5         0.00
.
.
TABLE SET_RECORD=SET_RECORD

A test file DATAFILE.BIN may be built to contain the series of numbers 1 to 1000, with the following task:

R1024 FILENAME     0.00       DATAFILE.BIN

001 EOPEN 1 FILENAME 1
002 SET DATA1 0
003 LET DATA1=DATA1+1
004 WRITE 1 DATA1
005 IF [DATA1<1000] 3

If you set SET_RECORD to 1, DATA1 - DATA5 will read 1.00 to 5.00
If you set SET_RECORD to 10, DATA1 - DATA5 will read 46.00 to 50.00
If you set SET_RECORD to 100, DATA1 - DATA5 will read 496.00 to 500.00

Tasks

You obtain the task list at the drop-down menu, under "Database".

Once you have the list, right click on a task name or the *TASK* heading to add, import, open (for editing) and control the tasks.

Each task opens for editing in a new window.

You select a line when you click on it, you open it for editing when you click on it a second time. Click away from from te line you changed to submit it to the interpreter.

To Insert/Delete lines, select a line and click on the task name bar.

Alarms and Change-Of-State

Once the variable that represents the alert condition and its associated message exist, an alert may be defined by two methods.

Screen editing method

Locate the alert variable. Click in the "A" column. Then select :

The "E" directs any change of state of this variable to the change of state logger.

The "N" simply eliminates a previously defined alert condition for that variable.

ALERT command method

An alert condition may be defined or removed with the ALERT command. The format of the command is :

ALERT name state[cr]

name is the name of the variable to be associated with the alert condition
state is

  • 0 for FALSE = alert condition
  • 1 for TRUE = alert condition
  • E for EITHER. This tags the variable for change of state recording.
  • N for NO alert condition (to cancel a previously existing alert condition)
Alarm acknowledge

The command ACK name RTES32 locates and maintains these registers:

  • ALARM$ - The quantity of alarms currently active
  • ACK$ - The quantity of alarms currently active and acknowledged
RTES32 locates the following registers on startup and uses them:
  • LOG$ defines an array of file names in the "Message" column where the alarm events are logged
  • DLOGS$ is a swith to turn on and off the alarm events logging
  • COS$ defines an array of file names in the "Message" column where the change of states are logged
  • DCOS$ is a switch to turn on and off the change of states logging
  • STATUS$ is an array of 16 registers that define in the "Message" column the status descriptors.

Web Host

RTES32 is ready to interface with web browsers.

Click "Communications" on the menu bar to choose the folder that will be the Host Directory and contain your HTML files. Your selection is saved in the 'registry'.

RTES32 looks for the following register names on startup and maintains them:

Using HTML

HTML files used to interface with RTES must

As RTES32 delivers your HTML files to the browser, it looks for the following special "tags".

@@variable definition@

The text contained between @@ and @ uses the same format as the report generator.

[[condition]text]

The expression between the second [ and the first ] is evaluated as a boolean. "text" is included if the result of the evaluation is true. (Click here for more details.)

!!command!

The text between the second and last ! is assumed to be an RTES command.

Example : !!LET HITS=HITS+1!

Use of the POST method

When defining the FORM, ACTION="page.htm" causes page.htm to be displayed when the form is submitted.
A pair of NAME and VALUE define the RTES command to be executed.

Examples :

(1) Start/stop:

(2) Set to a numeric value:

(3) Select value - Radio button style:

(4) Select value - Menu style:

(5) Assign a text to a variable:

Password Authorization Protocol

On startup, RTES32 looks for a register named PAP$.
When that Register is set to 1, a user id and password are requested to access the html documents via the web browser. The user id must match the text at Register PAP$ and the password must match the text at the next Register. If you change these texts, you must click "Run Configuration" under "Communications" on the menu bar for the change to take effect.

Using DHTML

RTES32 (and RTES) support a set of commands that allow the exchange of dynamic data with a web page where the variables are accessible via DOM, using Javascript.

DOM stands for Document Object Model and allows access to every entity on a web page. All browsers support DOM. All it takes is a mechanism that retrieves the appropriate data from the server and assigns it to the element it belongs to.

We supply a javascript named liveweb.js that allows you to easily use these techniques without any knowledge of scripting. All you have to do is follow these guidelines that we will apply to an example.

This is the complete document for this example:

Note: Other scripts are available and many more are being written and tested to produce various functions such as scada style functions. Please
contact us for details.

ODBC / SQL access

The RTES command WSQL provides a way to access databases using SQL via ODBC.
The format of the command is WSQL name
name is the name of a RTES register that defines a
file array. The file identified by the value of the register is interpreted by the report generator and passed on to ODBC.

The [ODBC]section in RTES32.CNF defines:

If the databse is located on a server that is only accessible using it's IP address, then 2 more parameters are required:
The file referenced by the WSQL command may contain any SQL statement that accesses the predefined database to write data to a table, delete data from a table or modify data in a table.

Any data returned by an WSQL query will be ignored. Use the RSQL command to retrieve data from a table.

You may execute the WSQL command from an RTES32 command line, as an X task statement or as an EXEC function, or also from a batch file you run with a GET command.

The RTES command RSQL provides a way to retrieve data from databases using SQL via ODBC.
The format of the command is RSQL name destination
name is the name of a RTES register that defines a file array. The file identified by the value of the register is interpreted by the report generator and passed on to ODBC.

destination is the name of the first of a series of consecutive RTES registers that will receive the data.

The [ODBC]section in RTES32.CNF defines:

If the databse is located on a server that is only accessible using it's IP address, then 2 more parameters are required:
The file referenced by the name paramter of the RSQL command may contain any SQL statement that accesses the predefined database to read data from table, but will also operate with statements that write data to a table, delete data from a table or modify data in a table.

In the event that the SQL satement returns several rows, only the first row is read.

You may execute the RSQL command from an RTES32 command line, as an X task statement or as an EXEC function, or also from a batch file you run with a GET command.

Example:

R0123 LOG     1.00    FAULT.FMT
R0124         0.00    DEFECT.FMT
R0125         0.00    DOWNTIME.FMT
A task issues the command: WSQL LOG

Since LOG=1, the selected file is DEFECT.FMT

DEFECT.FMT contains:

INSERT INTO Defects(Machine,Defect Type,Timestamp) VALUES (@@MC# NUMBER@,@@TYPE LIST 0 TYPES 0@,@@TOD REAL 6 2@)
Note that "INSERT INTO" is a standard SQL keyword, "Defects" is the name of a table you defined in the database specified in the [ODBC] section of RTES32.INI, "Machine", "Defect Type" and "Timestamp" are fields that you defined in that table, using the appropriate data types.

MC#, TYPE, TYPES and TOD are RTES register names.

Example of how WSQL may be used to record live data into a database.

In the case of a remote database, it is assumed that the server is IIS (Internet Information Services) Version 6 or equivalent, that it accepts sql queries on port 80 (http) and that it has a compatible query handler.

Note that the format of the tables in the database should follow certain guidelines if you intend to use the trend display facilities we supply.

Contact FAI for assisstance.

Logging alarm and change of state events.

The LOGS parameter defines a table in the database that will be used by RTES32 to log the alarms and change of state events. This table must exist and must contain the following fields:

Here is an example of how to create a table named "eventlogs" in MySql:
In this case, RTES32.INI will contain in the [ODBC] section: LOGS=eventlogs

Email Facility

A 'command line' emailer is available (free of charge to RTES users). The command line may be executed by RTES as EXT function, thus integrating it with an application. You may download email.exe here.

The email facility references a text line that may be crated dynamically with RTES (DOC / PRINT) just like a report, thus making the content of the email dynamic.

Some applications of this emailing facility are Alarm annunciation, Periodic status report, Archiving of events, Production reports.

To use the emailing facility, you must have make accessible to RTES32 the program (email.exe). The easiest way is to copy it to the RTES32 default directory, where OLEX*.RTES is located. Email.exe use a configuration file named email.ini, that must be also be in that same directory.

Create email.ini.
Using notepad, create a file containing the following - replacing the information within quote marks with your own, without the quote marks:

Below is an example of email.ini using a server on port 25 without authentication and with logging enabled:

Once email.ini is done, you may use email.exe to send and email that is contained in a file. The file must follow a certain format, that provides to email.exe the recipient and sender. Below is what a typical file looks like:

To send this email, save the above text in a file named "hourly.txt" (for instance) and you may open a command prompt window, change the direcory to the one containing the file and enter the command line : email hourly.txt
Illustration

You may also send this email through a EXT function in RTES32. Here is an example of how you do that:
Create two consecutive variables named EMAIL and HOURLY
Define a function EXT EMAIL=HOURLY (this is like defining a RULE, but with EXT instead of RULE)
Enter in the Message area of HOURLY : email hourly.txt

When you set HOURLY to 1, EMAIL changes to 1 as well and the EXT associated with it execute the text that is 1 line down as an EXTernal command line (just as if you entered it at the command prompt).

Illustration
See the example here to create hourly.txt dynamically.