SYS600 - Programming Language SCIL PDF
SYS600 - Programming Language SCIL PDF
SYS600 - Programming Language SCIL PDF
Technical Description
1MRS756176 MicroSCADA Pro SYS 600 9.2
Issued: 11.10.2006 Programming Language SCIL
Version: B/28.03.2008
Technical Description
4
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
9. Functions ...............................................................................129
9.1. General .....................................................................................129
9.2. Generic functions ......................................................................142
9.3. Arithmetic functions ...................................................................146
9.4. Time functions ...........................................................................152
9.5. String functions .........................................................................168
9.6. Bit functions ...............................................................................179
9.7. Vector handling functions ..........................................................182
9.8. List handling functions ...............................................................193
9.9. Functions related to program execution ....................................194
9.10.Functions related to the run-time environment .........................199
9.11.Functions related to the programming environment .................203
9.12.Language functions ..................................................................210
9.13.Error tracing functions ..............................................................215
9.14.Database functions ...................................................................216
9.15.File handling functions ..............................................................244
9.16.File management functions ......................................................257
9.17.Communication functions .........................................................272
9.18.CSV (Comma Separated Value) functions ...............................273
9.19.DDE client functions .................................................................276
9.20.DDE server functions ................................................................281
9.21.ODBC functions ........................................................................282
9.22.OPC Name Database functions ...............................................288
9.23.OPC functions ..........................................................................290
9.24.RTU functions ...........................................................................298
9.25.Printout functions ......................................................................301
9.26.Miscellaneous functions ...........................................................305
10.Graphics primitives ..............................................................309
10.1.Introduction ...............................................................................309
10.2.Full graphics SCIL commands ..................................................310
10.2.1.Drawing graphical elements ...........................................310
10.3.Graphics contexts .....................................................................315
10.3.1.General ..........................................................................315
10.3.2.Defining graphics contexts .............................................316
10.3.3.Components of graphics contexts ..................................317
10.3.4.Colors and fonts .............................................................322
10.3.5.Reading graphics contexts .............................................326
10.4.Graphics canvas .......................................................................326
10.5.Miscellaneous graphical commands .........................................331
10.5.1.Storing and restoring selections .....................................331
10.5.2.Display handling commands ..........................................331
5
SYS 600 9.2 MicroSCADA Pro 1MRS756176
6
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
1.1. Copyrights
The information in this document is subject to change without notice and should not
be construed as a commitment by ABB Oy. ABB Oy assumes no responsibility for
any errors that may appear in this document.
In no event shall ABB Oy be liable for direct, indirect, special, incidental or
consequential damages of any nature or kind arising from the use of this document,
nor shall ABB Oy be liable for incidental or consequential damages arising from use
of any software or hardware described in this document.
This document and parts thereof must not be reproduced or copied without written
permission from ABB Oy, and the contents thereof must not be imparted to a third
party nor used for any unauthorized purpose.
The software or hardware described in this document is furnished under a license
and may be used, copied, or disclosed only in accordance with the terms of such
license.
Copyright © 2006-2008 ABB Oy
All rights reserved.
1.2. Trademarks
Registrations and trademarks used in this document include:
Windows: Registered trademark of Microsoft Corporation.
7
SYS 600 9.2 MicroSCADA Pro 1MRS756176
8
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
2. Introduction
This chapter introduces the SCIL programming language, the SYS 600 application
engineering, and the SCIL program structure.
What is SCIL
SCIL, Supervisory Control Implementation Language, is a high level language
especially designed for the application engineering of the supervisory control
system SYS 600. All SYS 600 application programs as well as most system
configuration programs are built in SCIL.
Application engineering
In SYS 600, 'application engineering' means the composition of customized, process
specific supervisory control software. The result is an application software package
adapted for the user’s needs regarding control functions, communicating process
devices, user interface, level of information, etc. A base system contains one or more
application software packages named applications. The application engineering
comprises:
• Functional design, i.e. the programming and definition of the SCADA functions
as well as other supervisory control and calculation functions.
• User interface design.
The functional design involves the definition of databases (a database = a set of
connected data stored in a structured form) and the creation of SCIL programs. Each
application has a process database for handling process supervision and a report
database for data storage, calculations, automatic activation, etc. The databases are
composed of objects named application objects.
The user interface design involves the composition of pictures and dialogs. See
Figure 2.1.-1. Pictures are dynamic illustrations containing a static background,
dynamic windows and user activated function keys. Dialogs are independent
windows which may contain a wide range of user interface items, such as menus,
buttons, images, notebooks, and pictures. Pictures and dialogs represent two
different user interface design methods. The design and programming of dialogs and
dialog systems is named “Visual SCIL”.
These two portions of an application are interwoven with each others, and the user
interface design and the functional design generally occur in parallel.
Application engineering is simplified by using the standard application software
library, LIB 500, which requires a minimum of object definitions and SCIL
programming. In any case, SCIL is found in all SYS 600 applications, even in those
which are built with LIB 500, because the LIB 500 standard application software is
built with SCIL.
9
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Dialogs
Fig. 2.1.-1 A SYS 600 screen view showing three dialogs, one containing a picture.
The application engineering using LIB 500 is discussed in the LIB 500 User’s
Guide. The user interface design is described in the Visual SCIL User Interface
Design and the Picture Editing manuals.
10
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Fig. 2.1.-2 Features controlling the SCIL program execution and features
controlled by SCIL
11
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Composition
A SCIL program is composed of one or more textual statements. Each statement
represents an instruction to the system about a task to be carried out, e.g. the
presentation of a picture or the assignment of a variable value. Consecutive
statements mean a sequence of instructions, which are carried out in the prescribed
order.
Occurrence
SCIL programs appear in pictures, in command procedures (objects for automatic or
SCIL activated program execution), and in the dialogs and dialog items (Visual
SCIL objects). More information about this will be given in Chapter 3.
Example
The example in Figure 2.2.-1 gives an insight into what a SCIL program can look
like. The program could be placed under a function key in a picture, which means
that it is executed each time the key is pressed. The purpose of the program is to
bring a new picture called MENU on screen provided that a password is given
correctly (999).
Password
Fig. 2.2.-1 A SCIL program for the input and control of a password
12
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Components
Each line in the program example in Figure 2.2.-1 is a SCIL statement. (A
statement could also be continued on several lines.) A SCIL statement may consist
of the following main components:
• Commands. These are words with a pre-declared meaning constituting orders to
the system about steps to be taken. In the example in Figure 2.2.-1 each program
line starts with a command.
• Objects. Object is a broad concept which may correspond to physical parts of the
system or the process, database items, user interface objects, or abstract functions
specific to the SYS 600 system.
• Variables. Variables are facilities for the temporary storage and use of changing
data. In the example in Figure 2.2.-1, WORD is a variable.
• Function calls. SCIL has a large number of predefined functions for various
purposes.
• Expressions. Expressions are formulas which can contain constants, object
notations, variables, function calls and operators (e.g. +, - , /, *).
Statement format
The components above can be combined into statements according to one of the
following three formats:
Type (1) (described in Chapters 8, 10 and 11) implies that an action is performed on
or by means of the arguments. The arguments may be object references, expressions,
variables, names, etc. Some commands do not require any arguments, they are as
such complete statements. In some cases the arguments may contain statements. The
command names start with a ! (picture commands), # (control commands) or .
(Visual SCIL, full graphics and Motif commands).
Type (2) (described in Chapter 6) implies that a variable gets a value.
Type (3) is a program call which starts a program execution in a picture, dialog or
dialog item. This type is described in Chapter 5.
13
SYS 600 9.2 MicroSCADA Pro 1MRS756176
14
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
3. Programming in SCIL
This chapter describes the SCIL programming environment and the rules for
programming in SCIL:
3.1 The programming environment: the SYS 600 objects where SCIL
programs and expressions are found, the programming tools in brief,
the use of SCIL expressions in external applications via DDE.
3.2 Programming rules: The structure of the SCIL programs, SCIL
characters, SCIL names.
General
SCIL programs appear in:
• Pictures
• Visual SCIL objects
• Command procedures
In addition, SCIL expressions appear in windows, data objects and time channels.
SCIL expressions can also be entered in external Windows based applications and
evaluated through DDE (Dynamic Data Exchange).
SCIL programming is carried out on-line, while the SYS 600 system is running.
Various application programming tools, such as Dialog Editor, Picture Editor and
Object Navigator, use the SCIL Program Editor for entering SCIL programs. The
SCIL Program Editor is able to check the syntax of the program. To test SCIL
programs, use the Test Dialog accessed from the Tool Manager.
The subsequent presentation of the programming environment assumes that you use
a SYS 600 monitor (application session) of type "VS" (Visual SCIL). In other
monitor types (semi-graphic monitors or "X" type monitors) the programming tools
are semi-graphic. "X" type monitors are required if the application contains Motif
Widgets. In all other cases, use "VS" type monitors. You choose monitor type when
you open a SYS 600 monitor or screen.
Picture programs
A dynamic picture is composed of a static background, windows, function keys,
SCIL-programs and picture functions. Windows are the dynamic parts of the picture.
They can present data fields, graphs, figures or complete pictures. The picture
functions are complete pictures which are integrated in the total picture. Picture
functions and window pictures (pictures shown in a window) are commonly called
"part pictures" or "sub-pictures", while the total picture is called “main picture”.
15
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Pictures are built and programmed in the Picture Editor where they can be named
freely. The pictures and picture editing are described in the Picture Editing manual.
A picture may contain the following types of picture programs (none of them is
obligatory):
• A draw program executed every time the picture is loaded on screen,
immediately after the background has been produced on screen but before the
start program is executed. It can, e.g., be used for adding context specific
graphics to the background by means of graphics commands.
• A start program executed after the draw program. The start program is used for
basic definitions such as initial variable values, update interval, and program
blocks.
• An update program, which is executed repeatedly at intervals defined by a SCIL
command (the !UPDATE command, see Chapter 8) as long as the picture is
displayed on screen.
• An exit program, which is executed each time the picture is closed (even at exit
by clicking three times in the upper left corner of the picture).
• Function key programs executed at each click on the function keys to which
they belong.
• Named programs executed by program calls. A SCIL picture may contain any
number of named SCIL programs. The named programs are started by program
calls as described in Section 5.4. The named program names may be up to 63
characters long. Each picture may contain a named program with a predefined
name, ERROR_HANDLER, where the programmer can define the error handling
to be used in the picture. The ERROR_HANDLER program is described in
Chapter 12.
Besides these programs, the picture contains a background program which is created
automatically by the picture editor. The background program contains graphics
commands. Normally, it should not be edited manually.
Window definitions
The window definitions, see Figure 3.1.-1, may contain expressions which specify
what is to be shown in the windows. The expression of a window is evaluated each
time the window is shown. The window definitions may also contain conditions for
the display of different representations. Both the expressions and the conditions
follow the rules of SCIL.
16
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Methods
Each Visual SCIL can have a number of methods most of which are SCIL programs.
(There are also predefined methods which are programmed in C, but these are not
editable).
A dialog or a dialog item may contain the following SCIL programs (methods):
• Methods started at the creation and deletion of the object.
• Cyclically activated methods.
• Event activated methods started by a process event or an event activated by SCIL
(through event objects, see Section 5.3).
• Action methods started on an operator intervention (for example, a click on a
button).
• A help method started when help is requested.
• An error handling method.
17
SYS 600 9.2 MicroSCADA Pro 1MRS756176
In addition, each Visual SCIL object may have an arbitrary number of user defined
methods which are executed by a method call (see Section 5.4).
The methods of the dialogs and dialog items are programmed in the Dialog Editor.
The composition and programming of dialogs is described in the Visual SCIL User
Interface Design manual.
Command procedures
A command procedure is an independent SCIL program consisting of up to
1 000 000 lines (see Figure 3.1.-2). A command procedure can be activated by a
time channel (see below), an event channel (controller of event-bound activities) or
a SCIL program.
Command procedures are described in the Application Objects manual.
18
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Data objects
The data objects (datalog objects) are objects for the registration and storage of data.
The object definition, see Figure 3.1.-3, contains a SCIL expression which states
how the data is to be calculated.
Data objects are described in the Application Objects manual.
Time channels
The time channels control the execution of time-bound activities. By conditions
which are SCIL expressions, see Figure 3.1.-4, the initialization times and execution
times can be restricted, so that an initialization or an execution can only occur when
the conditions are fulfilled.
Time channels are described in the Application Objects manual.
19
SYS 600 9.2 MicroSCADA Pro 1MRS756176
20
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Item, data = Item and data depends on the DDE transaction as follows:
REQUEST: item = SCIL expression
POKE: item = SCIL object notation
data = SCIL expression
EXECUTE: item = SCIL statement.
The DDE Server function in SYS 600 supports the following SCIL data types (see
Chapter 4): integer, real, text, boolean. There are some SCIL functions which can be
used in the composition of the expressions used via DDE. See the DDE Server
Functions in Chapter 9.
When handling data using DDE Server, occurred SCIL errors are preserved, so that
the user can read afterwards the last SCIL status code of each DDE conversation by
doing a request transaction giving "DDE_SCIL_STATUS_CODE" as Item value.
Accessing a SYS 600 application using the DDE Server requires that the DDE
Server has been enabled in the base-system configuration (the SYS:BDE attribute).
For more information about using DDE, refer to the DDE documentation of the
Windows Application you are using.
Program structure
A SCIL program can contain up to 1 000 000 lines, and each line up to 65 535
characters (including spaces). A SCIL statement comprises one or more lines. A
minus sign (-) at the end of a SCIL line, before a possible comment, indicates that
the statement continues on the next line. A line may be divided anywhere where
spaces are allowed, but not within text constants. The statements are not numbered
and empty lines are allowed anywhere in the programs.
Spaces are allowed anywhere in the program except within numbers, words, names,
object notations and composed symbols. These elements, disregarding operators,
must be adjacent to at least one space at each side. Also the operators DIV and MOD
(see Chapter 7) must be adjacent to spaces.
Upper and lower case letters may be freely intermixed. When the program is
executed, lower case letters are converted into upper case, except for lower case
letters within text constants (see Chapter 4).
Comments can be placed anywhere in the program. They are preceded by a
semicolon (;), which indicates that the rest of the line is a comment. However, if the
semicolon is enclosed in quotation marks (";"), it is regarded as a text (see Chapter
4).
21
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Examples
The following two SCIL-programs are functionally equivalent:
Example 1:
T = TEMP:PAI1
#IF T> 90 #THEN #BLOCK
#SET C:PBO2 = 0
#PRINT 2 OVERHEAT
#BLOCK_END
#ELSE_IF T < 70 #THEN #SET C:PBO2 = 1
Example 2:
T = TEMP:PAI1 ;READ THE TEMPERATURE
#IF T > 90 #THEN #BLOCK ;IF WARMED OVER 90
#SET C:PBO2 = 0 ;STOP HEATING
#PRINT 2 OVERHEAT ;PRINT OVERHEAT MESSAGE
#BLOCK_END
#ELSE_IF T < 70 #THEN #SET C:PBO2 = 1
;RESTART HEATING IF T < 70
The following statement is divided on two lines. As a text constant cannot be divided
it is necessary to type it as a sum of two texts.
A = "IN THIS EXAMPLE, A LONG TEXT VALUE IS " - ;Comments allowed
+ "ASSIGNED TO VARIABLE A" ;like this
SCIL characters
SCIL uses an extended ASCII character set (ASCII = American Standard Code for
Information Interchange). This character set contains 256 characters, each of which
corresponds to a numeric value in the range 0 ... 255.
Some of these characters have a special meaning in SCIL. They symbolize
punctuation marks, operators, messages to the system, etc. These special symbols
and their meanings are listed below. When the symbols are composed of more than
one character, the characters can not be separated by spaces.
22
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
SCIL names
Most user interface objects (picture and Visual SCIL objects, see Chapter 5) and
application objects (see Chapter 5) are identified by logical names (identifiers),
which can be chosen freely. Likewise, the names of variables, named programs, user
defined methods, logical library representation files and directory paths can be
named freely.
As a rule, the names may be up to 63 characters long. However, the names of
pictures, windows and logical paths may be only 10 characters long.
Allowed characters are the letters A-Z, all digits and underscore (_). In application
object names periods (.) are allowed as well. As a rule, the first character of a name
must be a letter. Application object names may also start with a digit, but this is not
recommended.
SCIL supports blanks in Windows directory and file names.
Upper case and lower case letters are not distinct. For example,
OBJ_NAME and Obj_name are the one and the same name.
Examples
Below are some examples on valid and invalid SCIL names:
Valid names:
RELAY
RELAY_STN
RELAY_1234
Invalid names:
4TH_RELAY (starts with a digit, not valid as a name of a picture,
window or variable)
RELÄ (contains a special character)
RELAY_STATION (too long for a window name)
23
SYS 600 9.2 MicroSCADA Pro 1MRS756176
24
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
4. Data types
This chapter describes the SCIL data types: integer, real, boolean, time, text, bit
string, byte string, vector and list.
4.1. General
Data types
In SCIL there are six types of simple data (data constituted of single values):
integer, real, boolean, time, text, bit string and byte string.
In addition, there are two types of structured data: the data type vector represents an
ordered array of data elements, and the data type list represents an unordered list of
attribute names and attribute values. The components (elements and attributes) of
structured data may be of any data type, for example an element of a vector may be
a vector or a list.
Data type none is used in some contexts to denote a missing value.
For generic functions that deal with any type data (for example read the type or
status of data, determine the length of data item or test two data items for equality),
see Section 9.2.
Reliability of data
In SCIL, each data item has a status code, which expresses the reliability of the data.
As a rule, when an expression is evaluated, it gets the status code of the least reliable
operand. Data written explicitly by the programmer or entered by the user always
have OK status. A bad status code may originate, for example, from a process object
value, which have been marked as obsolete due to a communication fault.
The status code of data can be read and written with SCIL functions GET_STATUS
and SET_STATUS (See Section 9.2). The status codes are listed in the Status Codes
manual.
4.2. Integer
Description
The integer data type denotes positive and negative integer values ranging from
-2 147 483 648 through +2 147 483 647. These values may be referred to by
symbolic names MIN_INTEGER and MAX_INTEGER, respectively. Constant
integers outside these limits are represented as real numbers. The most negative
integer -2 147 483 648 cannot be written as a constant, it should be referred to by its
symbolic name MIN_INTEGER.
Integer constants can be typed in decimal or octal form. In decimal form integers are
written as a sequence of digits 0 ... 9 optionally preceded by a sign. No embedded
spaces nor commas or points are allowed.
Octal constants are written as a sequence of octal digits 0 ... 7 followed by a trailing
up arrow (^).
25
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Example
Examples of some valid integer constants:
256
0
000123
-5
777^
The last one represents integer value 511(decimal).
4.3. Real
Description
The real data type expresses, with limited precision, continuous quantities within a
large range of values. The accuracy of real numbers is limited to about seven
significant decimal digits.
Table 4.3.-1 shows the value ranges of the real numbers. All numbers between the
smallest negative and the smallest positive numbers yield the value 0. The ranges are
determined by the processor of the base system computer.
Table 4.3.-1 The value ranges of real values.
Smallest negative value -5.88 E(-39)
Largest negative value -3.41 E38
Smallest positive value 5.88 E(-39)
Largest positive value 3.41 E38
Real numbers are written using digits, decimal points and signs. No exponents are
allowed. At least one digit must precede the decimal point. Numbers without any
decimal point are considered as integer values if they fall within the value range of
integer values. Outside that range, they are considered as real values.
Internally, real numbers are represented by a 32-bit floating point format.
Because the internal representation of a real number is generally not exact, care
should be taken when comparing two real values for equality. For example, it is not
safe to rely on such "facts" as '1.7/5.0 == 0.34'. However, the following holds: Every
whole number in the range -16 777 216 .. +16 777 216 has an exact representation
as a real number. Therefore, for example the relation '170.0/5.0 == 34.0' is safe, no
rounding errors can occur.
For various arithmetic functions that operate on real data, see Section 9.3.
If better accuracy of floating point arithmetics is required by an application, special
purpose SCIL functions operating on 64-bit floating point numbers may be used. See
Section 9.3 for functions whose name is prefixed by "HIGH_PRECISION_".
26
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Example
Examples of some valid real numbers:
0.0
1234.56789
2147483648
5.
0.000000000000000000001
The second number contains 9 significant digits and consequently cannot be stored
without some loss of precision. The third number is a real constant because it falls
outside the range of integers.
4.4. Boolean
Description
Boolean data may take two values: FALSE and TRUE.
Boolean values result from comparisons (relational operators) and various other
tests (such as functions EVEN and ODD). They are frequently used in conditional
statements and expressions.
Internally, FALSE is represented by the value 0 and TRUE by the value 1. Hence,
the relation between the two boolean values is:
FALSE <TRUE.
Integer 0 and 1 are returned when boolean SCIL expressions are used via DDE
(Dynamic Data Exchange).
Examples
Some examples of boolean expressions and their values:
Expression Boolean value
4 + 1 == 5 TRUE
"NIGHT" == "DAY" FALSE
ODD(5) TRUE
4.5. Time
Time data is obtained by reading the system clock and various time stamp attributes
of objects.
A time value is internally represented as a 32-bit unsigned integer counting seconds
since the beginning of 1978.
For various functions that operate on time data, for example give a textual
representation (e.g. calendar time) of time data, see Section 9.4.
27
SYS 600 9.2 MicroSCADA Pro 1MRS756176
4.6. Text
Description
Text data is composed of 0 to 65 535 characters. ISO Latin-1 character set encoding
is used. Symbolic name MAX_TEXT_LENGTH may be used to refer to the text
length limit of the current implementation (65 535 today).
Text values may be compared and concatenated (’added’ using + operator) (See
Chapter 7). For various predefined functions that operate on text data, see Section
9.5.
Text constants are enclosed in quotation marks ("). A single quote (') or double
quotes (") contained in the text must be typed as two single quotes or two double
quotes respectively.
Examples
Two text constants:
"ABC_123!!?%"
"This is a text constant containing one "" and one ' ' "
Description
A bit string is a sequence of bits stored in consecutive memory bytes. The length of
a bit string (the number of bits in the string) may be anything from 0 to 65 535. The
bits in a string are numbered from 1 to 65 535 counting from left to right. Symbolic
name MAX_BIT_STRING_LENGTH may be used to refer to the bit string length
limit of the current implementation (65 535 today).
Bit strings appear as values of process object attributes and functions. They can be
created using functions BIT_SCAN and BIT_STRING and represented in a textual
format by means of BIN function (See Chapter 9).
Bit strings may be compared and concatenated (’added’ using + operator) (See
Chapter 7). For functions that manipulate bit strings on bit level, see Section 9.
Internally, a bit string is represented as a two-byte length field followed by as many
data bytes as needed to store the bits.
Example
An example of a bit string of eight bits converted to a text by means of the BIN
function:
BIN(%BITSTRING) = = "01010101"
28
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Description
A byte string is a sequence of consecutive 8-bit bytes with no structure and no
predefined semantics. The length of a byte string may be anything between 0 and
8 388 600 bytes. Symbolic name MAX_BYTE_STRING_LENGTH may be used to
refer to the byte string length limit of the current implementation (8 388 600 today).
Byte strings can be created by the PACK_STR function. By using the function
UNPACK_STR, a byte string can be interpreted as an array of numerical values.
Byte strings may be used to exchange binary data between SYS 600 and other
applications. Within the SCIL programming environment, they are used, for
example, to store compiled SCIL programs.
Byte strings may be compared and concatenated (’added’ using + operator) (See
Chapter 7).
Internally, a byte string is represented as a four-byte length field followed by as
many data bytes as needed to store the bytes.
4.9. Vector
Description
A vector is an ordered array of data. A data item as a component of a vector is called
an element. A vector may contain up to 1 000 000 elements numbered from 1 to
1 000 000. Symbolic name MAX_VECTOR_LENGTH may be used to refer to the
vector length limit of the current implementation (1 000 000 today).
The elements of a vector may be of any data type. Different elements may even be
of different data types.
A vector may be expanded by simply assigning values to its elements or by function
INSERT_ELEMENT. Elements may be removed by function
DELETE_ELEMENT. For these and various other functions that operate on vector
data, see Section 9.7.
For accessing elements of a vector, see Section 4.11.
Vector aggregate
A vector can be written as a vector aggregate in the following format:
VECTOR[([element [,element]*])]
or
(element1, element2 [,element]*)
The key word VECTOR is followed by the vector element values separated by
commas and enclosed in parentheses. The elements may be given as expressions of
any data type. The key word VECTOR may be omitted, if two or more elements are
listed. An empty vector may be written as VECTOR or VECTOR().
29
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Example
An example of a vector aggregate of five elements:
(-23, "NAME", 0.000001, CLOCK, A + B)
4.10. List
Description
A list is an unordered collection of data components. The components are called
attributes which have a name and a value. Hence, data type list is a list of attribute
name/value pairs. A list can hold up to 1 000 000 attributes. Symbolic name
MAX_LIST_ATTRIBUTE_COUNT may be used to refer to the attribute count
limit of the current implementation (1 000 000 today).
Attribute names are freely chosen, up to 63 character long identifiers.
The attributes of a list may be of any data type. Different attributes may have
different types.
New attributes to a list may be added by function MERGE_ATTRIBUTES.
Function DELETE_ATTRIBUTE may be used to remove attributes. For these and
other functions that operate on list data, see Section 9.8.
For accessing attributes of a list, see Section 4.11.
List aggregate
A list can be written as a list aggregate in the following format:
LIST[([attribute = value [,attribute = value]*])]
The key word LIST is followed by attribute value assignments separated by commas
and enclosed in parentheses. The attribute values may be given as expressions of any
data type. An empty list may be written as LIST or LIST().
Example
A list could have the following contents:
Using a LIST aggregate and vector aggregates, the list could be written:
LIST(LN = ("A","B"), IX = (4,2), UN = (10,11), OA = (3560,3430), OB = (7,16),
OV = (0,5.5))
30
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
31
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Examples:
Valid statements containing component access notations:
A.B = C(2).D(2 .. 6) ;Local variable access
@A.B(1)(12) = %C(2).D ;Global variable access
.SET .HEIGHTS(5) = ROOT\OBJ._GEOMETRY.H ;VS object attribute access
.SET ROOT/WINDOW1.A.B = WINDOW2.C(1) ;Window attribute access
Invalid statements:
#SET A:VB.C = SYS:BUV(5).A ;Not for application objects
MS = LOCAL_TIME.MS ;Not for return values
A = .METHOD(ARG).A ;Not for return values
(VECTOR1 + VECTOR2)(1) ;Not for intermediate results
32
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
5.1. General
Object categories
There are three categories of objects which represent three levels of system
engineering:
• System objects. The system objects are used for system configuration and
communication. They are of two types:
• Base system objects.
• Communication system objects (previously named system objects).
• Application objects. These objects form the functional portion of the
applications. There are ten types of application objects:
• Process objects
• Event handling objects
• Scale objects
• Data objects
• Command procedures
• Time channels
• Event channels
• Event objects
• Free type objects.
• Variable objects
• User interface objects. There are two types of objects for composing the user
interface portion of applications:
33
SYS 600 9.2 MicroSCADA Pro 1MRS756176
• Pictures
• Visual SCIL objects. There are about 40 Visual SCIL object types. Each type
corresponds to a type of dialog, dialog item (e.g. buttons, texts, lists, menus) or
image.
5.2.1. General
Overview
The system objects define the hardware and software configuration of the entire
SYS 600 system, as well as the data communication with connected devices. There
are two types of system objects:
• Base system objects (B) which define the base system configuration.
• Communication system objects (S) which are images of the physical system
devices connected to the communication units (NETs).
34
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
The base system objects are stored in the RAM memory of the base system computer
as long as SYS 600 is running. They are not stored on disk, but must be defined at
each start-up of the base system. The communication system objects are stored in
the communication units (NETs) as long as the units are running. Default values
may be stored in the communication programs (board based NETs) as a
preconfiguration.
35
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Description
The base system objects correspond to the devices and applications located in,
connected to, or otherwise known to the base system. They determine the hardware
and software properties of the base system and its applications.
The base system objects have the following names:
SYS The base system itself
APLn Applications (n = 1 ... 250)
PRIn Printers ( n = 1 ... 20)
MONn Monitors (n = 1 ... 100)
INDn Input devices: keyboard, mouse, control board (n = 1 ... 100)
STAn Stations (n = 1 ... 50 000)
STYn Station types (n = 1 ... 31)
NODn Nodes: base systems and NETs (n = 1 ... 250)
LINn Links: connection line (n = 1 ... 20)
'n' represents an ordinal number (’base system object number’). For APL and MON
type objects, it can be omitted from the object notations, which means that the
notation refers to the current application or monitor respectively.
Some attributes
Each of the base system object types have their own attributes. Here are some
examples:
AS Application State
The state of the application (APL): "HOT" = active, "WARM" = not
active, but accessible, "COLD" = passive, not available.
AC Alarm Count
Belongs to APL objects and shows the number of active alarms in the
application. The alarm class is given as an index. Index 0 refers to the
total number of active alarms.
36
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Examples
Examples of some base system object notations:
Description
The communication system objects correspond to the devices connected to the
communication units. Hence, these devices - communication units, stations, other
base systems, workstations and peripherals - can be accessed and controlled from
SCIL as communication system objects. Each NET unit has its own set-up of
communication system objects.
The communication system objects have the following names:
NETn (or NODn) Communication units and base systems (n = 1 ... 250)
APLn Applications (n = 1 ... 250)
STAn Stations (RTUs, PCLs, relays, etc.) (n = 0 ... 255)
PRIn Printers (n = 1 ... 8)
The 'n' above indicates the number of the objects as known to the NET where they
are defined. When handling the objects in SCIL, the 'n' in the object name is the
logical number of the device (according to the device mapping attributes).
Some attributes
Each of the object types have their own attributes. Here are just a few examples:
SA Station Address.
The station address of a device. The NET objects and STA objects have
a station address.
IU In Use.
States whether or not the object is in use. Most system objects have this
attribute.
Value: 0 = out of use
1 = in use.
PO Protocol
The protocol of a communication line given as an integer, e.g. 1 =
ANSI full duplex, 14 = SPA. 0 = the line is not defined.
37
SYS 600 9.2 MicroSCADA Pro 1MRS756176
ME MEmory address.
The contents of the memory address given as an index. Belongs to the
STA objects (ANSI stations).
Examples
Examples of some communication system object notations:
5.3.1. General
Object types
The application objects are programmable units which perform various functional
tasks in the SYS 600 application. They constitute data images of physical process or
system devices, data registers, SCIL programs, scaling algorithms, facilities for
automatic activation, etc.
There are ten types of application objects:
• Process objects (P) . . . data images of the physical process devices connected to
process stations (remote terminal units (RTUs), protective equipment, PLCs,
etc.).
• Event handling objects (H) . . . texts related to object states and events.
• Scales (X) . . . algorithms for scaling analog process values.
• Data objects (D) . . . collections of stored data.
• Command procedures (C) . . . SCIL programs.
• Time channels (T) . . . facilities for automatic time bound activation.
• Event channels (A) . . . facilities for automatic event bound activation.
• Event objects (E) . . . mechanisms for event activated start-up of SCIL programs
or program sequences in pictures and dialog objects.
• Free type objects (F) . . . special objects for the definition of user-defined
process object types.
• Variable objects (V) . . . temporary objects which can contain attributes
collected from other objects or arbitrary attributes.
Process objects, event handling objects, scales and free type objects are stored in the
process database, which holds an image of the process. Data objects, command
procedures, time channels and event channels are all stored in the report database,
which a database supporting reporting, calculation and control. These objects are
also commonly named reporting objects. Variable objects are stored in the same
way as variables (see Chapter 6). Event objects are not stored at all.
38
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
All application objects, with the exception of the variable objects, are global and
accessible throughout the entire system.
39
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Description
The process objects correspond to physical devices connected to the process stations
(RTUs, protection equipment, PLCs), for instance switches, sensors and breakers.
Each input and output connection in the stations is represented by a process object.
Normally, the value of an input object is updated from the process station, while the
value of an output object is sent to the station when written with the SCIL command
#SET (Section 8.2).
Some process objects have no correspondence in the stations. These are called
fictitious process objects and they can generally be updated only from SCIL
programs. They can, e.g., be used for process simulation or manually updated data.
There are nine predefined process object types depending on the type of object value
(i.e. the input or output connection in the stations): binary input and output, analog
input and output, digital input and output, double binary indications, pulse counters
and bit streams. In addition, for special purposes, the programmer can define his/her
own process object types by means of free type objects.
An updating of a process object value may cause an alarm, an automatic printout, an
updating on screen (through event objects, Section 5.3.9), and activation of an event
channel (Section 5.3.8).
Process objects with active alarms are included in an alarm buffer, which can be
read by SCIL function APPLICATION_ALARM_LIST and displayed as alarm
lists. If desired, the process object events can be stored in a history database, which
can similarly be read by SCIL function HISTORY_DATABASE_MANAGER and
displayed as event lists.
BI Binary Input
Binary process value from the process to the control system.
Value: 1 or 0.
BO Binary Output
Binary set value from the control system to the process.
Value: 1 or 0.
40
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
AI Analog Input
Analog measurement value from the process to the control system.
Value: real.
AO Analog Output
Analog set value from the control system to the process.
Value: real.
AL Alarm.
States whether the object is in alarm state or not.
Value: 0 - no alarm
1 - alarm state.
If the object notation is given without any attribute, the attribute is assumed to be
OV, except in connection with the commands #LIST, #CREATE, #DELETE and
#MODIFY (Chapter 8), where the whole object is referenced to.
Examples
Some examples of process object notations:
41
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Description
Event handling objects are related to the process objects. They define translatable
texts that describe the state of the process object and the transitions between the
states.
Each process object owns a reference to an event handling object. One event
handling object is typically used by several process objects.
Description
Scales are related to the process objects, or more exactly, to the analog process
objects. They define algorithms for the transformation of the digital process values
transferred from the stations to the values of the analog units of the corresponding
process objects.
Every REAL valued analog process object has a scale name, which defines the
scaling algorithm to be used for the transformation. The same scale can be used by
several process objects.
Description
Data objects (datalog objects) register and store calculated or sampled data. They are
used for the storage of report data, trend data, data for calculation and control,
system configuration data, etc. The data objects can also be used as application
variables when there is a need for exchanging data between different objects.
42
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
The data registration may be initiated from a program (by means of the commands
#EXEC and #EXEC_AFTER, see Section 8.2), from a time channel (Section 5.3.7.)
or from an event channel (Section 5.3.8). Each registration is performed according
to a SCIL expression and a logging function. Besides the calculated or sampled
value, each registration includes a time stamp and a status code.
Every data object can store a chosen number of data registrations (up to 1 000 000).
The registrations can be accessed as vectors by means of indices. The oldest
registered value has the index number 1.
RT Registration Time.
Value: time or vector of time values.
If the object notation lacks an attribute, the attribute is assumed to be OV, except in
connection with the command #EXEC or #EXEC_AFTER (Section 8.2), where the
notation refers to the whole object.
The above mentioned attributes are used indexed. An object notation with these
attributes without any index refers to the latest registered value.
Examples
Some examples of data object notations:
43
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Description
The command procedures contain SCIL programs which can be started
automatically or by SCIL. They can be used for all kinds of manually or
automatically started operations, such as calculations, control operations and
reporting. They cannot be used for affecting the user interface. Command
procedures can be started in the following ways:
• From SCIL programs with the #EXEC and #EXEC_AFTER commands (Section
8.2). (A command procedure can even start itself).
• From time channels (Section 5.3.7).
• From event channels (Section 5.3.8).
A command procedure can hold up to 1 000 000 SCIL lines. As a rule, command
procedures may not contain user interface related commands (picture commands,
Visual SCIL commands or graphical commands, see Section 8.1). However, a
command procedure, or a selected part of it, can be handled as a vector and be
executed with the #DO command (Section 8.2) and the DO function (Chapter 9). In
these cases, it may contain user interface commands if the #DO command or DO
function is executed in a user interface object.
IN Instruction.
The program of the command procedure.
Value: text vector.
OS Object Status.
States how the last execution succeeded.
Value: The status codes listed in the Status Codes manual, e.g.:
0 ... correctly executed
10 ... not executed.
A command procedure notation without an attribute refers to the program, i.e., the
IN attribute.
Indices can be used only with the attribute IN where they refer to the line numbers.
The IN attribute without indices refers to the whole program.
44
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Examples
Some examples of command procedure notations:
Description
Time channels are used for the automatic start-up of time-bound activities, which
can be:
• The registration of data objects.
• The execution of command procedures.
A certain time channel can start several data objects and command procedures. The
execution order is determined by the priorities of the data objects and command
procedures.
A time channel is activated at the execution time which means that the connected
objects are executed. At the initialization time the time channel is initialized, which
means that the registration of connected data objects is restarted from the first
record. Both initialization and execution can take place at absolute points of time or
periodically with a fixed interval. All times are given with an accuracy of one
minute. Discontinuous time activation is obtained with conditional expressions.
Time channels can be executed also with the #EXEC commands (Section 8.2) and
with event channels (Section 5.3.8).
The time channels can be used without an attribute only with the #EXEC commands.
Indices (1 or 2) can be used e.g. together with the RT attribute. Index 1 refers to the
initialization time and index 2 the activation time.
45
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Description
Event channels are used for the automatic start-up of event-bound activities. The
events normally originate from the process database, from where the event
channels transmit them to objects in the report database which take the
consequential actions (calculations, control actions, etc.). An event channel can
start the following operations:
• Registration of a data object.
• Execution of a command procedure.
• Activation of a time channel.
Each process object may have only one event channel, but an event channel may be
connected to up to 11 command procedures and data objects. At the activation of an
event channel, some essential attributes are transmitted as variables from the process
object to the connected reporting object. Thanks to this feature, several process
objects can share the same event channel.
An event channel is activated by the following events in the activating process
objects:
• An alarm comes or goes.
• The warning limits or alarm limits of an analog object are transgressed
(provided that the control system, not the RTU, handles the limit value
supervision).
• The OV attribute (BI, BO, AI, AO, DI, DO, DB, PC, BS or OE) is changed.
• The OV attribute is updated.
The options are chosen with a process object attribute (AA). Event channels can also
be activated with SCIL (the #EXEC commands, Section 8.2).
In addition, any user-defined attribute can activate the event channel of the object.
Description
The event objects are used to start event-bound activities, normally updates, in user
interface objects (pictures and Visual SCIL objects).
In pictures, the activation of an event object causes the execution of the statement(s)
determined by the #ON command (Section 8.2) for the specific event object. The
#ON commands are valid only for the actual picture - main picture or sub-picture -
46
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
where they have been executed. The event causes no action if there is no #ON
command in force for the actual event in the picture shown on screen at the event
moment.
In dialogs and dialog items, the activation of an event object starts the execution of
the event method, if any, defined to be activated by the event object in question.
An event object can be activated in two ways:
• From the process database, so that a change in a process object automatically
activates an event object with the same name and index as the process object. The
activation takes place independently of what causes the change - a change of state
in a station or an assignment in a SCIL program (by the command #SET, Section
8.2). The coupling of an event object to a process object is optional. The
activating attributes are listed in the Application Objects manual, Chapter 3, the
EE attribute description.
• From a SCIL program (in a picture or a command procedure) by the #EXEC
commands (Section 8.2). In this case the name of the event object can be freely
chosen.
If a process object is equipped with an event object, updating in pictures is carried
out automatically and immediately when a change occurs. The value of the changed
attribute is not transmitted to the picture, nor is any information about which
attribute has changed.
The event object notation does not contain any attribute. Event objects have no
values, hence they cannot be parts of expressions.
Example
If the process object
TEMP:P2
is equipped with an event object (EE = 1), the event object
TEMP:E2
is always activated when a change in the process object (for instance the attribute
AI) occurs in the process database.
Description
The variable objects serve as temporary storage places for attributes. They are used
to compose lists, e.g. alarm and event lists, to browse through the object properties,
to copy objects, to create and modify objects, etc.
A variable object is at the same time both an object and a global variable of list type
(Section 4.9). The list as a whole is handled as a variable with the same name as the
object (Chapter 6). The attributes in the list are accessed with a variable object
notation.
A variable object can be created and assigned attribute values in two ways:
• By creating the variable object with the #CREATE command (Section 8.2) and
assigning it attribute values with a list function or with the #SET command
47
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Examples
The statement
@VAR = PROD_QUERY(20)
assigns the variable VAR the list value returned by the function PROD_QUERY
(Chapter 9). The variable may be accessed as variable object VAR:V.
Some variable object notations:
General
The Visual SCIL objects correspond to the dialogs, dialog items and images
designed in the Dialog Editor or created with SCIL. There are about 40 types of
Visual SCIL objects which could be grouped as follows:
• Dialogs. These are of two types: ordinary dialogs and main dialogs.
• Compound dialog items. These are dialog items which may contain other dialog
items:
• Containers - visible or invisible boxes containing other dialog items.
• Picture containers. These are containers which can contain pictures.
48
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
• Menu bars, menus and menu items. Menu bars can contain one or more menus,
menus can contain menus and menu items.
• Notebooks, notebook pages and notebook items.
• Simple dialog items, such as buttons, toggle buttons, texts, lists, etc. The simple
dialog items can contain no other objects.
• Images.
In SCIL, the visual SCIL object types are referred to by names starting with VS_.
For instance, buttons are named VS_BUTTON. The Visual SCIL Objects manual
lists and describes all the Visual SCIL object types.
Generally, the dialogs, dialog items and images are designed in the Dialog editor,
though they can also be created directly with SCIL. Dialog and dialog items created
in the dialog editor are stored in files from where the SCIL command .LOAD loads
them in the memory as a visual SCIL object with a specific name. Objects created
with .CREATE are not stored in files.
The SCIL commands for handling Visual SCIL objects are detailed in Section 8.2.
Unlike the system and application objects, the Visual SCIL objects are not global.
They are known and accessed only within the dialog system where they are created
or loaded.
Dialog systems
The Visual SCIL objects are arranged in hierarchical dialog systems with a main
dialog or picture container at the top. Each main dialog and each dialog system
creates a new dialog system. The object hierarchy is of importance when referencing
the objects.
Objects containing another object are called parent objects and the contained objects
are called child objects. The child objects are dependent upon their parent objects.
When the parent objects are loaded the child objects are loaded as well, and when
the parent objects are deleted (with the .DELETE command), the child objects are
also deleted.
When loading a dialog or a dialog item with the .LOAD command, it becomes a
child object of the loading object (unless object path is given, see below). When
loading a main dialog or picture container, it creates a new dialog system.
Figure 5.4.2.-1 shows an example of a Visual SCIL dialog system with four dialogs.
Dialog 1, which is the main dialog, contains four dialog items. Dialog item B loads
dialog 2. This dialog contains three dialog items, one of which, object G loads dialog
3. Dialog item D contains two dialog items, and dialog item F contains two items.
For instance, D could be a menu bar containing menus, which contain menu items
(menu options). Dialog item J loads dialog 4.
The dialog items A .. D are child objects of the main dialog. Dialog 2 is the child
object of item B and the parent object of the dialog items G .. I. Dialog 4 is the child
object of item J which is the child object of item F, and so on.
49
SYS 600 9.2 MicroSCADA Pro 1MRS756176
50
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Attribute references
Attributes are referenced with the following notations:
[object].attribute[component]*
where 'object' is an object reference, 'attribute' is the name of the attribute and
'component' addresses a component of structured data, see Chapter 4.
If the attribute or method is referenced from a method within the same object, no
object reference is needed.
Attribute references can be used as operands in expressions. They are also used
together with the .SET command to achieve a change of the attribute. The attribute
references can be expanded like variables, see Chapter 6.
Example:
.SET MY_BUTTON._TITLE = "OK"
This statement sets the label of the button (the visual SCIL object MY_BUTTON)
to OK, which is immediately shown on screen if the button is shown.
Method calls
Method calls start the execution of methods - predefined methods and user defined
methods. Method calls have the following format:
[object].method [(argument_list)]
where
'object' is an object reference. Not needed when referencing methods in
the same object or one level below.
'method' is method name.
'argument_list' Arguments, which may be any SCIL expressions given as a list
of SCIL expressions separated by comma and enclosed in
parentheses. Up to 32 arguments may be given.
By using the SCIL command #RETURN, a method can be programmed to return a
value to the calling program. A method call that returns a value can be used as an
operand in an expression.
51
SYS 600 9.2 MicroSCADA Pro 1MRS756176
5.4.2. Pictures
General
The pictures and picture components were briefly described in Chapter 3. The
Picture Editing manual describes how to build and program the pictures. This
section discusses how to reference pictures and picture elements from SCIL.
In SCIL, the pictures and windows are handled by the picture handling commands
described in Section 8.4. In addition, the windows may have attributes which are
accessed by a window attribute reference. The named programs of the pictures are
executed by a named program call.
Picture hierarchy
A picture may contain a number of sub-pictures in the shape of pictures shown in
windows and picture functions. These sub-pictures in turn may contain sub-pictures.
A picture and its sub-picture form a picture hierarchy with the main picture (total
picture) on the top. Figure 5.4.2.-1 shows an example of such a hierarchy. A, B, C,
D, E and F denotes windows and picture functions.
Picture Paths
When referencing windows and named programs, a picture path may be used. A
picture path states in which picture - main picture or sub-picture - the window or
named program should be searched. A picture path has the following format:
name/name/name/ ... /name
52
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
where each 'name' is the name of the window or picture function containing the next
picture in the hierarchy counting from the picture where the command is issued.
(Back slash \ could be used instead of forward slash /.) The main picture can be
referenced with the predefined name ROOT. If the picture is included in a dialog
system (see Section 5.4.1.) ROOT also refers to the picture container where the
picture is included.
If no picture path is given, the window or named program is first searched from the
same picture as where the reference is issued. If not found there, it is searched from
the parent picture and so on up to the main picture. Hence, when referencing
windows and programs within the same picture or its parent picture, no path is
needed.
For example, the picture path for referencing a named program SAMPLE in sub-
picture 4 in Figure 5.4.2.-1 from the main picture would be:
A/D
If not found in sub-picture 4, the program is searched in sub-picture 1 and then in
the main picture.
53
SYS 600 9.2 MicroSCADA Pro 1MRS756176
@A = .MY_NAMED_PROGRAM (125,%V+6,"ABC")
The program MY_NAMED_PROGRAM is executed and its return value is assigned to
the variable A.
54
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
_QUEUE_FOR_EXECUTION(program [, delay])
Queues a SCIL program to be executed.
'program' Text or text vector, the program to be executed.
'delay' Real value indicating the minimum amount of seconds to elapse
before the program is executed. Default value is 0.
Return value: No return value.
This method is used when the programmer wants to execute a SCIL program at a
later point in time when the process would otherwise be idle. The program to be
executed is given as parameter in the method call. There is no way to exactly know
when in time the program is executed. A minimum time that has to expire can
however be defined in seconds as the second parameter. The maximum number of
queued programs per object is 100. If this limit is exceeded all queued executions
are removed and a SCIL error is raised.
Example:
The example shows how to ensure that the blocking cursor of a dialog is switched
off after a long program execution even if an error occurs that interrupts the normal
program flow.
.set my_dialog._busy = true
my_dialog._queue_for_execution(".set this._busy = false")
;long SCIL processing here
...
_ATTRIBUTE_NAMES
The attributes listed in alphabetical order.
Value type: List.
Value: Two attributes:
USER_DEFINED Text vector containing the names of user-
defined attributes.
PREDEFINED Text vector containing the names of the
attributes defined by the object class.
55
SYS 600 9.2 MicroSCADA Pro 1MRS756176
_CHILD_OBJECTS
The names of the child objects.
Value type: Text vector
Value: The names of the immediate children of the object listed in the
order of creation.
_COMPILED
Defines whether the SCIL programs of the object are compiled or not.
Value type: Boolean
Value: FALSE Not compiled (default)
TRUE Compiled
When the attribute is set to TRUE, the object and all its child objects that are loaded
together with it, are recursively flagged to be compiled. The methods of the objects
are not compiled at once, but instead they are compiled when called for the first time.
If the compilation fails, the uncompiled source code is silently used instead.
When the attribute is set to FALSE, the _COMPILED flag of the object and its child
objects are recursively cleared, and the compiled methods (if any) are 'decompiled',
i.e. their compilation result is discarded.
The _COMPILED attribute may be set any time (even from outside the object), but
it is good practice to insert the SCIL statement
.set THIS._compiled = TRUE
in the CREATE method of the object. This is to state that the object has benefit from
the compilation and is comprehensively tested to run as compiled.
_FILE_REVISION
File revision.
Value type: Text
Value: The FILE_REVISION attribute of the picture file (.pic) or the
Visual SCIL object file (.vso) the object was loaded from.
The value is an empty string, if the object has been created on-the-fly.
_OBJECT_CLASS
The class of the object.
Value type: Text
Value: The name of the class of the object
If the object is a window or picture function, the attribute has value "WINDOW" or
"PICTURE_FUNCTION", respectively.
56
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
_OBJECT_NAME
The name of the object.
Value type: Text
Value: The name of the object
_OBJECT_PATH
The path of the object.
Value type: Text
Value: The complete object path starting from the root,
e.g. "ROOT\NBK_BOOK\NBP_PAGE\TRE_TREE"
_SG_GEOMETRY
This attribute is applicable only for windows and picture functions.
Value type: List.
Value: Six attributes:
X X position of window/pf relative to part
picture / picture function.
Y Y position of window/pf relative to part
picture / picture function.
ABSOLUTE_X X position of window/pf relative to ROOT.
ABSOLUTE_Y Y position of window/pf relative to ROOT.
W Width of window/picture function in
semigraphical characters.
H Height of window/picture function in
semigraphical characters
W and H are 0 if window is not shown.
_SOURCE_FILE_NAME
The name of the file where the object is loaded from.
Value type: Text.
Value: The full operating system format name of the 'vso' file where the
object has been loaded from or the full name of the 'pic' file
where the window or picture function has been read from.
The value is an empty string, if the object is created on-the-fly, i.e. using .CREATE,
!WIN_NAME or !WIN_CREATE command.
57
SYS 600 9.2 MicroSCADA Pro 1MRS756176
_VARIABLE_NAMES
The names of the variables seen by the object.
Value type: Text vector.
Value: The names of global SCIL variables defined in the SCIL context
that the object belongs to.
The names are listed in alphabetical order.
5.5. Files
This section describes the principles of naming files in SCIL language and the
different file types accessible by SCIL programs.
Here, ’file type’ refers to the interpretation of its contents. The three file types
supported by SCIL programming environment are the following:
• Text files
• Binary files
• Keyed files
They are further described in the following sections. File management functions,
that handle entire files with no interpretation of the contents, are described in Section
9.16.
58
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
the directory PICT below the root directory of the SCIL application, but may be
set by SCIL in the VS_MAIN_DIALOG object.
Outside the VS main dialogs, the so-called 4-letter rule is further applied: A file is
first searched for in the logical path named according to the 4 first letters of the
file name. For example, file "APL_PROCES.PRD" is searched for using the
logical path "APL_".
• "/dir1/dir2/.../dir/name" names a file relative to SYS 600 root in an operating
system independent way, e.g "/APL/TIPPERARY/APL_/FILE.EXT"
• By an operating system file path, e.g.
"D:\SC\APL\TIPPERARY\APL_\FILE.EXT".
• By an operating system independent file tag created from a file name given by
any of the textual ways above.
The file or directory name ('name' above) may be of any length and contain any
characters allowed by the operating system. However, as far as portability is
concerned, names consisting of letters, digits, underscores and a dot (as a separator
of the file name extension) only are recommended.
59
SYS 600 9.2 MicroSCADA Pro 1MRS756176
General
Keyed files are random access files that consist of data records. The maximum
length of a data record is 508 characters.
The beginning of the data record contains the key of the record. The key uniquely
identifies the record within the file. The length of the key is defined when a keyed
file is created. The maximum length of the key is 253 characters. The data records
are logically ordered by the keys. The first character of the key is the most significant
in the ordering, the last character is least significant. Hence, if the key contains a
name, the records are alphabetically ordered.
Each data record must contain the key. Consequently, the minimum length of the
data record is the length of the key.
A data record can be read from a file by specifying its key, or the file may be
browsed forward or backward in the order specified by the record keys.
When a data record is written into the file, it is always positioned according to its
key. If the same key already exists in the file, the old data record is overwritten by
the new one. The length of record may change when it is rewritten.
Data records may also be deleted one by one by specifying the key to be deleted.
Concurrent access of keyed files by several SCIL programs is internally
synchronized. Therefore, they suit well for exchanging real-time data between SCIL
programs: More than one program may safely write and read a keyed file
simultaneously.
Implementation
The keyed files are implemented as a number of data blocks, index blocks and a
status block.
60
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
The data blocks contain the data records of the file. Each data block contains a
number of consecutive (in the order specified by the key) data records organized in
the order of the key.
The index blocks make up the index of data blocks in order to achieve fast access
of data. An index block contains a set of (key, block number) pairs, where the key
is the first key of the data block addressed by the block number. The pairs contained
in an index block are again organized in the order of the key. When the file grows,
more than one index block is needed. Upper level index blocks are then created. In
the upper level index blocks, the block number addresses a lower level index block
instead of a data block.
The status block, which is the first block of the file, contains book-keeping
information of the file, such as the length of the key and address of the topmost index
block.
When a new data record is written into the file (or an existing one is expanded), the
index is first used to locate the ’would-be’ data block for the record. If there is
enough free space in the block, the data is written into the block. Otherwise, the
neighboring data blocks are examined. If there is enough free space in the
neighboring blocks to rearrange the old records and the new one into these three data
blocks, it is done. Otherwise, a new data block is created and its key is inserted in an
index block. The same procedure is then repeated for the index block.
When a data record is deleted from a file (or an existing one is shortened), the free
space of a data block grows. When it is possible to combine the data block with its
neighbors, it is done and the freed block is inserted in the free block list of the file
for later re-use.
There are two internal implementations of keyed files:
• Version 1 file format uses 512-byte blocks. The size of the file is limited to 32
megabytes.
• Version 2 file format, first introduced in MicroSCADA revision 8.4.4, uses 4
kilobyte blocks and has no file size restrictions.
Function KEYED_FILE_MANAGER (see Section 9.15) may be used to convert
version 1 files to version 2 and vice versa.
The same function may be used to two other maintenance purposes of keyed files:
• Subfunction "COMPACT" makes a reorganized copy of a keyed file. The new
file is written in its most compact form and the free space in the file is minimized.
The resulting file may be smaller and faster to access.
• Subfunction "REBUILD" makes a copy of a keyed file where the index structure
is rebuilt from the scratch. The source file is scanned sequentially, the data
records found in the data blocks are written to the output file and a new index is
created for them. The index blocks of the source file are skipped. This
subfunction should be used, when the structure of a keyed file gets corrupted for a
reason or another, for example because of power fail of the computer. A
corrupted file may often be recognized by spurious FILE_INCONSISTENT
(5015) errors got when reading the file.
61
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Use
Keyed files are widely used within SYS 600 to implement various system files,
including:
• Process database file APL_PROCES.PRD
• History database files APL_yymmdd.PHD and APL_yymmdd.PHI
• Report database files APL_REPORT.nnn
• Picture files *.PIC
• Representation library files *.PIR
• SCIL database files *.SDB
For application specific purposes, keyed files may be used by file handling
commands described in Section 8.2.5.
General
A SCIL database is a data file for general purpose. It is internally structured to store
any data structure that may be created by SCIL language. The file is divided into
sections. Each section has a value that may be of any SCIL data type. The size of a
SCIL database file is limited only by the available disk space.
The structure of SCIL database is optimized for fast access. The component to be
read is located quickly by using indices without having to search through the file.
Similarly, writing a new value to a component rewrites only a minimal part of the
file.
The concurrent use of SCIL database by two or more SCIL programs is internally
synchronized. In addition, each read and write operation are atomic. For example, if
one SCIL program writes a list type data structure into the database, the concurrent
readers see all the new attribute values or none of them. Because of the strict access
discipline, SCIL databases suit perfectly for sharing SCIL data in real-time between
various SCIL programs of the application (in pictures, Visual SCIL objects,
command procedure objects etc.).
SCIL databases and parameter files (so called ini files handled by functions
READ_PARAMETER, WRITE_PARAMETER and DELETE_PARAMETER)
have some similarities, but at the same time some important differences. For some
comparison of SCIL Database and parameter files, see the table below.
62
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Versions
There are two slightly different implementations of SCIL database files:
• Version 2 implementation was introduced in MicroSCADA 8.4.5.
• Version 3 implementation was introduced in MicroSCADA 9.0. For the user’s
point of view, it is equivalent to version 2, but internally it has been optimised for
faster access.
• (Version 1 implementation was never used in any released product.)
The version of a SCIL database file is seen as an attribute of the result of the
DATA_MANAGER("OPEN") function call, see Section 9.15.
When MicroSCADA 9.0 or later is used, version 3 files are created by default. If a
9.0 system or later is frequently used to create SCIL databases for an 8.4.5 system,
this behavior may be overridden by the revision compatibility switch
"CREATE_VERSION_2_SCIL_DATABASES" in the application attribute
APL:BRC, see the System Objects manual, or in the SCIL function
REVISION_COMPATIBILITY, see Section 9.9.
When running MicroSCADA 9.0 or later, SCIL database files may be converted
from version 2 to 3 (for faster access) or vice versa (for 8.4.5 compatibility) by using
the DATA_MANAGER("COPY") function, see Section 9.15.
Access
The SCIL database is divided into sections (the same way as the parameter files).
The names of the sections are free texts, they may contain any number of characters
and are case-sensitive. A zero-length section name is allowed.
A section has a value, which may be of any SCIL data type. The value may be read
and written as a whole or only a component of it is accessed at a time.
In most cases, there is a need for more structure than the sections provide. An
obvious way of getting more structure is to define the section as a list value, whose
attributes may be of any data type.
If the database is used by several SCIL programs at the same time, the structure of
the data should be carefully designed. See an example of this below.
If a section contains a value of a process object along with its time stamp and status,
one possibility is to define three attributes in the section, for example OV, RT and
OS, respectively. When a SCIL program updates the value, it has to do 3 writes into
the database (unless it rewrites the whole section).
Now the reader of the data may encounter a problem. On one hand it is possible, for
example, that it reads the new value of OV but the old values of RT and OS (if it
runs faster than the writer). On the other hand, it might be that it reads the old value
of OV but the new values of RT and OS (if it runs slower).
63
SYS 600 9.2 MicroSCADA Pro 1MRS756176
A solution to this problem is to define only one attribute, for example VALUE, and
make it a list of attributes OV, RT and OS. This attribute may now be read and
written in one atomic operation.
SCIL databases are managed and accessed by the SCIL function
DATA_MANAGER, which is described in Section 9.15.
Use
SCIL databases are suitable for storing application specific data and sharing it in
real-time between concurrent processes. The following four SCIL databases are
used (and automatically created) by the base system:
• Common purpose application database APL_DATA.SDB
• Application text database APL_TEXT.SDB
• System text database SYS_TEXT.SDB
• OPC Name Database APL_OPCNAM.SDB
For fastest possible access, these files are kept permanently open by the base system.
64
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
6. Variables
This chapter describes the use of variables in SCIL:
6.1 General: Variable names and scope of variables
6.2 Local variables
6.3 Global variables
6.4 Using variables
6.5 Predefined picture variables
6.1. General
Contrary to constants, the variables have no fixed values. A variable is a name which
may be assigned any value. After the assignment, the variable name represents this
value within the scope of the variable (see below).
Any SCIL data type (Chapter 4) is allowed as a value of a variable. When speaking
of the data type of a variable, the data type of its current value is meant. The value
of a variable, also its data type, may be changed at any time by new assignment.
Variable names
The variable names may be freely chosen in accordance with the rules in Section 3.2
The variable names may contain up to 63 characters.
Scope of variables
There are types of variables in SCIL language: local and global variables.
The local variables are temporary variables that are available only within the SCIL
program where they are declared. They exist only while the SCIL program is
executing.
The global variables are permanent variables that are available for any program
executing within the SCIL context where they were created. They exist during the
entire life time of the SCIL context (see below).
65
SYS 600 9.2 MicroSCADA Pro 1MRS756176
SCIL contexts
A SCIL context is actually an internal data structure that contains the global
variables, logical paths and logical representation libraries defined by SCIL
programs executed within the context. A SCIL context is created when certain
objects start their execution and deleted when they terminate.
The following objects execute in their own SCIL context:
• A picture (whether printed or displayed on the screen). All programs, windows
and sub-pictures within the same picture share the SCIL context of the picture. A
variable defined in a window picture, for example, can be used in the main
picture, and vice versa. If window specific variables are desired, use window
attributes instead of variables (see Chapter 5).
• A dialog system. All dialogs and pictures within the same dialog share the SCIL
context of the main dialog or the picture container. Hence, for example, variables
defined in the main dialog can be used in all its child dialogs and dialog items. If
dialog or dialog item specific variables are desired, use the user defined attributes
(see Chapter 5).
• A command procedure and data object started with #EXEC or #EXEC_AFTER
or by an event channel.
• A time channel. Data objects and command procedures run by the time channel
share the SCIL context of the time channel. Hence, variables defined in command
procedures may be used by command procedures and data objects executed later
by the same time channel.
A SCIL context is normally created as empty: no variables, logical paths nor logical
representation libraries defined. There are the following exceptions to this rule:
• Objects activated by #EXEC, #EXEC_AFTER, #PRINT or #LIST command
inherit the logical paths and logical representation libraries of the activating SCIL
context.
• Argument variables may be passed to objects by means of #EXEC,
#EXEC_AFTER and #PRINT commands (see Section 8.2).
• Event channels and format pictures activated by process events and format
pictures printed by #LIST command start with a set of variables created from
attribute values of the process objects, so called ‘snapshot variables’.
• Pictures have a few predefined variables created automatically (see Section 6.5).
66
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Variable assignment
Variables are assigned values with an assignment statement of the following
syntax:
[@]V[component]* = expression
where 'V' is the variable name. If it is prefixed by @, a global variable is accessed,
otherwise a local variable.
Each 'component' addresses a component of structured data (an element or a range
of elements of a vector or an attribute of a list). See Section 4.11 for component
access.
The expression, which may be of any data type, is evaluated and the value is
assigned to the variable or to its component.
(If the expression is a text constant, a global variable assignment may also be
written without the equal sign as follows:
@V character string
which is the same as the statement @V = "character string", except that in the first
case lower case letters are converted to upper case. This is an obsolete feature that
is no longer recommended.)
Examples
Statement Explanation
@VAR = ABC:PAI The value of the process object is read from the
process database and assigned to the variable.
TEXT = "ABC:PAI" The object value is not read. The variable gets the text
value "ABC:PAI".
@LIST = PROD_QUERY(20) The variable LIST is assigned the list value formed by
function PROD_QUERY.
A.EXISTS = FALSE Attribute EXISTS of list variable A is set to FALSE.
@V = DATA:D(1 .. 20) Variable V becomes a vector containing the first 20
registered values of the data object DATA.
V(1 .. 5) = D1:D(1 .. 5) + D2:D(1 .. 5) The first five elements in variable V are assigned the
values of the sums of the first five registered values of
the data objects D1 and D2.
A = (5, 4, OBJ:POV3, CLOCK) The variable A becomes a vector of four elements.
67
SYS 600 9.2 MicroSCADA Pro 1MRS756176
This notation can be used as an operand in expressions.The data type of the variable
determines which operations may be carried out on it (Chapter 7).
Examples
Statement Explanation
@NEW = 30 * %OLD The variable NEW is assigned the value of the variable
OLD multiplied by 30.
A.COUNT = A.COUNT + 1 The COUNT attribute of list variable A is incremented.
!SHOW WIN VAR The whole vector is shown in the window WIN, which
must be of the type MULTIFIELD, BAR or CURVE.
@S = %A(1) + %A(2) The sum of the elements one and two in variable A.
Variable expansion
Variables can also be used for forming text strings and names. By including a
variable in a name or text string, you can assign different contents to the text or
name depending on the context. To use a variable as a part of a text or name,
enclose the variable name by quotes as follows:
'name[.attribute]'
The value of the variable 'name' or the value of its attribute 'attribute' is regarded as
a text constant that replaces the quote notation. The value must be of data type
integer, real, text, boolean (0 for FALSE, 1 for TRUE is expanded) or time (yy-mm-
dd hh:mm:ss is expanded). If a local variable by name 'name' exists, it is used for
expansion, otherwise global variable by that name.
This way of using variables is called ‘variable expansion’. Not only variables but
also window attributes and Visual SCIL object attributes can be expanded, provided
that they are of proper data type. In this case 'name' is a window or a Visual SCIL
object reference.
Examples
Statement Meaning
68
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
69
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Examples
Statement Meaning
70
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
7. Expressions
This chapter describes how to compose SCIL expressions using various types of
operators:
7.1 General Principles
7.2 Arithmetical Operators
7.3 Relational Operators
7.4 Logical Operators
Use
In SCIL, expressions are used as follows:
• For value assignments (objects, attributes, variables)
• As arguments for functions and commands
• As operands in expressions
Composition
Expressions are composed of operands and operators (possibly enclosed in
parentheses). The operators are symbols for operations (e.g. + : addition). The
operands constitute the objectives for these operations.
Operands
An operand may be:
• A constant (Chapter 4)
• A variable or a component of a variable (Chapter 6)
• A system or application object attribute or its component (Chapter 5)
• An attribute of a Visual SCIL or window object or its component (Chapter 5)
• An function call (Chapter 9)
• An vector or a list aggregate (Chapter 4)
• An named program or a method call, provided that the program returns a value
(Chapter 5)
• An expression enclosed in parentheses
The simplest expression is one single operand.
The data types of the operands determine which operations may be carried out on
them and what the data type of the result will be. The data compatibility rules for
each operator are given in figures below. List type operands cannot be operated upon
by any operator. The list data type is therefore omitted from the compatibility rule
figures. The data type of an expression can be read with the function DATA_TYPE
(see Chapter 9).
71
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Operators
There are three types of SCIL operators:
• Arithmetical operators
• Relational operators
• Logical operators
In SCIL expressions, they are evaluated in the order of priority mentioned below.
The operators and their usage are described in the next sections.
Use
Arithmetical operators are used for numerical calculations. As operands they expect
numeric values, except for addition, which accepts text, bit string and byte string
operands as well ((see Fig. 7.2.-1)).
Operators
SCIL has the following arithmetical operators:
+ addition, positive sign
- subtraction, negative sign
* multiplication
/ division
** exponential operator
DIV integer division, the remainder is truncated from the result
MOD modulus operator (the remainder by integer division
provided that the operators are positive).
The operators DIV and MOD must be enclosed by spaces. For the other operators,
spaces are optional.
Signs are valid for numeric data types (integers, real numbers and vectors of integers
and real numbers) only.
Priority order
The order of priority for the arithmetical operators, i.e. the order in which different
parts of an expression are evaluated, does not differ from that in mathematics. It is
as follows (operators with the highest priority first):
1) **
2) / , * , DIV , MOD
3) + , -
Operations with the same order of priority are evaluated from left to right.
Compatibility rules
Below are rules for what data types can be combined by means of the arithmetical
operators and the data type of the resulting value.
72
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Addition_rules
Subtraction_rules
73
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Multiplication_rules
Division_rules
DIV_and_MOD_rules
74
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Exponent_rules
Examples
Below are some examples of arithmetical operations. The bit string operands are
written here by means of the BIT_SCAN function, which creates a bit string out of
its text representation.
Expression Result
Use
Relational operators are used for comparing expressions. The result of a comparison
is always a boolean value, that is, the value of a relation is either TRUE or FALSE.
Operators
The following relational operators are available in SCIL:
== equal to
> greater than
< less than
<> unequal
<= less than or equal to
>= greater than or equal to
75
SYS 600 9.2 MicroSCADA Pro 1MRS756176
The relational operators have a lower order of priority than the arithmetical
operators. Accordingly, arithmetical expressions are evaluated before comparisons
are carried out.
Compatibility rules
(see Fig. 7.3.-1) presents rules for what data types may be compared by means of
relational operators.
Relational_operators
Examples
Below are some examples of expressions containing relational operators.
Expression Result
76
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Expression Result
Use
With logical operators boolean values can be operated upon.
Operators
In SCIL there are the following logical operators:
AND conjunction, "both .. and"
OR disjunction, "or"
X OR exclusive or, "either, but not both"
NOT logical negation, the opposite
Logical operators have a lower order of priority than the relational operators, that is,
relational expressions are evaluated before the logical operations are carried out.
Logical operator NOT takes precedence of the other logical operators.
If an expression contains two or more different logical operators from the set (AND,
OR, XOR), parentheses are required to explicitly specify the order. See the example
below.
Compatibility rules
All logical operators expect operands of boolean type. Likewise, the results of
logical operations are of boolean type.
Examples
Imagine that A and B are boolean data with the values shown to the left. The
logical operators give the following results:
Wrong: A == 1 AND B == 2 OR C == 3
Right: (A == 1 AND B == 2) OR C ==3
or A == 1 AND (B == 2 OR C == 3)
77
SYS 600 9.2 MicroSCADA Pro 1MRS756176
78
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
8. SCIL statements
This chapter describes the SCIL statements. It is divided into four sections as
follows:
8.1 General: The different types of SCIL statements, their arguments, and
a table over all general SCIL statements, Visual SCIL commands and
picture commands.
8.2 General SCIL statements: The statements listed and described
8.3 Visual SCIL Commands: The Visual SCIL commands listed and
described
8.4 Picture Commands: The picture handling commands listed and
described
8.1. General
Arguments
Most commands require arguments to become complete statements. The arguments
specify the command with operands or key words. In this chapter, the commands are
written in upper case letters and the arguments in lower case letters. Arguments in
square brackets ([]) are optional. Argument enclosed by []* may be repeated a
number of times or it may be omitted. There must be at least one space character
between a command and its arguments.
79
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Overview
Table 8.1.-1 General SCIL statements and Visual SCIL commands.
Statement Brief Description Page
Assignment statement Assigns a value to a variable. 83
#ARGUMENT Declares arguments of the program. 83
#BLOCK , #BLOCK_END Compounds statements into one. 84
#CASE, #CASE_END Multibranched conditional execution. 84
#CLOSE_FILE Closes a keyed file. 104
#CREATE Creates a new application or base system object. 93
#CREATE_FILE Creates and opens a new keyed file. 105
#DELETE Deletes an application object. 94
#DELETE_FILE Deletes a file. 105
#DO Executes the SCIL program given as an argument. 85
#ELSE Defines a branch within an #IF statement. 87
#ELSE_IF Defines a branch within an #IF statement. 87
#ERROR CONTINUE, Defines the error handling policy. 86
#ERROR EVENT
#ERROR IGNORE,
#ERROR STOP
#ERROR RAISE Raises a SCIL error. 86
#EXEC Queues an application object for execution. 94
#EXEC_AFTER Queues an application object for execution after a time delay. 95
#GET Updates process object values. 95
#IF Conditional execution. 87
#INIT_QUERY Initiates a process query. 95
#LIST Prints process object data. 99
#LOCAL Declares local variables of the program. 87
#LOOP, #LOOP_END Executes a sequence of statements in a loop. 88
#LOOP_EXIT Interrupts a loop. 90
#LOOP_WITH, #LOOP_END Executes a loop a number of times. 90
#MODIFY Changes an application object definition. 97
#ON Declares a program block to be executed when an event occurs. 91
#ON ERROR Defines an error handler. 91
#ON KEY_ERROR Defines a key error handler. 92
#OPEN_FILE Opens a keyed file. 105
#OTHERWISE Defines the default branch within a #CASE statement 84
#PATH Defines a logical path. 101
#PAUSE Takes a pause. 92
#PRINT Prints a picture. 100
#READ Reads a data record from a keyed file. 106
#READ_KEYS Reads the keys of a keyed file. 106
#READ_NEXT Reads a data record from a keyed file. 107
#READ_PREV Reads a data record from a keyed file. 107
#REMOVE Deletes a data record from a keyed file. 108
80
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
81
SYS 600 9.2 MicroSCADA Pro 1MRS756176
82
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
[@]name[component]* = value
Assigns a value to a variable.
'name' The name of the variable
'component' Component of structured data, see Chapter 4
'value' Any type expression
This statement replaces the current value of a variable or a component of a variable
by a new value. With the @ prefix, 'name' refers to a global variable, otherwise a
local variable is referred to.
Examples:
@X = Y ;Local variable Y is copied to global variable X
Y = %X ;Global variable X is copied to local variable Y
@X(5)= 1 ;The 5th element of global vector variable X is set
Y.A = 0 ;Attribute A of (list type) local variable Y is cleared
Y.A.B(1 .. 5) = 0 ;The 5 first elements of vector attribute B of
;list attribute A of local variable Y are cleared
83
SYS 600 9.2 MicroSCADA Pro 1MRS756176
#ARGUMENT A, B
#LOCAL C = 0
#IF ARGUMENT_COUNT == 3 #THEN C = ARGUMENT(3)
#BLOCK
[statement]*
#BLOCK_END
Compounds statements into one.
'statement' Any SCIL statements.
#BLOCK compounds a number of statements into one statement. It is usually used
within structured statements (IF, CASE, ON) in places where a single statement is
required by the syntax.
Example:
#IF A > B #THEN #BLOCK
#IF A - B > 10 #THEN #BLOCK
!SHOW WIN "THE VALUE TOO LARGE"
TOO_LARGE = TRUE
#BLOCK_END
#ELSE !SHOW WIN "CHECK!"
#BLOCK_END
#ELSE !SHOW WIN "OK"
#CASE value
[#WHEN selector statement]*
[#OTHERWISE statement]
#CASE_END
Multibranched conditional execution.
The statement selects (at most) one of listed SCIL statements for execution. The
selection is based on a case value, which is compared to 'selectors' of each branch.
'value' A value of type integer, real, boolean, time, text or bit string.
'selector' The selector is a comma-separated list of items that select the
branch for execution. An item may be given as:
1. A single value of type integer, real, boolean, time, text or bit
string.
2. A vector of such values. In this case 'value' is compared to
each element of the vector to find a match.
3. A range of such values, v1 .. v2. The range may be semi-open:
v1 .. means values greater or equal to v1
.. v2 means values less or equal to v2.
'statement' Any SCIL statement.
The 'value' is compared to each 'selector' item of the #WHEN commands. The first
matching #WHEN statement is executed and the rest of the #CASE statement to the
matching #CASE_END is skipped. If no matching #WHEN statement is found, the
#OTHERWISE statement (if any) is executed.
84
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
There may be several selectors that match the case value, but only the first branch is
executed. No error is generated, in case no branch is selected.
Examples:
#CASE C
#WHEN "A".."Z", "a" .. "z" #BLOCK
IS_A_LETTER = TRUE
#CASE C
#WHEN "A", "E", "I", "O", "U", "Y", -
"a", "e", "i", "o", "u", "y" IS_A_VOWEL = TRUE
#OTHERWISE IS_A_VOWEL = FALSE
#CASE_END
#BLOCK_END
#OTHERWISE IS_A_LETTER = FALSE
#BLOCK_END
#CASE D
#WHEN 0,3,6,8,9 SHAPE = "NO STRAIGHT LINES IN THIS DIGIT"
#WHEN 1,2,4..5,7 SHAPE = "CONTAINS STRAIGHT LINES"
#WHEN .. -1 #BLOCK
WISE_GUY = TRUE
SHAPE = "DON''T TRY TO FOOL ME"
#BLOCK_END
#OTHERWISE SHAPE = "ONE DIGIT ONLY, PLEASE"
#CASE_END
#CASE DATA_TYPE(D)
#WHEN "INTEGER" T = 1
#WHEN "REAL" T = 2
#OTHERWISE !SHOW W "SIMPLE NUMERIC DATA EXPECTED"
#CASE_END
#DO program
Executes the SCIL program given as an argument.
'program' A text or a text vector containing the statement or the program to
be executed.
The #DO command is used to execute a SCIL program stored outside the current
program context (picture, dialog, command procedure) or created on-the-fly.
The program is executed as a subroutine of the calling program, contrary to the
#EXEC command (Section ), which queues the specified object for later execution.
#DO command cannot pass arguments to the called program, nor does it support
return values from the called program. Use function DO instead, see Chapter 8.
Example:
#LOCAL PROG = TEXT_READ("ABC.TXT")
#IF PROG.STATUS == 0 #THEN DO PROG.TEXT
;The SCIL program in the file ABC.TXT is executed.
#DO ABC:C
;The program (IN attribute) of the command procedure ABC is executed.
85
SYS 600 9.2 MicroSCADA Pro 1MRS756176
#ERROR IGNORE
#ERROR CONTINUE
#ERROR STOP
#ERROR EVENT
Defines the error handling policy.
IGNORE means that the program execution continues regardless of errors.
The error handling programs are not activated and no error
message is produced.
CONTINUE means that an error handler is activated or an error message is
produced, but the program execution continues.
STOP means that an error handler is activated or an error message is
produced and the execution of the program containing the error
is aborted. The statement of an active #ON ERROR command is
executed (see below).
EVENT means that the execution of the program containing the error is
aborted, but no error message is produced. The statement of an
active #ON ERROR command is executed (see below). Not
available in the methods of dialogs.
An #ERROR command applies only to the program or #ON block in which it is
executed.
The status code of the most recent error occurred in the program can be read with
the STATUS function, Chapter 9.
If no ERROR command has been executed in a program, the following default
policies are applied:
In error handling programs, the error handling policy is always IGNORE, regardless
of possible #ERROR commands. In delete methods of Visual SCIL objects all errors
are ignored.
86
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
The command is mainly used within error handling blocks (#ON ERROR or #ON
KEY_ERROR blocks) in order to activate an error status in the program. In error
handling blocks, 'status' can be omitted, whereby the activated status is the most
recent error status that has occurred in the program. Outside an error handling block,
the command interrupts the program execution.
Example:
#ON ERROR #BLOCK
#IF STATUS == STATUS_CODE("SCIL_APL_APL_COMMUNICATION_TIMEOUT") #THEN -
!SHOW INFO "Timeout"
#ELSE #ERROR RAISE
#BLOCK_END
87
SYS 600 9.2 MicroSCADA Pro 1MRS756176
The name of local variable may not be formed by using variable expansion. The
following is not valid:
#LOCAL 'LN'_MAX
The SCIL interpreter first finds out whether a local variable by the given name
exists. If it does, the local variable is used, if not, a global variable by the name is
used.
The local variables exist only while the program is executed. When the program
terminates, all its local variables are destroyed and the memory space allocated for
them is freed.
Example:
This example illustrates the use of local variables and arguments (which may be
taken as read-only local variables).
#ARGUMENT A, B, LN
#LOCAL X, Y = A + B ;Initial value of Y is the sum of arguments A and B
#LOCAL I
#LOCAL V = VECTOR()
#LOOP [condition]
[statement]*
#LOOP_END [max]
Executes a sequence of statements in a loop.
'condition' A boolean expression, a precondition for entering the body of
the loop. Default value: TRUE.
88
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
89
SYS 600 9.2 MicroSCADA Pro 1MRS756176
#LOOP_EXIT
Interrupts a loop.
The statement interrupts the innermost loop (#LOOP or #LOOP_WITH) it is
textually located in.
Example:
I = 0
#LOOP
I = I + 1
!SHOW LOOP_NR I
!SHOW QUESTION "CONTINUE? (Y/N)"
!INPUT_VAR ANSWER ANSWER
#IF ANSWER == "N" #THEN #LOOP_EXIT
#LOOP_END
90
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
#ON TEMP:E1
;The former statement is cancelled.
91
SYS 600 9.2 MicroSCADA Pro 1MRS756176
#PAUSE interval
Takes a pause.
'interval' Time interval in seconds given as a real expression.
This command is used to momentarily suspend the program execution.
#RETURN [value]
Stops the program execution and returns a value to the caller.
'value' Any SCIL expression.
#RETURN command is used in named programs, methods and programs executed
with the DO function (see Chapter 9) to stop execution and return a value to the
caller.
The #RETURN command without 'value' may be used in any SCIL program to exit
the program.
A program encountering no #RETURN statement returns a value with data type
"NONE".
Example:
;Suppose you have the following named programs:
92
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
#SET_TIME time
Sets the system time.
'time' Time given in the format YY-MM-DD HH:MM:SS (if
SYS:BTF = 0) or DD-MM-YY HH:MM:SS (if SYS:BTF = 1).
The seconds may be omitted.
The command sets the time of the system clock. If the computer has an external
clock, the command has no relevance.
93
SYS 600 9.2 MicroSCADA Pro 1MRS756176
#DELETE object
Deletes an application object.
'object' An object notation of type P, H, X, F, D, C, T, A or V. A variable
object notation (type V) may contain an attribute name.
The given object is deleted. If a variable object notation contains an attribute name,
the attribute, not the entire object, is deleted.
Using a variable object notation, any global variable may be deleted, see the
example below.
A process object group (process object notation without an index) may be deleted
only if it does not contain any process objects. A time channel may be deleted only
if no object is connected to it. A scale can be deleted only if no process objects use
it. An object of free type (F) can be deleted only if all process objects of the
corresponding type have been deleted.
Examples:
@TMP = 1
#DELETE TMP:V
;The variable TMP is deleted
#DELETE A:P1
;The process object A with index 1 is deleted.
#DELETE A:P
;The process object group A is deleted (possible only if there are no objects
;in the group).
#DELETE V:VAB
;The attribute AB of the global variable V is deleted.
94
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
#EXEC EVENT:E1
;An event object named EVENT is activated.
#GET object
Updates process object values.
'object' A process object notation or an STA system object notation with
the attribute ME or DA.
The command reads the specified process object value(s) or a memory address or an
address range from the station and updates the process database. For process objects,
the attribute may be omitted. It is then assumed to be OV. The command is valid
only for process objects corresponding to physical objects in stations on ANSI X.3
lines.
Examples:
#GET A:PBI
#GET B:PBI(1 .. 4)
#GET STA1:SME(1003^ .. 1010^)
;The binary object A, the four first indices of the binary object B and
;the memory address area 1003 to 1010 from station 1 are updated in the process
;database.
#INIT_QUERY n [condition]
Initiates a process query.
'n' Text expression, either "A", "P" , "L", "H" or "E":
"A" (Alphabetical) The entire process database is searched in
alphabetical order.
95
SYS 600 9.2 MicroSCADA Pro 1MRS756176
#INIT_QUERY "P" UN == 5
;The objects of unit 5 in address order.
96
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
97
SYS 600 9.2 MicroSCADA Pro 1MRS756176
98
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
#SET TASK:CIU = 1
;The command procedure TASK is taken into use.
#SET PRI1:BLP = 72
;The number of lines per page is set to 72 for printer 1.
99
SYS 600 9.2 MicroSCADA Pro 1MRS756176
The format picture of the process object is output to the printer. If the process object
is given with an index, the physical format picture (PF) is written, otherwise the
logical format picture of the group (LF) is used. For process objects of user-defined
types, the command always prints the physical format picture (PF).
The start program of the picture, exclusive of the picture commands, is executed
before printout. Only those windows which have an expression are printed. Curves
and bars are not printed. Depending on the printer definition in the base system (the
PRIn:BOD attribute), the printout may be stored on disk.
The variable list, which may be omitted, defines the variables used in the printed
picture (in windows or in start programs). The variable list may assign a value to a
variable called FORM_FEED, which determines the paper form feed, see the
#PRINT command. In conjunction with #LIST command, the default value of
FORM_FEED is 0, which means that the printer starts a new page only when the
previous one is full.
In addition to the variables of 'variable list', the #LIST command automatically
defines a set of variables which get their names as well as their values from attributes
("snapshot variables"). If the process object is given with an index, these attributes
may be (depending on the object type and definition): LN, IX, OV, BI, BO, DB, DI,
DO, AI, AO, PC, BS, OE, AL, AS, OS, SE, SP, OF, AZ, RT, RM, AT, AM and CA.
For user-defined object types also other attributes may also be transferred to
variables. The corresponding variables may be used in the physical format. If the
process object is given without an index, only the LN attribute is passed in this way
to the logical format. The variable values given in the variable list have precedence
of these automatically generated variables.
Examples:
#LIST 3 TEMP:P (@A = 30)
;The logical format of the process object group is printed to printer 3.
100
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
This command is used when a paper printout of a picture is needed, for example, a
report picture. The start program of the picture, excluding the picture commands, is
executed before the print process. Only those windows which have an expression are
printed. Curves and bars are not printed. Depending on the printer definition in the
base system (the PRIn:BOD attribute), the printout may be stored on disk.
The variable list, which may be omitted, defines the variables used in the printed
picture (in windows or in start programs). In addition, the variable list may assign a
value to a predefined variable called FORM_FEED, which controls the form feed
during printing. The FORM_FEED parameter can have the following values:
0 Form feed only when the page is full (the page length is determined by the
PRIn:BLP attribute, where 'n' is a physical printer number)
1 Form feed before (if not already done) and after printout
2 Form feed before printout (if not already done)
3 Form feed after printout
#LOOP_WITH N = 1 .. 20
#PRINT 1 FORM_'N' (@FORM_FEED = 0)
#LOOP_END
;The pictures FORM_1 ... FORM_20 are printed without form feed.
101
SYS 600 9.2 MicroSCADA Pro 1MRS756176
requested with the path name, it is first searched for in the first directory of the path,
then in the next one, etc. If a path name is used when a new file is created, the new
file will be stored in the first directory of the path name.
A #PATH command without any sign defines a ’global’ path. Such a path definition
is monitor specific when executed in a picture or dialog. If executed in a command
procedure, it applies to all command procedures. If executed in a printed picture, it
applies to all pictures printed with #PRINT. If the directory list is omitted, all
directories of the path name are removed, but the path name remains. Global paths
should be defined only once, for example in the start picture or dialog. System and
application specific paths should be defined by using the base system attributes
SYS:BPH and APL:BPH, respectively (see the System Objects manual).
A #PATH command with a + or - sign defines ’local’ and temporary paths by adding
directories to, or removing them from, the path definition. Local paths are valid only
in the SCIL context where they are defined and take precedence over the global
paths with the same name. A + sign means that the directories are added to the
beginning of the directory list of the path name. A - sign means that the directories
are removed from the directory list. If the directory list is omitted, the - sign removes
all locally defined directories from the path name. (Note: as a terminating - sign
means that the statement is continued on the next line, and in this case should be
typed as two subsequent minus signs followed by an empty line, see the example
below).
When an object invokes another one using #EXEC, #EXEC_AFTER, #PRINT or
#LIST command, both the global and local path definitions are inherited as local
path definitions in the activated object. If, for example, a picture program starts a
command procedure, the paths of the picture will be local paths in the command
procedure and, hence, take precedence over the global command procedure paths.
The latest definition of a path is valid. Hence, by defining paths locally (with + and
-), you ensure that no inherited definitions will override the desired path definitions.
The following automatically defined path names are used as default paths:
SCS_ /SCS/ACTIVE/SCS_
LAN_ /LAN/ACTIVE/LAN_
SYSF /LAN/ACTIVE/SYSF
SYSO /LAN/ACTIVE/SYSO
PICG /LAN/ACTIVE/PICG
PICL /LAN/ACTIVE/PICL
PROD /LAN/ACTIVE/PROD
PROL /LAN/ACTIVE/PROL
REPC /LAN/ACTIVE/REPC
REPL /LAN/ACTIVE/REPL
SYS_ /SYS/ACTIVE/SYS_
APL_ /APL/application/APL_
FORM /APL/application/FORM
PICT /APL/application/PICT
102
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
These default path names are valid everywhere, though the corresponding
directories may be changed globally or locally. A file called without any path name
is stored or sought in the directory/directories defined by the default path name
which coincide with the first four characters in the file name. If no other path name
suits, PICT is used. Visual SCIL main dialogs constitute an exception to this case.
This is described in the Visual User Interface Design manual.
Defined paths can be read with the path functions, see Chapter 9.
Example:
#PATH PROCESS + /APL/APPL1/PICT, NO_CREATE, /APL/APPL2/PICT
;A local logical path named PROCESS is created. If the directory
;/APL/APPL1/PICT does not exist, it is created, but if the directory
;/APL/APPL2/PICT does not exist, it is not created.
!NEW_PIC PROCESS/PICTURE
;The picture named PICTURE is first sought for in the application APPL1,
;then in application APPL2.
103
SYS 600 9.2 MicroSCADA Pro 1MRS756176
#CLOSE_FILE n
Closes a keyed file.
'n' File number. The file number assigned to the file when opened
with the #OPEN_FILE or #CREATE_FILE command. Integer
expression, 1 ... 10.
104
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Closes the file defined by 'n'. This command should be used when the file is no
longer used. Open files are automatically closed when the SCIL context is deleted.
Example:
#CLOSE_FILE 2
;The file opened as number 2 is closed.
105
SYS 600 9.2 MicroSCADA Pro 1MRS756176
'file' Text or byte string expression, the name of the file. See Section
5.5.1 for file naming.
'keylength' The name of the variable to receive the key length (integer value
1 ... 253) used in the file. If a local variable by that name exists,
it is used, otherwise a global variable.
The command opens a keyed file. Up to 10 files can be open at the same time in the
SCIL context.
When the file is no longer used, it should be closed with the #CLOSE_FILE
command, see above.
Example:
#OPEN_FILE 2 1 "APL_/RTU3" L
;The file RTU3 in application 1 is opened. The variable L will contain
;the key length.
106
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
The command reads the keys of the file defined by 'n' and stores them in the variable
'keys'. Up to 1 000 000 keys are read, starting from 'key1' and ending with 'key2'. If
'key2' is omitted the keys are read to the end of the file, or until the vector is full
(1 000 000 keys). If 'key1' and 'key2' are omitted, the keys of the entire file, up to
1 000 000, are read.
Example:
#READ_KEYS 2 V "A" "B"
;Reads the keys starting with letter "A" (supposing that key length is > 1).
107
SYS 600 9.2 MicroSCADA Pro 1MRS756176
#REMOVE n key
Deletes a data record from a keyed file.
'n' File number. The file number assigned to the file when opened
with the #OPEN_FILE or #CREATE_FILE commands (see
above). Integer value, 1 ... 10.
'key' The key of the record to be deleted. A text containing 'keylength'
characters (see the #OPEN_FILE command above).
The command deletes the chosen record. The deletion cannot be undone.
Example:
#REMOVE 2 RTU_KEY(D:POA5)
;The record configuring the process object D is deleted.
108
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
109
SYS 600 9.2 MicroSCADA Pro 1MRS756176
The example above creates a dialog containing two containers, each of which
contains dialog items. The last statement makes the dialog visible on screen.
.DELETE object
Deletes a Visual SCIL object.
'object' The object name, possibly including a path (see Chapter 5).
Deleting a Visual SCIL object means that it is removed from the screen (if shown)
and from the dialog system. When an object is deleted, all its children are deleted as
well.
When an object is deleted, its Delete method, if any, is executed.
Examples:
.DELETE DIALOG1 ;Deletes the object DIALOG1 and all its child objects.
110
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
In the example above, the dialog stored as MYDIALOG in the file MYFILE is
loaded as a Visual SCIL object of type VS_DIALOG. As the visibility attribute
_OPEN is set to "TRUE", the dialog is shown immediately. The command loads the
complete contents of the dialog MYDIALOG.
111
SYS 600 9.2 MicroSCADA Pro 1MRS756176
112
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
User defined attributes will always have the data type of the value last assigned to
the attribute.
Examples:
Moving a button:
.SET BUTTON._GEOMETRY = (20, 20, 20, 20)
!CLOSE
Closes the monitor.
On full graphic operator consoles, the command ends the application session by
closing the kernel process of the monitor (PICO).
On a semi-graphic monitor, the command empties the screen from pictures and
makes it turn black. The monitor can be refreshed by clicking the mouse, which
loads the SYS 600 start picture on screen. If there are pictures in the monitor alarm
picture queue when the !CLOSE command is issued, the monitor screen is not
emptied but instead the oldest alarm picture in the queue is displayed on screen. If
an alarm occurs while the monitor is kept closed, and the monitor in question is
defined as an alarm monitor for the object, the alarm picture is immediately
displayed.
!FAST_PIC[picture]
!FAST_PIC-[picture]
!FAST_PIC[-][picture],[-][picture], ...
Adds and removes fast picture definitions in semi-graphic monitors.
'picture' A picture specified as:
[path/] picture name
where:
'picture name is the picture name exclusive the extension, and
'path' is a logical path name.
If 'path' is omitted, the default path names are used. See the
PATH command, Section 8.2.4.
Default: The present picture
113
SYS 600 9.2 MicroSCADA Pro 1MRS756176
The first command model marks the picture as a fast picture. When the picture is
subsequently erased from the screen, it is saved as a fast picture. This means that
every dynamic part of the picture is saved in the form it had when the picture was
erased. Updating is, however, terminated as in the case of ordinary pictures. When
the picture is again displayed on screen, it has the same appearance as when it was
previously erased and updating starts from this state. The start program of the picture
is no further executed.
The second command model, where the picture name is preceded by a minus sign,
removes the fast picture definition. Henceforth, the picture is no longer stored as fast
picture. Several fast picture definitions at a time can be added and removed as shown
in the third command model above. Note: if 'picture' is omitted, the minus sign at the
end of the line will denote that the statement is continued on the next line. To avoid
this, type two subsequent minus signs and an empty line as shown in the example
below.
Fast pictures are monitor specific, i.e. a picture may be a fast picture in one monitor
but not in the others.
The fast pictures are continuously stored in the main memory. If there is insufficient
main memory storage space in the computer, a large number of fast pictures may
delay the handling of the ordinary ones.
All fast picture definitions are cancelled when the system is exited or the application
state is changed. After a fast picture has been edited in the picture editor it functions
in the normal way until it is stored again.
Example:
!FAST_PIC MYPIC
;Next time the picture MYPIC is exited it is stored as a fast picture.
!FAST_PIC - -
;empty line
;The fast picture definition of the current picture is cancelled. Hereafter
;it functions as an ordinary picture.
!INT_PIC
Displays an alarm picture.
Incoming alarms are added to a monitor (application session or window) specific
alarm picture queue. This command displays the oldest alarm picture in the queue.
At the same time the name of the picture is removed from the alarm picture queue.
If the alarm picture queue is empty, the command has no effect.
In other respects, the command works like !NEW_PIC.
!LAST_PIC
Displays the previous picture.
114
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
This command causes the picture handling process to go one step backwards in the
queue built up by !NEW_PIC, see Figure 8.4.1.-1, and display that picture. If this
picture is no longer available (for example has been deleted or is locked by Picture
Editor), the previous picture in the queue is displayed. Finally, if there are no
available pictures in the queue, an error is raised and no picture change occurs.
In other respects, the command works like !NEW_PIC.
!NEW_PIC picture
Displays a picture.
'picture' The picture to be displayed, specified as
[path/] picture name
where:
'picture name is the picture name exclusive the extension, and
'path' is a logical path name.
If 'path' is omitted, the default path names are used. See the
PATH command, Section 8.2.4.
The picture with the given name, if it exists, is displayed on screen. First the
background becomes visible. After that, possible draw and start programs are
executed (unless the picture is stored as fast pictures, see !FAST_PIC). If the named
picture does not exist, an error message is produced.
When a picture is displayed, its picture name is automatically placed as the last item
in a monitor specific queue of shown pictures, which is maintained by the picture
handling unit. If the picture name already is in the queue, all subsequent picture
names are removed from the queue, and the picture name in its former position is
thereafter the last item in the queue, see Figure 8.4.1.-1.
If 'path' is omitted, the picture is searched for in the directories defined by the default
path name valid for the actual picture name, see the #PATH command, Section
8.2.4.
An error status is produced if the picture does not exist.
Examples:
!NEW_PIC MYPIC
;The picture named MYPIC is shown on screen. The picture is searched for in
;the directory/directories defined by the path name PICT.
!NEW_PIC OWNPIC/MYPIC
;The picture MYPIC is searched for in the directory/directories defined by the
;path name OWNPIC.
115
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Fig. 8.4.1.-1 The picture queue. Each monitor or picture container has its own
picture queue.
!RECALL_PIC
Recalls a stored picture name.
The picture, the name of which is stored by !STORE_PIC (see below), is displayed
on screen. The command functions like !NEW_PIC.
The command has no effect if !STORE_PIC has not been used.
!RESTORE
Stops function key blinking.
When a function key has been pressed, it may be marked by blinking (depending on
the key definition). This command stops the blinking of all function keys on the
entire screen.
!STORE_PIC
Stores the present picture name.
The name of the present picture is stored and it can later be retrieved with the
command !RECALL_PIC.
Only one name at a time may be stored in this way. When the command is used
again, the previous picture name is removed.
116
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
!UPDATE interval
Defines the update time interval.
'interval' Time interval in seconds given as a positive real expression.
The value of 'interval' is automatically rounded to an accuracy of
0.1 seconds.
If there is an update program in the picture, it is executed repeatedly with this
interval as long as the picture is displayed on screen, or until a new !UPDATE
command is issued. After the update program has been executed to the completion,
it restarts when the time interval given by this command has elapsed. Subsequent
!UPDATE commands may change the time interval. The most recently given time
interval is valid. If 0 is given as a time interval, the updating ceases until a new
interval other than 0 is given.
When an !UPDATE command is issued, the update program is immediately
executed once (provided that the interval is unlike 0). The next execution takes place
at a synchronization time. After that execution restarts cyclically with the given
interval. The time interval between the first and second execution may be shorter
than the interval given with the !UPDATE command.
In MicroSCADA revision 8.2 no synchronization was done. If the changed policy
causes troubles at an upgrade, the revision compatibility switch
"DO_NOT_SYNCHRONIZE_PICTURE_UPDATE" may be used. See the System
Objects manual for details.
The main picture, its window pictures and picture functions may have different
updating intervals.
Examples:
!UPDATE 5
;The update program is restarted when five seconds have elapsed since the
;previous execution.
!UPDATE %A
;The updating interval is assigned the value of the variable A.
117
SYS 600 9.2 MicroSCADA Pro 1MRS756176
same level and the same parent. When the level of a displayed window is updated
with the !WIN_LEVEL command, the window is stacked as the topmost window
among the windows with the same level and the same parent.
The stacking order is the same whether the child window is totally contained within
its parent or not.
118
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Examples:
!SHOW MESSAGE "ENTER PASSWORD:"
;The text ENTER PASSWORD: is shown in the window called MESSAGE.
!SHOW TREND/COLUMN %MAX
;The variable MAX is shown in the window COLUMN of the window TREND.
119
SYS 600 9.2 MicroSCADA Pro 1MRS756176
The window background used in the monitor is specified by the base system
attribute MONn:BWC. By means of the !WIN_BG_COLOR command, the SCIL
programmer can choose the background color of individual windows. The command
may be given before or after the window is shown for the first time.
When a window is shown for the first time, the background color is set to the color
defined by the MON:BWC attribute, if not otherwise defined by the
!WIN_BG_COLOR command. Later changes of WC do not affect the background
color.
The !WIN_BG_COLOR command is not applicable to semi-graphic monitors.
120
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
With this command the window expression may be changed during the program
execution. The last given expression is valid. Hence, if the expression given with
!WIN_INPUT is intended to be used, no expression should be given with the
!SHOW command.
If 'picture' is omitted, the window is sought from the picture or picture function
where the command was issued. If the window is not found there, the window is
sought from the entire screen. An error status is produced if the window cannot be
found.
Example:
!WIN_INPUT LINE "TRY AGAIN:"
!SHOW LINE
;The text TRY AGAIN: is shown in the window LINE.
121
SYS 600 9.2 MicroSCADA Pro 1MRS756176
122
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
If 'picture' is excluded from the command, the window is sought from the picture or
picture function where the command was issued. If the window is not found there,
the window is sought from the entire screen. An error status is produced if the
window cannot be found.
Examples:
!WIN_POS ABC (1,1)
;The window ABC is moved to the upper left corner of the main picture.
!SHOW INFO "POINT OUT A NEW LOCATION"
!INPUT_POS POS
!WIN_POS FIG %POS
;The window FIG is moved to the position pointed out with the mouse.
123
SYS 600 9.2 MicroSCADA Pro 1MRS756176
!CSR_LEFT
!CSR_RIGHT
!CSR_BOL
!CSR_EOL
These commands move the data entry cursor.
!CSR_LEFT moves the data entry cursor one step to the left and !CSR_RIGHT one
step to the right. !CSR_BOL moves the cursor to the beginning of the input field,
!CSR_EOL to the end of the input field.
These commands may be used only after the !INPUT_VAR command, and have no
effect if this command has not been issued.
!ENTER
Completes data entry.
After an !INPUT_VAR command has been executed, the system waits for character
inputs until it gets an !ENTER command, or the Enter key on the keyboard is
pressed. If the program containing the !ENTER command (usually a function key
program) contains other statements after !ENTER, these are executed. Then the
program execution continues with the statements following after !INPUT_VAR.
The command has no effect if no !INPUT_VAR command has been issued.
!INPUT_KEY keytext var
Reads function key information.
'keytext' This argument states the kind of information to be read:
PROGRAM The program
HEADER The function key header
HELP The function key help text
‘var' A variable name. The variable will contain the selected
information as a text vector. If a local variable by the name
exists, it is used, otherwise a global variable.
The chosen information of the clicked function key is read and placed in the variable
'var'. The variable becomes a vector, the length of which is determined by the chosen
information.
After this command has been executed, no other commands are executed until a
function key has been clicked.
The execution of this command may be interrupted by input timeout (attribute
APL:BIT), status PICO_INPUT_TIMEOUT.
Example:
!INPUT_KEY HELP V
!SHOW HELP %V
;After the !INPUT_KEY command has been executed, the system waits until a
;function key is pressed. If this has a help text, the text will be shown in
;the window HELP.
124
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
!INPUT_POS var
Reads the mouse or cursor position.
'var' The name of a variable. If a local variable by the name exists, it
is used, otherwise a global variable.
The command reads the coordinates of the subsequent push on the mouse, or the
corresponding keyboard operation, and stores the coordinates in the given variable.
The entire control board is available. After this command has been executed, no
other commands are executed until a position has been pointed out with the mouse.
The variable 'var' becomes a vector with four integer elements:
(x,y,x_rel,y_rel)
where:
'x,y' are the coordinates for the cursor position in relation to the upper
left corner of the screen which is (1,1). The value range of the x-
coordinate is 1 ... 160. The coordinates 1 ... 80 belong to the
screen and 81 ... 160 lie on the control board outside the screen.
The value range of the y-coordinate is 1 ... 96. The screen part
lies in the range 1 ... 48. The coordinates 49 ... 96 are situated on
the control board outside the screen.
'x_rel,y_rel' are the coordinates of the cursor position in relation to the upper
left corner (= (1,1)) of the window where the !INPUT_POS
command is executed. These coordinates may have negative
values.
The execution of this command may be interrupted by input timeout (attribute
APL:BIT), status PICO_INPUT_TIMEOUT.
Examples:
!INPUT_POS V
;The position of the following push on the mouse is read and assigned to the
;variable V.
!WIN_POS WINDOW %V
;The window WINDOW is moved to the position determined by the variable V (only
;the first two elements are noted, i.e., the first coordinate pairs).
125
SYS 600 9.2 MicroSCADA Pro 1MRS756176
This command allows the user to assign a value to a variable during operation. The
window name states in which window the value is echoed. The statement is executed
only if the window is defined and is of FIELD type. The window definition
determines the data type of the variable (integer, real or text) as well as the number
of decimals (if real data).
After this command, the system waits for an input in the form of characters, from
the keyboard or control board, until it gets an !ENTER command or the Enter/Line
Feed key of the keyboard is pressed. No commands are handled other than those
affecting the character input.
Entering data using the control board requires that a character key set is defined in
the picture. When using the keyboard, lower case letters are converted to upper case
letters. The Nordic letters Å, Ä, Ö, and the German Ü are converted to the
corresponding SYS 600 semi-graphic characters, i.e., the ASCII codes [ , \ , and ].
This command is not allowed in update programs.
The execution of this command may be interrupted by input timeout (attribute
APL:BIT), status PICO_INPUT_TIMEOUT.
Example:
!INPUT_VAR WIND V
;The value of the variable V is read from the window WIND.
!RUBOUT
!RUBOUT_CUR
!RUBOUT_BOL
!RUBOUT_EOL
Delete input data.
!RUBOUT deletes the character to the left of the input cursor.
!RUBOUT_CUR deletes the character in the current position of the cursor.
!RUBOUT_BOL deletes the beginning of the line until, but not including, the
cursor.
!RUBOUT_EOL deletes the end of line starting from the cursor position.
The commands may be used only after the !INPUT_VAR command, and they have
no effect if this command has not been issued.
!TOGGLE_MOD
Insert/typeover.
Shifts from type-over (default) to insert and vice versa. The command may be used
only after the !INPUT_VAR command and has no effect if this command has not
been issued.
126
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
!RESET
Deletes variables in a picture.
All variables assigned before this command, except for those of the start program,
are deleted. At the same time the command !RESTORE (Section 8.4.1) is executed.
Example:
@PROFIT = 350000
!SHOW WIND %PROFIT
;350000 is shown in the window WIND.
!RESET
!SHOW WIND %PROFIT
;An error message is displayed.
#ON ERROR !RESET
;The variables are deleted when an error occurs.
127
SYS 600 9.2 MicroSCADA Pro 1MRS756176
128
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
9. Functions
This chapter describes the predefined SCIL functions. The chapter is organized into
the following sections:
9.1 General
9.2 Generic Functions
9.3 Arithmetic Functions
9.4 Time Functions
9.5 String Functions
9.6 Bit Functions
9.7 Vector Handling Functions
9.8 List Handling Functions
9.9 Functions Related to Program Execution
9.10 Functions Related to the Run-time Environment
9.11 Functions Related to the Programming Environment
9.12 Language Functions
9.13 Error Tracing Functions
9.14 Database Functions
9.15 File Handling Functions
9.16 File Management Functions
9.17 Communication Functions
9.18 CSV (Comma Separated Value) Functions
9.19 DDE Client Functions
9.20 DDE Server Functions
9.21 ODBC Functions
9.22 OPC Name Database Functions
9.23 OPC Functions
9.24 RTU Functions
9.25 Printout Functions
9.26 Miscellaneous Functions
Besides the SCIL functions described in this chapter, there are also some functions
for handling full graphic elements, which are described in Chapter 10.
9.1. General
Function calls
SCIL provides a number of standard functions, which return values according to a
predetermined algorithm. Function calls are used as operands in expressions (see
example 8-1).
A function call has the following format:
function(argument(s))
129
SYS 600 9.2 MicroSCADA Pro 1MRS756176
The argument list consists of one or more expressions, separated by commas. If the
function does not take any arguments, only the function name is used or an empty
argument list () may be given. The expected data types of the arguments, as well as
the data type of the result, are fixed by the actual function. The data type of the result
determines how the function call may be used in expressions (see Chapter 7).
Whenever a function expects a real type argument, an integer argument will do as
well. It is implicitly converted to real value before the function is called. Also, when
a vector argument with real type elements is expected, integer elements are accepted
as well, unless otherwise noted.
Several functions expect a predefined text type argument. They are called text
keywords in the descriptions of functions. These arguments are case-insensitive. As
an example, function LOCATE takes an optional argument by keyword value
"ALL". Though not mentioned in the description, argument values "all", "All" and
even "aLL" are accepted as well.
In the function descriptions in this chapter, the data types of the arguments, as well
as the data type of the resulting value, are given for each function. Arguments within
square brackets [] are optional. Notation []* means that the argument within the
square brackets is optional but may appear more than one times. If not otherwise
stated, all arguments can be arbitrary SCIL expressions of the specified data type.
Examples
The following examples illustrates the use of functions:
!SHOW TIME TIMES(OBJ:PRT)
;The latest registration time for the object is written out as a text in the
;window called TIME.
Overview
130
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
131
SYS 600 9.2 MicroSCADA Pro 1MRS756176
132
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
DDE_VECTOR(vector, decimal_separator, Creates a DDE style list with a user defined list separator. 281
list_separator)
DEC(value [,length [,decimals]]) Represents integer and real values as text. 171
DEC_SCAN(string) Creates an integer or a real value out of its decimal text 171
representation.
DELETE_ATTRIBUTE(list, attribute) Deletes attribute(s) from a list. 193
DELETE_ELEMENT(v, index [,index2]) Deletes individual elements of a vector. 184
DELETE_PARAMETER(file, section [,key]) Deletes a parameter from a parameter file. 248
DIRECTORY_MANAGER("COPY", source, Copies a directory and all its contents into a new directory. 263
target)
DIRECTORY_MANAGER("COPY_CONTENTS", Copies the files of a directory into another directory. 263
source, target [,filter [,subdirectories Optionally, the subdirectories are recursively copied as well.
[,overwrite]]])
DIRECTORY_MANAGER("CREATE", directory Creates a directory or a hierarchy of directories. 264
[,recursion])
DIRECTORY_MANAGER("DELETE", directory) Deletes one or more directories and all the directories and 262
files contained in them.
DIRECTORY_MANAGER("DELETE_CONTENT Deletes files and directories contained in a given directory. 263
S", directory [,filter [,subdirectories]])
DIRECTORY_MANAGER("EXISTS", directory) Checks the existence of one or more directories. 263
DIRECTORY_MANAGER("GET_ATTRIBUTES", Returns attribute information from one or more directories. 265
directory)
DIRECTORY_MANAGER("LIST", directory [,filter Lists the directories contained in a given directory. 262
[,recursion] [,hidden]])
DIRECTORY_MANAGER("MOVE", directory, Moves a directory to another directory. 264
target)
DIRECTORY_MANAGER("RENAME", directory, Renames a directory. 264
name)
DO(program [,a]*) Executes the SCIL program given as an argument. 195
DOW[(time)] The day of week . 155
DOY[(time)] The day of year . 155
DRIVE_MANAGER("EXISTS", drive) Checks the existence of one or more drives. 260
DRIVE_MANAGER("GET_ATTRIBUTES", tag) Returns some information from drives. 260
DRIVE_MANAGER("GET_DEFAULT") Returns the default drive, i.e. the drive assumed if an absolute 260
path does not contain the drive.
DRIVE_MANAGER("LIST") Returns the drives available in the system. 260
DUMP(data [,line_length]) Represents data as text in SCIL expression syntax. 142
EDIT(text, key) Simple text editing. 171
ELEMENT_LENGTH(vl) The lengths of vector elements and list attributes. 142
END_QUERY Tells whether a process object query is completed. 231
ENVIRONMENT(variable) Retrieves an operating system environment variable value. 199
EQUAL(v1, v2, [,status_handling [,case_policy]]) Compares two SCIL values for equality. 143
ERROR_STATE Returns the current error handling policy. 195
133
SYS 600 9.2 MicroSCADA Pro 1MRS756176
134
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
135
SYS 600 9.2 MicroSCADA Pro 1MRS756176
136
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
137
SYS 600 9.2 MicroSCADA Pro 1MRS756176
OPC_NAME_MANAGER("PUT", apl, name, Creates a new name in the OPC Name Database or 289
definition) overwrites an existing one.
OPS_CALL(command [,nowait]) Executes an operating system command. 196
OPS_NAME[([major [,minor]])] Returns the name of the operating system. 201
OPS_PROCESS(command [,directory [,wait]]) Starts an external program as a separate process. 196
PACK_STR(source, type [,length [,byte_order]]) Creates a text, a bit string or a byte string out of its elements. 175
PACK_TIME(year, month, day, hour, minute, Creates a SCIL time data value out of its components. 158
second)
PAD([string, ]filler, length) Pads a text with a filler string to the given length. 176
PARSE_FILE_NAME(name [,file]) Converts SCIL path names and file names to operating 251
system file names.
PATH(name) The directories contained in a logical path. 252
PATHS(level) The logical paths defined on a specified level. 252
PHYS_FETCH(apl, unit, address [,bit_address]) Fetches the configuration attributes of a process object 225
PICK(v, indices) Picks up specified elements from a vector. 188
PREV(n) Fetches the configuration attributes of an object within a 224
search result.
PRINT_TRANSPARENT(data [,log]) Sends printout to a printer. 301
PRINTER_SET Returns the target printer numbers. 305
PROD_QUERY(n) Returns attributes of objects selected by a process object 231
query.
RANDOM(n1, n2) Generates a random number. 151
READ_BYTES(file [,start [,length]]) Reads a binary file. 252
READ_COLUMNS(file, pos, width [,start Reads a text file as columns. 252
[,count]])
READ_PARAMETER(file, section, key [,default]) Reads a parameter from a parameter file. 253
READ_TEXT(file [,start [,number]]) Reads a text file. 254
REGISTRY(function, key, value_name) Reads the registry maintained by Windows operating system. 201
REMOVE_DUPLICATES(v [,status_handling Removes duplicate elements of a vector. 188
[,case_policy]])
REP_LIB(name) The files contained in a logical representation library. 254
REP_LIBS(level) The logical library names defined on a specified level. 255
REPLACE(text, string, new_string) Replaces text strings by another string. 177
REVERSE(v) Reverses the order of elements of a vector. 189
REVISION_COMPATIBILITY(issue [,enable]) Selects the compatibility issues to be used in the context. 197
ROUND(arg [,decimals])) Rounds off a real value. 151
RTU_ADDR(key) Returns a list with the address of the object in a certain 298
record.
RTU_AINT(i) Converts an integer to ASCII characters (according to the 299
RP570 protocol).
RTU_AREAL(r) Converts a real number to four ASCII characters (float 299
DS801).
138
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
RTU_ATIME [(t [,msec])] Converts time data (operating system time) to ASCII (RTU200 299
time).
RTU_BIN(h) Converts HEX-ASCII numbers given as a text to binary 300
numbers in text form.
RTU_HEXASC(b) Converts binary numbers given as a text to hex-ascii numbers 300
as a text.
RTU_INT(a) Converts two ASCII characters (2's complement RP570) to an 300
integer.
RTU_KEY(oa) Returns the search key for a record in an RTU200 300
configuration file.
RTU_MSEC(atime) Returns the milliseconds of the 6-byte RTU time string 'atime'. 301
RTU_OA(type, ba) Returns the object address. 301
RTU_REAL(a) Converts 4 ASCII characters (float DS801) to a real number. 301
RTU_TIME(a) Converts ASCII (RTU200 time) to SYS 600 time data. 301
SCALE(v, scale_object [,direction]) Scales a value using a scale object. 306
SCIL_HOST Returns the type and number of the process that is running 202
this SCIL code.
SCIL_LINE_NUMBER Tells the current line number within the SCIL program. 215
SCIL_TO_CSV(data [,option]*) Converts SCIL data into a CSV file format record. 275
SECOND[(time)] The second. 159
SELECT(source, condition [,wildcards]) Selects the elements of a vector or a list of vectors that fulfil 189
given condition.
SEPARATE(text, delimiter) Extracts fields of a text. 177
SET_CLOCK(time) Sets the SYS time. 159
SET_LANGUAGE(language) Sets the current language of the SCIL context. 214
SET_LOCAL_TIME(time) Sets the local time of the system. 159
SET_RANDOM_SEED(seed) Sets the seed number of the random number generator. 152
SET_STATUS(source, status) Modifies the status code of SCIL data. 145
SET_SYS_TIME(time) Sets the SYS time of the system. 160
SET_UTC_TIME(time) Sets the UTC time of the system. 160
SHADOW_FILE(file_name) Queues a file for shadowing. 255
SHUFFLE(n) Shuffles integers 1 to n into a random order. 190
SIN(arg) The sine of the argument. 152
SORT(v, [start, [length]]) Sorts a vector. 191
SPACOM(message) Communicates with a SPACOM unit connected to a COM 273
port.
SPREAD(v, indices, new_value) Replaces vector elements by a new value. 191
SQL_BEGIN_TRANSACTION(connection_id) Marks the beginning of a transaction. 286
SQL_COMMIT(connection_id) Commits a transaction the start of which was marked with 287
SQL_BEGIN_TRANSACTION.
SQL_CONNECT(source, user, password) Opens an ODBC connection to a data source. 282
SQL_DISCONNECT(connection_id) Closes the ODBC connection defined by the argument. 283
139
SYS 600 9.2 MicroSCADA Pro 1MRS756176
140
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
UNPACK_STR(source [,length [,byte_order]]) Splits a text, a bit string or a byte string to a vector of its 178
elements.
UPPER_CASE(text) Converts text to upper case. 179
UTC_TIME The present UTC time. 166
UTC_TIME_ADD(time, s [,ms]) Adds seconds and milliseconds to given UTC time. 166
UTC_TIME_INTERVAL(from, to) The length of the time interval between two UTC times. 166
UTC_TO_LOCAL_TIME(time) Converts UTC time to local time. 167
UTC_TO_SYS_TIME(time) Converts UTC time to SYS time. 167
VALIDATE(as, string) Validates a text string as a SCIL object name. 209
VALIDATE_OBJECT_ADDRESS(apl, pt, un, oa Validates an object address. 209
[,subaddress])
VARIABLE_NAMES Lists the names of global variables defined in the SCIL 198
context.
VECTOR [([element1 [,element]*)] Creates a vector out of given elements. 193
WEEK(time)] The number of the week within a year. 167
WORKSTATION_CALL(command [,arg]*) Executes a command in the workstation. 198
WRITE_BYTES(file, data [,append]) Writes a binary file. 256
WRITE_COLUMNS(file, pos, width, data Writes a text file as columns. 256
[,append])
WRITE_PARAMETER(file, section, key, value) Writes a parameter into a parameter file. 257
WRITE_TEXT(file, text [,append]) Writes a text file. 257
YEAR(time)] The year. 167
141
SYS 600 9.2 MicroSCADA Pro 1MRS756176
DATA_TYPE(expression)
The data type of the argument
The function returns the data type of the argument, or value "NONE" if the
expression cannot be evaluated. Consequently, it can be used to check an expression,
for example the existence of a variable..
'expression' An expression of any data type.
Value: Text. The data type of the expression:
"INTEGER"
"REAL"
"BOOLEAN"
"TEXT"
"TIME"
"BIT_STRING"
"BYTE_STRING"
"VECTOR"
"LIST"
"NONE" (= the expression is wrong or undefined)
Example:
DATA_TYPE(CLOCK) == "TIME"
#IF DATA_TYPE(DATA:DOV) == "NONE" #THEN .......
DUMP(data [,line_length])
Represents data as text in SCIL expression syntax.
This function creates a text vector that represents the contents of any SCIL data in
SCIL expression syntax. The status code of each data item (unless 0) is also dumped.
'data' An expression of any data type.
'line_length' An integer, 80 ... 65 535. Maximum line length in the resulting
text vector. Default is 80.
Value: A text vector.
This function can be used to store any SCIL data structure in a text file.
See function EVALUATE for the reverse operation.
ELEMENT_LENGTH(vl)
The lengths of vector elements and list attributes.
'vl' Vector or list value.
Value: Vector or list containing the lengths of components of 'vl'.
142
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
If the argument 'vl' is a vector, the value of the function call is an integer vector of
the same length, the nth element of the resulting value containing the length of nth
element of 'vl'.
If the argument 'vl' is a list, the value of the function call is a list having the same
attributes as 'vl', each containing the length of the corresponding attribute of 'vl'.
Example 1:
#LOCAL LINES, LINE_LENGTHS
LINES = READ_TEXT("c:\sc\stool\misc\languages.txt") ;A text file is read
LINE_LENGTHS = ELEMENT_LENGTH(LINES) ;LINE_LENGTHS contains the length of
;each line
EVALUATE(expression)
Evaluates an expression given as text in SCIL syntax.
'expression' A text or text vector value containing the SCIL expression to be
evaluated. If a text vector is given, other lines but the last one
must end with a continuation character ( - ).
Value: The result of the evaluation, which may be of any data type.
143
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Example:
The following example shows how to store any data value (such as a complicated
list) in a disk file and then read it back:
#LOCAL WRITE_STATUS = WRITE_TEXT("DUMP.TXT",DUMP(V))
#IF WRITE_STATUS == 0 #THEN W = EVALUATE(READ_TEXT("DUMP.TXT"))
GET_STATUS(data)
Returns the status code(s) of a value.
'data' A value of any data type.
Value: If 'data' is of a simple data type, the function returns an integer
value. If it is a vector, the function returns an integer vector
containing the status codes of each element of the argument
vector. If it is a list, the function returns a list with the same
attribute names, each attribute containing the status code of the
corresponding argument attribute.
See function SET_STATUS for the reverse operation.
LENGTH(arg)
The length of the argument.
'arg' A value of any data type.
Value: Integer value. According to the data type of the argument, the
following is returned:
Integer 1
Real 1
Boolean 1
Time 1
Text The number of characters in the text.
Bit string The number of bits in the string
Byte string The number of bytes in the byte string
Vector The number of elements in the vector.
List The number of attributes in the list.
Examples:
LENGTH(340) == 1
LENGTH("ABCD") == 4
LENGTH(" ") == 1
LENGTH("") == 0
144
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
SET_STATUS(source, status)
Modifies the status code of SCIL data.
'source' A value of any data type.
'status' An integer expression, 0 ... 65 535, or a vector or a list of such
integers.
Value: Same data type as 'source'.
The function merges the contents of 'source' argument and the status code(s) 'status'
as follows:
• If 'source' is of a simple data type, 'status' must be an integer value.
• If 'source' is a vector, 'status' may be an integer or an integer vector. If 'status' is an
integer, the status of each element of 'source' is set to 'status'. If 'status' is a vector,
the status of nth element of 'source' is set to the nth element of 'status'. If the
vector 'status' is shorter than the vector 'source', the 'source' is modified only up to
the length of 'status'. If 'status' is longer than 'source', the extra elements are
ignored.
• If 'source' is a list, 'status' may be an integer or a list value. If 'status' is an integer,
the status of each attribute of 'source' is set to 'status'. If 'status' is a list, the status
of 'source' attribute NN is set to the value of 'status' attribute NN. The attributes of
'status' that do not exist in 'source' are ignored. The attributes of 'source' that do
not exist in 'status' are unaffected.
If a value is assigned a status code >= 10, the value itself is lost. If a value in 'source'
has a status code >= 10, and it is assigned a status code <10, the value is initialized
by integer zero.
See function GET_STATUS for the reverse operation.
Examples:
@V = SET_STATUS(%V, 2)
;Status code 2, OBSOLETE_STATUS, is set to the variable V.
@A = SET_STATUS(%A,GET_STATUS(%B))
;The status of the variable A is copied from the variable B.
TYPE_CAST(source, type)
Views data as if it were of different data type.
'source' The source data to be viewed. Integer, real, time, boolean, text
or bit string.
'type' Text keyword specifying the result data type:
"INTEGER", "REAL", "TIME", "BOOLEAN", "TEXT",
"BIT_STRING" or "BYTE_STRING"
See the compatibility rules below.
Value: A value of data type specified by 'type'.
145
SYS 600 9.2 MicroSCADA Pro 1MRS756176
This function interprets the memory bit pattern of a value as if it were of another
data type. The following data type compatibility rules apply:
• Bit patterns of INTEGER, REAL, TIME and BOOLEAN data can be viewed as
INTEGER, REAL, TIME or BOOLEAN data.
• Bit patterns of TEXT, BIT_STRING and BYTE_STRING data can be viewed as
TEXT, BIT_STRING or BYTE_STRING data.
• Any other combination results to a runtime error.
This is a low-level, close-to-hardware, function, whose results may be hardware
dependent.Type-casting from and to real data may result to invalid floating point
numbers. Type-casting to a bit string returns the bit pattern of the source as a bit
string, whose length is 8 times the length of the source (one character or byte
occupies 8 bits). Type-casting from a bit string returns a text or byte string, whose
length is 1/8 of the length of the bit string.
Example:
TYPE_CAST(TRUE, "INTEGER") returns the integer value 1, which is the integer
representation of the boolean value TRUE.
ABS(arg)
The absolute value.
'arg' An integer or real value, or a vector of such values.
Value: The absolute value of the argument. Same data type as the
argument.
Example:
ABS(-3) ;returns the integer value 3.
ARCCOS(arg)
Arcus cosinus.
This function returns, as radians, the angle, whose cosine equals to the argument.
'arg' A real value -1.0 ... +1.0, or a vector of such real values.
Value: A real value or a vector of real values. The angle(s) in radians.
ARCSIN(arg)
Arcus sinus.
146
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
This function returns, as radians, the angle, whose sine equals to the argument.
'arg' A real value -1.0 ... +1.0, or a vector of such real values.
Value: A real value or a vector of real values. The angle(s) in radians.
ARCTAN(arg)
Arcus tangens.
This function returns, as radians, the angle, whose tangent equals to the argument.
'arg' A real value, or a vector of such real values.
Value: A real value or a vector of real values. The angle(s) in radians.
COS(arg)
The cosine of the argument.
'arg' A real or integer value or a vector of such values. The angle(s)
in radians.
Value: A real value or a vector of real values.
EVEN(arg)
Tells whether the argument is even.
'arg' An integer or a vector of integer values.
Value: A boolean value or a vector of boolean values.
EXP(arg)
The exponential function.
The result is the number e, Neper's number, raised to the power of the argument.
'arg' A real value, max. +88.0, or a vector of such values.
Value: A real value or a vector of real values.
HIGH_PRECISION_ADD(n1 [,n]*)
Adds up two or more high precision numbers.
'n1' ’DOUBLE’ value, the first addend, see below.
'n' ’DOUBLE’ values, up to 31 more addends.
Value: ’DOUBLE’ (byte string) value, the sum of the arguments.
This and the following five functions implement the high precision arithmetics in
SCIL. High precision numbers are based on 64-bit floating point numbers, while the
REAL datatype of SCIL is based on 32-bit floating point numbers. High precision
numbers are accurate to approx. 15 decimal digits (compared to only 7 of REAL
data).
147
SYS 600 9.2 MicroSCADA Pro 1MRS756176
The high precision number arguments of these functions may be given in any of the
following four ways (collectively called ’DOUBLE’ type, for short):
1. As an integer value, e.g. 1234567890.
2. As a real value, e.g. 1.25.
3. As a text containing the decimal representation of the number. The
representation may contain decimal digits, a sign, decimal point and leading and
trailing spaces. Examples of valid text representations: " -1.234565789012",
"12345678901234 " and "100000000000000000000".
4. As a byte string value returned by one of the high precision functions.
The high precision functions return their high precision results as a byte string data
containing the 64-bit floating point representation. This internal representation is
converted to normal SCIL data types by function HIGH_PRECISION_SHOW.
When you enter a high precision constant in your SCIL program, use
a text type argument instead of a real or an integer argument, unless
you are sure that your constant has an exact representation as a 32-
bit floating point number or as an integer.
Example:
#LOCAL PI, PI_PLUS_1
PI = HIGH_PRECISION_ADD("3.141592653589793") ;Remember the double quotes!
;Otherwise you lose precision.
PI_PLUS_1 = HIGH_PRECISION_ADD(PI, 1)
HIGH_PRECISION_DIV(n1, n2)
Divides a high precision number by another.
'n1' ’DOUBLE’ value, the dividend.
'n2' ’DOUBLE’ value, the divisor.
Value: ’DOUBLE’ (byte string) value, 'n1' * 'n2'.
See function HIGH_PRECISION_ADD for details of high precision arithmetics.
HIGH_PRECISION_MUL(n1, n2)
Multiplies two high precision numbers.
'n1' ’DOUBLE’ value, the multiplier.
'n2' ’DOUBLE’ value, the multiplicand.
Value: ’DOUBLE’ (byte string) value, 'n1' * 'n2'.
See function HIGH_PRECISION_ADD for details of high precision arithmetics.
HIGH_PRECISION_SHOW(n [,decimals])
Displays a high precision number in various formats.
'n' ’DOUBLE’ (byte string) value
'decimals' Integer value 0 ... 253, number of decimals to display.
Default value is 6.
148
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
HIGH_PRECISION_SUB(n1, n2)
Subtracts a high precision number from another.
'n1' ’DOUBLE’ value, the minuend.
'n2' ’DOUBLE’ value, the subtrahend.
Value: ’DOUBLE’ (byte string) value, 'n1' - 'n2'.
See function HIGH_PRECISION_ADD for details of high precision arithmetics.
HIGH_PRECISION_SUM(v)
Calculates the sum of the high precision number elements of a vector.
'v' A vector of ’DOUBLE’ elements.
Value: A list with the following attributes:
SUM ’DOUBLE’ (byte string) value, the calculated sum.
STATUS Integer value, SCIL status code, 0 = OK, see below.
ERRORS A vector of integer elements, see below.
The STATUS attribute of the result is set to SUSPICIOUS_STATUS (= 1), if any
of the elements of the argument vector has a non-zero status. If the argument vector
is empty, or it contains no valid elements, NOT_SAMPLED_STATUS is set.
If the argument vector contains elements that are not valid ’DOUBLE’ values, the
indices of such elements are returned in attribute ERRORS. If the length of the
attribute is 0, no erroneous elements have been encountered.
See function HIGH_PRECISION_ADD for details of high precision arithmetics.
LN(arg)
Natural logarithm.
'arg' A real value > 0, or a vector of such values.
Value: A real value or a vector of real values.
149
SYS 600 9.2 MicroSCADA Pro 1MRS756176
MAX(arg1 [,arg]*)
The largest value in the argument list.
'arg1' ... Up to 32 integers, real or time values or vectors of such values.
Value: An integer, a real or a time value or a vector of these.
The following rules apply for scalar (non-vector) arguments. First, if all the
arguments are integers, the result is an integer. Second, if all the arguments are time
values, the result is a time value. Third, if any of the arguments is a real value, the
result is a real value. Fourth, if time arguments are mixed with numeric arguments
(which actually makes no sense), the result is numeric.
Finally, if the argument list contains vectors, the result is a vector of the length of
the longest argument vector. Each element is compared to the corresponding
element in the other argument vectors, as well as to the scalar arguments according
to the data type conversion rules above. If the lengths of argument vectors are
unequal, the odd elements get SUSPICIOUS_STATUS (see the Status Codes
manual).
Notes:
1. If the argument list contains only one argument, the argument is returned as
such.
2. To find the largest element of a vector, use function HIGH or HIGH_INDEX.
See the functions MIN, HIGH and HIGH_INDEX as well.
Examples:
MAX(1, 5, 3) == 5
MAX(1.0, 5, 3) == 5.0
MAX(VECTOR(1, 2, 4), 3, VECTOR(5, 0, 1)) ;returns VECTOR(5, 3, 4)
MIN(arg1 [,arg]*)
The smallest value in the argument list.
'arg1' ... Up to 32 integer, real or time values or vectors of such values.
Value: An integer, a real or a time value or a vector of these.
The following rules apply for the scalar (non-vector) arguments. First, if all the
arguments are integers, the result is an integer. Second, if all the arguments are time
values, the result is a time value. Third, if any of the arguments is a real value, the
result is a real value. Fourth, if time arguments are mixed with numeric arguments
(which actually makes no sense), the result is numeric.
Finally, if the argument list contains vectors, the result is a vector, which is as long
as the longest argument vector. Each element is compared to the corresponding
element in the other argument vectors, as well as to the scalar arguments according
to the data type conversion rules mentioned above. If the lengths of argument
vectors are unequal, the odd elements get SUSPICIOUS_STATUS (see the Status
Codes manual).
Notes:
1. If the argument list contains only one argument, the argument is returned as
such.
150
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
ODD(arg)
Tells whether the argument is odd.
'arg' An integer or a vector of integer values.
Value: A boolean value or a vector of boolean values.
Example:
ODD(5) == TRUE
EVEN(5) == FALSE
RANDOM(n1, n2)
Generates a random number.
'n1' An integer or real value.
'n2' An integer or real value.
Value: Integer or real value.
If 'n1' and 'n2' are integers, an integer value in the range [n1, n2] (including n1 and
n2) is returned. If 'n1' and 'n2' are real values, a real value in the range [n1, n2), i.e.
including n1 but excluding n2, is returned.
This function is based on the random number generator of the underlying operating
system. The generator generates a fixed sequence of pseudo-random integers, where
each generated number works as a seed to the next number. If you want to get
exactly the same random numbers every time the SCIL program is executed. You
can use function SET_RANDOM_SEED with a fixed argument, but if you want to
have different random numbers each time, use SET_RANDOM_SEED with a
varying argument (current time, for example).
ROUND(arg [,decimals])
Rounds off a real value.
If 'decimals' is omitted, the argument is rounded off to the nearest integer. If
'decimals' is given, the argument is rounded off to the nearest real value having
'decimals' decimal digits. See also function TRUNC.
'arg' A real value or a vector of real values.
'decimals' An integer >= 0, number of decimal digits
Value: If 'decimals' omitted, an integer or a vector of integers,
otherwise a real value or a vector of real values.
151
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Examples:
ROUND(4.5) == 5
ROUND(-4.5) == -5
ROUND(2.7456, 2) == 2.75
SET_RANDOM_SEED(seed)
Sets the seed number of the random number generator.
'seed' Any integer or time value.
Value: Always integer 0.
See the function RANDOM for details.
SIN(arg)
The sine of the argument.
'arg' A real or integer value or a vector of such values. The angle(s)
in radians.
Value: A real value or a vector of real values.
SQRT(arg)
The square root of the argument.
'arg' A real value > = 0, or a vector of such values.
Value: A real value > = 0 or a vector of such values.
TRUNC(arg [,decimals])
Truncates a real value.
If 'decimals' is omitted, the argument is truncated to an integer by removing the
fraction part. If 'decimals' is given, the argument is truncated to a real value having
'decimals' decimal digits. See also function ROUND.
'arg' A real value or a vector of real values.
'decimals' An integer >= 0, number of decimal digits
Value: If 'decimals' omitted, an integer or a vector of integers,
otherwise a real value or a vector of real values.
Examples:
TRUNC(4.5) == 4
TRUNC(-4.5) == -4
TRUNC(2.7456,2) == 2.74
152
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
The time functions usually take a time type or a qualified time type argument. A time
type value is used to represent a time in one-second resolution. A qualified time has
a resolution of one millisecond, it also contains the daylight saving information, see
below. Many of the functions may also be called without an argument, the present
time is then assumed.
Both local and UTC time are supported by these functions. See function
TIME_ZONE_RULES for details of maintaining the rules of time zone and daylight
saving time transitions.
A SYS 600 system may run either in local time or in UTC time. The time reference
is specified by the base system attribute SYS:BTR. The term ’SYS time’ is used
below to refer to the time reference of the system.
At the end of this section you find examples of the time functions.
Several functions that convert times from local to UTC time or otherwise calculate
qualified time values return status information as the status of the CL attribute of
the result. The following values may be returned:
OK_STATUS (0).The time is existing and unique.
FAULTY_TIME_STATUS (3). The time is non-existing, either because its DS
attribute is wrong or it specifies a moment that was skipped over during the
transition to daylight saving time or the resulting time is out of the valid range of
time type data.
AMBIGUOUS_TIME_STATUS (4). The time is ambiguous, because it specifies a
moment that was duplicated during a transition to standard time and DS attribute
does not tell which one is meant.
The following special cases may occur when converting UTC time to local time:
1. DS attribute of the argument is missing. This is OK, not considered as an error.
2. DS attribute is set to TRUE. The attribute is ignored and the status of resulting
CL attribute is set to 3 (FAULTY_TIME_STATUS).
3. The resulting value of CL attribute is not in the range of TIME data type.CL is
set to its minimum or maximum value and its status is set to 3
(FAULTY_TIME_STATUS).
153
SYS 600 9.2 MicroSCADA Pro 1MRS756176
The following special cases may occur when converting local time to UTC time:
1. DS attribute of the argument is missing. This is OK if the given local time is
neither ambiguous nor non-existing (normally it is not). A local time may be
ambiguous if it specifies a time close to the transition from daylight saving time
to standard time: If the transition takes place at 4 o'clock by moving clock one
hour backward, the times from 03.00.00 to 03.59.59 are ambiguous, they may
represent daylight saving or standard time. If the given time is ambiguous, it is
assumed that it is standard time. The status of the CL attribute of the result is set
to 4 (AMBIGUOUS_TIME_STATUS).
2. The argument specifies a non-existing time. A local time may be non-existing if
it specifies a time close to the transition from standard time to the daylight
saving time. If the transitions takes place at 3 o'clock by moving clock one hour
forward, the times from 03.00.00 to 03.59.59 are non-existing. If the argument
specifies a non-existing time, the exact UTC time of the transition is returned
and the status of the CL attribute of the result is set to 3
(FAULTY_TIME_STATUS).
3. The DS attribute of the argument is wrong. The attribute is ignored and the
status of resulting CL attribute is set to 3 (FAULTY_TIME_STATUS).
4. The resulting value of CL attribute is not in the range of TIME data type. CL is
set to its minimum or maximum value and its status is set to 3
(FAULTY_TIME_STATUS).
Example:
; This function converts the given local time argument to UTC time and displays
; an error message if something wrong.
#ARGUMENT LOCAL_TIME_ARG
#LOCAL UTC = LOCAL_TO_UTC_TIME(LOCAL_TIME_ARG)
#CASE GET_STATUS(UTC.CL)
#WHEN STATUS_CODE("FAULTY_TIME_STATUS") -
.SET MESSAGE._TITLE = "Skipped during transition to DST"
#WHEN STATUS_CODE("AMBIGUOUS_TIME_STATUS") -
.SET MESSAGE._TITLE = "Please specify DST or STT"
#OTHERWISE
.SET MESSAGE._TITLE = ""
#CASE_END
#RETURN UTC
CLOCK
The present SYS time with a one-second resolution.
Value: Time value.
DATE[(time [,"FULL"])]
The date (year, month and day) as text.
'time' A time value or a vector of time values.
Default value is the present SYS time.
"FULL" Optional keyword argument, 4-digit year is requested.
Value: A text or text vector.
154
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
The date is given in the format "yy-mm-dd" or "dd-mm-yy" depending on the value
of the attribute SYS:BTF.
If the optional argument "FULL" is given, the year is shown with 4 digits: "yyyy-
mm-dd" or "dd-mm-yyyy".
See also functions TIME, TIMEMS and TIMES.
Examples:
DATE
;Returns the current date, for example "03-10-22", if SYS:BTF = 0
DATE("FULL")
;Returns the current date, for example "22-10-2003", if SYS:BTF = 1
DAY[(time)]
The day of month.
'time' A time value or a vector of time values.
Default value is the present SYS time.
Value: An integer 1 ... 31 or a vector of such integers.
DOW[(time)]
The day of week.
The number of the day counting from Monday, which is number one.
'time' A time value or a vector of time values.
Default value is the present SYS time.
Value: An integer 1 ... 7 or a vector of such integers.
DOY[(time)]
The day of year.
The number of the day since the beginning of the year.
'time' A time value or a vector of time values.
Default value is the present SYS time.
Value: An integer 1 ... 366 or a vector of such integers.
HOD[(time)]
Hours passed since the beginning of the day.
'time' A time value or a vector of time values.
Default value is the present SYS time.
Value: A real value < 24.0 or a vector of such values.
155
SYS 600 9.2 MicroSCADA Pro 1MRS756176
HOUR[(time)]
The hour.
'time' A time value or a vector of time values.
Default value is the present SYS time.
Value: An integer 0 ... 23 or a vector of such integers.
HOY[(time)]
Hours passed since the beginning of the year.
'time' A time value or a vector of time values.
Default value is the present SYS time.
Value: A real value < 8784.0 or a vector of such values.
HR_CLOCK
SYS time in seconds and microseconds.
Value: A list containing the following two attributes:
CL The seconds of the SYS time as time data.
US The microseconds of the SYS time as an integer. (with an
accuracy depending on the operating. system, often 10
milliseconds).
This function is more or less obsolete. Use function SYS_TIME instead.
LOCAL_TIME
The present local time.
Value: A list (qualified time), local time.
LOCAL_TIME_ADD(time, s [,ms])
Adds seconds and milliseconds to given local time.
'time' A time or list (qualified time) value, local time.
's' An integer, seconds to add.
'ms' An integer, milliseconds to add.
Value: A list (qualified time) value, local time.
For the possible status codes returned as the status of the CL attribute of the result,
see heading "Qualified time" above.
Example:
The following three calls each return the moment of time 3 seconds from now:
LOCAL_TIME_ADD(LOCAL_TIME, 3)
LOCAL_TIME_ADD(LOCAL_TIME, 0, 3000)
LOCAL_TIME_ADD(LOCAL_TIME, 4, -1000)
156
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
LOCAL_TIME_INFORMATION[(time)]
Gives information on given local time.
'time' Time or list (qualified time) value, local time.
Default value is the present local time.
Value: A list with the following attributes:
UTC Time value
DAYLIGHT_SAVING Boolean value
TIME_ZONE Real value
BIAS Real value
STATUS Integer value
The attributes contain the following information from the moment of 'time':
• UTC is the corresponding UTC time.
• DAYLIGHT_SAVING is TRUE if daylight saving time was or is in use,
otherwise FALSE.
• TIME_ZONE is the time zone (as a real number to support fractional time zones)
that the site belonged or belongs to.
• BIAS is the difference between the local time and the UTC time. When standard
time is in use, BIAS is equal to TIME_ZONE. When daylight saving time is in
use, BIAS is usually TIME_ZONE + 1.
• STATUS tells the quality of 'time':
OK_STATUS (0) = Existing and unique.
FAULTY_TIME_STATUS (3) = Non-existing, either because its DS attribute is
wrong or it specifies a moment that was skipped over during the transition to
daylight saving time.
AMBIGUOUS_TIME_STATUS (4) = Ambiguous, because it specifies a moment
that was duplicated during the transition to standard time and DS attribute does
not tell which one is meant.
LOCAL_TIME_INTERVAL(from, to)
The length of the time interval between two local times.
'from' A time or list (qualified time) value, local time.
'to' A time or list (qualified time) value, local time.
Value: The length of the interval as a list with two attributes:
S Integer (positive or negative), the seconds.
MS Integer -999 ... 999, the milliseconds.
If the length of the interval is greater than MAX_INTEGER, S is set to
MAX_INTEGER, MS is set to 999 and the status of S is set to 3
(FAULTY_TIME_STATUS).
If the (negative) length of the interval is smaller than MIN_INTEGER, S is set to
MIN_INTEGER, MS is set to -999 and the status of S is set to 3
(FAULTY_TIME_STATUS).
157
SYS 600 9.2 MicroSCADA Pro 1MRS756176
For other possible status codes returned as the status of the S attribute of the result,
see heading "Qualified time" above.
LOCAL_TO_SYS_TIME(time)
Converts local time to SYS time.
'time' A time or list (qualified time) value or a vector of such values,
local time(s).
Value: A list (qualified time) or a vector of lists, SYS time(s).
For the possible status codes returned as the status of the CL attribute of the result,
see heading "Qualified time" above.
This function either is equivalent to LOCAL_TO_UTC_TIME or simply returns its
argument (as qualified time value(s)), depending on the time reference of the system
(SYS:BTR).
LOCAL_TO_UTC_TIME(time)
Converts local time to UTC time.
'time' A time or list (qualified time) value or a vector of such values,
local time(s).
Value: A list (qualified time) or a vector of lists, UTC time(s).
For the possible status codes returned as the status of the CL attribute of the result,
see heading "Qualified time" above.
MINUTE[(time)]
The minute.
'time' A time value or a vector of time values.
Default value is the present SYS time.
Value: An integer 0 ... 59 or a vector of such integers.
MONTH[(time)]
The number of the month.
'time' A time value or a vector of time values.
Default value is the present SYS time.
Value: An integer 1 ... 12 or a vector of such integers.
158
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
SECOND[(time)]
The second.
'time' A time value or a vector of time values.Default value is the
present SYS time.
Value: An integer 0 ... 59 or a vector of such integers.
SET_CLOCK(time)
Sets the SYS time.
'time' Time data or a list with the following two attributes:
CL The seconds of the SYS time, time value.
US The microseconds of the SYS time, integer value.
Value: A real value. The number of seconds that the SYS time was
changed. A positive value means that the clock was set forward.
A negative value indicates that it was set backward.
This function is more or less obsolete, use SET_LOCAL_TIME, SET_SYS_TIME
or SET_UTC_TIME instead.
SET_LOCAL_TIME(time)
Sets the local time of the system.
'time' A time or list (qualified time) value, local time.
Value: The status of the operation and the resulted length of the time
shift as a list with the following attributes:
STATUS An integer. The status code, see below.
S An integer, seconds moved.
MS An integer -999 ... 999, milliseconds moved.
The 'time' argument is first converted to UTC time and the system clock is set
accordingly. However, if the conversion results to a non-existing
(FAULTY_TIME_STATUS) or ambiguous (AMBIGUOUS_TIME_STATUS)
time, the system clock is not set and only the STATUS attribute is returned.
159
SYS 600 9.2 MicroSCADA Pro 1MRS756176
SET_SYS_TIME(time)
Sets the SYS time of the system.
'time' A time or list (qualified time) value, SYS time.
Value: The status of the operation and the resulted length of the time
shift as a list with the following attributes:
STATUS An integer. The status code, see below.
S An integer, seconds moved.
MS An integer -999 ... 999, milliseconds moved.
The 'time' argument is first converted to UTC time (if needed) and the system clock
is set accordingly. However, if the conversion results to a non-existing
(FAULTY_TIME_STATUS) or ambiguous (AMBIGUOUS_TIME_STATUS)
time, the system clock is not set and only the STATUS attribute is returned.
This function is equivalent to either SET_LOCAL_TIME or SET_UTC_TIME,
depending on the time reference of the system (SYS:BTR).
SET_UTC_TIME(time)
Sets the UTC time of the system.
'time' A time or list (qualified time) value, UTC time.
Value: The status of the operation and the resulted length of the time
shift as a list with the following attributes:
STATUS An integer. The status code, 0 = OK_STATUS.
S An integer, seconds moved.
MS An integer -999 ... 999, milliseconds moved.
SYS_TIME
The present SYS time.
Value: A list (qualified time), SYS time.
This function is equivalent to either LOCAL_TIME or UTC_TIME, depending on
the time reference of the system (SYS:BTR).
SYS_TIME_ADD(time, s [,ms])
Adds seconds and milliseconds to given SYS time.
'time' A time or list (qualified time) value, SYS time.
's' An integer, seconds to add.
'ms' An integer, milliseconds to add.
Value: A list (qualified time) value, SYS time.
For the possible status codes returned as the status of the CL attribute of the result,
see heading "Qualified time" above.
160
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
SYS_TIME_INTERVAL(from, to)
The length of the time interval between two SYS times.
'from' A time or list (qualified time) value, SYS time.
'to' A time or list (qualified time) value, SYS time.
Value: The length of the interval as a list with two attributes:
S Integer (positive or negative), the seconds.
MS Integer -999 ... 999, the milliseconds.
If the length of the interval is greater than MAX_INTEGER, S is set to
MAX_INTEGER, MS is set to 999 and the status of S is set to 3
(FAULTY_TIME_STATUS).
If the (negative) length of the interval is smaller than MIN_INTEGER, S is set to
MIN_INTEGER, MS is set to -999 and the status of S is set to 3
(FAULTY_TIME_STATUS).
For other possible status codes returned as the status of the S attribute of the result,
see heading "Qualified time" above.
This function is equivalent to either LOCAL_TIME_INTERVAL or
UTC_TIME_INTERVAL, depending on the time reference of the system
(SYS:BTR).
SYS_TO_LOCAL_TIME(time)
Converts SYS time to local time.
'time' A time or list (qualified time) value or a vector of such values,
SYS time(s).
Value: A list (qualified time) or a vector of lists, local time(s).
For the possible status codes returned as the status of the CL attribute of the result,
see heading "Qualified time" above.
This function either is equivalent to UTC_TO_LOCAL_TIME or simply returns its
argument (as qualified time value(s)), depending on the time reference of the system
(SYS:BTR).
161
SYS 600 9.2 MicroSCADA Pro 1MRS756176
SYS_TO_UTC_TIME(time)
Converts SYS time to UTC time.
'time' A time or list (qualified time) value or a vector of such values,
SYS time(s).
Value: A list (qualified time) or a vector of lists, UTC time(s).
For the possible status codes returned as the status of the CL attribute of the result,
see heading "Qualified time" above.
This function either is equivalent to LOCAL_TO_UTC_TIME or simply returns its
argument (as qualified time value(s)), depending on the time reference of the system
(SYS:BTR).
TIME[(time [,"FULL"])]
Date and time as text, excluding seconds.
'time' A time value or a vector of time values.
Default value is the present SYS time.
"FULL" Optional keyword argument, 4-digit year is requested.
Value: A text or text vector.
The date and time is given in format "yy-mm-dd hh:mm" or "dd-mm-yy hh:mm"
depending on the value of the attribute SYS:BTF.
If the optional argument "FULL" is given, the year is shown with 4 digits: "yyyy-
mm-dd hh:mm" or "dd-mm-yyyy hh:mm".
See also functions DATE, TIMEMS and TIMES.
Examples:
TIME
;Returns the current time, for example "03-10-22 12:42", if SYS:BTF = 0
TIME("FULL")
;Returns the current time, for example "22-10-2003 12:42", if SYS:BTF = 1
TIME_ZONE_RULES[(rule)]
Reads and sets the time zone rules of the system.
'rule' A list value, the time zone rule to be set, see below.
Value: A list value with two attributes:
STATUS An integer, SCIL status code of the call.
RULES A vector of list values, the implemented time zone
rules in chronological order.
This function sets a new time zone rule and returns all the implemented rules
(including the rule just set) as a vector. If the function is called without an argument,
only the implemented rules are returned.
162
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
A time zone rule is represented as a list value containing the following attributes:
DATE A time value (hours, minutes and seconds are ignored).
The date after which the rule is to be applied.
The default value is the present date.
TZ An integer or real value (optional).
The time zone -13 ... 13, a real value may be used to define a half
or quarter hour time zone.
STT Standard Time specification, see below (optional).
DST Daylight Saving Time specification, see below (optional).
If any of attributes TZ, STT or DST is missing, the corresponding definition remains
untouched. For example, if a given rule contains only the attribute DST, the time
zone and Standard Time specification are as they were before DATE.
The Standard Time and Daylight Saving Time specification are represented as a list
value containing the following attributes:
BIAS An integer or real value.
Time bias (to the time zone) while this time (STT or DST) used.
The default is 0 for STT and +1 hour for DST.
MONTH An integer 0 ... 12. The month of transition, 0 means no switch.
DAY_OF_WEEK An integer 1 ... 7. The day of week of transition (1=Monday,
7=Sunday).
WEEK Integer 1 ... 5. Specifies the week of the transition as follows:
Suppose DAY_OF_WEEK = 7, i.e. Sunday.
Then, WEEK = 1 states that the transition takes place on the 1st
Sunday of the month.
If WEEK = 5, the transition takes place on the last Sunday of the
month (Value 5 has the special meaning of ’last’).
HOUR An integer 0 ... 23. The hour of transition.
MINUTE An integer 0 ... 59. The minute of transition, default is 0.
A once only rule may be specified by omitting attributes DAY_OF_WEEK and
WEEK, and specifying the following two attributes instead:
YEAR Integer 1978 ... 2113. The year of the transition.
DAY Integer 1 ... 31. The day of month of the transition.
Example:
Suppose the following rules have been and will be applied on a site:
1. Daylight saving time was first applied in 1983. Transition to DST at 3:00 on the
last Sunday of March. Transition to STT at 4:00 on the last Sunday of
September.
2. In 1997, the transition to STT was moved one month later, to the last Sunday of
October.
3. In 2002 it was decided, that from 2003 on, daylight saving is no longer applied.
The following SCIL program teaches the rules to SYS 600:
163
SYS 600 9.2 MicroSCADA Pro 1MRS756176
RULES = TIME_ZONE_RULES(LIST(-
DATE = GENESIS, TZ = 2,-
DST = LIST(MONTH = 0), STT = LIST(MONTH = 0)))
;Rule 1
RULES = TIME_ZONE_RULES(LIST(-
DATE = DATE1,-
DST = LIST(MONTH = 3, DAY_OF_WEEK = 7, WEEK = 5, HOUR = 3),-
STT = LIST(MONTH = 9, DAY_OF_WEEK = 7, WEEK = 5, HOUR = 4)))
;Rule 2
RULES = TIME_ZONE_RULES(LIST(-
DATE = DATE2,-
STT = LIST(MONTH = 10, DAY_OF_WEEK = 7, WEEK = 5, HOUR = 4)))
;Rule 3
RULES = TIME_ZONE_RULES(LIST(-
DATE = DATE3,-
DST=LIST(MONTH = 0), STT=LIST(MONTH = 0)))
The time zone rules are stored in the text file SYS_/SYS_TIME.PAR. After
running the example above, the contents of the file are as follows (the second rule
has been divided to two lines here, for clarity):
1978-01-01 DST=LIST(MONTH=0),STT=LIST(MONTH=0),TZ=2
1983-01-01 DST=LIST(BIAS=1,DAY_OF_WEEK=7,HOUR=3,MINUTE=0,MONTH=3,WEEK=5),-
STT=LIST(BIAS=0,DAY_OF_WEEK=7,HOUR=4,MINUTE=0,MONTH=9,WEEK=5)
1997-01-01 STT=LIST(BIAS=0,DAY_OF_WEEK=7,HOUR=4,MINUTE=0,MONTH=10,WEEK=5)
2003-01-01 DST=LIST(MONTH=0),STT=LIST(MONTH=0)
Whenever the SYS 600 program is restarted, the current rule obeyed by the
operating system is read. If it differs from the current rule from SYS_TIME.PAR, a
new rule is appended to the file. This makes an alternative way to add a new time
zone rule: Change the operating system time zone settings and restart SYS 600.
However, a rule obeyed in the past cannot be added this way and the program must
be restarted.
When the program is started for the first time, it makes the ’sophisticated guess’ that
the current rule has been applied since the beginning of SYS 600 time counting, 1st
of January, 1978.
164
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
TIMES[(time [,"FULL"])]
Date and time as text, including seconds.
'time' A time value or a vector of time values.
Default value is the present SYS time.
"FULL" Optional keyword argument, 4-digit year is requested.
Value: A text or text vector.
The date and time is returned in format "yy-mm-dd hh:mm:ss" or "dd-mm-yy
hh:mm:ss" depending on the value of the attribute SYS:BTF.
If the optional argument "FULL" is given, the year is shown with 4 digits: "yyyy-
mm-dd hh:mm:ss" or "dd-mm-yyyy hh:mm:ss".
See also functions DATE, TIME, TIMEMS, TOD, TODMS and TODS.
Examples:
TIMES
;Returns the current time, for example "03-10-22 12:42:15", if SYS:BTF = 0
TIMES("FULL")
;Returns the current time, for example "22-10-2003 12:42:15", if SYS:BTF = 1
TOD[(time)]
Time of day as text, excluding seconds
'time' A time value or a vector of time values.
Default value is the present SYS time.
Value: A text or text vector, in format "hh:mm".
165
SYS 600 9.2 MicroSCADA Pro 1MRS756176
TODMS[(time [,msecs])]
Time of day as text, including seconds and milliseconds.
'time' A time value, a qualified time (list) value or a vector of such
values.The default value is the present SYS time.
'msecs' An optional integer or integer vector argument, milliseconds
0 ... 999.
Value: A text or text vector, in format "hh:mm:ss.mmm".
If the milliseconds are given explicitly as a vector, the length of the vector must
equal to the length of the 'time' vector.
TODS[(time)]
Time of day as text, including seconds.
'time' A time value or a vector of time values.
Default value is the present SYS time.
Value: A text or text vector, in format "hh:mm:ss".
UTC_TIME
The present UTC time.
Value: A list (qualified time), UTC time.
UTC_TIME_ADD(time, s [,ms])
Adds seconds and milliseconds to given UTC time.
'time' A time or list (qualified time) value, UTC time.
's' An integer, seconds to add.
'ms' An integer, milliseconds to add.
Value: A list (qualified time) value, UTC time.
For the possible status codes returned as the status of the CL attribute of the result,
see heading "Qualified time" above.
Example:
The following three calls each return the moment of time 3 seconds from now:
UTC_TIME_ADD(UTC_TIME, 3)
UTC_TIME_ADD(UTC_TIME, 0, 3000)
UTC_TIME_ADD(UTC_TIME, 4, -1000)
UTC_TIME_INTERVAL(from, to)
The length of the time interval between two UTC times.
'from' A time or list (qualified time) value, UTC time.
'to' A time or list (qualified time) value, UTC time.
Value: The length of the interval as a list with two attributes:
166
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
UTC_TO_LOCAL_TIME(time)
Converts UTC time to local time.
'time' A time or list (qualified time) value or a vector of such values,
UTC time(s).
Value: A list (qualified time) or a vector of lists, local time(s).
UTC_TO_SYS_TIME(time)
Converts UTC time to SYS time.
'time' A time or list (qualified time) value or a vector of such values,
UTC time(s).
Value: A list (qualified time) or a vector of lists, SYS time(s).
This function either is equivalent to UTC_TO_LOCAL_TIME or simply returns its
argument (as qualified time value(s)), depending on the time reference of the system
(SYS:BTR).
WEEK(time)]
The number of the week within a year.
The week numbering rule that is used may be given as the statement: "The 4th of
January always belongs to week number 1".
'time' A time value or a vector of time values.
Default value is the present SYS time.
Value: An integer 1 ... 53 or a vector of such integers.
YEAR(time)]
The year.
'time' A time value or a vector of time values.
Default value is the present SYS time.
Value: An integer 1978 ... 2113 or a vector of such integers.
Examples:
167
SYS 600 9.2 MicroSCADA Pro 1MRS756176
On 19th February '97 at 20:35:04 o'clock the time functions returned the following
values (supposing SYS:BTF == 0):
Function call Value
TIMES "97-02-19 20:35:04"
TIMES(CLOCK-1) "97-02-19 20:35:03"
TIME "97-02-19 20:35"
TODS "20:35:04"
DATE "97-02-19"
YEAR 1997
MONTH 2
HOUR 20
MINUTE 35
SECOND 4
DOY 50
HOD 20.58444
HOY 1196.584
LOCAL_TIME_INFORMATION If the time zone is +2 hours:
LIST(UTC=...,DAYLIGHT_SAVING=FALSE,
TIME_ZONE=2.0,BIAS=2.0,STATUS=0)
TIMES(PACK_TIME(1993,5,5,12,30,0)) "93-05-05 12:30:00"
ASCII(n)
The ASCII character corresponding to the numeric ASCII code.
'n' An integer 0 ... 255 or a vector of such integers.
Value: An ASCII character or a vector of ASCII characters.
See function ASCII_CODE for the reverse operation.
Examples:
ASCII(65) ;returns "A"
ASCII(13) ;returns ‘carriage return’ character
ASCII_CODE(c)
The numeric ASCII code of the character argument.
'c' An ASCII character or a vector of ASCII characters.
Value: An integer 0 ... 255 or a vector of such integers.
See function ASCII for the reverse operation.
Example:
ASCII_CODE("A") == 65
BCD_TO_INTEGER(bcd)
Converts BCD coded numbers to integers.
168
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
BIN(b)
Represents bit strings and integers as text in binary format.
'b' A bit string or integer, or a vector of bit strings and integers.
Value: A text or text vector. The length of the binary representation of
an integer is 32 characters, the length of the representation of a
bit string is the same as the length of the bit string.
See function BIN_SCAN for the reverse operation.
Example:
BIN(BIT_SCAN("010101")) == "010101"
BIN(23) ;returns "0000...0010111" (27 leading zeroes)
BIN_SCAN(string)
Creates an integer or real value out of its binary text representation.
The text representation may contain leading blanks, a sign (+/-), digits 0 and 1 and
a decimal point.
'string' A text or a text vector.
169
SYS 600 9.2 MicroSCADA Pro 1MRS756176
BIT_SCAN(string)
Creates a bit string out of its text representation.
'string' A text containing characters "0" and "1" only, or a vector of such
texts.
Value: A bit string or a vector of bit strings.
Example:
BIT_SCAN("101") ;creates a bit string of length 3
CAPITALIZE(text)
Capitalizes a text.
'text' A text or a text vector.
Value: A text or a text vector.
The function converts the first character of the text or each vector element to upper
case and the rest of the text to lower case according to ISO Latin-1 character set
encoding.
See also functions LOWER_CASE and UPPER_CASE.
Example:
CAPITALIZE("VÄSTERÅS") == "Västerås"
COLLECT(v, delimiter)
Collects text fields into a text.
The function collects the text fields given in a text vector into one text value, where
the fields are delimited by the given delimiter character.
'v' A text vector.
'delimiter' A text value of length 1.
Value: A text value.
See function SEPARATE for the reverse operation.
Example:
COLLECT(VECTOR("Alpha","Beta","Gamma"), "+") == "Alpha+Beta+Gamma"
170
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
DEC_SCAN(string)
Creates an integer or a real value out of its decimal text representation.
'string' A text or a text vector.
The text representation may contain leading blanks, a sign (+/-),
digits and a decimal point. Any other character is considered as
an error generating a bad status.
Value: An integer or a real value, or a vector of such values.
If the text representation contains a decimal point, the result is a
real value, otherwise it is an integer value. If the integer result
falls outside the integer value range (see Chapter 4), a real value
is returned.
See function DEC for the reverse operation.
Examples:
DEC_SCAN(" -5") == -5
DEC_SCAN("+40000.0") == 40000.0
EDIT(text, key)
Simple text editing.
The function removes spaces and tabs out of a text according to a specified rule.
'text' A text or a text vector.
'key' A text value. One of the following keywords:
"TRIM" Removes leading and trailing spaces and
tabs.
"LEFT_TRIM" Removes leading spaces and tabs.
"RIGHT_TRIM" Removes trailing spaces and tabs.
171
SYS 600 9.2 MicroSCADA Pro 1MRS756176
HEX(n)
Represents an integer as text in hexadecimal format.
'n' An integer or a vector of integers.
Value: A text of 4 or 8 characters or a vector of such texts.
A 4-character text is returned if the value of the argument is in
range -32 768 ... 32 767, otherwise an 8-character text is
returned. Leading zeroes are used when necessary.
See function HEX_SCAN for the reverse operation.
Example:
HEX(26) == "001A"
HEX(-1) == "FFFF"
HEX(123456) == "0001E240"
172
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
HEX_SCAN(string)
Creates an integer or a real value out of its hexadecimal text representation.
The text representation may contain leading blanks, a sign (+/-), hexadecimal digits
and a decimal point. Any other character is considered as an error generating a bad
status. The allowed ‘digits’ are 0 ... 9, A ... F and a ... f.
'string' A text or a text vector.
Value: An integer or a real value, or a vector of such values.
If the text representation contains a decimal point, the result is a
real value, otherwise it is an integer value. If the integer result
falls outside the integer value range (see Chapter 4), the
overflown (high order) bits are discarded.
See function HEX for the reverse operation.
Examples:
HEX_SCAN("F") == 15
HEX_SCAN("A.8") == 10.5
INTEGER_TO_BCD(int [,digits])
Represents an integer value as a BCD coded bit string
BCD (Binary Coded Decimal) values are represented in SCIL by values of
BIT_STRING data type. Each digit takes 4 bits so the length of a BCD bit string is
a multiple of 4. The length of a BCD value is limited to 9 digits.
'int' Integer value containing the integer to be converted.
'digits' Integer value 0 to 9, number of BCD digits in the result
Default is 0.
Value: List value with attributes
STATUS Integer status code of the conversion.
BCD Bit string value, the BCD coded representation of
'int'.
If 'digits' is 0, a bit string long enough to hold the result is returned. Otherwise
exactly 'digits' BCD digits are returned, padded with leading zeroes, if necessary.
If the value of 'int' can be represented as a BCD bit string (i.e. it is non-negative and
in the range specified by 'digits'), the STATUS attribute is set to OK_STATUS (0)
and the result of the conversion is returned in attribute BCD.
If the argument is invalid, STATUS is set to
SCIL_ARGUMENT_OUT_OF_RANGE and BCD attribute is not returned.
See function BCD_TO_INTEGER for the reverse operation.
Example:
#LOCAL i_A = 9876
#LOCAL l_bcd = INTEGER_TO_BCD(i_A,9)
;converts the value of the variable 'i_A'
;returns a list with attributes 'BCD' and 'STATUS'
#LOCAL t_bcd = bin(l_bcd.bcd)
;returns the BCD code converted to textformat
173
SYS 600 9.2 MicroSCADA Pro 1MRS756176
LOWER_CASE(text)
Converts text to lower case.
The function converts the upper case characters of 'text' to lower case according to
ISO Latin-1 character set encoding.
'text' A text or a text vector.
Value: A text or a text vector.
174
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
OCT(n)
Represents an integer as text in octal format.
'n' An integer or an integer vector.
Value: A text of 6 or 11 characters or a vector of such texts.
A 6-character text is returned if the value of the argument is in
range -32 768 ... 32 767, otherwise an 11-character text is
returned. Leading zeroes are used when necessary.
Examples:
OCT(10) == "000012"
OCT(-1) == "177777"
OCT_SCAN(string)
Creates an integer or a real value out of its octal text representation.
The text representation may contain leading blanks, a sign (+/-), digits of the radix
and a decimal point. Any other character is considered as an error generating a bad
status. The allowed digits are 0 ... 7.
'string' A text or a text vector.
Value: An integer or a real value, or a vector of such values.
If the text representation contains a decimal point, the result is a
real value, otherwise it is an integer value. If the integer result
falls outside the integer value range (see Chapter 4), the
overflown (high order) bits are discarded.
See the OCT function for the reverse operation.
Examples:
OCT_SCAN("10") == 8
OCT_SCAN("1.2") == 1.25
175
SYS 600 9.2 MicroSCADA Pro 1MRS756176
176
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
SEPARATE(text, delimiter)
Extracts fields of a text.
The function extracts the fields of text and returns the fields as a text vector. A field
is any substring delimited by the given delimiter character.
'text' A text value.
'delimiter' A one character text value.
Value: A text vector containing the fields of 'text'.
The delimiter character itself is not included in the field. If no
delimiter character is found in the text, the entire text is returned
as the only element of the resulting vector. An empty field is
returned in case of two consecutive delimiters.
See function COLLECT for the reverse operation.
Example:
SEPARATE("A,B,C,D", ",")
;returns the vector ("A","B","C","D").
177
SYS 600 9.2 MicroSCADA Pro 1MRS756176
'length' An integer 0 ... 65 535 (texts and bit strings) or 0 ... 8 388 600
(byte strings). Default is 0. The length of the substring. If 'length'
= 0, the function returns the end of 'string' starting from 'start'. If
'start' is greater than the length of 'string', an empty string is
returned. If the substring extends beyond the end of 'string', the
result is padded with trailing blanks (texts), zero bits (bit strings)
or zero bytes (byte strings).
Value: The same data type as 'string'. The substring.
Examples:
SUBSTR("ABCDE",3,2) == "CD"
SUBSTR("ABCDE",4,3) == "DE "
SUBSTR("ABCDE",6,3) == " "
V = BIT_SCAN("1010101")
BIN(SUBSTR(V,2,3)) == "010"
SUBSTR(BYTES,1,100000)
;returns a byte string containing the first 100000 bytes of byte string BYTES.
178
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Examples:
UNPACK_STR("ABC") == ("A","B","C")
UNPACK_STR("ABCDE",2) == ("AB","CD","E")
UNPACK_STR(BIT_SCAN("0111")) == (0,1,1,1)
UNPACK_STR(BIT_SCAN("011011"),2) == (2,1,3)
UNPACK_STR(BIT_SCAN("0110111"),2) == (2,1,3)
UPPER_CASE(text)
Converts text to upper case.
The function converts the lower case characters of 'text' to upper case according to
ISO Latin-1 character set encoding.
'text' A text or a text vector.
Value: A text or a text vector.
See also functions LOWER_CASE and CAPITALIZE.
Example:
UPPER_CASE("Västerås") == "VÄSTERÅS"
BIT(a, b)
The bit value of a given bit in a bit string or integer.
The function returns the bit value of bit number 'b' in 'a'.
'a' An integer or a bit string value, or a vector of such values.
'b' The bit number. An integer in the range 0 ... 31 or 1 ... 65 535
depending on the data type of 'a'.
Value: Integer 0 or 1, or a vector of such integers.
Examples:
BIT(3,0) == 1
BIT(-1,15) == 1
BIT(BIT_SCAN("010101"),5) == 0
179
SYS 600 9.2 MicroSCADA Pro 1MRS756176
BIT_AND(a1, a2)
Bitwise logical AND of the arguments.
'a1' An integer or a bit string value, or a vector of such values.
'a2' As 'a1'.
Value: An integer or a bit string value, or a vector of such values.
If one of the arguments is a vector and the other is simple data, the operation is
performed on the simple data and each vector element. If both arguments are
vectors, the operation is performed on the corresponding elements. If the lengths of
the vectors are unequal, odd elements are given SUSPICIOUS_STATUS (see the
Status Codes manual). Mixing integer and bit string values in one operation is not
allowed.
Examples:
BIT_AND(6,5) == 4
BIT_AND(BIT_MASK(0,2,4), BIT_MASK(1,2,4)) == BIT_MASK(2,4)
BIT_CLEAR(a [,b]*)
Sets given bits to 0.
The function calculates an integer by setting the bits numbered 'b' in 'a' to zero.
'a' An integer or a bit string value, or a vector of such values.
'b' The numbers of bits to set, in the range 0 ... 31 or 1 ... 65 535
depending on the data type of 'a'. Up to 31 bit numbers may be
given. The bit numbers must not exceed the number of bits in 'a'.
Value: The same data type as the argument 'a'.
Examples:
BIT_CLEAR(3,0) == 2
BIT_CLEAR(2,0) == 2
BIT_CLEAR(BIT_SCAN("01111"),2,4,5) == BIT_SCAN("00100")
BIT_COMPL(a)
Logical bit complement of the argument.
The function calculates the bitwise logical NOT of the argument.
'a' An integer or bit string value, or a vector of such values.
Value: The same data type as the argument 'a'.
Examples:
BIT_COMPL(0) == -1
HEX(BIT_COMPL(HEX_SCAN("207F"))) == "DF80"
BIT_COMPL(BIT_SCAN("0101")) == BIT_SCAN("1010")
180
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
BIT_MASK([b1 [,b]]*)
Bit mask with given bits set to 1.
The function calculates an integer number by setting the given bits to 1 and all the
others to 0.
'b1', 'b' Bit numbers. Up to 32 integer values in the range 0 ... 31.
Value: An integer.
Examples:
BIT_MASK() == 0
BIT_MASK(0) == 1
BIT_MASK(4,0) == 17
BIT_OR(a1, a2)
Bitwise logical OR of the arguments.
'a1' An integer or a bit string value, or a vector of such values.
'a2' As 'a1'.
Value: An integer or a bit string value, or a vector of such values.
If one of the arguments is a vector and the other is simple data, the operation is
performed on the simple data and each vector element. If both arguments are
vectors, the operation is performed on the corresponding elements. If the lengths of
the vectors are unequal, odd elements are given SUSPICIOUS_STATUS (see the
Status Codes manual). Mixing integer and bit string values in one operation is not
allowed.
Examples:
BIT_OR(6,5) == 7
BIT_OR(BIT_MASK(0,2,4), BIT_MASK(1,2,4)) == BIT_MASK(0,1,2,4)
BIT_SET(a [,b]*)
Sets given bits to 1.
The function calculates an integer by setting the bits numbered 'b' in 'a' to one.
'a' An integer or a bit string value, or a vector of such values.
'b' The numbers of bits to set, in the range 0 ... 31 or 1 ... 65 535
depending on the data type of 'a'. Up to 31 bit numbers may be
given. The bit numbers must not exceed the number of bits in 'a'.
Value: The same data type as the argument 'a'.
Examples:
BIT_SET(0,3) == 8
BIT_SET(-1,15) == -1
BIT_SET(BIT_SCAN("0101"),1,3) == BIT_SCAN("1111")
181
SYS 600 9.2 MicroSCADA Pro 1MRS756176
BIT_STRING(length [,b]*)
Creates a bit string by setting given bits to 1 and the other ones to 0.
'length' An integer, 1 ... 65 535. The number of bits in the bit string.
'b' Up to 31 integer values in the range 1 ... 'length'. The numbers of
the bits to be set to 1.
Value: Bit string.
Example:
BIT_STRING(5,1,3,5) == BIT_SCAN("10101")
BIT_XOR(a1, a2)
Bitwise logical XOR (exclusive OR) of the arguments.
'a1' An integer or a bit string value, or a vector of such values.
'a2' As 'a1'.
Value: An integer or a bit string value, or a vector of such values.
If one of the arguments is a vector and the other is simple data, the operation is
performed on the simple data and each vector element. If both arguments are
vectors, the operation is performed on the corresponding elements. If the lengths of
the vectors are unequal, odd elements are given SUSPICIOUS_STATUS (see the
Status Codes manual). Mixing integer and bit string values in one operation is not
allowed.
Examples:
BIT_XOR(6,5) == 3
BIT_XOR(BIT_MASK(0,2,4), BIT_MASK(1,2,4)) == BIT_MASK(0,1)
APPEND(v, data)
Appends data to a vector.
The function creates a vector by appending 'data' to the contents of vector 'v'. If 'data'
is a vector, the elements of 'data' are appended to 'v' resulting to a vector whose
length is the sum of the argument vectors. If 'data' is of any other data type, the length
of the resulting vector is one greater than the length of 'v' and the last element gets
the contents of 'data'.
'v' A vector.
'data' Any SCIL data type.
Value: A vector.
Example:
V1 = (1,2,3)
V2 = (4,5)
APPEND(V1,V2) ;returns (1,2,3,4,5)
APPEND(V1,6) ;returns (1,2,3,6)
182
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
BINARY_SEARCH(v, value)
Searches an ordered vector by its element contents.
'v' The vector to be searched.
The elements of the vector may be of integer, real, time, text or
Boolean type.
'value' The value to be searched for.
Data types allowed: integer, real, time, text or Boolean.
Value: Integer, the index of the occurrence of 'value' in the vector. Zero
will be returned, if 'value' is not found.
The vector 'v' must be arranged in ascending or descending order. Its elements must
be all numeric (integer or real), all time values, all text values or all Boolean values.
If the vector contains more than one element by value 'value', the function returns
the index of any of them.
The validity of vector 'v' is not checked. If the vector is not arranged, the function
may or may not find the value. If the data type rules are violated, the function may
fail by status SCIL_INCOMPATIBLE_TYPES, or it may find the requested value
or return a zero.
To search an unordered vector by its contents, see function FIND_ELEMENT.
When the vector is long, BINARY_SEARCH is much faster than
FIND_ELEMENT and should therefore be used whenever possible.
Example:
V = ("AB","CD","CD","EF")
I = BINARY_SEARCH(V,"EF") ;returns 4
I = BINARY_SEARCH(V,"CD") ;returns 2 or 3
I = BINARY_SEARCH(V,"ab") ;returns 0 (the search is case-sensitive)
183
SYS 600 9.2 MicroSCADA Pro 1MRS756176
;The contents of B:
;B(1) == 2.0 (the range 0.0 .. 5.0)
;B(2) == 1.0 (the range 5.0 .. 10.0)
CUMULATE(v)
Accumulates the elements of the argument vector.
Each element n of the result vector is set to the sum of the n first elements of the
argument vector.
'v' A vector with real elements.
Value: A vector of the same length as the argument vector. The
elements of the vector are of real type.
The function uses double precision (64-bit) floating point arithmetics internally to
achieve the best possible accuracy.
This function is frequently used when calculating duration curves.
Example:
V = (1, -5.6, 3.3, 37)
CUMULATE(V) ;returns (1.0, -4.6, -1.3, 35.7)
184
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Value: Integer, the index of the first occurrence of 'value' in the vector,
or the first occurrence at or after 'start_index'. Zero is returned,
if 'value' is not found.
To search an ordered (ascending or descending) vector by its contents, see function
BINARY_SEARCH. When the vector is long, BINARY_SEARCH is much faster
than FIND_ELEMENT and should therefore be used whenever possible.
Example:
V = ("AB","CD","EF","CD")
I = FIND_ELEMENT(V,"CD") ;returns 2
I = FIND_ELEMENT(V,"CD",I + 1) ;returns 4 (second occurrence of "CD")
I = FIND_ELEMENT(V,"CD",I + 1) ;returns 0 (no more found)
HIGH(v)
LOW(v)
The largest (HIGH) or the smallest (LOW) element in a vector.
'v' A vector with elements of integer, real or time type.
Value: A vector of one element which is the largest or smallest element
of the argument vector.
If all the elements of the argument vector are of the same data
type, the resulting data type will follow. Otherwise, a real type
result is returned.
The result is returned as a one-element vector to be able to return the status of the
result: The status of the only element is set to SUSPICIOUS_STATUS (= 1), if any
of the elements of the argument vector has a non-zero status. If the argument vector
is empty, or it contains no valid elements, NOT_SAMPLED_STATUS is set.
Example:
V = (1,-5.6,3.3,37)
HIGH(V) == 37.0
LOW(V) == -5.6
HIGH_INDEX(v)
LOW_INDEX(v)
The index of the largest or smallest element in a vector.
‘v' A vector with elements of integer, real or time type.
Value: An integer.
HIGH_INDEX returns the index of the largest and LOW_INDEX the index of the
smallest element in the argument vector. If the argument vector is empty, or it
contains no valid elements, the function returns the value 0.
Examples:
V = (1,-5.6,3.3,37)
HIGH_INDEX(V) == 4
LOW_INDEX(V) == 2
185
SYS 600 9.2 MicroSCADA Pro 1MRS756176
INTERP(v, x)
Interpolates a value from a curve.
'v' A vector with real type elements.
'x' A real value.
186
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
The argument 'v' is interpreted as (x, y) coordinate pairs defining a curve. The 1st
and 2nd element define the first point (x, y) of the curve, the 3rd and 4th define the
second point, etc. The x coordinates must be given in ascending order. The y
coordinate corresponding to the given 'x' is interpolated from the curve and returned
as a real number. If 'x' < x1, y1 is returned. If 'x' > xn, yn is returned (where 'n'
denotes the number of coordinate pairs in the vector).
Value: A real number.
Examples:
A(1) = 1.0 ;X1
A(2) = 6.0 ;Y1
A(3) = 3.0 ;X2
A(4) = 7.0 ;Y2
INTERP(A,1.0) == 6.0
INTERP(A,2.0) == 6.5
INTERP(A,5.0) == 7.0
X = INVERSE(A,5,0.0,10.0)
;The vector X now consists of the elements:
; 1.0 (y=2)
; 2.0 (y=4)
; 2.4 (y=6)
; 2.8 (y=8)
; 3.0 (y=10)
For y=2, x gets the value 1.0, because this is the lowest possible value, and for y=10,
x gets the value 3.0, because this is the highest possible value.
187
SYS 600 9.2 MicroSCADA Pro 1MRS756176
MEAN(v)
The mean value of the elements of a vector.
This function calculates the sum of all valid elements of a vector and divides the sum
by their count.
'v' A vector with real elements.
Value: A vector of one element. The data type of the element is real.
The result is returned as a one-element vector to be able to return the status of the
result: The status of the only element is set to SUSPICIOUS_STATUS (= 1), if any
of the elements of the argument vector has a non-zero status. If the argument vector
is empty, or it contains no valid elements, NOT_SAMPLED_STATUS is set.
The function uses double precision (64-bit) floating point arithmetics internally to
achieve the best possible accuracy.
Example:
V = (1,-5.6,3.3,37)
M = MEAN(V) ;Now M(1) == 8.925
PICK(v, indices)
Picks up specified elements from a vector.
'v' Any vector value.
'indices' An integer vector with elements in the range 1 ... 1 000 000. The
vector specifies the indices of the elements which will be
selected from the source vector.
Value: A vector, of the same length as 'indices', containing the elements
selected from the source vector.
If the index vector contains indices that are not present in the source vector (i.e.
indices <= 0 or indices that are greater than the length of 'v'), the corresponding
elements in the result vector are given NOT_SAMPLED_STATUS.
This function is frequently used in conjunction with functions SELECT, SORT and
SHUFFLE.
Example:
#LOCAL P, N, S
P = (1,2,3,5,7,11,13,17,19)
N = (7,4,1)
S = PICK(P,N)
;Now S == (13,5,1)
188
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
REVERSE(v)
Reverses the order of elements of a vector.
'v' Any vector.
Value: A vector of the same length as the argument vector.
Example:
V = (1,-5.6,3.3,37)
REVERSE(V)
;returns (37,3.3,-5.6,1)
189
SYS 600 9.2 MicroSCADA Pro 1MRS756176
the element is used as the left hand operand of a relation. The expression must
evaluate to a boolean value. Local variables and arguments of the program may not
be used as operands in the condition. Examples of valid conditions:
">= 1 AND <= 10" ;Selects elements in range 1 .. 10
"() >= 1 AND () >= 10" ;Same as above
"> 10 OR ODD()" ;Selects all odd elements and the ones > 10
"== ""A*""" ;Selects elements starting with letter A
If 'source' is a list, the attribute values of each index are matched for the given
condition. The syntax of the condition is the normal SCIL expression syntax, but the
value of the attribute element is referred to by the attribute name. Examples of valid
conditions:
"AB >= 1 AND CD <= 10" ;Selects all i: source.AB(i) >= 1 and
; source.CD(i) <= 10
"ABC > 10 OR ODD(EFG)" ;Selects all i: source.ABC(i) > 10 and
; source.EFG(i) is odd
"LN == ""A*""" AND OV == 1" ;Selects all i: source.LN(i) starts with A and
; source.OV(i) == 1
SHUFFLE(n)
Shuffles integers 1 to n into a random order.
The function creates a vector of length n that contains integer values 1 to n in a
random order.
'n' Integer value in range 0 ... 1 000 000.
Value: Integer vector of length 'n'.
Example:
To rearrange any vector V to a random order:
SHUFFLED = PICK(V,SHUFFLE(LENGTH(V)))
190
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
191
SYS 600 9.2 MicroSCADA Pro 1MRS756176
I = (1,3,5)
A = (6,7,8)
S = SPREAD(V,I,A)
T = SPREAD(V,I,0)
;Now
;S == (6,2,7,4,8)
;T == (0,2,0,4,0)
SUM(v)
SUM_POS(v)
SUM_NEG(v)
The sum of all or the positive or the negative elements of a vector.
The functions calculate the sum of all (SUM), positive (SUM_POS) or negative
(SUM_NEG) valid elements of a vector, respectively.
'v' A vector with integer or real or elements.
Value: A vector of one element. The element is an integer if all the
elements of 'v' are integers, otherwise it is a real number.
The result is returned as a one-element vector to be able to return the status of the
result: The status of the only element is set to SUSPICIOUS_STATUS (= 1), if any
of the elements of the argument vector has a non-zero status. If the argument vector
is empty, or it contains no valid elements, NOT_SAMPLED_STATUS is set.
The functions use double precision (64-bit) floating point arithmetics internally to
achieve the best possible accuracy.
Examples:
#LOCAL V, POS, NEG
V = (1,-5.6,3.3,37)
POS = SUM_POS(V)
NEG = SUM_NEG(V)
;Now
;POS(1) == 41.3
;NEG(1) == -5.6
TREND(v, n)
Returns the last (‘newest’) elements of a vector.
'v' Any vector.
'n' An integer in the range 0 ... 1 000 000. The number of elements
to be included in the result vector.
Value: A vector of length 'n'. If 'n' is greater than the length of the
argument vector, the first elements get no value, their status is set
to NOT_SAMPLED_STATUS.
Examples:
#LOCAL V = (1,-5.6,3.3,37)
TREND(V,2)
;returns vector (3.3,37)
192
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
ATTRIBUTE_EXISTS(list, attribute)
Checks whether a list contains given attribute(s).
'list' Any list value.
'attribute' Text or text vector, the name(s) of attribute(s).
Value: A boolean or boolean vector. TRUE if the given attribute is
found in the list, otherwise FALSE.
DELETE_ATTRIBUTE(list, attribute)
Deletes attribute(s) from a list.
'list' Any list value.
'attribute' Text or text vector, the name(s) of attribute(s) to be deleted.
Value: A list, which is a copy of 'list' but attribute(s) specified by
'attribute' are removed.
Attributes that do not exist in 'list' are silently ignored, no error is generated.
Example:
The following statement reads the definition of a process object and removes
attributes LN and IX out of it.
#LOCAL A = DELETE_ATTRIBUTE(FETCH(0, "P", "ABC", 1), ("LN", "IX"))
193
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Syntactically, LIST is actually not a function, because it does not have expressions
as its arguments.
Example:
#LOCAL STUFF = LIST(NUMBERS = (1, 2 ,3), NAMES = ("A", "B", "C"))
LIST_ATTR(list)
Names of attributes of a list.
'list' A list value.
Value: A text vector containing the names of attributes of 'list' in
alphabetical order.
Example:
#LOCAL X = LIST(AA = 1, BB = 2, CM = "TEST")
LIST_ATTR(X) ;returns VECTOR("AA", "BB", "CM")
MERGE_ATTRIBUTES(left, right)
Merges two lists into one.
'left' Any list value.
'right' Any list value.
Value: A list which contains all the attributes of 'left' and 'right' lists.
If the same attribute exists in both 'left' and 'right', the value in
'right' is returned.
Example:
#LOCAL X = LIST(A = 1,B = 2)
#LOCAL Y = LIST(C = 3,D = 4)
#LOCAL Z
X = MERGE_ATTRIBUTES(X, LIST(C = 4)) ;X contains LIST(A = 1,B = 2,C = 4)
Z = MERGE_ATTRIBUTES(X, Y) ;Z contains LIST(A = 1,B = 2,C = 3,D = 4)
ARGUMENT(n)
Nth argument of the program call.
'n' Integer value 1 ... 32.
Value: The value of the nth argument of the argument list. If there are
fewer than 'n' arguments in the list, a value with data type
"NONE" is returned.
For efficiency and clarity, it is recommended to name the arguments using the
#ARGUMENT command. However, if the SCIL program is designed to take a
varying number of arguments, this function along with ARGUMENT_COUNT is
frequently used to read the optional arguments.
Example:
#ARGUMENT A
194
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
ARGUMENT_COUNT
The total number of arguments of the program call.
Value: Integer, 0 ... 32.
ARGUMENTS
All arguments of the program call as a vector.
Value: Vector with up to 32 elements. If the program call has no
arguments, a zero length vector is returned.
Example:
@A = ARGUMENTS
@B = DO(%PROGRAM, %A)
DO(program [,a]*)
Executes the SCIL program given as an argument.
'program' A text vector containing the SCIL program to be executed.
'a' Any SCIL data type. These arguments are passed to the SCIL
program (up to 31 arguments may be specified).
Value: The value returned by the #RETURN command in the executed
program, or 0 if the program did not terminate by #RETURN
command.
This function is recommended instead of #DO command, because arguments and
return values are not supported by #DO command.
Example:
;An example that calculates the tangent function of its argument.
#LOCAL RESULT = DO(READ_TEXT("TANGENT.SCL"), 0.5)
ERROR_STATE
Returns the current error handling policy.
Value: Text value depicting the current error handling policy: "STOP",
"CONTINUE", "IGNORE" or "EVENT".
Example:
#LOCAL PREVIOUS_ERROR_STATE
PREVIOUS_ERROR_STATE = ERROR_STATE
#ERROR IGNORE
; Run ignoring errors
195
SYS 600 9.2 MicroSCADA Pro 1MRS756176
...
#ERROR 'PREVIOUS_ERROR_STATE'
MEMORY_USAGE(keyword, arg)
The amount of pool memory allocated for the argument.
'keyword' Text keyword, "EXPRESSION" or "VARIABLE".
'arg' Any expression, if 'keyword' = "EXPRESSION".
A text or text vector, the name(s) of the variable(s),
if 'keyword' = "VARIABLE".
Value Integer or integer vector, the amount of memory pool allocated
for the expression or the variable(s).
This function helps debugging and analysing SCIL applications. It returns the
amount of memory pool (as bytes) allocated for an expression, or for a variable
(including the bookkeeping data and the value of the variable).
Examples:
(Memory usage in current implementation of SCIL, may change in future releases.)
MEMORY_USAGE("EXPRESSION","ABC") == 8
MEMORY_USAGE ("EXPRESSION",1) == 0 ;since integer values are not allocated
;from the pool
@X = "ABC"
MEMORY_USAGE("VARIABLE","X") == 136
OPS_CALL(command [,nowait])
Executes an operating system command.
'command' A text value. The command to be executed.
'nowait' Integer 0 ... 16. If omitted, OPS_CALL starts the execution of
the command and waits until it has finished. If given,
termination is not waited. The value of the argument has no
meaning in current implementation. The allowed range is
preserved for compatibility.
Value: A list with the following attributes:
ST Integer, the status value returned by the operating system.
0 = OK, any other value = failure.
FN 0. The attribute has no meaning in current
implementation. It is preserved for compatibility.
Example:
@A = OPS_CALL("mons -d rbsnt 4 -n", 1) ;Opening a SYS 600 monitor.
196
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
REVISION_COMPATIBILITY(issue [,enable])
Selects the compatibility issues to be used in the context.
'issue' Text keyword. The name of the compatibility issue.
'enable' An optional boolean argument. TRUE = compatibility is
enabled. FALSE = compatibility is disabled. If this argument is
not given, the function only reads the compatibility state without
modifying it.
Value: Boolean value indicating the compatibility before it was
changed by the function.
The compatibility with the old revision is enabled/disabled by compatibility issues.
The REVISION_COMPATIBILITY function overrides temporarily, in the current
SCIL context, the revision compatibility defined in the APL:BRC attribute. See the
description of the APL:BRC attribute in the System Objects manual.
Example:
#LOCAL RC
RC = REVISION_COMPATIBILITY ("FILE_FUNCTIONS_CREATE_DIRECTORIES", FALSE)
; WRITE_TEXT function used here
RC = REVISION_COMPATIBILITY ("FILE_FUNCTIONS_CREATE_DIRECTORIES", RC)
197
SYS 600 9.2 MicroSCADA Pro 1MRS756176
STATUS
The status code of the last error in the program.
Value: A non-negative integer, status code. See the Status Codes
manual.
The function reads and resets the internal ’last error’ indicator.
Example:
#LOCAL S
#ERROR IGNORE
S = STATUS
#SET ABC:PBI = 0
S = STATUS
#ERROR STOP
#IF S > 0 #THEN !SHOW ERROR S
#ELSE !ERASE ERROR
VARIABLE_NAMES
Lists the names of global variables defined in the SCIL context.
Value: A text vector, the names of global variables in alphabetic order.
WORKSTATION_CALL(command [,arg]*)
Executes a command in the workstation.
'command' A text keyword, the action to be done at the workstation.
"EXECUTE" Workstation execution
"VIEW_DOCUMENT" Viewing a document in a browser
'arg' Text values, case-insensitive command specific arguments.
Value: Integer, a SCIL status code.
When command "EXECUTE" is used, the second argument is the program to be
started (including the path and possible program specific parameters) and the third
(optional) argument is the default working directory to be used.
When command "VIEW_DOCUMENT" is used, the second argument is the page to
be shown in a browser.
Initialization file for viewing documents is "wserver.ini" and it is located in
\sc\prog\exec -directory. It contains information about the document viewer
(Browser including the path) to be started to view a document.
Listing of a sample wserver.ini:
[document_viewer]
viewer = C:\Program Files\Plus!\Microsoft Internet\Iexplore.exe
;;viewer = C:\Program Files\Netscape\Communicator\Program\netscape.exe
Examples:
@S=WORKSTATION_CALL("VIEW_DOCUMENT", "file://c:/ms_docs/help.html")
;Opens a file called help.html in the browser on the workstation
@S=WORKSTATION_CALL("EXECUTE", "c:\winnt\notepad.exe test.txt", "c:\")
;Starts the notepad program on the workstation
198
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
AEP_PROGRAMS(apl)
Lists the running Application Extension Programs of an application.
'apl' Integer value 0 ... 250, the logical application number.
0 = current application.
Value: A vector. Each element provides information about one AEP
program invocation as a list with the following attributes:
PROGRAM_NUMBER Integer, the AEP program number.
START_COMMAND Text, the command that was used in
AEP_START to start the program.
ARGUMENT Any type, the SCIL argument given to
the program when started.
START_TIME Time value, the time program was
started.
PROCESS_NAME Text, the name of the executable,e .g.
"topcal.exe".
PROCESS_ID Integer, the process id (PID) of the
executing process.
This function may be used to supervise the execution of external programs. See also
IP_PROGRAMS below.
CONSOLE_OUTPUT(text)
Writes a message into the notification window.
'text' Any text value.
Value: The status code of the operation. 0 = OK.
It is not recommended to use control characters (for example CR or LF) in the text
sent to the notification window. If control characters are used, the behaviour is
undefined.
ENVIRONMENT(variable)
Retrieves an operating system environment variable value.
'variable' A text specifying the name of the environment variable.
Value: A text, the value of the environment variable. An empty text is
returned, if the environment variable does not exist.
Example:
OPERATING_SYSTEM = ENVIRONMENT("OS")
199
SYS 600 9.2 MicroSCADA Pro 1MRS756176
IP_PROGRAMS
Lists the running Integrated Programs in the system.
Value: A vector. Each element provides information about one IP
program invocation as a list with the following attributes:
PROGRAM_NUMBER Integer, the IP program number.
START_COMMAND Text, the command that was used in
IP_START to start the program.
ARGUMENT Any type, the SCIL argument given to
the program when started.
START_TIME Time value, the time program was
started.
PROCESS_NAME Text, the name of the executable, e.g.
"ip.exe".
PROCESS_ID Integer, the process id (PID) of the
executing process.
This function may be used to supervise the execution of external programs. See also
AEP_PROGRAMS above.
MEMORY_POOL_USAGE(pool)
The amount of memory allocated from a memory pool.
'pool' Text keyword specifying the pool to get information from:
"LOCAL" Local pool of the process.
"GLOBAL" The global memory pool.
"PROCESS" The pool used by the process (either local or
global).
Value: List value with following attributes:
SIZE Size of the pool as megabytes.
USED Bytes used.
FREE Bytes free.
BLOCK_SIZES Vector of allocation block sizes used by the
pool (only if SIZE > 0).
USED_BLOCKS Vector counting allocations of each block
size (only if SIZE > 0).
FREE_BLOCKS Vector counting free blocks of each size
(only if SIZE > 0)
POOL Text value, "LOCAL" or "GLOBAL" (only
if 'pool' is "PROCESS").
200
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
OPS_NAME[([major [,minor]])]
Returns the name of the operating system.
'major' Integer value, the major version number.
'minor' Integer value, the minor version number, default value 0.
Value: Text value, the name of the operating system, whose version
numbers match with ’major’ and ’minor’, see the table below.
If the function is called without arguments, the name of the operating system that is
running is returned.
The following table summarizes the values of the major and minor version numbers
current Windows versions that run SYS 600:
"Windows" 4 0
"Windows 2000" 5 0
"Windows XP" 5 1
"Windows Server 2003" 5 2
If the arguments do not match with any known operating system version, a question
mark "?" is returned.
Tools that display operating system information are encouraged to use this function.
By using it, they don’t have to be updated when new operating system versions are
taken into use.
201
SYS 600 9.2 MicroSCADA Pro 1MRS756176
See operating system documentation for further information about registry keys,
value names and value types.
Example:
#LOCAL RESULT
RESULT = REGISTRY("READ","SOFTWARE\ABB\PAK\SYS_500\MAIN_LICENSE","CUSTOMER")
#IF RESULT.STATUS == 0 #THEN .DO_SOMETHING(RESULT.VALUE)
#ELSE_IF RESULT.STATUS == STATUS_CODE("SCIL_REGISTRY_KEY_NOT_FOUND") #THEN -
.MAIN_LICENSE_IS_MISSING
#ELSE .DO_SOMETHING_ELSE(RESULT.STATUS)
SCIL_HOST
Returns the type and number of the process that is running this SCIL code.
For example, the start program of a picture can find out whether the picture is being
displayed on a monitor or printed.
Value: A list containing two attributes:
NAME The process type as a text string. The possible
values are:
"MAIN" The main (start-up) process
"PICO" A monitor process
"REPR" A report process
"PRIN" A printer spooler process
processing a format picture
"PRNC" A printer process processing a
page header
"PICL" A picture documentation
process
"EXTERNAL" An external program running
the SCIL interpreter
NUMBER Process number as an integer.
For the MAIN process and EXTERNAL processes,
the value is 0.
For a PICO and PICL process, this is the monitor
number
For a REPR process, the number is coded as
100 * apl + n, where
'apl' is the application number
'n' = 1 for the time channel queue,
'n' = 2 for the event channel queue and
'n' = 2 + p for parallel queue 'p'.
For a PRIN process, the number is coded as
100 * apl + n, where
'apl' is the application number
'n' = 1 for process printouts and
'n' = 2 for report printouts.
For a PRNC process, this the printer number.
202
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
This function can be used, for example, in the start program of a picture to determine
whether the picture is being displayed on a monitor or printed.
Example:
#LOCAL HOST, OX, CX, OV, S
HOST = SCIL_HOST
#IF HOST.NAME == "PRIN" #THEN #BLOCK
OX = 'LN':POX'IX'
CX = 'LN':PCX'IX'
OV = 'LN':POV'IX'
S = PRINT_TRANSPARENT((-2,TIMES, "OBJECT TEXT:",OX,-
"COMMENT TEXT:",CX, " OBJECT VALUE:",-1,DEC(OV)))
#BLOCK_END
This program block first checks whether the picture is being printed or shown on the
screen. If it is printed, the PRINT_TRANSPARENT function prints a row
containing the present time and the values of attributes OX, CX and OV of a process
object.
COMPILE(source)
Runs the SCIL compiler.
'source' Text vector containing the SCIL source code.
Value: A list value with following attributes:
STATUS Integer, status code from the
compilation
CODE Byte string, the compiled byte
code
ERROR_LINE Text, the erroneous source line
ERROR_LINE_NUMBER Integer, the line number in error
ERROR_POSITION Integer, the character position
in error
Attribute CODE is returned if the compilation succeeds (STATUS == 0). Attributes
ERROR_LINE, ERROR_LINE_NUMBER and ERROR_POSITION are returned
if the compilation fails.
MAX_APPLICATION_NUMBER
Maximum number of application objects.
Value: Integer, 250 (99 in rev. 8.4.4)
MAX_BIT_STRING_LENGTH
Maximum number of bits in a bit string type value.
Value: Integer, 65535
203
SYS 600 9.2 MicroSCADA Pro 1MRS756176
MAX_BYTE_STRING_LENGTH
Maximum number of bytes in a byte string type value.
Value: Integer, 8 388 600 (1 048 576 in rev. 8.4.4)
MAX_INPUT_DEVICE_NUMBER
Maximum number of input device objects.
Value: Integer, 100 (50 in rev. 8.4.5)
MAX_INTEGER
Largest positive integer value.
Value: Integer, 2 147 483 647
MAX_LINK_NUMBER
Maximum number of link objects.
Value: Integer, 20
MAX_LIST_ATTRIBUTE_COUNT
Maximum number of attributes in a list.
Value: Integer, 1 000 000 (10 000 in rev. 8.4.4)
MAX_MONITOR_NUMBER
Maximum number of monitor objects.
Value: Integer, 100 (50 in MicroSCADA rev. 8.4.5).
MAX_NODE_NUMBER
Maximum number of node objects.
Value: Integer, 250
MAX_OBJECT_NAME_LENGTH
Maximum length of application and Visual SCIL object names.
Value: Integer, 63
MAX_PICTURE_NAME_LENGTH
Maximum length of picture names.
Value: Integer, 10
204
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
MAX_PRINTER_NUMBER
Maximum number of printer objects.
Value: Integer, 20
MAX_PROCESS_OBJECT_INDEX
Maximum number of process objects in a process object group.
Value: Integer, 65 535 (10 000 in rev. 8.4.4)
MAX_REPRESENTATION_NAME_LENGTH
Maximum length of representation names.
Value: Integer, 10
MAX_STATION_NUMBER
Maximum number of station objects.
Value: Integer, 50 000 (in 9.2 SP1, 5 000 in 9.2)
MAX_STATION_TYPE_NUMBER
Maximum number of station type objects.
Value: Integer, 33 (31 in rev. 9.1)
MAX_TEXT_LENGTH
Maximum number of characters in a text type value.
Value: Integer, 65 535 (255 in rev. 8.4.4)
MAX_VECTOR_LENGTH
Maximum number of elements in a vector.
Value: Integer, 1 000 000 (10 000 in rev. 8.4.4)
MAX_WINDOW_NAME_LENGTH
Maximum length of window and picture function names.
Value: Integer, 10
MIN_INTEGER
Smallest negative integer value.
Value: Integer, -2 147 483 648
205
SYS 600 9.2 MicroSCADA Pro 1MRS756176
206
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
207
SYS 600 9.2 MicroSCADA Pro 1MRS756176
STATUS_CODE(mnemonic)
The numeric value of a mnemonic status code name.
'mnemonic' Text keyword value, the mnemonic status code name.
Value: Integer value, the numeric value of the status code.
-1, if there is no status code by given name.
See function STATUS_CODE_NAME for the reverse operation and examples.
STATUS_CODE_NAME(code)
The mnemonic name of a numeric status code.
'code' Integer, the numeric status code
Value: Text value, the mnemonic name of the status code.
Empty string, if status code number is not used.
Examples:
The following statements are true:
STATUS_CODE("SCIL_UNDEFINED_VARIABLE") == 188
STATUS_CODE_NAME(188) == "SCIL_UNDEFINED_VARIABLE"
STATUS_CODE("NO_SUCH_ERROR_CODE") == -1
STATUS_CODE_NAME(-1) == ""
208
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
VALIDATE(as, string)
Validates a text string as a SCIL object name.
'as' Text keyword value telling how to interpret 'string':
"VS_OBJECT_NAME",
"APPLICATION_OBJECT_NAME",
"WINDOW_NAME","PICTURE_NAME" or
"VARIABLE_NAME".
'string' Text string to be validated.
Value: Integer, SCIL status code. 0 = OK.
This function validates a given text string as a VS object, an application object, a
window, a picture or a variable name. If the name is OK, integer zero is returned.
Otherwise an appropriate SCIL status code is returned. Only the validity of the name
is checked, existence of the object is not verified.
Example:
#LOCAL STATUS
#LOCAL INPUT_STRING = "A_B_C"
STATUS = VALIDATE("VS_OBJECT_NAME",INPUT_STRING)
#IF STATUS == 0 #THEN ROOT.CREATE_NEW_OBJECT(INPUT_STRING)
#ELSE MESSAGES.SHOW("INVALID OBJECT NAME: " + STATUS_CODE_NAME(STATUS))
209
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Language identifiers
It is recommended, but not required, that the two-letter language identifiers defined
by the ISO standard 639 are used by the applications.
When ISO 639 language identifiers are used, the system is able to map the Windows
language id’s, which are derived from the Windows locale id’s, to the language
identifiers of the SYS 600 applications. Consequently, the OPC clients connected to
the OPC Data Access Server may define their language by the means specified in
the OPC standard, and the base system automatically converts the Windows
language id’s to the ISO 639 language identifiers.
210
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
The applications should select the language identifiers from Table 9.12.-1.
Table 9.12.-1 ISO 639 language identifiers and Windows language id’s
Afrikaans AF LANG_AFRIKAANS
Albanian SQ LANG_ALBANIAN
Arabic AR LANG_ARABIC
Armenian HY LANG_ARMENIAN
Assamese AS LANG_ASSAMESE
Azerbaijani AZ LANG_AZERI
Basque EU LANG_BASQUE
Byelorussian BE LANG_BELARUSIAN
Bengali BN LANG_BENGALI
Bulgarian BG LANG_BULGARIAN
Catalan CA LANG_CATALAN
Chinese ZH LANG_CHINESE
Croatian HR LANG_CROATIAN
Czech CS LANG_CZECH
Danish DA LANG_DANISH
Dutch NL LANG_DUTCH
English EN LANG_ENGLISH
Estonian ET LANG_ESTONIAN
Faroese FO LANG_FAEROESE
Persian FA LANG_FARSI
Finnish FI LANG_FINNISH
French FR LANG_FRENCH
Georgian KA LANG_GEORGIAN
German DE LANG_GERMAN
Greek EL LANG_GREEK
Gujarati GU LANG_GUJARATI
Hebrew HE LANG_HEBREW
Hindi HI LANG_HINDI
Hungarian HU LANG_HUNGARIAN
Icelandic IS LANG_ICELANDIC
Indonesian ID LANG_INDONESIAN
Italian IT LANG_ITALIAN
Japanese JA LANG_JAPANESE
Kannada KN LANG_KANNADA
Kashmiri KS LANG_KASHMIRI
Kazakh KK LANG_KAZAK
Korean KO LANG_KOREAN
Latvian LV LANG_LATVIAN
Lithuanian LT LANG_LITHUANIAN
Macedonian MK LANG_MACEDONIAN
Malay MS LANG_MALAY
Malayalam ML LANG_MALAYALAM
Marathi MR LANG_MARATHI
Nepali NE LANG_NEPALI
Norwegian NO LANG_NORWEGIAN
Oriya OR LANG_ORIYA
Polish PL LANG_POLISH
211
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Table 9.12.-1 ISO 639 language identifiers and Windows language id’s
Portuguese PT LANG_PORTUGUESE
Punjabi PA LANG_PUNJABI
Romanian RO LANG_ROMANIAN
Russian RU LANG_RUSSIAN
Sanskrit SA LANG_SANSKRIT
Serbian SR LANG_SERBIAN
Sindhi SD LANG_SINDHI
Slovak SK LANG_SLOVAK
Slovenian SL LANG_SLOVENIAN
Spanish ES LANG_SPANISH
Swahili SW LANG_SWAHILI
Swedish SV LANG_SWEDISH
Tamil TA LANG_TAMIL
Tatar TT LANG_TATAR
Telugu TE LANG_TELUGU
Thai TH LANG_THAI
Turkish TR LANG_TURKISH
Ukrainian UK LANG_UKRAINIAN
Urdu UR LANG_URDU
Uzbek UZ LANG_UZBEK
Vietnamese VI LANG_VIETNAMESE
Uzbek UZ LANG_UZBEK
Vietnamese VI LANG_VIETNAMESE
212
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
• The language of the SCIL context works as the second argument’s default value
of the SCIL TRANSLATE and TRANSLATION functions, see below.
Text databases
The translations of application texts are stored in data files called text databases.
The databases have three different scopes for different needs of software
components using translated texts:
1. The application text database APL_TEXT.SDB is designed to contain the site-
specific texts of the application.
2. The text databases listed by the application attribute APL:BTD are to be used by
various software products, such as LIBxxx products, and their localizations.
3. The system text database SYS_TEXT.SDB is delivered with the SYS 600 base
software and should not be modified.
The databases are searched in the scope order, APL_TEXT.SDB first and
SYS_TEXT.SDB last.
The text databases are organized as SCIL databases, where the text identifier acts as
the section name. The databases are maintained by the Text Translation Tool, or
directly by using the SCIL function DATA_MANAGER, see the example below.
Example:
The following piece of SCIL code creates a translation of the text identifier
"IDClosed" into a couple of languages:
#local db,-
ok = 0,-
result,-
id,-
translations,-
close_result
id = "IDClosed"
translations = list(EN = "Closed", DE = "Geschlossen", FI = "Kiinni")
db = data_manager("OPEN", "APL_TEXT.SDB")
#if db.status <> ok #return db.status
213
SYS 600 9.2 MicroSCADA Pro 1MRS756176
SET_LANGUAGE(language)
Sets the current language of the SCIL context.
'language' A text keyword, language identifier as defined in the ISO
standard 639.
Value: A text keyword, the language of the SCIL context before the
function call.
The function does not check that the language identifier is a valid ISO 639 language
identifier, nor does it check that the language is really supported by the application.
If the 'language' argument is an empty string, the initial language of the SCIL context
is restored.
TRANSLATE(text [,language])
Translates texts defined in Visual SCIL objects.
'text' A text value, a reference to a text identifier defined in the Dialog
Editor, or a vector of such text identifiers. The reference starts
with an @.
'language' A text keyword, language identifier as defined in the ISO
standard 639.
Value: A text or a text vector value, the translated text(s).
If there is no initial @ character in 'text', no translation is done,
but the text is returned as such. If there are two initial @
characters, one of the @ characters is removed from the resulting
text, but no translation takes place.
The function can only be used in user interface objects (Visual SCIL objects and
pictures). The function searches the current dialog or dialog item (object THIS) for
the text reference. If either the text reference or the language is not found, the parent
object is searched, and so on, up to the object that was loaded with .LOAD
command.
The 'language' argument is used only if you want to override the language selected
for the monitor. If no 'language' argument is given, the language of the SCIL context
is used (see above).
TRANSLATION(id [,language])
Translates texts by using text databases.
'id' A text value, the identifier of the text to be translated, or a vector
of such identifiers.
The identifier is case-sensitive, may be of any length and may
contain any characters.
'language' A text keyword, language identifier as defined in the ISO
standard 639.
'Value:' A text or a text vector value, the translated text(s).
214
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Normally, the function is used without the 'language' argument. In this case, the
language of the SCIL context is used (see above). If no translation into the language
is found, the English translation is returned, if any.
If the target language is explicitly given as the argument 'language' and the
translation is not found, no automatic translation into English is performed.
If no translation into the requested language is found, the function returns the text
identifier as such.
Example
.SET OBJECT_TEXT._TITLE = TRANSLATION('LN':POX'IX')
; Display the OX attribute in the operator’s native language
; Because the TX attribute is the translation of OX, this is equivalent to
.SET OBJECT_TEXT._TITLE = 'LN':PTX'IX'
SCIL_LINE_NUMBER
Tells the current line number within the SCIL program.
Value: Integer value. The current line number
Example:
@C = CONSOLE_OUTPUT("Reached line " + DEC(SCIL_LINE_NUMBER))
215
SYS 600 9.2 MicroSCADA Pro 1MRS756176
TRACE_END
Stops trace logging.
Value: Integer value. The status of closing the trace file (0 = successful).
TRACE_PAUSE
Pauses trace logging.
Value: Integer value. The status the operation (0 = successful).
TRACE_RESUME
Resumes trace logging.
Value: Integer value. The status of the operation (0 = successful).
216
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
The value, status and registration time of two indices of process object
BREAKER1 are read. Note that this code is not equivalent to the following:
@OV10 = BREAKER:POV10
@OS10 = BREAKER:POS10
@RQ10 = BREAKER:PRQ10
@OV22 = BREAKER:POV22
@OS22 = BREAKER:POS22
@RQ22 = BREAKER:PRQ22
217
SYS 600 9.2 MicroSCADA Pro 1MRS756176
218
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
219
SYS 600 9.2 MicroSCADA Pro 1MRS756176
220
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Example 2:
The following piece of code reads and handles all the data objects of the application,
50 objects at a time.
#LOCAL OBJECTS
#LOCAL START = ""
#LOCAL MORE_TO_COME = TRUE
#LOOP MORE_TO_COME
OBJECTS = APPLICATION_OBJECT_LIST(0, "D", "A", "", START, "", 50)
#IF OBJECTS.COUNT > 0 #THEN #BLOCK
.HANDLE_UP_TO_50_OBJECTS(OBJECTS.LN)
START = OBJETCS.LN(OBJECTS.COUNT)
#BLOCK_END
MORE_TO_COME = OBJECTS.MORE
#LOOP_END
221
SYS 600 9.2 MicroSCADA Pro 1MRS756176
222
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
223
SYS 600 9.2 MicroSCADA Pro 1MRS756176
NEXT(n)
PREV(n)
Fetches the configuration attributes of an object within a search result.
'n' Integer, 1 ... 10. The identification number of the search.
Value: A list containing the configuration attributes of the object, the
dynamic run-time attributes are not returned. The object type
determines which attributes are returned. If the object does not
exist a list is returned containing only the IU attribute which has
the value -1.
These functions are used to browse through the result of a search initiated with the
#SEARCH command. Process objects, data objects, command procedures, scales,
time channels, event channels and free type objects can be searched through. The
functions require that the search has been initiated with the #SEARCH command,
see Section 8.2.2.
Example:
#LOCAL OBJ
#SEARCH 2 0 "P" "A" "A"
OBJ = NEXT(2)
!SHOW NAME OBJ.LN
224
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
The name of the process object group following A in alphabetical order is shown.
APPLICATION_ALARM_COUNT(apl [, filter])
Counts the alarms and warnings of an application.
'apl' Integer, 0 ... 250. The logical application number. 0 = the own
application. Both local and external applications are supported.
'filter' A text containing a filter for selecting objects.
The filter is a boolean type expression composed of relations and
logical operators. The relations have an attribute as the left
operand. All attributes, except vector and list type attributes, can
be included in the expression. In conjunction with text attributes,
the wildcard characters % and * can be used. % represents one
character anywhere in the name, * represents none, one or
several characters at the end of the name. Default = "".
Value: A list containing the following integer attributes:
STATUS SCIL status code, 0 = OK_STATUS.
The next attributes are present only if
STATUS = 0.
ACTIVE_NOACK Count of active alarms that do not
require an acknowledgement
(AL = 1, AR = 1, RC = 0)
ACTIVE_ACKED Count of acknowledged active alarms
(AL = 1, AR = 1, RC = 1)
225
SYS 600 9.2 MicroSCADA Pro 1MRS756176
226
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
227
SYS 600 9.2 MicroSCADA Pro 1MRS756176
228
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
229
SYS 600 9.2 MicroSCADA Pro 1MRS756176
When a time interval fetch is specified, the function expects that the
history records are stored in ascending time order. If not, the set of
records included in the result is unspecified.
Examples:
#LOCAL DATA = DATA_FETCH (0,"ABC",1,5,0)
;Every fifth history record of the data object ABC is read.
230
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Examples:
#LOCAL HISTORY = DATA_FETCH(0, "A", 1)
#LOCAL STATUS1 = DATA_STORE(0, "DATA", HISTORY, 1)
#LOCAL STATUS2 = DATA_STORE(2, "A", HISTORY, 1)
The history of the data object A in the current application is copied to the data object
DATA in the current application and to the data object A in application 2.
These functions are more or less obsolete. Use more powerful SCIL
functions APPLICATION_OBJECT_LIST,
APPLICATION_OBJECT_ATTRIBUTES and
APPLICATION_ALARM_LIST for a query of the process database
and HISTORY_DATABASE_MANAGER to browse the event
history.
END_QUERY
Tells whether a process object query is completed.
Value: Boolean data. TRUE = the query is completed. FALSE = the
query is not completed.
The function tests whether all objects matching a process query initiated by the
#INIT_QUERY command (Chapter 8) have been read with the PROD_QUERY
function.
Example:
#IF END_QUERY #THEN #BLOCK
!SHOW MESSAGE "READY"
#BLOCK_END
#ELSE #BLOCK
LIST = PROD_QUERY(20)
!SHOW NAME LIST.LN
!SHOW VALUE LIST.OV
#BLOCK_END
If the query has been completed, the message READY is shown on screen.
Otherwise, 20 more process objects are handled.
PROD_QUERY(n)
Returns attributes of objects selected by a process object query.
'n' Integer, [-] 1 ... APL:BQL. The maximum number of process
objects that are included in the query. If the number is given with
a negative sign, the browsing is performed backwards.
Value: A list containing the following attributes:
Identification: LN (Logical Name), IX (Index), PT (Process
Object Type), OI (Object Identification), OX
(Object Text)
231
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Attributes
Index LN IX OV
1 "TEMP" 1 63.0
2 "PH" 5 6.5
3 "SWITCH" 1 1
4 "SWITCH" 2 0
The attribute LN (logical name) constitutes the first vector, IX (index) the second
one and OV (object value) the third one.
HISTORY_DATABASE_MANAGER("OPEN" [,apl])
Opens a session to the history database of an application.
The HISTORY_DATABASE_MANAGER function is session-based. A query
session is first created. Subsequent calls of the function may then set various query
parameters and do queries. At last, the session is closed.
There may be up to 10 open query sessions within one SCIL context.
232
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
When a SCIL context is deleted, the open query sessions are closed automatically.
However, it is a good practice to close the sessions explicitly by SCIL to save system
resources.
'apl' Integer or text value.
When an integer, specifies the logical application number (0 =
current application)
Text keyword "NO_APPLICATION" is used to specify no
application.
Default value is 0.
Value: List:
SESSION Integer value. Used to identify the session in
subsequent calls.
STATUS Integer value, SCIL status code.
This command opens a new query session and sets the query parameters to their
default values (described later). If already 10 sessions are open, status
SCIL_TOO_MANY_HDB_SESSIONS is returned in the STATUS attribute of the
result.
If another than the current APPLICATION is specified, it has to be local (in same
SYS) but its state is allowed to be COLD.
If no application is specified, SET_DIRECTORY command must be used to tell the
history database manager where to find the database.
If a cold application or no application at all is specified, the user defined attributes
of user defined process objects are not returned, because there is no process database
to find the attribute descriptions of corresponding F-type objects.
HISTORY_DATABASE_MANAGER("CLOSE", session)
Closes a session to the history database of an application.
'session' Integer value returned by OPEN command.
Value: List:
STATUS Integer value, SCIL status code.
This command closes the session by releasing all the resources associated to the
session.
233
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Value: List:
DATE_COUNT Integer value. Number of days whose
history database was successfully
opened.
MISSING_DATES Time vector containing the dates
whose database files could not be
read.
MISSING_STATUS Integer vector containing the status
codes of failed database file reads.
STATUS Integer value, SCIL status code.
The period defines the time period whose database files are included in the query. A
period may contain up to 1000 database files. Status SCIL_PERIOD_TOO_LONG
is returned, if this limit is exceeded.
The arguments 'begin' and 'end' are used only to define the date: hours, minutes and
seconds are ignored.
The period is initially empty.
HISTORY_DATABASE_MANAGER("SET_DIRECTORY", session,
directory)
Sets the location of database files.
'session' Integer value returned by OPEN command.
'directory' Text or text vector containing the directory (or directories)
where to locate the database files. See Section 5.5.1 for directory
naming.
Value: List:
STATUS Integer value, SCIL status code.
Up to 20 directories may be specified. Status SCIL_TOO_MANY_DIRECTORIES
is returned if this limit is exceeded.
Setting this parameter resets the active period.
When a session is opened, this parameter is set to point to the APL_ subdirectory of
the application. If no application is defined, the parameter is left empty.
HISTORY_DATABASE_MANAGER("SET_WINDOW", session,
begin, end)
Sets the time window of the query.
'session' Integer value returned by OPEN command.
'begin' Time value or an integer 0.
Begin time of the window. If 0, the window has an open
beginning.
'end' Time value or an integer 0.
End time of the window. If 0, the window has an open end.
234
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Value: List:
STATUS Integer value, SCIL status code.
This command sets the time window of the query. A time window may have an open
beginning and/or an open end, meaning all events older than 'end' or old events
newer than 'begin', respectively.
If both 'begin' and 'end' are non-zero, they may be given in any order.
When a session is opened, the window is set to (0, 0).
HISTORY_DATABASE_MANAGER("SET_DIRECTION", session,
direction)
Sets the search direction.
'session' Integer value returned by OPEN command.
'direction' Text keyword, either "FORWARD" or "BACKWARD".
"FORWARD" The query starts from the beginning of the
time window.
"BACKWARD" The query starts from the end of the time
window.
Value: List:
STATUS Integer value, SCIL status code.
The results of a query are returned in the order of 'direction': If "FORWARD", they
are returned in time order, if "BACKWARD", they are returned in reversed time
order.
When a session is opened, the direction is set to "BACKWARD".
235
SYS 600 9.2 MicroSCADA Pro 1MRS756176
HISTORY_DATABASE_MANAGER("SET_TIMEOUT", session,
timeout)
Sets the maximum time a query may last.
'session' Integer value returned by OPEN command.
'timeout' Integer or real value, time-out in seconds.
Value: List.
STATUS Integer value, SCIL status code.
The time-out of a query specifies the maximum time a query may last. If it is
exceeded, the query is interrupted and the partial results found so far are returned.
When a session is opened, the time-out is set to 5 seconds.
HISTORY_DATABASE_MANAGER("SET_CONDITION", session,
condition)
Sets the condition for requested events.
'session' Integer value returned by OPEN command.
'condition' Text value, the condition requested events should fulfil.
Value: List:
STATUS Integer value, SCIL status code.
The condition is given as in #INIT_QUERY and #SEARCH commands.
When a session is opened, the condition is set to an empty string.
HISTORY_DATABASE_MANAGER("SET_ATTRIBUTES", session,
attributes)
Sets the attributes whose values are to be returned by the query.
History database information related to each event are described in the Application
Objects manual Chapter 3.
'session' Integer value returned by OPEN command.
'attributes' Text vector.
Specifies the set of attributes whose value is returned by the
query.
Value: List:
STATUS Integer value, SCIL status code.
Any number of attributes may be specified.
Attributes LN, IX, OV, ET and EM do not have to specified, they are always
included in the set. The object type specific names (BI, BO, etc.) for the object value
attribute are not used. If no application is specified for the session, the user defined
attributes of user defined process objects are not returned by the query.
The initial value of the set is (LN, IX, OV, ET, EM).
236
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
HISTORY_DATABASE_MANAGER("GET_PARAMETERS",
session)
Returns the current values of parameters.
'session' Integer value returned by OPEN command.
Value: List:
DIRECTORY Text vector, file directories to locate
database files.
PERIOD Two place vector containing the first and last
date of the period, see SET_PERIOD
command.
WINDOW Two place vector containing the beginning
and end of the time window, see
SET_WINDOW,
ORDER "LOG" or "EVENT".
DIRECTION "FORWARD" or "BACKWARD".
TIMEOUT Real value, the query time-out in seconds.
ATTRIBUTES Text vector, the attributes returned by the
query.
CONDITION Text value, the query condition.
STATUS Integer value, SCIL status code.
237
SYS 600 9.2 MicroSCADA Pro 1MRS756176
The event identifiers returned by a query are valid only during the
current period setting.
The following example reads the latest 20 events, then waits a second and reads the
new ones. For clarity, error handling is omitted.
Example:
#LOCAL R, SESSION, FIRST, SECOND
R = HISTORY_DATABASE_MANAGER("OPEN")
SESSION = R.SESSION
R = HISTORY_DATABASE_MANAGER("SET_PERIOD", SESSION,-
PACK_TIME(1998,4,1,0,0,0),CLOCK)
FIRST = HISTORY_DATABASE_MANAGER("QUERY",SESSION,20)
#IF FIRST.COUNT > 0 #THEN #BLOCK
#PAUSE 1
R = HISTORY_DATABASE_MANAGER("SET_ORDER",SESSION,"FORWARD")
SECOND = HISTORY_DATABASE_MANAGER("QUERY",SESSION,100,FIRST.ID(1))
#BLOCK_END
The second query may miss a new event if its time-stamp is out of
order.
238
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
History database information related to each event are described in the Application
Objects manual, Chapter 3.
'session' Integer value returned by OPEN command.
'event' Vector value, the event identifier of the event.
Value: List:
DATA List value containing all the attributes of the event.
STATUS Integer value, SCIL status code.
HISTORY_DATABASE_MANAGER("SET_COMMENT", session,
event, comment)
Sets the EX attribute of the specified event.
'session' Integer value returned by OPEN command.
'event' Vector value, the event identifier of the event.
'comment' Text value, the comment.
Value: List:
STATUS Integer value, SCIL status code.
239
SYS 600 9.2 MicroSCADA Pro 1MRS756176
240
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
241
SYS 600 9.2 MicroSCADA Pro 1MRS756176
242
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Example 2:
Syntax "ON", order "INTERLEAVED". The delimiter is dot, duplicates are not
allowed. The same data as in Example 1.
#LOCAL NAMES = VECTOR("a.b.d", "a.b.c", "a.b", "e.f", "a.b.c")
#LOCAL TREE
TREE = NAME_HIERARCHY(NAMES, "INTERLEAVED", "ON")
;The value of the variable TREE is now:
;List 2
; ROOT List 4
; COUNT 2
; NAMES Vector 2
; (1) "a"
; (2) "e"
; ROLES Vector 2
; (1) "BRANCH"
; (2) "BRANCH"
; BRANCHES Vector 2
; (1) List 5
; COUNT 1
; NAMES Vector 1
; (1) "b"
; ROLES Vector 1
; (1) "BOTH"
; BRANCHES Vector 1
; (1) List 4
; COUNT 2
; NAMES Vector 2
; (1) "c"
; (2) "d"
; ROLES Vector 2
; (1) "LEAF"
; (2) "LEAF"
; INDEXES Vector 2
; (1) 2
; (2) 1
; INDEXES Vector 1
; (1) 3
; (2) List 4
; COUNT 1
; NAMES Vector 1
; (1) "f"
; ROLES Vector 1
; (1) "LEAF"
; INDEXES Vector 1
; (1) 4
; ERRORS Vector 1
; (1) 5 ;The 5th name "a.b.c" is a duplicate
Example 3:
Syntax "OI", order "SEPARATE". Duplicates are allowed.
#LOCAL NAMES = VECTOR("Elgarose Transformer Q91",-
"Elgarose Coles Valley Q1",-
"Eastwick Incoming 110kV Q0",-
"Elgarose Transformer Q91")
#LOCAL SV15 = APL:BSV15
#LOCAL OI = SV15.PROCESS_OBJECTS.OI
#LOCAL TREE
TREE = NAME_HIERARCHY(NAMES, "SEPARATE", "OI",-
VECTOR(OI.LENGTH1, OI.LENGTH2,OI.LENGTH3))
;The value of the variable TREE is now:
;List 2
; ROOT List 4
243
SYS 600 9.2 MicroSCADA Pro 1MRS756176
; BRANCH_COUNT 2
; BRANCH_NAMES Vector 2
; (1) "Eastwick"
; (2) "Elgarose"
; BRANCHES Vector 2
; (1) List 4
; BRANCH_COUNT 1
; BRANCH_NAMES Vector 1
; (1) "Incoming 110kV"
; BRANCHES Vector 1
; (1) List 4
; BRANCH_COUNT 0
; LEAF_COUNT 1
; LEAF_NAMES Vector 1
; (1) "Q0"
; LEAF_INDEXES Vector 1
; (1) Vector 1
; (1) 3
; LEAF_COUNT 0
; (2) List 4
; BRANCH_COUNT 2
; BRANCH_NAMES Vector 2
; (1) "Coles Valley"
; (2) "Transformer"
; BRANCHES Vector 2
; (1) List 4
; BRANCH_COUNT 0
; LEAF_COUNT 1
; LEAF_NAMES Vector 1
; (1) "Q1"
; LEAF_INDEXES Vector 1
; (1) Vector 1
; (1) 2
; (2) List 4
; BRANCH_COUNT 0
; LEAF_COUNT 1
; LEAF_NAMES Vector 1
; (1) "Q91"
; LEAF_INDEXES Vector 2
; (1) Vector 1
; (1) 1
; (2) 4
; LEAF_COUNT 0
; LEAF_COUNT 0
; ERRORS Vector 0
DATA_MANAGER(function [,argument]*)
SCIL database management.
'function' A text keyword, the subfunction to be performed
'argument' A subfunction specific list of other arguments
Value: A list always containing the attribute:
STATUS Integer value, SCIL status code.
Other subfunction specific attributes may be returned.
The structure and properties of SCIL databases are described in Chapter 5.6.
Each subfunction is described in detail below.
244
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
DATA_MANAGER("CREATE", file)
Creates a new SCIL database and opens it for use.
'file' A text or byte string value, the name or tag of the file to be
created. Extension SDB is recommended.
Value: A list with attributes:
STATUS An integer, the SCIL status code
HANDLE An integer, a handle to the file to be used in
subsequent calls of the function
Up to 10 databases may be concurrently open
within a SCIL context.
VERSION Integer 2 or 3, the version of the file format
DATA_MANAGER("OPEN", file)
Opens an existing SCIL database.
'file' A text or byte string value, the name or tag of the file to be
opened
Value: A list with attributes:
STATUS An integer, the SCIL status code
HANDLE An integer, a handle to the file to be used in
subsequent calls of the function
Up to 10 databases may be concurrently open
within a SCIL context.
VERSION Integer 2 or 3, the version of the file format
245
SYS 600 9.2 MicroSCADA Pro 1MRS756176
DATA_MANAGER("CLOSE", handle)
Closes a SCIL database when no longer used.
'handle' An integer, a handle to the file
Value: A list with one attribute:
STATUS An integer, the SCIL status code
If a SCIL program does not close the file, it is automatically closed when the SCIL
context of the program is destroyed.
DATA_MANAGER("LIST_SECTIONS", handle)
Lists the sections of a SCIL database in alphabetic order.
'handle' An integer, a handle to the file
Value: A list with attributes:
STATUS An integer, the SCIL status code
SECTIONS A text vector, the section names
246
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
247
SYS 600 9.2 MicroSCADA Pro 1MRS756176
FILE_LOCK_MANAGER(function, file)
Locks and unlocks files.
This function is used to temporarily lock a file for use of only one SCIL context. This
function is mainly needed by tools (such as dialog editor) to prevent simultaneous
modification of same data by two users. All the SCIL tools accessing the file should
use FILE_LOCK_MANAGER to synchronize the access to the file, locking a file
with FILE_LOCK_MANAGER does not prevent accessing of the file by
READ_TEXT, WRITE_TEXT or other SCIL functions.
'function' Text value, the function to be performed:
"LOCK" Lock the file for exclusive use.
"UNLOCK" Unlock the file.
"BREAK" Break the lock.
'file' Text value containing the name of the file to be locked in OS
dependent format (see PARSE_FILE_NAME function to obtain
OS file names).
Value: A text value containing:
"OK" Function successfully performed.
"LOCKED" LOCK failed because of an existing lock.
248
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
"BROKEN" UNLOCK detected that the file was not locked, i.e.
broken by somebody else.
"INVALID" The 'file' argument is invalid. This means that the
name is not a valid file name or the directory in the
name does not exist or the access to it is denied.
Notes:
• The file does not have to exist, actually 'file' argument is used as a unique
identifier of the lock. The argument is used a seed for a lock file name, which is
generated by prefixing the file name in 'file' by "_L_", for example if 'file' is
"C:\DATA\ABC.DAT", then the lock file name used is
"C:\DATA\_L_ABC.DAT". Therefore, the file name should not be extremely
long.
• Two different 'file' arguments may refer to one and same lock. For example, if a
logical drive K points to directory "C:\DATA", then 'file' arguments
"C:\DATA\ABC.DAT" and "K:\ABC.DAT" denote the same lock.
• When a SCIL context is destroyed, all the locks it holds are automatically
released by the base system software.
• The function "BREAK" should be used with care. It should be used only after a
program crash or other such failure which has left the file locked.
249
SYS 600 9.2 MicroSCADA Pro 1MRS756176
250
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
PARSE_FILE_NAME(name [,file])
Converts SCIL path names and file names to operating system file names.
'name' Text value: directory or path name, either
1) SCIL path name, e.g. "PICT"
2) SCIL directory name, e.g. "/APL/TEST/PICT" or "PICT/"
3) OS dependent directory name, e.g. "C:\SC\APL\TEST\PICT"
'file' Text value: optional file name, e.g. "station.pic"
Value: Text value containing the path name of the file (or directory) in
OS dependent format, e.g.
"C:\SC\APL\TEST\PICT\STATION.PIC" (or
"C:\SC\APL\TEST\PICT"). Returns "", if there is an error in
arguments.
Notes:
• The directory name in SCIL format may be given with or without the trailing "/"
(see however note 3).
• The OS dependent directory name may be given with or without the trailing OS
dependent delimiter (e.g. "\").
• In SCIL, depending on the context, "PICT" may mean either the path PICT or the
directory "/APL/xxx/PICT". To resolve the ambiguity, "PICT" is used for the
path and "PICT/" for the directory.
• If a path name is given as 'name' and file is not given, the function returns the first
directory in the path.
• If a path name is given as 'name' and 'file' exists, the complete file path name of
the found file is returned.
• If a path name is given as 'name' and 'file' does not exist, the returned path name
contains the first directory of the logical path, i.e. the returned value is the
complete would-be name of the file if created.
• The arguments of the function are case-insensitive. The case of the returned value
is OS dependent. In NT, upper case string is returned.
251
SYS 600 9.2 MicroSCADA Pro 1MRS756176
PATH(name)
The directories contained in a logical path.
'name' Text expression, the name of a logical path.
Value: Text vector containing the names (in an operating system
dependent format) of directories that make up the logical path.
See #PATH command in Section 8.2.4 for details of logical paths.
PATHS(level)
The logical paths defined on a specified level.
'level' Integer value 0 to 3 specifying the requested level in path
hierarchy:
0 System paths
1 Application paths
2 Process specific paths (e.g. monitor paths)
3 Temporary paths
Value: Text vector containing the names of the defined logical paths on
the requested level.
See #PATH command in Section 8.2.4 for details of logical paths.
252
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
253
SYS 600 9.2 MicroSCADA Pro 1MRS756176
For compatibility reasons, this function does not support lines longer
than 255 characters. Longer lines are silently truncated to 255
characters.This function is now more or less obsolete, use the
function TEXT_READ instead.
Example:
!SHOW DIRECTIVE READ_TEXT("DIRECTIVE.TXT")
;The contents of the file DIRECTIVE.TXT are shown in the window DIRECTIVE.
REP_LIB(name)
The files contained in a logical representation library.
'name' Text expression, the name of the logical representation library.
Value: Text vector containing the names (in an operating system
dependent format) of library files that make up the logical
library.
See #REP_LIB command in Section 8.2.4 for details of logical representation
libraries.
254
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
REP_LIBS(level)
The logical library names defined on a specified level.
'level' Integer value 0 to 3 specifying the requested level in library
hierarchy:
0 System libraries
1 Application libraries
2 Process specific libraries (e.g. monitor libraries)
3 Temporary libraries
Value: Text vector containing the names of the defined logical
representation libraries on the requested level.
See #REP_LIB command in Section 8.2.4 for details of logical representation
libraries.
SHADOW_FILE(file_name)
Queues a file for shadowing.
'file_name' Text or byte string (file tag). The name of the file. See Section
5.5.1 for file naming.
Value: A list value containing the following attributes:
STATUS status code (0 = OK).
QUEUED Boolean value indicating whether the file was
queued for shadowing.
The function first locates the file. The status is returned in attribute STATUS. Then
it checks whether the file belongs to an application that is currently shadowed. If yes,
the file is queued for shadowing (the function does not wait for the completion of
shadowing) and TRUE is returned in attribute QUEUED. If not, FALSE is returned
and nothing is done.
This function should be used if a file is created in an application directory (a
directory below the directory "/APL/application") using a non-SYS 600 program,
for example, by a tool that copies files using operating system utilities.
255
SYS 600 9.2 MicroSCADA Pro 1MRS756176
256
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
257
SYS 600 9.2 MicroSCADA Pro 1MRS756176
258
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Calling syntax
The common calling syntax of DRIVE_MANAGER, DIRECTORY_MANAGER
and FILE_MANAGER is
FUNCTION_NAME(command [,argument]*)
The first argument 'command' is a text keyword that selects the requested
subfunction. The keyword is case-insensitive. In the descriptions of subfunctions
below, the 'command' argument is represented as an upper-case text constant. Any
valid SCIL expression resulting to a valid keyword value will do, of course.
The auxiliary functions do not follow this convention.
Example listing all files in the given directory:
TAGS = FM_DIRECTORY("c:\temp")
NAMES = FM_REPRESENT(FILE_MANAGER("LIST", TAGS))
;NAMES is a vector containing the filenames of the directory "c:\temp".
Compatibility
The functions in this chapter all use abstract tags instead of a textual names as file
identifiers.
File handling commands (Section 8.2.5) and file handling functions (Section 9.15)
accept a file tag argument as the identifier of the file to enable their use in
conjunction with file management functions.
DRIVE_MANAGER
A drive is the root of a file hierarchy. Depending on the operating system, a drive
may correspond to a physical disk-like device or it may consist of several physical
devices or it may be a partitioning of a physical device or it may map to a directory
of another drive. In Windows, a drive corresponds to a Windows logical drive
(labelled A, B, and so on) or an UNC (Universal Naming Convention) name of the
form \\servername\sharename.
259
SYS 600 9.2 MicroSCADA Pro 1MRS756176
DRIVE_MANAGER("LIST")
Returns the drives available in the system.
Value: Vector value containing the drive tags of the available drives.
DRIVE_MANAGER("EXISTS", drive)
Checks the existence of one or more drives.
'drive' Drive tag or a vector of drive tags to be checked.
Value: Boolean or boolean vector value indicating whether the drive(s)
exist or not.
DRIVE_MANAGER("GET_DEFAULT")
Returns the default drive, i.e. the drive assumed if an absolute path does not contain
the drive.
Value: Byte string value containing the tag of the default drive.
DRIVE_MANAGER("GET_ATTRIBUTES", tag)
Returns some information from drives.
'tag' The drive tag or a vector of drive tags of interest.
Value: A list of following attributes:
STATUS Integer or integer vector value, the status code(s) of
the query.
FAILURES Integer value containing the number of failed
queries. If FAILURES == 0, STATUS contains all
zeroes.
TYPE Text or text vector value:
"FIXED"
"REMOVABLE"
"CDROM"
"NETWORK"
"RAM"
"SHARED"
"UNKNOWN"
260
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
DIRECTORY_MANAGER
The following commands are recognized by DIRECTORY_MANAGER:
• LIST
• CREATE
• DELETE
• DELETE_CONTENTS
• EXISTS
• COPY
• COPY_CONTENTS
• MOVE
• RENAME
• GET_ATTRIBUTES
261
SYS 600 9.2 MicroSCADA Pro 1MRS756176
DIRECTORY_MANAGER("DELETE", directory)
Deletes one or more directories and all the directories and files contained in them.
'directory' Absolute directory tag or a vector of tags to be deleted.
Value: List value with following attributes:
OK Boolean value, TRUE if successful.
FAILED A vector value containing relative directory or file
tags of directories and files not deleted. Missing if
OK = TRUE.
STATUS An integer vector containing the status codes of
failed deletions. Missing if OK = TRUE.
262
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
DIRECTORY_MANAGER("DELETE_CONTENTS", directory
[,filter [,subdirectories]])
Deletes files and directories contained in a given directory.
'directory' Absolute directory tag of the directory whose contents are
deleted.
'filter' Text value: The filter for the file and directory names to be
deleted.
May contain wildcard characters * , % and ?.
Default value is "" (no filter).
'subdirectories' Text keyword "INCLUDE_DIRECTORIES" or
"OMIT_DIRECTORIES".
Specifies whether the subdirectories are deleted or not. If
subdirectories are deleted, the filter is applied to the name of
subdirectories (not to the contained files).
Default value is "OMIT_DIRECTORIES".
Value: List value with following attributes:
OK Boolean value, TRUE if successful.
FAILED A vector value containing relative directory or file
tags of directories and files not deleted.Missing if
OK = TRUE.
STATUS An integer vector containing the status codes of
failed deletions. Missing if OK = TRUE.
DIRECTORY_MANAGER("EXISTS", directory)
Checks the existence of one or more directories.
'directory' Absolute directory tag or a vector of tags to be checked.
Value: Boolean or boolean vector value indicating whether the
directories exist or not.
263
SYS 600 9.2 MicroSCADA Pro 1MRS756176
264
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
DIRECTORY_MANAGER("GET_ATTRIBUTES", directory)
Returns attribute information from one or more directories.
'directory' Absolute directory tag or vector of directory tags of interest.
value List value containing the following attributes:
STATUS Integer or integer vector value containing the
status of each query.
READ_ONLY Boolean or boolean vector value.
SYSTEM Boolean or boolean vector value, TRUE if
exclusively used by the OS.
HIDDEN Boolean or boolean vector value, TRUE if a
’hidden’ directory.
ARCHIVE Boolean or boolean vector value, TRUE if
’archive’ attribute is set in the directory.
COMPRESSED Boolean or boolean vector value, TRUE if a
compressed directory.
ENCRYPTED Boolean or boolean vector value, TRUE if an
encrypted directory.
FAILURES Integer value telling the number of failed
queries.
FILE_MANAGER
The following commands are recognized by FILE_MANAGER:
• LIST
• DELETE
• EXISTS
• COPY
• MOVE
• RENAME
• GET_ATTRIBUTES
265
SYS 600 9.2 MicroSCADA Pro 1MRS756176
FILE_MANAGER("DELETE", file)
Deletes one or more files.
'file' Absolute file tag or a vector of file tags to be deleted.
Value: A list value containing the following attributes:
DELETED Integer value containing the number of deleted
files.
FAILED Integer value containing the number of failed
deletions.
STATUS Integer or vector value containing the status code
for each deletion.
FILE_MANAGER("EXISTS", file)
Checks the existence of one or more files.
'file' Absolute file tag or a vector of file tags to be checked.
Value: Boolean or a boolean vector value indicating whether the file
exists or not.
266
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
FILE_MANAGER("GET_ATTRIBUTES", file)
Returns attribute information from one or more files.
'file' Absolute file tag or vector of file tags of interest.
Value: List value containing the following attributes:
STATUS Integer or integer vector value, the status of
the query.
FAILURES Integer value telling the number of failed
queries.
READ_ONLY Boolean or boolean vector value.
SYSTEM Boolean or boolean vector value, TRUE if
exclusively used by the OS.
HIDDEN Boolean or boolean vector value, TRUE if a
’hidden’ file.
ARCHIVE Boolean or boolean vector value, TRUE if
’archive’ attribute is set in the file.
COMPRESSED Boolean or boolean vector value, TRUE if a
compressed file.
ENCRYPTED Boolean or boolean vector value, TRUE if an
encrypted file.
CREATED_S Time or time vector value, the seconds of the
creation.time of the file.
CREATED_US Integer or integer vector value, the
microseconds of the creation time of the file.
MODIFIED_S Time or time vector value, the seconds of the
modification time of the file.
MODIFIED_US Integer or integer vector value, the
microseconds of the modification time of the
file.
267
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Auxiliary functions
FM_APPLICATION_DIRECTORY[(path)]
Creates a directory tag out of an application relative directory path.
'path' Text or text vector value, the directory path(s) given in SCIL file
name format, e.g. "PAR/DEFAULT".
Value: The absolute directory tag of the directory specified by 'path' or
a vector of such tags.
If argument 'path' is omitted, the tag of the application root
directory is returned.
FM_APPLICATION_FILE(path)
Creates a file tag out of an application relative file path.
'path' Text or text vector value, the file path(s) given in SCIL file name
format, e.g. "PAR/DEFAULT/MYTOOL.INI".
Value: The absolute file tag of the file specified by 'path' or a vector of
such tags.
268
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
FM_COMBINE_NAME(name, extension)
Combines a proper file name and an extension to a file name.
'name' Text or text vector value, the proper file name(s).
'extension' Text or text vector value, the file name extension(s).
Value: Text or text vector value, the combined file name(s).
Either 'name' or 'extension' or both may be vectors. If both, they must be of equal
length.
Trailing blanks, if any, are removed from 'name' and 'extension'. If the extension is
empty, the name is returned. Otherwise, a period is inserted between name and
extension. The resulting file name is not syntax checked.
FM_DIRECTORY(path [,check])
Creates a directory tag out of a directory path or checks a directory path.
'path' Text or text vector value, directory path(s).
Any valid directory path.
'check' Text keyword "CHECK".
Value: If "CHECK", a text or text vector value:
"ABSOLUTE" 'path' denotes a valid absolute path.
"RELATIVE" 'path' denotes a valid relative path.
"ERROR" 'path' is not a valid path.
Otherwise, an absolute or relative directory tag (a byte string
value) or a vector of tags.
FM_DRIVE(name [,check])
Creates a drive tag out of a drive name or checks a drive name.
'name' Text or text vector value, drive name(s). In Windows, one-letter
name optionally followed by ":" or a UNC name.
'check' Text keyword "CHECK".
Value: If "CHECK", a text or text vector value "OK" or "ERROR",
otherwise a drive tag (a byte string value) or a vector of drive
tags.
FM_EXTRACT(tag, component)
Extracts a component from one or more directory or file tags.
'tag' Any directory or file tag or a vector of such tags.
'component' Text keyword specifying the component to be extracted.
"DRIVE" The drive, zero length byte string is returned
if 'tag' is not an absolute path.
"PATH" The intermediate directory path to the last
component.
269
SYS 600 9.2 MicroSCADA Pro 1MRS756176
FM_FILE(path [,check])
Creates a file tag out of a file path or checks a file path.
'path' Text or text vector value, file path(s). Any valid file path.
'check' Text keyword "CHECK".
Value: If "CHECK", a text or text vector value:
"ABSOLUTE" 'path' denotes a valid absolute path.
"RELATIVE" 'path' denotes a valid relative path.
"ERROR" 'path' is not a valid path.
Otherwise an absolute or relative file tag (a byte string value) or
a vector of tags.
FM_REPRESENT(tag [,option]*)
Converts one or more drive, directory or file tags into an OS dependent text
representation.
'tag' Byte string or a byte string vector value: drive, directory or file
tag(s).
'option' One or more of following text keywords in any order
"DRIVE_POSTFIX" In Windows, append a ":" to a
drive name (if a drive tag).
"DIRECTORY_POSTFIX" In Windows, append a "\" to
directory path (if a directory
tag).
"UPPER_CASE" Use upper case letters.
"LOWER_CASE" Use lower case letters.
"CAPITALIZE" Capitalize the names.
Value: Text or text vector value, the text representation of the given
tag(s).
270
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
By default, in Windows a drive name is given without the trailing ":", a directory
name is given without the trailing "\" and the case used when the tag was created is
not changed.
If 'tag' denotes the default drive, an empty string is returned.
FM_SCIL_DIRECTORY(name [,check])
Creates a directory tag out of a SCIL directory name or checks a SCIL directory
name.
'name' Text or text vector value, SCIL name(s).
'check' Text keyword "CHECK".
Value: If "CHECK", a text or text vector value:
"ABSOLUTE" 'name' denotes a valid absolute directory.
"RELATIVE" 'name' denotes a valid application directory.
"ERROR" 'name' is not a valid SCIL name.
Otherwise an absolute directory tag (a byte string value) or a
vector of tags.
SCIL directory names begin with a slash and are relative to the root directory of the
SYS 600 installation (usually "\SC"). To create a directory tag for a logical path, use
function PATH first to find out the directory name(s).
FM_SCIL_REPRESENT(tag [,case])
Converts one or more directory or file tags into a SCIL name text representation.
'tag' Byte string or a byte string vector value: directory or file tag(s).
'case' One of the following text keywords:
"UPPER_CASE" Use upper case letters.
"LOWER_CASE" Use lower case letters.
271
SYS 600 9.2 MicroSCADA Pro 1MRS756176
FM_SPLIT_NAME(file)
Extracts the proper name and the extension from one or more file names.
'file' Text or text vector value, file name(s).
Value: List value with following attributes.
NAME Text or text vector value, the proper name(s).
EXTENSION Text or text vector value, the extension(s).
272
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
In the example the function loads the communication program called SYS_NET2 to
the communication board connected to link number 2 (defined as LIN2:B).
SPACOM(message)
Communicates with a SPACOM unit connected to a COM port.
The SPACOM function sends the 'message' string to the SPACOM unit and returns
the reply character string. The function can be used only for communication with
SPACOM units connected to the base system. This assumes that the base system
attributes SYS:BSD and SYS:BSP have been set (see the System Objects manual,
Chapter 4).
'message' Text. The message to be sent to the SPACOM unit.
Value: Text. Reply string. "N" is returned if the unit replies with NAK,
and "T" is returned if the unit does not reply or the reply cannot
be interpreted (time-out).
TIMEOUT(millisecs)
Changes the communication time-out.
Changes locally the base system time-out used in the communication with other
nodes. The function affects only the context where it is used. The global time-out is
specified by the SYS:BTI attribute.
'millisecs' Integer expression, >= 0. The time-out in milliseconds.
0 means that SYS:BTI will be used for time-out.
Value: The previous time-out value.
The time-out is applied to the following communication:
• Communication with an external application (APL-APL communication).
• Communication with a NET via system (S) objects.
• Communication with a NET via process objects (#SET and #GET command).
Example:
#LOCAL OLD, TEMP
OLD = TIMEOUT(10000) ;The time-out is changed
#SET STA:S.. ....... ;Communication with NET
TEMP = TIMEOUT(OLD) ;The time-out is reset to its previous value.
273
SYS 600 9.2 MicroSCADA Pro 1MRS756176
• The ’Europian’ variant uses a semicolon as the field separator, because the
comma is reserved for the decimal point use.
Both of these variants are supported by the CSV functions.
All the SCIL data types are supported by the CSV functions. For the structured data
types (vectors and lists), two representation options are implemented:
• Horisontal: The components are presented on one line, separated by commas, as
the output of the DUMP function.
• Vertical: Each component is shown in its own line. Note, that these lines still
make up only one field of the CSV format.
The primary target in the design of the CSV functions has been the database export/
import functionality. Typically, a CSV record contains the configuration of a
SYS 600 database object and a CSV field contains the value of one attribute of the
object. However, the functions can be used to export and import any data between
SCIL and an external application.
274
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
SCIL_TO_CSV(data [,option]*)
Converts SCIL data into a CSV file format record.
'data' Vector value, the SCIL data to be converted
'option' Up to 4 text keywords in any order:
"DECIMAL_POINT_IS_COMMA" The comma is used as the
decimal point character
and semicolon as the
field separator.
"VERTICAL_TEXT_VECTORS" Text vectors are shown
vertically.
"VERTICAL_VECTORS" Vectors, other than text
vectors, are shown
vertically.
"VERTICAL_LISTS" Lists are shown
vertically.
Value: A list with the following attributes:
CSV Text vector containing the CSV record.
275
SYS 600 9.2 MicroSCADA Pro 1MRS756176
276
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
The DDE functions in SYS 600 use status codes listed below, most of which are
DDE protocol status codes. The status code texts can be, and should be, used as such
in SCIL expressions. They are defined as predefined integers in the SYS 600 kernel.
DDE_CONNECT(service, topic)
Opens a connection to an external application.
'service' Text. The service name the remote application responds to.
Usually the same as the application name.
'topic' Text. A valid topic name within the remote application.
Value: A list containing the following two attributes:
STATUS A predefined integer (see above). The
value indicates whether the function
was successfully executed or not.
DMLERR_NO_ERROR (= 0) means
that the operation succeeded.
277
SYS 600 9.2 MicroSCADA Pro 1MRS756176
DDE_DISCONNECT(connection_id)
Closes the DDE connection.
'connection_id' Integer, 1 ... 10. The DDE connection identifier obtained using
the DDE_CONNECT.
Value: A list containing the following attribute:
STATUS A predefined integer, see above. The value
indicates whether the function was successfully
executed or not. DMLERR_NO_ERROR (= 0)
means that the operation succeeded.
Example:
Disconnecting from a remote application (e.g. Excel):
@RESULT = DDE_DISCONNECT(%CONN )
#IF RESULT.STATUS == DMLERR_NO_ERROR #THEN #BLOCK
;Connection was successfully closed.
#BLOCK_END
#ELSE
;Connection not successfully closed.
278
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
279
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Example:
Setting "Time of Day" in cell "R1C1" in Excel:
#LOCAL RESULT, CONN
...
RESULT = DDE_POKE(CONN, "R1C1", TOD, 30)
#IF RESULT.STATUS == DMLERR_NO_ERROR #THEN #BLOCK
;The value was successfully set.
#BLOCK_END
#ELSE #BLOCK
;The value was NOT successfully set.
#BLOCK_END
The string "%o~" corresponds to <Alt+o><ENTER> in Excel and opens a dialog for
cell formatting.
280
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Integer
Text
Time Time will be returned as seconds count from1.1.1978.
Boolean Boolean will be returned as 0 or 1.
Real Real will be returned to client application as SCIL real format ("." as
decimal separator)
The vector data type is not supported directly but can be used with the help of the
DDE_VECTOR function described below. SYS 600 real data can be transformed
into text data with user defined decimal separator using the DDE_REAL function
(see below). The data types Bit string, Byte string and List are not supported.
DDE_REAL(real, separator)
Creates a DDE style real number with a user defined decimal separator.
'real' Real. A valid SCIL expression.
'separator' Text. A valid decimal separator in client application.
Value: A text value with defined decimal separator.
281
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Example:
@A = DDE_REAL(1.23,",")
;Result: %A == "1,23"
0 SQL_SUCCESS
1 SQL_SUCCESS_WITH_INFO
-1 SQL_ERROR
100 SQL_NO_DATA_FOUND
2 SQL_STILL_EXECUTING
99 SQL_NEED_DATA
2001 SQL_UNSUPPORTED_DATATYPE
In certain cases, also an error code may be returned (for status codes SQL_ERROR
and SQL_SUCCESS_WITH_INFO). The error codes are the ODBC error codes
listed in appendix A.
282
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
'password' Text. A text string containing the password for 'user' when
accessing the data source specified in 'source'. An empty string
if no password needed.
Value: A list containing the following three attributes:
STATUS A predefined integer (see above). The
values SQL_SUCCESS and
SQL_SUCCESS_WITH_INFO
indicate a successful execution.
CONNECTION_ID Integer, 1 ... 10. The identification
number of the connection. Returned
only when the operation did succeed.
ERROR_CODE Text. A five-character ODBC error
code. Returned only when STATUS is
SQL_ERROR or
SQL_SUCCESS_WITH_INFO.
Example:
Opening the connection to a data source named ACCESS:
@RESULT = SQL_CONNECT("ACCESS", "MICRO", "SCADA")
#IF RESULT:VSTATUS == SQL_SUCCESS OR-
RESULT:VSTATUS == SQL_SUCCESS_WITH_INFO #THEN #BLOCK
@CONN = RESULT:VCONNECTION_ID
;Continue the database interaction.
#BLOCK_END
#ELSE #BLOCK
;The connection was not successful.
#BLOCK_END
SQL_DISCONNECT(connection_id)
Closes the ODBC connection defined by the argument.
If SQL_BEGIN_TRANSACTION has been issued, SQL_COMMIT is run
automatically before the connection is closed (see below). All statements associated
with the connection are freed.
'connection_id' Integer 1 ... 10. The connection identification of the connection
that is to be disconnected.
Value: A list containing the following two attributes:
STATUS A predefined integer (see above). The values
SQL_SUCCESS and
SQL_SUCCESS_WITH_INFO indicate a
successful execution.
ERROR_CODE Text. A five-character ODBC error code.
Returned only when STATUS is
SQL_ERROR or
SQL_SUCCESS_WITH_INFO.
Example:
Closing the connection opened in the example above:
@RESULT = SQL_DISCONNECT(%CONN)
283
SYS 600 9.2 MicroSCADA Pro 1MRS756176
284
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
SQL_FETCH(statement_id)
Fetches a row of data from a result set obtained by SQL_EXECUTE.
'statement_id' Integer 1 ... 100. The statement identification number returned
by SQL_EXECUTE.
Value: A list containing the following three attributes:
STATUS A predefined integer (see above). The values
SQL_SUCCESS and
SQL_SUCCESS_WITH_INFO indicate a
successful execution.
DATA A vector containing data fetched from a
result table. Returned only if the operation
did succeed.
ERROR_CODE Text. A five-character ODBC error code.
Returned only when STATUS is
SQL_ERROR or
SQL_SUCCESS_WITH_INFO.
The function has no meaning if SQL_EXECUTE not executed.
Example:
Reading names and addresses from a database:
@SQLSTMT = "SELECT NAME, ADDRESS FROM EMPLOYEE"
@RESULT = SQL_EXECUTE(%CONN, %SQLSTMT)
#IF RESULT:VSTATUS == SQL_SUCCESS OR-
RESULT:VSTATUS == SQL_SUCCESS_WITH_INFO -
#THEN #BLOCK
@STMT = RESULT:VSTATEMENT_ID
#LOOP
@RESULT=SQL_FETCH(%STMT)
#IF RESULT:VSTATUS == SQL_SUCCESS OR-
RESULT:VSTATUS == SQL_SUCCESS_WITH_INFO -
#THEN #BLOCK
...... ; FETCH succeeded
#BLOCK_END
#ELSE #LOOP_EXIT
#LOOP_END
#BLOCK_END
;RESULT:VDATA(1) and RESULT:VDATA(2) contain
;the name and address respectively.
SQL_FREE_STATEMENT(statement_id)
Frees the specified statement and stops processing associated with the statement.
'statement_id' Integer, 1 ... 100. The statement identification returned from
SQL_EXECUTE.
Value: A list containing the following two attributes:
285
SYS 600 9.2 MicroSCADA Pro 1MRS756176
SQL_BEGIN_TRANSACTION(connection_id)
Marks the beginning of a transaction.
'connection_id' Integer, 1 ... 10. The identification of the connection on which
the transaction is to be executed.
Value: A list containing the following two attributes:
STATUS A predefined integer (see above). The values
SQL_SUCCESS and
SQL_SUCCESS_WITH_INFO indicate a
successful execution.
ERROR_CODE Text. A five-character ODBC error code.
Returned only when STATUS is
SQL_ERROR or
SQL_SUCCESS_WITH_INFO.
The transaction will be completed when SQL_COMMIT or SQL_ROLLBACK is
encountered (see below). Disconnecting the connection will also commit the
transaction.
Example:
@RESULT = SQL_BEGIN_TRANSACTION(%CONN)
#IF RESULT:VSTATUS == SQL_SUCCESS OR-
RESULT:VSTATUS == SQL_SUCCESS_WITH_INFO -
#THEN #BLOCK
@SQLSTMT = "DELETE FROM MYTABLE WHERE AGE = 18"
@RESULT1 = SQL_EXECUTE(%CONN, %SQLSTMT)
@SQLSTMT = "UPDATE MYTABLE SET AGE = 18 WHERE AGE = 17"
@RESULT2 = SQL_EXECUTE(%CONN, %SQLSTMT)
#IF (RESULT1:VSTATUS == SQL_SUCCESS OR-
RESULT1:VSTATUS == SQL_SUCCESS_WITH_INFO) AND-
(RESULT2:VSTATUS == SQL_SUCCESS OR-
RESULT2:VSTATUS == SQL_SUCCESS_WITH_INFO) -
#THEN #BLOCK
286
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
@RESULT = SQL_COMMIT(%CONN)
#IF RESULT:VSTATUS <> SQL_SUCCESS AND-
RESULT:VSTATUS <> SQL_SUCCESS_WITH_INFO - #THEN #BLOCK
;The commit was not successful
#BLOCK_END
#BLOCK_END
#ELSE #BLOCK
@RESULT = SQL_ROLLBACK(%CONN)
#IF RESULT:VSTATUS <> SQL_SUCCESS AND-
RESULT:VSTATUS <> SQL_SUCCESS_WITH_INFO - #THEN #BLOCK
;The rollback was not successful
#BLOCK_END
#BLOCK_END
#BLOCK_END
#ELSE #BLOCK
;The transaction could not be started.
#BLOCK_END
SQL_COMMIT(connection_id)
Commits a transaction the start of which was marked with
SQL_BEGIN_TRANSACTION.
'connection_id' Integer, 1 ... 10. The identification number of the connection on
which a transaction is to be committed.
Value: A list containing the following two attributes:
STATUS A predefined integer (see above). The values
SQL_SUCCESS and
SQL_SUCCESS_WITH_INFO indicate a
successful execution.
ERROR_CODE Text. A five-character ODBC error code.
Returned only when STATUS is
SQL_ERROR or
SQL_SUCCESS_WITH_INFO.
Example:
See the example related to the SQL_BEGIN_TRANSACTION function above.
SQL_ROLLBACK(connection_id)
Rolls back a transaction started with SQL_BEGIN_TRANSACTION.
'connection_id' Integer, 1 ... 10. The connection identification of the connection
on which a transaction is to be rolled back.
Value: A list containing the following two attributes:
STATUS A predefined integer (see above). The values
SQL_SUCCESS and
SQL_SUCCESS_WITH_INFO indicate a
successful execution.
ERROR_CODE Text. A five-character ODBC error code.
Returned only when STATUS is
SQL_ERROR or
SQL_SUCCESS_WITH_INFO.
287
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Example:
See the example related to the SQL_BEGIN_TRANSACTION function above.
288
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
OPC_NAME_MANAGER("LIST", apl)
Lists the OPC item names found in the OPC Name Database.
Value: A list of attributes:
STATUS SCIL status code (0 = OK)
LIST A text vector containing the names
289
SYS 600 9.2 MicroSCADA Pro 1MRS756176
290
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
291
SYS 600 9.2 MicroSCADA Pro 1MRS756176
An event category descriptor is a data structure that describes one event category in
an OPC A&E server. It is a list of the following attributes:
ID An integer, the numeric ID of the category
DESCRIPTION A text description of the category
TYPE A text keyword, which tells the type of the events of the
category:
"SIMPLE" Simple events
"TRACKING" Tracking events
"CONDITION" Condition events
CONDITIONS A list vector, present only if TYPE = "CONDITION". Each
element describes one of the conditions of the category by the
following attributes:
NAME The name of the condition.
SUBCONDITIONS A text vector containing the names of
the subconditions of the condition.
An area node descriptor is a data structure that describes one area in the OPC event
source hierarchy tree. It is a list with the following five attributes:
AREA_NAMES A text vector containing the names of the
area nodes directly below this node.
AREAS A list vector containing the area node
descriptors of these descendant areas
(recursive definition!).
SOURCE_NAMES A text vector containing the names of OPC
event sources directly below this node.
SOURCE_QUALIFIED_NAMES A text vector containing the fully qualified
names of these sources.
SOURCE_CONDITIONS A vector of vectors containing the names of
the conditions that these sources have. Each
element is a text vector that lists the names of
the conditions associated to the event source.
In the first form of the function call (i.e. the node is defined by a base system node
number), the possible user account and its password are defined by the node object
attribute OP (NODn:BOP). See the System Objects manual for the details.
292
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
OPC_AE_REFRESH(apl, unit)
Requests a refresh from an external OPC A&E server.
'apl' An integer, the logical application number, 0 = current
application.
The application must be local.
'unit' An integer, the number of the process database unit that runs the
OPC A&E client
Value: An integer, the SCIL status code of the operation (0 = OK)
An OPC A&E refresh causes the server to (re)send an event notification for all active
and unacknowledged inactive conditions.
If the A&E server provides a full implementation of the OPC A&E specification,
this function is never needed. If not, the function may be used to get initial values
for OPC Event type process objects that are created or taken into use while the
system is running.
OPC_AE_SERVERS(nodenr)
OPC_AE_SERVERS(nodename [, user, password])
Lists the OPC A&E servers found in a network node.
'nodenr' An integer 1 ... 250, the node number of the node object locating
the computer to be searched for the servers.
'nodename' A text, the name or IP address of the node to be searched.
A null string denotes the current node.
'user' A text, the name of the user account under which the remote
OPC server browser is launched (optional). The name may be
prefixed by the domain name, for example "DOMAIN\USER".
'password' A text, the password of the user.
Value: A list with the following attributes:
STATUS SCIL status code of the operation
The following attribute is returned only if
STATUS = 0 (OK)
SERVERS A list vector. Each element describes an A&E
server by the following 3 text attributes:
NAME The name of the server
PROGID The program ID of the server
CLSID The class ID of the server
In the first form of the function call (i.e. the node is defined by a base system node
number), the possible user account and its password are defined by the node object
attribute OP (NODn:BOP). See the System Objects manual for the details.
293
SYS 600 9.2 MicroSCADA Pro 1MRS756176
OPC_AE_VALIDATE(apl, unit)
Cross-checks a process database and the name space of an OPC A&E server.
'apl' An integer, the logical application number, 0 = current
application
'unit' An integer, the number of the process database unit that runs the
OPC A&E client
Value: A list of the following attributes:
STATUS SCIL status code of the operation
The following attributes are returned only if
STATUS = 0 (OK)
AREA_BROWSING_SUPPORTED
Boolean TRUE if the server implements the
IOPCEventAreaBrowser interface, FALSE if not.
If the interface is not implemented, the attributes
INVALID_SOURCES and
UNDEFINED_SOURCES are not present.
SOURCE_CONDITION_QUERY_SUPPORTED
Boolean TRUE if the server implements the
QuerySourceConditions method, FALSE if not.
If the method is not implemented, the attribute
INVALID_SOURCE_CONDITIONS is not
present.
INVALID_CATEGORY_IDS
A list vector of categories described in the database
but not found in the server. Each element of the
vector is a list of the following two attributes:
EH The name of the erroneous event
handling object
CI The category ID in the database
EVENT_TYPE_MISMATCHES
A vector of event type mismatch descriptors. The
descriptor is a list that describes one mismatch by
the following four attributes:
EH The name of the erroneous event
handling object
CI The category ID in the event handling
object
ET The event type in the event handling
object
CATEGORY_EVENT_TYPE
The event type of the category in the
server
INVALID_CONDITIONS
294
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
295
SYS 600 9.2 MicroSCADA Pro 1MRS756176
A name space node descriptor is a data structure that describes one node in the OPC
item hierarchy tree. It is a list with the following six attributes:
BRANCH_NAMES A text vector containing the names of the branch
nodes directly below this node.
BRANCHES A list vector containing the name space node
descriptors of these descendant branch nodes
(recursive definition!).
ITEM_NAMES A text vector containing the names of OPC items
directly below this node.
ITEM_IDS A text vector containing the fully qualified OPC
item ID’s of these items.
296
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
297
SYS 600 9.2 MicroSCADA Pro 1MRS756176
OPC_DA_SERVERS(nodenr)
OPC_DA_SERVERS(nodename [, user, password])
Lists the OPC Data Access servers found in a network node.
'nodenr' An integer 1 ... 250, the node number of the node object locating
the computer to be searched for the servers.
'nodename' A text, the name or IP address of the node to be searched.
A null string denotes the current node.
'user' A text, the name of the user account under which the remote
OPC server browser is launched (optional). The name may be
prefixed by the domain name, for example "DOMAIN\USER".
'password' A text, the password of the user.
Value: A list of the following attributes:
STATUS SCIL status code of the operation
The following attributes are returned only if
STATUS = 0 (OK)
DA20_SERVERS A vector of server descriptors of the DA
servers that support the version 2.0 of the
standard.
DA30_SERVERS A vector of server descriptors of the DA
servers that support the version 3.0 of the
standard.
The server descriptor is a list of the following three text
attributes:
NAME The name of the server
PROGID The program ID of the server
CLSID The class ID of the server
In the first form of the function call (i.e. the node is defined by a base system node
number), the possible user account and its password are defined by the node object
attribute OP (NODn:BOP). See the System Objects manual for the details.
RTU_ADDR(key)
Returns a list with the address of the object in a certain record.
'key' Text of three characters. The search key of the record.
Value: A list with the following attributes:
TP Integer, 0 ... 11. The type of the RTU200 object (see
below).
BA Integer. The block address in RTU200.
The TP attribute contains the four most significant bits and the BA attribute the 12
least significant bits of the object address (OA).
298
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
RTU_AINT(i)
Converts an integer to ASCII characters (according to the RP570 protocol).
'i' An integer number.
Value: A text of two characters.
Example:
RTU_HEXASC(RTU_AINT(342)) ;returns "0156"
RTU_AREAL(r)
Converts a real number to four ASCII characters (float DS801).
'r' A real number.
Value: A text of four ASCII characters.
Example:
RTU_HEXASC (RTU_AREAL(5.5)) ;returns "40B00000"
299
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Example:
RTU_HEXASC (RTU_ATIME (OBJ:PRT)) ;returns "0EC5226ED990"
RTU_BIN(h)
Converts HEX-ASCII numbers given as a text to binary numbers in text form.
'h' A text or a text vector of HEX-ASCII numbers.
Value: Text or text vector. The texts represent binary numbers.
Example:
RTU_BIN("414243") ;returns "ABC"
RTU_HEXASC(b)
Converts binary numbers given as a text to hex-ascii numbers as a text.
'b' A text or text vector representing 8 bit binary numbers.
Value: A text of hex-ascii numbers.
Example:
RTU_HEXASC("ABC") ;returns "414243"
RTU_INT(a)
Converts two ASCII characters (2's complement RP570) to an integer.
'a' A text of two ASCII characters.
Value: Integer.
Example:
RTU_INT(RTU_BIN("0156")) ;returns 342
RTU_KEY(oa)
Returns the search key for a record in an RTU200 configuration file.
The process object corresponding to the record must be known.
'oa' Integer. The object address, the OA attribute, of the process
object stored in the record.
Value: A text of three characters. The search key for the record.
Example:
@UN = X:PUN1
#OPEN_FILE 1 0 "RTU'UN'.CFG" KL
#READ 1 RTU_KEY(X:POA1) RECORD
;%RECORD contains the configuration record associated with the object X:P1.
300
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
RTU_MSEC(atime)
Returns the milliseconds of the 6-byte RTU time string 'atime'.
'atime' Text. The RTU time.
Value: Integer. The number of milliseconds.
RTU_OA(type, ba)
Returns the object address.
'type' Integer, 0 ... 11. The type of the object (see the TP attribute in the
RTU_ADDR description above).
'ba' Integer. The address (block address) of the object in RTU200,
see the BA attribute in the RTU_ADDR description above.
Value: Integer. The object address, the attribute OA of the process
object.
Example:
RTU_OA(5,201) ;returns 20681
RTU_REAL(a)
Converts 4 ASCII characters (float DS801) to a real number.
'a' A text of four ASCII characters.
Value: A real number.
Example:
RTU_REAL(RTU_BIN("40B00000")) ;returns 5.5
RTU_TIME(a)
Converts ASCII (RTU200 time) to SYS 600 time data.
'a' A text of 6 ASCII characters.
Value: Time data.
PRINT_TRANSPARENT(data [,log])
Sends printout to a printer.
The function sends a printout (data, printer commands and control codes) directly to
printers defined as ‘transparent’ and writes data to the printer log file. The function
enables full printer control and allows for freely formatted texts and graphics.
301
SYS 600 9.2 MicroSCADA Pro 1MRS756176
302
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Transparent_printout
303
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Unlike the semi-graphic picture based printout, the printout produced with the
PRINT_TRANSPARENT function does not automatically include any SYS 600
picture elements, only the texts, graphics and formatting specified by the function.
However, complete pictures and picture elements may be included as printout files.
The first argument of the function, 'data', specifies the printout - i.e. the printed data,
formatting and print processing. The second (optional) argument, 'log', specifies the
output to the log file. The function returns the status of the printer spool operation.
'data' Vector value, the printout vector, or integer 0 = no printout.
The printout vector is an ordinary SCIL vector containing text, integer
and vector type elements. It may contain the following elements:
• The data to be sent to the printer. This is specified by texts and text vectors
given as constants or SCIL expressions. The texts may be encoded in any
symbol set supported by the printer. The SCIL expressions must be marked by
the printout processing command -5 as the preceding element (see below).
They are evaluated at the moment of physical printing, and the result is sent to
the printer. Expressions can be used, e.g. to print the actual printout time of a
report. The text elements may also comprise printer control sequences for
producing graphics. However, this is generally not recommended, because they
would make the print vector printer interface dependent and the print processor
would not be able to keep track of output pages. Instead, printer control
sequences can be defined in the CS attribute and included in the print vector as
printer control commands. Files (e.g. window dump files transferred to printout
files) may be included using the READ_TEXT function.
• Printer control commands. The printer control commands are logical
commands that control the printer. They are represented as positive integers
defined by the printer specific CS attribute of the printer object (see the System
Objects manual, Chapter 10). There is a tool for defining the printer control
commands.
• Print processor commands. The print processor commands control the
processing of the print vector itself. They are given as negative integers. The
following print processor commands are available:
-1 Auto-NL on Automatic new line feature on (default)
-2 Auto-NL off Automatic new line feature off
-3 Increment LN Increment line number attribute LN
-4 Increment PN Increment page number attribute PN
-5 Formula The next element in the vector will be interpreted
follows as a SCIL expression instead of plain text
The automatic new line feature (on by default) means that a new line
command (printer control command 1, see above) is automatically
appended to each text element in the print vector.
The increment LN and increment PN commands may be used to inform
the print processor that a new line or new page is started using printer
control commands that are not predefined (see the CS attribute).
304
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
'log' Vector (or integer 0). The contents of the vector is in full transferred to
the log file (provided that the printer has been defined with printer log
output in the base system configuration). SCIL expressions are
evaluated before the transfer. 0 = no log file output.
Value: Integer. The status code generated by the print spool operation. 0 = OK
or no "transparent" printer among the target printers.
The target printers can be examined by means of the PRINTER_SET function (see
below). By reading the SCIL_HOST function, the SCIL program can determine
whether the picture is being printed or displayed on the screen.
Example:
#LOCAL HOST, OX, CX, OV, S
HOST = SCIL_HOST
#IF HOST.NAME == "PRIN" #THEN #BLOCK
OX = 'LN':POX'IX'
CX = 'LN':PCX'IX'
OV = 'LN':POV'IX'
S = PRINT_TRANSPARENT((-2,TIMES, "OBJECT TEXT:",OX,-
"COMMENT TEXT:",CX, " OBJECT VALUE:",-1,DEC(OV)))
#BLOCK_END
This program block first checks whether the picture is being printed or shown on the
screen. If it is printed, the PRINT_TRANSPARENT function prints a row
containing the present time and the values of attributes OX, CX and OV of a process
object.
PRINTER_SET
Returns the target printer numbers.
Value: A vector of integer elements.
The function returns the logical target printer numbers (mapped through APL:BPR
to find the physical printer numbers) of the printed picture. By means of this
function, the SCIL program may examine the properties of target printers.
Called somewhere else than in a printed picture, the function has no meaning.
305
SYS 600 9.2 MicroSCADA Pro 1MRS756176
AUDIO_ALARM(alarm_class, on_or_off)
Sets and resets the specified audio alarm(s).
'alarm_class' Integer value 1 … 8 or text keyword "ALL"
'on_or_off' Text keyword "ON" or "OFF"
Value: Integer, the status code of the operation, (0=OK_STATUS).
The value "ALL" for the argument 'alarm_class' sets or resets the audio alarm for all
alarm classes 1 to 7.
The value 8 is used to force the watchog flip-flop bit to 0 or 1 at system start-up or
shutdown.
306
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
UNLOCK_PICTURE(picture)
Unlocks a locked picture.
'picture' Text value, the name of the picture in SCIL ([path/]name) or
operating system file name format.
Value: Integer value, a SCIL status code.
0 OK_STATUS
4024 PICF_PICTURE_IS_NOT_LOCKED
Other status codes may also be returned if the argument is
invalid.
This function should be used only after the monitor process has
crashed or silently disappeared during a picture editing session,
leaving a picture locked. In a locked state the picture cannot be
opened, error 4005 (PICF_SHARE_ERROR) is raised instead.
307
SYS 600 9.2 MicroSCADA Pro 1MRS756176
308
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
10.1. Introduction
SYS 600 full graphics in pictures, partly also in dialogs, are realized using SCIL
graphics commands. There are SCIL commands for drawing various types of
graphical elements, such as points, lines, polylines and polygons, arcs, circles,
ellipses, boxes (rectangles), and texts. The SCIL graphics commands specify the
geometry of the graphical elements, while the location and size, as well as other
features, are given as arguments.
The graphics commands can be included in any SYS 600 picture program (see
Section 3.1.) and in the methods of the dialogs and dialog items. The
BACKGROUND program of a picture contains the graphics commands generated
by the picture editor. As a rule, this program should not be edited manually. Context
dependent graphics in the background can be written in the DRAW program. Like
picture commands and Visual SCIL commands (Chapter 8), the graphics commands
are not allowed in command procedures, unless they are executed by #DO
commands or DO functions situated in user interface objects. The graphics
commands are described in Section 10.2.
Graphics contexts
The features of the graphical elements - color, type of line, line width, font, etc. - are
defined by graphics contexts, which are identified by integer numbers. A graphics
context is a series of properties, called "components", such as the ones mentioned.
Several commands can use the same graphics context, though all properties are not
used by all graphics commands. The graphics contexts are described in Section 10.3.
Graphics canvas
The graphical elements are displayed in the user interface object (picture, picture
function, dialog item) chosen as graphics "canvas". By default, the canvas is the
picture or Visual SCIL object where the graphical commands are situated.
Any picture and picture function can be chosen as graphics canvas. However,
regarding the dialogs, only certain types of dialog items can contain graphics
elements. These are the dialog items that allow the display of images (have the
image attribute).
The location of a graphical element is given by x,y coordinates related to the home
position of the canvas. The upper left corner of the picture or picture function where
the element will be displayed. As the resolution of screens varies, the graphics
commands use a screen independent coordinate system. The coordinate system can
contain SCIL coordinates or VS coordinates. The SCIL coordinate system is fixed
by a scaling factor. By means of an input command, the coordinates can be read from
the mouse position. Refer to Section 10.4. to learn about the SCIL and VS
coordinates, and the mouse input commands.
309
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Miscellaneous
The context definitions, canvas selection and scaling can be temporarily stored and
restored within the same picture. See Section 10.5.
The display of the graphics on screen can be controlled by some display handling
commands (Section 10.5.2).
310
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
If the FILL option is given, the arc is filled according to the ARC_MODE
component of the graphics context.
311
SYS 600 9.2 MicroSCADA Pro 1MRS756176
'r' Integer or real data, or integer or real vector. The radius given in
coordinate units, see Section 10.4.
If the FILL option is given, the circle is filled.
312
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
At least one image must and up to 4 images may be specified in the command. The
one used in drawing depends on the size of the current MicroSCADA font. If no
image is specified for the current font size, the image for the next smaller font is
used. If there is no image for smaller fonts, the image for the next larger font is used.
When an image for a wrong font size is used, it is scaled in proportion to font sizes
(if 'w' and/or 'h' is 0).
.IMAGE command is ignored in monitors of other type than VS.
313
SYS 600 9.2 MicroSCADA Pro 1MRS756176
314
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
10.3.1. General
A graphics context is a collection of components (Section 10.3.3.) each of which
define a graphical property, for instance, background color, foreground color, font.
A picture contains a number of graphical contexts identified by a number. The
context numbers are used as arguments in the graphical commands. The maximum
number of graphics contexts that can be used in one picture is limited to 2 000.
The defined graphics contexts (together with the canvas selection and the scaling)
can be temporarily stored and restored, see Section 10.5.
315
SYS 600 9.2 MicroSCADA Pro 1MRS756176
The number of the context together with its scope identify the context and
distinguishes it from other contexts with different context number or scope.
When a part picture is shown, it inherits the contexts of its parent picture. However,
changes in the contexts of the parent picture do not affect the contexts of the part
pictures which are already displayed on screen. Likewise, the contexts are inherited
downwards in the hierarchy of a dialog system.
Default settings
As long as no component definitions have been done for a context in a certain scope,
all the components have the default values mentioned in the component descriptions
Section 10.3.3. The contexts (except number 99) can be modified any time with the
commands described in Section 10.3.2.
Context number 99 contains the default settings of the components. This contexts
cannot be changed. It contains the following components:
FUNCTION "COPY"
FOREGROUND "WHITE"
BACKGROUND "BLACK"
LINE_WIDTH 0
LINE_STYLE "SOLID"
CAP_STYLE "BUTT"
JOIN_STYLE "MITER"
FONT "" (semi-graphic)
ARC_MODE "PIESLICE"
NAME ""
GC number 99 may only be used as a source in GC copy. For self-documentation, a
predefined constant name DEFAULT_GC may be used instead of number 99
(DEFAULT_GC == 99).
Context number 0 is the default context in those cases where no context number is
given in the graphics commands.
316
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
317
SYS 600 9.2 MicroSCADA Pro 1MRS756176
AM ARC_MODE
This component specifies how filled arcs are drawn: as sectors or segments.
Value: "CHORD" The end points of the arc are connected and
the resulting segment is filled.
"PIESLICE" The end points of the arc are connected in the
center of the circle and the resulting sector is
filled.
Default: "PIESLICE"
BG BACKGROUND
Specifies the "background color" of the full graphic lines and text. This
BACKGROUND color is used in the following cases:
• In the gaps of double dashed lines
• As the background of "filled" texts
Values: The color can be given in the following four ways (see Section
10.3.4.):
With a color name given as a text, e.g., "LIGHT BLUE"
With a RGB number given as a vector of three elements, e.g.,
(10000,20000,30000)
With a color number given as an integer expression, e.g. 5
With scope and color number given as a vector of two elements:
(scope,color_number), e.g., ("M",5).
Default value: "BLACK"
CS CAP_STYLE
Specifies the endpoints of the line, see Figure 10.3.3.-2.
Values: "BUTT" The line is cut off in a 90° angle to the line
direction at the end point.
"NOTLAST" The same as "BUTT", but the line is cut off
one pixel before the end point.
"PROJECTING" The line is cut off in the same way as
"BUTT" half its width past the endpoint.
"ROUND" The line end is rounded in a half circle with r
= half its width past the endpoint.
Default value: "BUTT"
318
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
DL DASH_LIST
Specifies the length of dashes and gaps when drawing dashed lines.
Value: Vector of even length. The odd indexes define the lengths of
dashes and the even indexes the lengths of the gaps. The lengths
are given in coordinate units, see Section 10.4.
Default: The dashes as well as the gaps are four pixels long.
Fig. 10.3.3.-1 Wide lines are drawn centered in relation to the start and end
points
319
SYS 600 9.2 MicroSCADA Pro 1MRS756176
DO DASH_OFFSET
Specifies the position in the dash pattern where to start a dashed line. For example,
if DASH_LIST == (5,2) and DASH_OFFSET == 5, the line starts with the gap.
Value: Positive integer
Default value: 0
FT FONT
Specifies the X-windows name of the font used to draw a text.
Value: The value can be given in the following four ways (see Section
10.3.4):
With a font name given as a text, e.g. "KANJI_24"
With a font number given as an integer expression, e.g. 3.
With scope and font number given as a vector of two elements:
(scope,font_number), e.g., ("M",3).
As a list with one or several of the following attributes:
FAMILY (FA), POINT_SIZE (PS), FACE (FC).
Default: The MicroSCADA semi-graphical font which is called
"MICROSCADA-SEMIGRAPHICS".
FG FOREGROUND
This component specifies the color in which the graphical element is displayed.
Values: The color can be given in the following four ways (see Section
10.3.4.):
With a color name given as a text, e.g., "LIGHT BLUE".
With a RGB number given as a vector of three elements, e.g.,
(10000,20000,30000).
With a color number given as an integer expression, e.g. 5.
With scope and color number given as a vector of two elements:
(scope,color_number), e.g., ("M",5).
Default value: "WHITE"
FU FUNCTION
This component states how the color of added pixels ('new') are combined with the
color of already existing pixels ('old') on screen.
Each color in use has a palette number (pixel value, 0 ... 255). The FU component
determines how the bit representations of the color numbers are combined bit-wise
by means of logical operators.
Value: "CLEAR" 0
"AND" new AND old
"ANDREVERSE" new AND (NOT old)
"COPY" new
320
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
JS JOIN_STYLE
Specifies how corners are drawn for wide lines drawn with a single graphics
command, see Figure 10.3.3.-3.
Values: "MITER" The outer edges of the two lines are extended
to meet in one point.
"ROUND" The lines are joined by a circular arc with r =
half the line width centered on the join point.
"BEVEL" The outer edges of the lines are joined at the
end points.
Default: "MITER"
LS LINE_STYLE
Specifies how the line is drawn and in which colors.
Values: "SOLID" The line is continuous (without dashes) and
drawn in the FOREGROUND color.
"ONOFFDASH" The line is dashed with the dashes drawn in
the foreground color.
"DOUBLEDASH" The line is dashed with the dashes drawn n
the foreground color and the gaps between
the dashes in the background color.
Default value: "SOLID"
321
SYS 600 9.2 MicroSCADA Pro 1MRS756176
LW LINE_WIDTH
Specifies the width of the line in coordinate units (see Section 10.4). Wide lines are
drawn centered between the start and the end point given in the drawing command,
see Figure 10.3.3.-1.
Values: Integer or real, >= 0.
Default value: 0
NA NAME
A freely chosen name of the graphics context. This component is not copied when
copying a context.
Value: Text.
Colors
The final color of a graphical element displayed on screen depends on the
FOREGROUND BACKGROUND and FUNCTION components of the graphics
context (Section 10.3.3). The colors can be given in four manners:
• By color names (Windows or X windows). The names of the colors in the semi-
graphic pictures are: WHITE, BLACK, RED, GREEN, BLUE, CYAN,
MAGENTA, YELLOW.
• By RGB intensities given as a vector of three elements where the first element
defines the red, the second element the green and the third element the blue
intensity of the color as an integer or real value in the range 0 ... 65 535.
Consequently, for example, (0,0,0) is black and (65535,65535,65535) is white.
• By a color mix number. A color mix number is a dedicated color cell in the color
palette of the operating system or X server. The number is defined by the
.COLOR command, see below.
• With scope and color mix number given as a vector of two elements:
(scope,color_number), e.g., ("M",5).
322
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
If there are several SYS 600 windows (or other applications requiring many colors)
open on a monitor, it may happen that the palette runs out of entries. To avoid this
from happening, define the color as SHARED.
A change to a private color appears immediately on screen, i.e., all the pixels drawn
with the color are immediately affected. Changes to a shared color affect only pixels
drawn with the color after the change. Hence, private colors are needed for color
animation (done for example in the color chooser pictures).
The default color allocation policy is specified with the value of the APL:BCP
attribute of the application that uses the monitor. The default color allocation policy
for a monitor is specified by the new monitor attribute CP. The default color
allocation policy for an application (all monitors used by the application) is defined
by the application attribute, CP.
The allocation policy is assigned to a color when the color is first defined. The later
.COLOR commands applying to the same color do not change the policy unless
explicitly requested.
COLOR([scope,]number)
Returns the RGB values of the color specified by the arguments.
'scope' The scope of the color
'number' The number of the color
Value: Vector of three elements
Example:
.COLOR 1: "NAVYBLUE"
.GC : FG = 1
.BOX 100, 100, 200, 200, FILL
@RGB = COLOR(1)
323
SYS 600 9.2 MicroSCADA Pro 1MRS756176
The example creates a color mix initialized as navy blue, then draws a filled box in
the selected color. The color is added with more red, which appears in the color of
the box according to the color allocation policy definitions.
Fonts
The font used in texts is specified by the FONT component of the graphics context
(Section 10.3.3). Fonts can be given as follows:
• With a font name given as a text, e.g. "KANJI_24".
• With a font number given as an integer expression, e.g. 3. The font numbers are
defined by the .FONT command, see below.
• With scope and font number given as a vector of two elements: (scope,
font_number), e.g., ("M", 3).
• As a list with one or several of the following attributes: FAMILY (FA),
POINT_SIZE (PS), FACE (FC).
The .FONT command below defines font numbers, and the FONT function is used
for reading font numbers.
FONT([scope,] number)
Returns the attributes of a font.
'scope' The scope of the font.
'number' The number of the font.
Value: The font function returns a list with the attributes shown in
Figure 10.3.4.-1. Each attribute has a two-letter alias name.
324
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
325
SYS 600 9.2 MicroSCADA Pro 1MRS756176
GC([scope,]n)
The function returns the values of the components of the context.
'scope' The scope of the context, see Section 10.3.
'n' Graphics context number, integer 0 ... 20 or 0 ... 50 depending
on the scope, see Section 10.3.2.
Value: List, where the abbreviated names of the components are the
attributes.
Example:
@GC_DEF = GC(0)
!SHOW INFO "CURRENT DEFAULT FONT IS " + GC_DEF:VFT
COLOR_IN([scope,] n)
The function returns the RGB values of the foreground color in the context as a
vector of three elements.
'scope' Scope of the context.
'n' Graphics context number.
FONT_IN([scope,] n)
The function returns a list value with the same attributes as for the FONT function,
see Section 10.3.4.
'scope' Scope of the context.
'n' Graphical context number.
General description
The graphical elements are displayed on the selected canvas which can be:
• The object (picture, picture function, dialog object) which contains the command
(default).
• The root object - the main picture or the main dialog.
• A named window or dialog object.
• The parent object of the object where the command is executed.
The canvas can be selected with the commands in next section Selecting Canvas
(together with the context definitions and the scaling factor) can be temporarily
stored. See Section 10.5.
326
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Selecting canvas
If not changed with any of the commands listed below, the canvas for the graphics
commands is the object where the commands are executed. Use the following
commands in order to get the elements displayed on another canvas:
.CANVAS object
The command selects the named picture object (window picture or picture function)
or dialog object (dialog or dialog object) - for canvas.
'object' A picture reference or a Visual SCIL object reference, see
Chapter 5.
.CANVAS ROOT
The root object is used as canvas. In a picture the root object is the main picture. In
a dialog system, the root is the main dialog or picture container.
.CANVAS PARENT
The parent object is used as canvas. In a picture the parent object is the parent picture
of the current window picture or picture function. In a dialog system, the parent is
the parent object of the current object.
.CANVAS CURRENT
The current object is used as canvas, i.e., the object containing the graphics
command. Hence, this command returns the canvas to the default.
.COORDINATE_SYSTEM coordinate_system
Specifies the coordinate system to be used in graphic drawing commands and mouse
handling commands.
The coordinate system is specified by one of the following key words: SCIL, VS.
Changes of the coordinate system with the COORDINATE_SYSTEM command
are valid only within the SCIL program where the change was made.
Example:
.COORDINATE_SYSTEM SCIL
327
SYS 600 9.2 MicroSCADA Pro 1MRS756176
328
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
.SCALING [s]
Sets the scaling factor to be used in the subsequent SCIL graphics commands.
's' is an integer or real expression, the scaling factor. If 's' = 0, the
coordinates are taken as pixel coordinates of the screen where
the graphical element is displayed. If 's' is omitted, the scaling
factor is returned to the default (= 1 280).
For example, a graphical element programmed with s = 0 will have different sizes
depending on the resolution of the screen where it is shown.
The scaling factor can be temporarily stored (together with context definitions and
canvas selections) by the commands in Section 10.5. Note that the scaling factor
only affects the SCIL coordinate system.
Mouse input
The coordinates can be read from the cursor position with the .MOUSE command.
The .MOUSE command can be used with or without tracing. If tracing is OFF, the
command reads the cursor position and the current mouse button states. If tracing is
on, the command notes the following mouse events: button press and release,
movement of mouse (provided that motion event is on, see the .MOUSE ON
command). By means of the .MOUSE ON and .MOUSE OFF commands, tracing
is switched on and off (default = OFF).
The .MOUSE DISCARD command is used to discard the pending mouse clicks.
329
SYS 600 9.2 MicroSCADA Pro 1MRS756176
.MOUSE ON [,MOTION]
.MOUSE OFF
.MOUSE ON sets the program in tracing state. If the MOTION option is given, also
the motion of the cursor is traced.
.MOUSE OFF ends the tracing state. The tracing state is automatically ended when
a program is completed.
Example:
The following SCIL sequence draws a line segment from (0,0) to the position
pointed by the user. The final position is given by releasing button 1.
.MOUSE ON
@B1_PRESSED = FALSE
#LOOP NOT %B1_PRESSED
.MOUSE X, Y, BUTTON, BUTTONS
#IF (%BUTTON ==1) AND (BIT(%BUTTONS , 1)==0) #THEN #BLOCK
@B1_PRESSED = TRUE
#BLOCK_END
#LOOP_END
The program sequence above waits until mouse button 1 is pressed, then the
following is executed:
.MOUSE ON, MOTION
.GC : FUNCTION = "XOR"
.LINE 0, 0, %X, %Y
#LOOP %B1_PRESSED
.MOUSE NEW_X, NEW_Y, BUTTON, BUTTONS
.LINE 0, 0, %X, %Y
#IF %BUTTON == 1 #THEN @B1_PRESSED = FALSE
#ELSE #BLOCK
.LINE 0, 0, %NEW_X, %NEW_Y
@X = %NEW_X
@Y = %NEW_Y
#BLOCK_END
#LOOP_END
The line is drawn and erased until the mouse button is released, then the following
is executed:
.GC : FUNCTION = "COPY"
.LINE 0, 0, %NEW_X, %NEW_Y
.MOUSE OFF
The line is drawn from (0,0) to the coordinates given be the variables %NEW_X and
%NEW_Y.
330
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
.MOUSE DISCARD
.MOUSE DISCARD discards all the pending mouse clicks, i.e. the mouse clicks that
have not yet been processed.
This command may be used after a lengthy calculation to discard the mouse clicks
that are done by an impatient operator.
After a new dialog has been displayed, this command may be used to cancel any
mouse clicks that may have been done before the dialog was seen.
This command works only in VS monitors (in others, it does nothing). Unlike other
.MOUSE commands, .MOUSE DISCARD may be used both within a main dialog
context and within a picture container context (the others work only in a picture
container context).
.PUSH
.POP
The commands .PUSH and .POP are used for storing temporarily the context
definitions, the scaling factor and the canvas selection. They are useful, when there
is a need to store standard selections, meanwhile make other selections, and then
restore the standard selections after a while. They are used, for example, when a
subroutine uses specific values for canvas, scaling and graphics contexts, which
should not interfere with the picture that executes the subroutine.
.PUSH stores the current canvas selection, scaling factor and graphics contexts
definitions. .POP restores the selections stored with .PUSH. The .POP command
must be located in the same program as the corresponding .PUSH command.
.FLUSH
This command forces a blink timing and an immediate updating of the entire
application window. However, if there is an ongoing pending, see below, the
command has no effect. The command is rather time consuming.
.PEND ON
.PEND OFF
Pending is used to prevent disturbing flickering when drawing related graphics
primitives in sequence (for example when changing position of an object in
animation).
The graphics drawn after PEND ON are not shown on screen until the matching
PEND OFF is encountered. At PEND OFF the resulting output of the intervening
commands is shown as a flash (that is the drawn primitives are not displayed one by
one). PEND ON and the matching PEND OFF must be located in the same SCIL
331
SYS 600 9.2 MicroSCADA Pro 1MRS756176
program. If a SCIL program ends while the output is pending, an automatic PEND
OFF is generated by the base software. PEND commands may be nested. In this
case, the outermost PEND OFF triggers the output.
An implicit PEND ON - PEND OFF is set by the base software around the semi-
graphical background and the draw program when a picture is displayed.
332
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
11.1. General
Motif widgets are standardized components of the Motif user interface, e.g. dialog
boxes, buttons, labels, scroll bars, etc. The Motif widgets are organized into classes
with similar properties and functions. Figure 1 shows the Motif widget classes and
the class hierarchy. The class hierarchy is constructed so that the lower classes (to
the right in the figure) have all the properties of the higher classes (to the left in the
figure) plus some additional properties. For instance, the PushButton class has all
the properties of the Label class, but also some other essential properties which the
Label class lacks.
A widget specified for display on screen is called a widget instance or an object. A
widget instance is always also an X window, except for the widgets called gadgets.
The top-level window of a SYS 600 operator process window, i.e. the window
directly under the root window (= the screen), is always a widget of the class.
ApplicationShell. The SYS 600 main window is implemented as a DrawingArea
widget.
Composite widget classes support the containment of other widgets within them.
The contained widgets are called child widgets, and the containing widgets are
called parent widgets. Widgets of the classes below Manager - manager widgets
- have the ability to manage the position and size of their children. Generally, for
space reserving reasons, the descendants of a widget, ie., its children in one or more
links, must be managed before the widget itself and its ancestors are managed.
When a parent widget is shown, all its managed child widgets are shown as well.
The configurable features of the widgets, e.g. color, position, and function of a
widget instance is specified by its resources (Section 11.4). Each widget class has
its own set of resources plus some resources inherited from widget classes higher up
in the widget class hierarchy. The resources can be assigned values when a widget
instance is created, or later. Resources can also be set in resource files.
333
SYS 600 9.2 MicroSCADA Pro 1MRS756176
In Motif there are a number of creation routines for creating widget instances or
compound objects comprising several widget instances. These routines can be
invoked by means of SCIL commands. There are SCIL commands for creating,
deleting and modifying widgets (Section 11.2). The SCIL programmer can also
manage and unmanage the widgets (Sections 11.2 and 11.3).
The Motif widgets, their resources and the Motif creation routines are described in
the Motif Programming Manuals.
334
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
335
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Example:
.MODIFY RUNNING_WIDGET = LIST(X = RUNNING_WIDGET.X + 10,-
Y = RUNNING_WIDGET.Y + 10)
.DELETE [parent/]widget
DELETE destroys a widget instance and all its descendants.
'widget' Widget name.
'parent' The "path" to the widget specified by a chain of parent/child
relations. If 'parent' is omitted, the first found widget instance
with the given name is selected.
The widget(s) are erased from screen and their definitions are deleted. In order to
erase the widgets and preserve the widget definitions, use the UNMANAGE widget
method (see Section 11.3).
When a SYS 600 picture is removed from screen, all its widgets are automatically
deleted.
[parent/]widget.method
Executes a widget method.
'widget' The name of the widget instance.
'parent' The "path" to the widget specified by a chain of parent/child
relations. If 'parent' is omitted, the first found widget instance
with the given name is selected.
'method' The name of the method. The following four predefined methods
are available:
MANAGE Manages a previously created widget. If all
its ancestors have been managed, the widget
and all its managed children are shown on
screen.
UNMANAGE Unmanages a widget and all its descendants,
but the widget instances are preserved.
MANAGE_ALL_ Recursively manages all SCIL -created
CHILDREN descendants of a widget in correct order, i.e.
starting from the child widget furthest down
in the parent/child chain.
336
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
11.4.1. General
The widget resources are the configurable features of the widgets, e.g., position,
size, color, font, callback routines. The Motif (and Xt) widget classes and their
resources are listed and described in Appendix B of the Motif Programming Manual
(O'Reilly Associates, Inc.) and in the OSF/Motif Programmer's Reference Manual.
All listed resources can be used in SCIL, except those which have data types not
implemented in SCIL (see Section 11.4.3). In SCIL, the Motif resources are
recognized by names which resembles the Motif resource names (see Section
11.4.2). The data types of the resources are translated to SCIL data types (see
Section 11.4.3). The value of a resource can be written as described in Section
11.4.4, and read as an expression as described in Section 11.4.5.
337
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Besides the Motif resources, the following non-motif resources are available in
SCIL:
PARENT This resource can only be read, see Section 11.4.4. It contains the
widget identification number of the parent widget as an integer
value. The value should only be used as a value of a Widget type
resource of another widget in a CREATE, MODIFY or SET
command.
STATE The 'state' parameter (boolean) of the Motif routine
XmToggleButtonGetState. In SCIL, the routine corresponds to
the SET_STATE method, see Section 11.3.
NOTIFY The 'notify' parameter (boolean) of the Motif routine
XmToggleButtonGetState. In SCIL, the routine corresponds to
the SET_STATE method, see Section 11.3.
Only one callback procedure may be specified for a resource. Currently, the
additional info fields that appear in some CallbackStruct structures are not delivered
to SCIL callback procedures.
XmFontList resources
Font lists are given as vectors, the elements of which are SCIL font specifications
(see Section 10.3.4).
Examples:
@FL(1) = ("M",2) ;Monitor specific font number 2
.CREATE W = MOTIF_LABEL(FONT_LIST = %FL, ...)
338
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
339
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Pixel resources
Pixel resources are given as SCIL color specifications (see Section 10.3.4).
Examples:
BACKGROUND = "NAVY BLUE" ;by name
FOREGROUND = (10000,20000,30000) ;by RGB values
BORDER_COLOR = ("M", 5) ;monitor specific color # 5
.CREATE TB = MOTIF_TOGGLE_BUTTON
.SET TB.NOTIFY = FALSE
.SET TB.STATE = TRUE
TB.SET_STATE
340
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
[parent/]widget.resource
where
'parent' The parent/child path to the widget.
'widget' The name of the widget.
'resource' The resource name. When reading the STATE and NOTIFY
resources, the resource names must be preceded by GET_, i.e.,
the names are GET_STATE and GET_NOTIFY.
The value of the expression is the value of the resource, but the resource data type
has been transformed to a SCIL data type according to Table 11.4.3-1.
Examples:
The expression
A/B.WIDTH
has the value of the WIDTH resource of the widget called B of the parent A.
The command
.SET A/B.WIDTH = A/B.WIDTH + 10
adds 100 units to the width resource (e.g. 100 pixels if the UNIT_TYPE is
pixel).
PIXMAP (name)
Creates a pixmap (a two dimensional array of pixels) of the named library
representation. The function, or variables assigned values by means of the function,
can be used for all Motif resources of the datatype pixmap.
'name' Text. Library representation. The representation is given in one
of the following ways:
1. library representation name
2. logical library name/representation name (see the #REP_LIB
command in Section 8.2.4.
Result: Pixmap
Example:
@PIX = PIXMAP("FIG_1")
341
SYS 600 9.2 MicroSCADA Pro 1MRS756176
GIF_PIXMAP ( file_name)
GIF_PIXMAP enables the importing of GIF format images in Motif environment.
'file_name' Text value. The name of the GIF format file to be imported. The
name is given in operating system format.
Result: Integer value, which can be used as a pixmap resource value in
Motif.
Example:
A Motif button is created. The image drawn in the button is imported from a GIF file.
.CREATE_MANAGED BUTTON = MOTIF_PUSH_BUTTON(-
SCIL_X = 200,-
SCIL_Y = 200,-
LABEL_TYPE = "PIXMAP",-
LABEL_PIXMAP = GIF_PIXMAP("/USR/SC/GIF/BUTTON.GIF"))
The importing of a GIF picture may fail if all the colors in the X
server color palette are reserved and the program does not find a
color, which is close enough to the desired color. Unless your
graphical board supports the use of 65536 colors simultaneously, it is
not recommended to use GIF pictures, which comprise a wide range
of colors.
342
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
343
SYS 600 9.2 MicroSCADA Pro 1MRS756176
344
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
345
SYS 600 9.2 MicroSCADA Pro 1MRS756176
346
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
347
SYS 600 9.2 MicroSCADA Pro 1MRS756176
348
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
WINDOW1/PIC_FUNC_1/WINDOW2.MY_NAMED_PROGRAM
• The erroneous SCIL line (text)
• The column position within the line (integer, may be 0)
• Current error handling policy (text), either "STOP" or "CONTINUE"
• Program line number (integer)
The error handler program is searched for in the following order:
1. The picture - main picture, window picture or picture function - where the error
occurred.
2. The picture functions of the picture where the error occurred.
3. The parent of the picture where the error occurred.
4. The picture functions of the parent picture .
5. The parent of the parent picture, etc., up to the main picture.
The first error handler program found is executed.
If no error handler is found, the standard picture error message is shown on the top
line of the main picture. See the Status Codes manual.
349
SYS 600 9.2 MicroSCADA Pro 1MRS756176
350
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
13.1. General
Fig. 13.1.-1 The SCIL editor as accessed from the Tool Manager
The SCIL editor is a text editor designed for editing text files and SCIL programs.
The editor has ordinary editing functions and tools for assisting design of SCIL
program code. The assistant tools for SCIL programming are dialogs for inserting
SCIL commands, statements and functions as well as syntax checking. Figure 13.1.-
1 shows the SCIL editor as opened from the Tool Manager. The menu bar and the
toolbar are located above the text window and below there is a status bar. The status
bar shows current cursor position in terms of rows and columns. The active path is
also shown in a field on the status bar. Unsaved changes in the program are indicated
with a colored pencil on the status bar. The pencil is dimmed when there are no
unsaved changes.
351
SYS 600 9.2 MicroSCADA Pro 1MRS756176
13.2. Menus
Commands of the File menu:
New Open a new file with the default name ‘Untitled.txt’. In
case there are unsaved changes to the current file a dialog
asking if changes are to be saved is shown.
Open... Open an existing file. Clicking Open displays a File
Chooser dialog box for selecting the file to open.
Save Save the file without changing the filename. The Save
command acts as Save As if invoked on a new file.
Save As... Save the file. A File Chooser dialog box for choosing path
and file name is opened.
Import... Insert the contents of a text file after the current line.
Opens a File Chooser dialog box for selecting the file to
be imported.
Export... Export the whole text or the selected text. Opens a File
Chooser dialog box, with a default file name
‘Exported.txt’, for selecting the file to export to.
Print Setup... On a VS local monitor this command opens a standard
Print Setup dialog provided by the Windows operating
system.
Print… On a VS local monitor this command opens a standard
Print dialog provided by the Windows operating system.
On a VS remote monitor the current text is printed
immediately.
File history commands The names and the paths of the most recently opened files.
The maximum number of the file names and paths shown
can be determined from the File History Length in the
Options menu.
More History This submenu is placed under the 5th file history
command and displays the possible commands from 6 to
20. The submenu is visible if File History Length is set
to more than 5, and if more than 5 files have been opened
after the setting was made. The commands on the
submenu do not contain any mnemonics.
Exit Exit the SCIL editor. The user is informed if there are
unsaved changes to the text.
The commands of the File menu differ whether the SCIL editor is opened from the
Tool Manager or from within another tool. When the SCIL editor is opened from the
Tool Manager the File menu contains the commands New, Open, Save and Save
As..., while opened from within another tool these commands are replaced by the
Update command.
Commands of the Edit menu:
Undo Undo last executed command.
Redo Redo last executed command.
Cut Cut selected text and place on the Clipboard.
352
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
353
SYS 600 9.2 MicroSCADA Pro 1MRS756176
354
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
13.3. Toolbar
The toolbar of the SCIL editor is a collection of buttons corresponding to commands
found in the menus. The toolbar is shown in Figure 13.3.-1. The corresponding
command of each button is explained in Table 13.3.-1.The last button ‘Evaluate in
Test Dialog’ (in Table 13.3.-1) is present on the tool bar when the editor is opened
from the Test Dialog.
Fig. 13.3.-1 Toolbar of the SCIL editor as opened from the Tool Manager
355
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Opening files
When you have opened the editor from the Tool Manager, you can open a text file
for editing or create a new file. This possibility is usually not available when you
have opened the editor from an object tool. To open a file:
1. Click Open from the File menu. A file chooser dialox box appears.
2. Select directory from the directory tree. All files are listed as default. Four
different path selection modes are supported, as described below. The default is
SYS 600 Relative Paths. The file list can be viewed as a list or with details by
clicking on either the List ( ) or the Details ( ) button on the right, above the
file list box.
3. Click the name of the text file, or type the file name in the data entry field below
the file list. A file can be opened also as a read-only file by selecting the Read-
only check box.
4. Click Open.
356
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
To close a file and start editing of another file, open another file or click New from
the File menu to open a new file. If the previous file was not saved, you are asked to
save the changes or abandon them.
In the File Chooser the paths can be selected in four different modes:
Application Relative Paths Path representation in the SYS 600 path format
relative to the current SYS 600 application home
directory. The application home directory itself
can't be referenced.
SYS 600 Relative Paths Path representation in the SYS 600 path format
relative to the SYS 600 root directory. The
SYS 600 root directory itself can't be referenced.
Logical Paths Path representation in the SYS 600 logical path
format.
Operating System Paths Path representation in the format used by the
operating system.
Creating files
File name is given when the file is saved. If the file does not exist, a new file is
created.
Saving files
You can save your work any time. To save a file:
1. Click Save or Save As from the File menu. The Save command saves the file
with the same name, if it already exists. Use the Save As command to save the
file with another name.
2. When selecting Save for the first time or Save As, the file chooser dialog box
appears. Select the correct folder from the directory tree and click on the file
name, or type it in the Save as text box. Four different path selection modes are
supported, as described above. A new folder can also be created by clicking on
the Create New Folder button ( ) above the file list.
3. Click Save.
If you have opened the SCIL Editor from an object tool, save the program by
choosing Update on the File menu.
Undo operation
To undo the last editing operation, click Undo on the Edit menu. The undo
operation revokes the last editing operation. The maximum number of actions that
can be undone is 50.
357
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Typing
The basic function of the SCIL Editor compares to common text editing programs.
Most keyboard keys have their natural functions. The functions of some important
keys are explained below:
Insert toggles between insert and overwrite.
Home moves the cursor to the beginning of the line and the End
key to the end of line.
<Ctrl>+Home moves the cursor to the beginning of the program.
<Ctrl>+End moves the cursor the end of the program or text.
← and → moves the cursor one step to the left and right
respectively.
<Ctrl>+← and <Ctrl>+→moves the cursor to the beginning of the next/previous
word.
Tab inserts a specified number of spaces defined by the user
and moves the cursor the same number of steps to the
right.
More information on shortcut keys is found by choosing Shortcut Keys from the
Help menu.
Copying
To copy a text within the program or from one program to another:
1. Select the text you want to copy as described above.
2. Choose Copy from the Edit menu or press the <Ctrl> and C keys at the same
time (<Ctrl>+C). The text is copied to the clipboard.
If you want to move text from one program to another, activate the program to
which you want to copy.
1. Place the cursor at the position where you want to insert the copied text.
2. Click Paste from the Edit menu or press <Ctrl>+V.
358
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
Moving text
To move text:
1. Select the text you want to move as described above.
2. Choose Cut from the Edit menu or press <Ctrl>+X. The selection is removed
from the screen and placed in the clipboard.
3. If you want to move text from one program to another, activate the program to
which you want to move.
4. Click the place where you want to insert the text.
5. Choose Paste from the Edit menu or press <Ctrl>+V.
Deleting
To delete text:
1. Select the text you want to delete as described above.
2. Click Clear from the Edit menu or press Delete key.
The selected text disappears.
Commenting
A comment in a SCIL program is a line or a part of a line marked by a comment mark
(;) at the beginning. When this sign appears in a program line, the rest of the line is
regarded as a comment and not executed. You can use comments, for example, to
explain how the program works or to prevent the execution of a program line
without deleting it permanently. The comment signs may be inserted and deleted
using the ordinary text editing functions. If you wish to mark several subsequent
lines as comments, you can also use the Comment and Uncomment commands of
the Edit menu.
To mark a program section as comments:
1. Select the lines you want to mark as comments, see above.
2. Click Comment on the Edit menu.
A semicolon is inserted as the first character of each line in the selection.
To remove the comment marks located in the beginning of lines:
1. Select the lines from which you want to remove the comment marks.
2. Click Uncomment on the Edit menu.
All the comment marks that are located at the beginning of the lines are removed.
Semicolons located elsewhere are not removed.
Indenting
Text in paragraphs usually extends from the left margin to the right margin. A
paragraph can be indented to set it off from other text. Indenting is used to increase
readability of program code. Setting the measurement for indenting is done by
choosing Indent... from the Options menu. The checkbox ‘Auto-indent enabled’
means that a new line is indented according to previous line.
359
SYS 600 9.2 MicroSCADA Pro 1MRS756176
To indent a section:
1. Select the lines you want to indent. If no text is selected, the current line is
indented.
2. Click Indent from the Edit Menu.
To unindent a section:
1. Select the lines you want to unindent.
2. Click Unindent from the Edit Menu.
Finding text
The Find/Replace command searches for a given text in the program. It stops when
it finds the first match and shows it as a selection. To use the Find/Replace
command:
1. To search a certain part of the text, select the text to be searched. Otherwise the
whole document is searched. The Find or Replace operation is always started
from the current cursor position.
2. Click Find/Replace from the Edit menu. The dialog box shown in Figure 13.5.-1
appears. Moving the cursor is possible in the main window while the Find/
Replace dialog box is open.
Fig. 13.5.-1 You can search for text that is located somewhere in the same program
using the Find/Replace command on the Edit menu
3. In the ‘Find what:’ field, type the text you want to search for. You can either
search in an upward or downward direction of the program by selecting
Forwards or Backwards under Direction in the dialog. If the case of the text
(upper case/lower case) is of importance, select the check box Match Case. If a
text was selected in step 1, ‘Selection’ is selected under Scope.
4. Click Find First. If a matching text is found, the first match is shown selected in
the text window. If no matching text is found, a dialog box saying “Text not
found” appears. After the first find operation the Find First command button is
replaced with Find Next command button, which can be used for finding the
next occurrence. Find Next may be invoked repeatedly to search for the string
until you Close.
The Find Next operation in the main window is not possible while the Find/Replace
dialog is open.
360
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
The last twenty items of the Find/Replace word lists are saved and restored when
closing and opening the SCIL Editor. The lists are sorted in the chronological order,
last used words first.
Replacing text
To replace the occurrences of a text string with another one:
1. If you wish to replace the occurrences found in a certain text section, select the
section. Otherwise the whole document is considered. The Find or Replace
operation is always started from the current cursor position.
2. Click Find/Replace from the Edit menu. The dialog shown in Figure 13.5.-2
appears. Moving the cursor is possible in the main window while the Find/
Replace dialog box is open.
Fig. 13.5.-2 With this dialog you can replace one text with another
3. In the first text box, type the text you want to replace, and in the second box,
type the text you want to replace it with. You can also select whether the whole
document or the selected text section. If the case of the text is of importance,
select Match Case. Select search direction under ‘Direction’.
4. Click Find First to find the first occurrence of the text string without replacing it
immediately. After the first find operation the Find First command button is
replaced with Find Next command button, which can be used for finding the
next occurrence. Find Next may be invoked repeatedly to search for the string
until you Close.
5. When an occurrence to be replaced is found, click Replace. This replaces the
selected text and searches the next occurrence of the text string. If the found text
is edited manually in the main window during a Find or a Replace operation,
clicking Replace button replaces nothing, but the Find Next operation is
performed. Replace All replaces all occurrences of the text string.
The Find Next operation in the main window is not possible while the Find/Replace
dialog is open
The last twenty items of the Find/Replace word lists are saved and restored when
closing and opening the SCIL Editor. The lists are sorted in the chronological order,
last used words first.
361
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Finding blocks
If you want to go to a certain SCIL block in the program, click Find Block in the
Edit menu. The Find Block command searches for the following Block commands
downwards in the program starting from the cursor:
#BLOCK .... #BLOCK_END
#LOOP ....#LOOP_END
#CASE ....#CASE_END
When a block is found, it is selected in the text window. To find another block, place
the cursor after the command that ends the previous block and then click Find Block
again.
Finding a line
If you want to move quickly to a certain line number:
1. Click Go To Line from the Edit menu or pressing <Ctrl>+L on the keyboard.
The dialog shown in Figure 13.5.-3 appears.
Fig. 13.5.-3 You can move to a certain line using this dialog.
2. In the text box, type the number of the line to which you want to move and click
OK.
If the line number is invalid, the cursor is moved to the first line and if the given line
number is too big the cursor is moved to the last line.
362
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
If there is an existing file with the same name, the user is asked to confirm
overwriting of the existing file.
In the file chooser four different path selection modes are supported, as described on
page 252.
Fig. 13.5.-4 The Insert SCIL Commands, Functions & Objects dialog of the SCIL
editor
363
SYS 600 9.2 MicroSCADA Pro 1MRS756176
Fig. 13.5.-5 The Syntax check command shows a dialog like this when a syntax
error is encountered
364
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
365
SYS 600 9.2 MicroSCADA Pro 1MRS756176
366
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
14.1. General
The SCIL programs of pictures and command procedures can be compiled for better
performance. Compiling a SCIL program means that it is converted into an
operating system independent format which is then executed by a so called virtual
SCIL machine. The compiled code is stored, in addition to the original SCIL code,
in the picture or in the command procedure. Once a SCIL program is compiled, the
compiled version is automatically used instead of the original SCIL code. The
compilation is controlled by means of the corresponding tools, picture editor and
command procedure tool.
The picture change time of a typical single line diagram picture built with LIB500,
which is compiled, is about 2/3 of the time of the uncompiled version.
367
SYS 600 9.2 MicroSCADA Pro 1MRS756176
A compiled SCIL program may be harder to debug, because source lines are not
available at run-time. The error message field in the top left corner of a picture is not
able to show the erroneous SCIL line (only the line number is given). The standard
error dialog of VS objects is also unable to display the line that caused the error. It
is recommended that a SCIL program is first debugged uncompiled, and after that
compiled to a product version.
Example 2:
@END = "_END"
#BLOCK
.DO_SOMETHING
#BLOCK'END'
Example 3:
@A = "1 + "
@B = 'A' 2
368
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
@POWER = OBJECT:P'V'
Example 2:
@A = 1
@B = 2
@C = 'A'.'B' ;The compiler assumes that the right hand
;expression is a VS object or window attribute reference
14.3.4. Recommendations
To avoid the potential problems described above (and to make SCIL programs
more readable), following recommendations on the use of variable expansions may
be given:
• Use direct variable access instead of expansion whenever possible.
Instead of 'A' + 'B', write %A + %B.
As another advantage, the direct variable access is faster than expansion even in
uncompiled programs.
• Use variable expansion mainly for generating various identifiers.
Examples of 'good' usage of expansions might be:
#SET 'LN':PBO1 = 1 ;As an object name
#SET ABC'POSTFIX':PBO1 = 1 ;As a part of an object name
@OLD_ERROR_STATE = ERROR_STATE
#ERROR IGNORE
.DO_SOMETHING
#ERROR 'OLD_ERROR_STATE' ;As a command keyword value
369
SYS 600 9.2 MicroSCADA Pro 1MRS756176
When variable expansions are used as recommended above, the compiled and
uncompiled program always behave identically. Even most cases of other 'non-
pathological' (or even 'pathological') use of expansions work as they are expected.
Examples of such cases:
@V = "PBO1"
#SET OBJECT:'V' = 1
@V = "OBJECT:PBO1"
#SET 'V' = 1
@V = "DIALOG\BUTTON"
.SET 'V'.TITLE = "Push me"
.SET 'V'_2.TITLE = "Push me too"
@NAME = "ABC"
@'NAME' = %'NAME' + 1
370
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
371
SYS 600 9.2 MicroSCADA Pro 1MRS756176
372
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
373
SYS 600 9.2 MicroSCADA Pro 1MRS756176
374
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
15. Index
Symbols
_ATTRIBUTE_NAMES .......................................................................... 55
_CHILD_OBJECTS ................................................................................. 56
_COMPILED ............................................................................................ 56
_FILE_REVISION ................................................................................... 56
_FLAG_FOR_EXECUTION ................................................................... 54
_OBJECT_CLASS ................................................................................... 56
_OBJECT_NAME .................................................................................... 57
_OBJECT_PATH ..................................................................................... 57
_QUEUE_FOR_EXECUTION ................................................................ 55
_SG_GEOMETRY ................................................................................... 57
_SOURCE_FILE_NAME ........................................................................ 57
_VARIABLE_NAMES ............................................................................ 58
A
ABS ........................................................................................................ 146
Absolute value ........................................................................................ 146
Accuracy ................................................................................................... 26
ADD_INTERLOCKED ......................................................................... 305
Addition .............................................................................................. 72, 73
AEP_PROGRAMS ................................................................................. 199
Alarm buffer ............................................................................................. 40
Alarm list .................................................................................................. 40
Alarm picture .......................................................................................... 114
Alarm picture queue ............................................................................... 114
AM .......................................................................................................... 318
AND ......................................................................................................... 77
APL ..................................................................................................... 36, 37
APL_OPCNAM.SDB ............................................................................. 288
APPEND ................................................................................................. 182
Application ......................................................................................... 35, 39
Application engineering ............................................................................. 9
Application objects ................................................................................... 33
APPLICATION_ALARM_COUNT ...................................................... 225
APPLICATION_ALARM_LIST ..................................................... 40, 226
APPLICATION_OBJECT_ATTRIBUTES ........................................... 216
APPLICATION_OBJECT_COUNT ..................................................... 217
APPLICATION_OBJECT_EXISTS ...................................................... 217
APPLICATION_OBJECT_LIST ........................................................... 218
APPLICATION_OBJECT_SELECT ..................................................... 221
ARC ................................................................................................ 310, 311
Arc .......................................................................................... 310, 311, 318
ARC_MODE .......................................................................................... 318
ARCCOS ................................................................................................ 146
ARCSIN ................................................................................................. 146
375
SYS 600 9.2 MicroSCADA Pro 1MRS756176
376
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
377
SYS 600 9.2 MicroSCADA Pro 1MRS756176
378
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
379
SYS 600 9.2 MicroSCADA Pro 1MRS756176
380
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
381
SYS 600 9.2 MicroSCADA Pro 1MRS756176
382
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
J
JOIN_STYLE ................................................................................. 319, 321
JS ............................................................................................................ 321
K
KEY_POS ................................................................................................. 69
Keyed files ................................................................................................ 60
KEYED_FILE_MANAGER .................................................................. 249
L
LAST_PIC .............................................................................................. 114
Less than ................................................................................................... 75
Less than or equal to ................................................................................. 75
Level parameter .............................................................................. 117, 121
LIB500 ........................................................................................................ 9
Library representation ............................................................................ 123
LIN ........................................................................................................... 36
LINE ....................................................................................................... 313
Line ......................................................................................... 313, 319, 321
LINE_STYLE ......................................................................................... 321
LINE_WIDTH ........................................................................................ 322
LIST .................................................................................................. 99, 193
List ...................................................................................................... 25, 30
List aggregate ........................................................................................... 30
LIST_ATTR ........................................................................................... 194
LN ........................................................................................................... 149
LOAD ..................................................................................................... 111
LOAD_DCP ........................................................................................... 272
LOCAL ..................................................................................................... 87
Local variables .......................................................................................... 65
LOCAL_TIME ....................................................................................... 156
LOCAL_TIME_ADD ............................................................................ 156
LOCAL_TIME_INFORMATION ......................................................... 157
LOCAL_TIME_INTERVAL ................................................................. 157
LOCAL_TO_SYS_TIME ...................................................................... 158
LOCAL_TO_UTC_TIME ...................................................................... 158
LOCATE ................................................................................................ 174
Logical names ........................................................................................... 23
Logical operator .................................................................................. 72, 77
Logical path ............................................................................................ 101
Logical representation library ................................................................. 103
LOOP ........................................................................................................ 88
LOOP_END ....................................................................................... 88, 90
LOOP_EXIT ............................................................................................. 90
LOOP_WITH ........................................................................................... 90
LOW ....................................................................................................... 185
LOW_INDEX ......................................................................................... 185
383
SYS 600 9.2 MicroSCADA Pro 1MRS756176
384
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
385
SYS 600 9.2 MicroSCADA Pro 1MRS756176
386
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
387
SYS 600 9.2 MicroSCADA Pro 1MRS756176
388
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
389
SYS 600 9.2 MicroSCADA Pro 1MRS756176
390
1MRS756176 MicroSCADA Pro SYS 600 9.2
Programming Language SCIL
Technical Description
U
Uncommenting ....................................................................................... 359
Undo ....................................................................................................... 357
Undoing in SCIL Program Editor ........................................................... 363
Unequal ..................................................................................................... 75
UNPACK_STR ...................................................................................... 178
UPDATE ................................................................................................ 117
Update program ........................................................................................ 16
Update time interval ............................................................................... 117
UPPER_CASE ....................................................................................... 179
USER .............................................................................................. 315, 316
User Interface Objects ........................................................................ 33, 52
UTC_TIME ............................................................................................ 166
UTC_TIME_ADD .................................................................................. 166
UTC_TIME_INTERVAL ...................................................................... 166
UTC_TO_LOCAL_TIME ...................................................................... 167
UTC_TO_SYS_TIME ............................................................................ 167
V
VALIDATE ............................................................................................ 209
VALIDATE_OBJECT_ADDRESS ....................................................... 209
Variable .............................................................................................. 13, 65
Variable Assignment ................................................................................ 67
Variable expansion ................................................................................... 68
Variable object .............................................................................. 38, 39, 47
VARIABLE_NAMES ............................................................................ 198
VECTOR ................................................................................................ 193
Vector ................................................................................................. 25, 29
Vector aggregate ....................................................................................... 29
Vector function ....................................................................................... 182
VIDEO_NR .............................................................................................. 69
Visual SCIL ................................................................................................ 9
Visual SCIL Commands ........................................................................... 79
Visual SCIL objects .......................................................................... 48, 109
W
WEEK ..................................................................................................... 167
WHEN ...................................................................................................... 84
Widget .................................................................................................... 333
Widget methods ...................................................................................... 336
Widget resource ...................................................................................... 337
Widget.method ....................................................................................... 336
WIN_BG_COLOR ................................................................................. 119
WIN_CREATE ....................................................................................... 120
WIN_INPUT .......................................................................................... 120
WIN_NAME .......................................................................................... 121
WIN_PIC ................................................................................................ 122
391
WIN_POS .............................................................................................. 122
WIN_REP .............................................................................................. 123
Window .......................................................................................... 117, 118
Window level ......................................................................................... 117
Workstation .............................................................................................. 37
WORKSTATION_CALL ...................................................................... 198
WRITE ................................................................................................... 108
WRITE_BYTES .................................................................................... 256
WRITE_COLUMNS .............................................................................. 256
WRITE_PARAMETER ......................................................................... 257
WRITE_TEXT ....................................................................................... 257
X
XOR ......................................................................................................... 77
Y
YEAR ..................................................................................................... 167
1MRS756176 EN 03.2008
ABB Oy
Substation Automation Products
P.O. Box 699
FI-65101 Vaasa
FINLAND
Tel. +358 10 22 11
Fax. +358 10 224 1094
www.abb.com/substationautomation