Programming Language SCIL
Programming Language SCIL
Issued: 15.03.2002
Version: A
Technical Reference Manual
Program revision: 8.4.4
Notice 1
The information in this document is subject to change without notice and should not
be construed as a commitment by ABB. ABB assumes no responsibility for any error
that may occur in this document.
Notice 2
This document complies with the program revision 8.4.4.
Notice 3
Additional information such as Release Notes and Last Minute Remarks can be
found on the program distribution media.
Trademarks
1 Introduction 1
2 Programming in SCIL 2
3 Data types 3
4 Objects and files 4
5 Variables 5
6 Expressions 6
7 SCIL statements 7
8 Functions 8
9 Graphics primitives 9
10 Using motif widgets in SCIL 10
11 SCIL programming guide 11
12 SCIL editor 12
13 The SCIL compiler 13
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual Contents
Contents:
1. Introduction ...............................................................................1
1.1. Presentation of SCIL .....................................................................1
1.2. SCIL programs ..............................................................................3
1.3. SCIL statements ............................................................................5
1.4. Organization of this manual ..........................................................5
2. Programming in SCIL ...............................................................7
2.1. SCIL programming environment ...................................................7
2.2. SCIL programming rules .............................................................13
3. Data types ................................................................................17
3.1. General .......................................................................................17
3.2. Integer .........................................................................................17
3.3. Real .............................................................................................18
3.4. Boolean .......................................................................................19
3.5. Time ............................................................................................19
3.6. Text .............................................................................................20
3.7. Bit string ......................................................................................20
3.8. Byte string ...................................................................................20
3.9. Vector ..........................................................................................21
3.10.List ..............................................................................................22
3.11.Accessing components of structured data ..................................22
4. Objects and files .....................................................................25
4.1. General .......................................................................................25
4.2. System objects ............................................................................26
4.2.1. General ............................................................................26
4.2.2. Base system objects (B) ..................................................27
4.2.3. Communication system objects .......................................28
4.3. Application objects ......................................................................29
4.3.1. General ............................................................................29
4.3.2. Process objects (P) ..........................................................31
4.3.3. Scales (X) ........................................................................33
4.3.4. Data objects (D) ...............................................................33
4.3.5. Command procedures (C) ...............................................35
4.3.6. Time channels (T) ............................................................36
4.3.7. Event channels (A) ...........................................................36
4.3.8. Event objects (E) ..............................................................37
4.3.9. Variable objects (V) ..........................................................38
4.4. User interface objects .................................................................39
4.4.1. Visual SCIL objects ..........................................................39
4.4.2. Pictures ............................................................................42
4.5. Predefined VS object, window and picture function methods .....45
MicroSCADA Programming Language SCIL 1MRS751849-MEN
1. Introduction 1
This chapter introduces the SCIL programming language, the MicroSCADA
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 MicroSCADA. All MicroSCADA application programs as well as most
system configuration programs are built in SCIL.
Application engineering
In MicroSCADA, ’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 1.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 MicroSCADA applications, even in
those which are built with LIB 500, because the LIB 500 standard application
software is built with SCIL.
1
MicroSCADA Programming Language SCIL 1MRS751849-MEN
)LJ $0LFUR6&$'$VFUHHQYLHZVKRZLQJWKUHHGLDORJVRQHFRQWDLQLQJDSLFWXUH
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.
2
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 1. Introduction
)LJ )HDWXUHVFRQWUROOLQJWKH6&,/SURJUDPH[HFXWLRQDQGIHDWXUHV
FRQWUROOHGE\6&,/
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
3
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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 2.
Example
The example in Figure 1.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).
)LJ $6&,/SURJUDPIRUWKHLQSXWDQGFRQWURORIDSDVVZRUG
4
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 1. Introduction
Statement format
The components above can be combined into statements according to one of the
following three formats :
command {arguments} (1)
variable = expression (2)
name.program {arguments} (3)
Type (1) (described in Chapters 7, 9 and 10) 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 5) 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 4.
5
MicroSCADA Programming Language SCIL 1MRS751849-MEN
6
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 2. Programming in SCIL
2. Programming in SCIL
This chapter describes the SCIL programming environment and the rules for
programming in SCIL: 2
2.1 The programming environment: the MicroSCADA objects where SCIL
programs and expressions are found, the programming tools in brief, the use
of SCIL expressions in external applications via DDE.
2.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 MicroSCADA 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 MicroSCADA 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 MicroSCADA 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”.
7
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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 GUDZSURJUDP 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.
• AVWDUWSURJUDPexecuted after the draw program. The start program is used for
basic definitions such as initial variable values, update interval, and program
blocks.
• An XSGDWHSURJUDP, which is executed repeatedly at intervals defined by a SCIL
command (the !UPDATE command, see Chapter 7) as long as the picture is
displayed on screen.
• AnH[LWSURJUDP, which is executed each time the picture is closed (even at exit
by clicking three times in the upper left corner of the picture).
• )XQFWLRQNH\SURJUDPV executed at each click on the function keys to which
they belong.
• 1DPHGSURJUDPVexecuted 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 4.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 11.
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 2.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.
8
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 2. Programming in SCIL
)LJ $QH[DPSOHRIDZLQGRZGHILQLWLRQ
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 4.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.
In addition, each Visual SCIL object may have an arbitrary number of user defined
methods which are executed by a method call (see Section 4.4).
9
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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 10000
lines (see Figure 2.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.
)LJ $QH[DPSOHRIDFRPPDQGSURFHGXUH
Data objects
The data objects (datalog objects) are objects for the registration and storage of data.
The object definition, see Figure 2.1.-3, contains a SCIL expression which states
how the data is to be calculated.
Data objects are described in the Application Objects manual.
10
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 2. Programming in SCIL
)LJ $QH[DPSOHRIDGDWDREMHFWGHILQLWLRQ
Time channels
The time channels control the execution of time-bound activities. By conditions
which are SCIL expressions, see Figure 2.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.
11
MicroSCADA Programming Language SCIL 1MRS751849-MEN
)LJ $QH[DPSOHRIDWLPHFKDQQHOGHILQLWLRQ
12
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 2. Programming in SCIL
The DDE Server function in MicroSCADA supports the following SCIL data types
(see Chapter 3): 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 8. 2
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 MicroSCADA 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 10000 lines, and each line up to 255 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 6) 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 3).
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
3).
Examples
The following two SCIL-programs are functionally equivalent:
([DPSOH
@T = TEMP:PAI1
#IF %T> 90 #THEN #BLOCK
#SET C:PBO2=0
13
MicroSCADA Programming Language SCIL 1MRS751849-MEN
#PRINT 2 OVERHEAT
#BLOCK_END
#ELSE_IF %T< 70 #THEN #SET C:PBO2=1
([DPSOH
@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.
Table 1:
Symbol Meaning in SCIL
- minus sign, continuation of program line
+ plus sign
* multiplication
** exponential operator
/ division, separator in paths
\ separator in Visual SCIL object paths
() parantheses, enclose indexing and argument
lists
, an enumeration
. decimal point, marks a graphics or Motif
command, an attribute or a method
.. index interval
" encloses a text
@ global variable assignment
% global variable access
’ variable expansion
# precedes a control command
! precedes a picture command
: follows an object name
; starts a comment
= assignment
== equal to
> greater than
14
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 2. Programming in SCIL
Table 1:
Symbol Meaning in SCIL
>=
<
greater than or equal to
less than 2
<= less than or equal to
<> not equal to
^ an octal number
SCIL names
Most user interface objects (picture and Visual SCIL objects, see Chapter 4) and
application objects (see Chapter 4) 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 NT 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)
15
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 3. Data types
3. Data types
This chapter describes the SCIL data types: integer, real, boolean, time, text, bit
string, byte string, vector and list.
3.1. General 3
Data types
In SCIL there are six types of simple data (data constituted of single values):
LQWHJHU,UHDOERROHDQWLPHWH[W ELWVWULQJandE\WHVWULQJ.
In addition, there are two types of structured data: the data type YHFWRU represents an
ordered array of data elements, and the data type OLVWrepresents 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 QRQH 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 8.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 8.2). The status codes are listed in the Status Codes
manual.
3.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 (^).
17
MicroSCADA Programming Language SCIL 1MRS751849-MEN
Example
Examples of some valid integer constants:
256
0
000123
-5
777^
The last one represents integer value 511(decimal).
3.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 3.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.
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 -16777216 .. +16777216 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 8.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 8.3 for functions whose name is prefixed by "HIGH_PRECISION_".
18
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 3. Data types
Example
Examples of some valid real numbers:
0.0
1234.56789
2147483648
5. 3
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.
3.4. Boolean
Description
Boolean data may take two values: )$/6( and 758(.
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:
([SUHVVLRQ %RROHDQYDOXH
4 + 1 == 5 TRUE
"NIGHT" == "DAY" FALSE
ODD(5) TRUE
3.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 8.4.
19
MicroSCADA Programming Language SCIL 1MRS751849-MEN
3.6. Text
Description
Text data is composed of 0 to 255 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 (255 today).
Text values may be compared and concatenated (’added’ using + operator) (See
Chapter 6). For various predefined functions that operate on text data, see Section
8.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 65535. The
bits in a string are numbered from 1 to 65535 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 (65535 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 8).
Bit strings may be compared and concatenated (’added’ using + operator) (See
Chapter 6). For functions that manipulate bit strings on bit level, see Section 8.6.
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"
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
20
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 3. Data types
3.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 10000 elements numbered from 1 to 10000.
Symbolic name MAX_VECTOR_LENGTH may be used to refer to the vector
length limit of the current implementation (10000 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 8.7.
For accessing elements of a vector, see Section 3.11.
Vector aggregate
A vector can be written as a YHFWRUDJJUHJDWH 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().
Example
An example of a vector aggregate of five elements:
(-23, "NAME", 0.000001, CLOCK, A + B)
21
MicroSCADA Programming Language SCIL 1MRS751849-MEN
3.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 10000 attributes. Symbolic name
MAX_LIST_ATTRIBUTE_COUNT may be used to refer to the attribute count
limit of the current implementation (10000 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 8.8.
For accessing attributes of a list, see Section 3.11.
List aggregate
A list can be written as a OLVWDJJUHJDWH 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:
Table 3.10.-1
Attribute name: LN IX UN OA OB OV ....
Index
1 "A" 4 10 3560 7 0 ....
2 "B" 2 11 3430 16 5.5 ....
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))
22
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 3. Data types
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
23
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
4.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 nine types of application objects:
Process 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:
- 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.
25
MicroSCADA Programming Language SCIL 1MRS751849-MEN
4.2.1. General
Overview
The system objects define the hardware and software configuration of the entire
MicroSCADA system, as well as the data communication with connected devices.
There are two types of system objects:
• %DVHV\VWHPREMHFWV%which define the base system configuration.
• &RPPXQLFDWLRQV\VWHPREMHFWV6 which are images of the physical system
devices connected to the communication units (NETs).
The base system objects are stored in the RAM memory of the base system computer
as long as MicroSCADA 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.
26
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
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 .. 99)
PRIn Printers ( n = 1 .. 20)
MONn Monitors (n = 1 .. 50)
INDn Input devices: keyboard, mouse, control board (n = 1 .. 50)
27
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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.
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)
28
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
Some attributes
4
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.
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:
4.3.1. General
Object types
The application objects are programmable units which perform various functional
tasks in the MicroSCADA application. They constitute data images of physical
process or system devices, data registers, SCIL programs, scaling algorithms,
facilities for automatic activation, etc.
29
MicroSCADA Programming Language SCIL 1MRS751849-MEN
30
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
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 7.2).
Some process objects have no correspondence in the stations. These are called
ILFWLWLRXVprocess 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 4.3.8), and activation of an event
channel (Section 4.3.7).
Process objects with active alarms are included in an DODUPEXIIHU, which can be
read by SCIL process queries (the function PROD_QUERY, Chapter 8) and
displayed as alarm lists. If desired, the process object events can be stored in a
KLVWRU\GDWDEDVH, which can similarly be read with process queries and displayed
as event lists.
31
MicroSCADA Programming Language SCIL 1MRS751849-MEN
32
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
Examples
Some examples of process object notations:
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 analog process object has a scale name, which defines the scaling algorithm
is 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.
The data registration may be initiated from a program (by means of the commands
#EXEC and #EXEC_AFTER, see Section 7.2), from a time channel (Section 4.3.6.)
or from an event channel (Section 4.3.7). Each registration is performed according
33
MicroSCADA Programming Language SCIL 1MRS751849-MEN
Examples
Some examples of data object notations:
34
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
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
4
7.2). (A command procedure can even start itself).
• From time channels (Section 4.3.6).
• From event channels (Section 4.3.7).
A command procedure can hold up to 10000 SCIL statements. As a rule, command
procedures may not contain user interface related commands (picture commands,
Visual SCIL commands or graphical commands, see Section 7.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 7.2) and the DO function (Chapter 8). In
these cases, it may contain user interface commands if the #DO command or DO
function is executed in a user interface object.
Examples
Some examples of command procedure notations:
35
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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 H[HFXWLRQWLPHwhich means that the connected
objects are executed. At theLQLWLDOL]DWLRQWLPH 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 7.2) and
with event channels (Section 4.3.7).
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
36
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
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 or BS) is changed. 4
• 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 7.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 7.2) for the specific event object. The
#ON commands are valid only for the actual picture - main picture or sub-picture -
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
7.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.
37
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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 3.9). The list as a whole is handled as a variable with the same name as the
object (Chapter 5). 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 7.2) and
assigning it attribute values with a list function or with the #SET command
(Section 7.2). In this case, the attribute names may be arbitrary, up to 63
characters.
• By assigning a global variable a value of list type (Section 5.4). A variable object
with the same name as the variable is formed. The variable object gets all the
attributes of the list expression.
A variable object notation must always contain an attribute. Unlike the other object
types, the names of the variable object attributes can contain up to 63 characters. If
the attribute is of vector type, the vector elements are identified by indices. An object
notation without an index denotes the whole vector. If the attribute name contains
more or less characters than two, the index must be enclosed by parentheses.
As global variables (Chapter 5), variable objects are accessible within the SCIL
context they are created in.
38
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
Examples
The statement
@VAR = PROD_QUERY(20)
assigns the variable VAR the list value returned by the function PROD_QUERY
(Chapter 8). The variable may be accessed as variable object VAR:V.
Some variable object notations:
Variable objects are more or less obsolete. Attributes of list type variables may be
accessed in a more powerful way by using data component access described in
Section 3.11. For example, VAR:VLN1 may be written as %VAR.LN(1), when
read, or @VAR.LN(1), when written.
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.
• 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.
39
MicroSCADA Programming Language SCIL 1MRS751849-MEN
The SCIL commands for handling Visual SCIL objects are detailed in Section 7.3.
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 4.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.
)LJ $QH[DPSOHRIDGLDORJV\VWHP
40
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
can be set in the dialog editor, some only with SCIL, and some both in the editor and
with SCIL.
The dynamic changes of the dialogs and dialog items are obtained by changing their
attribute values with the SCIL commands .SET and .MODIFY.
Each object has a number of predefined attributes with predefined names, data types
and meanings. The predefined attributes of each object type are listed and described
in the Visual SCIL Objects manual. In addition, the objects can be given an arbitrary
number of user defined attributes with the .LOAD, .CREATE and .MODIFY 4
commands.
Each dialog and dialog item may have a number of methods which are programs for
various purposes, e.g. cyclically executed programs, programs executed on certain
events (event objects), programs started by a user operation, and programs started
by SCIL.
The programs started by SCIL may be predefined or user defined. They are started
by a method call of the format described below.
Attribute references
Attributes are referenced with the following notations:
>REMHFW@DWWULEXWH>FRPSRQHQW@
where ’object’ is an object reference, ’attribute’ is the name of the attribute and
’component’ addresses a component of structured data, see Chapter 3.
If the attribute or method is referenced from a method within the same object, no
object reference is needed.
41
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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 5.
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:
>REMHFW@PHWKRG>DUJXPHQWBOLVW@
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.
4.4.2. Pictures
General
The pictures and picture components were briefly described in Chapter 2. 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 7.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 4.4.2.-1 shows an example of such a hierarchy. A, B, C,
D, E and F denotes windows and picture functions.
42
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
)LJ $KLHUDUFKLFDOSLFWXUHVWUXFWXUH7KHVXESLFWXUHVDUHSLFWXUH
IXQFWLRQVRUSLFWXUHVVKRZQLQZLQGRZV7KHOHWWHUV$)GHQRWHV
WKHQDPHVRIZLQGRZVDQGSLFWXUHIXQFWLRQV
A picture containing sub-pictures is the parent of its sub-pictures and the contained
sub-pictures are children. This parent - child - relationship is of importance for how
the windows are shown in relation to other windows. It is also of importance when
referencing windows and named programs.
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:
QDPHQDPHQDPHQDPH
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 4.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 4.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.
43
MicroSCADA Programming Language SCIL 1MRS751849-MEN
44
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
([DPSOH
A/B.CREATE_ERROR_DIALOG
Executes the named program CREATE_ERROR_DIALOG of window B which is a child
window of window A.
@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.
45
MicroSCADA Programming Language SCIL 1MRS751849-MEN
46
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
4.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
8.15.
47
MicroSCADA Programming Language SCIL 1MRS751849-MEN
)LOH and GLUHFWRU\WDJV are abstract, operating system independent identifiers, that
are formed from textual file and directory names by means of file management
functions described in Section 8.15.
AGLUHFWRU\ may be identified in one of the following ways:
"/dir1/dir2/.../name/"names a directory relative to MicroSCADA root in an
operating system independent way, e.g. "/APL/TIPPERARY/APL_/".
• By an operating system file path, e.g. "D:\SC\APL\TIPPERARY\APL_\".
• By an operating system independent directory tag created from a SCIL directory
name or an operating system directory name.
A ILOHmay be identified in one of the following ways:
• "path/name" identifies a file contained in a logical path in an operating system
independent way. The logical paths are simple names given to a directory or a
search list of directories, see Section 7.2.4 for more information on logical paths.
• "name" identifies a file contained in the default directory of the SCIL context or
in the logical path derived from the file name. The default directory is normally
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 MicroSCADA 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.
48
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
3DUDPHWHUILOHV are special purpose files of predefined format similar to INI files of
used by various utilities of Windows operating system. They are designed to save
settings of tool programs from invocation to another. SCIL functions
READ_PARAMETER, WRITE_PARAMETER and DELETE_PARAMETER
implement the handling of parameter files. The format of parameter files is
described in Appendix C.
While a text file is being written, no other SCIL program may read or write the file.
Consequently, if a text file is used to pass data from a SCIL program to another SCIL
program that may be executing in parallel, the access of file should be synchronized
4
between the programs, for example using function FILE_LOCK_MANAGER.
For descriptions of functions mentioned above, see Section 8.14.
General
Keyed files are random access files that consist of GDWD UHFRUGV. The maximum
length of a data record is 508 characters.
The beginning of the data record contains the NH\ 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.
49
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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.
The GDWDEORFNV 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 LQGH[EORFNV 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 VWDWXV EORFNwhich 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 8.14) 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.
50
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 4. Objects and files
• 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.
4
Use
Keyed files are widely used within MicroSCADA 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
For application specific purposes, keyed files may be used by file handling
commands described in Section 7.2.5.
51
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 5. Variables
5. Variables
This chapter describes the use of variables in SCIL:
5.1 General: Variable names and scope of variables
5.2 Local variables
5.3 Global variables
5.4 Using variables
5.5 Predefined picture variables
5.1. General
5
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 3) 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 2.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 ORFDOYDULDEOHVare temporary variables that are available only within the SCIL
program where they are declared. They exist only while the SCIL program is
executing.
The JOREDOYDULDEOHV 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).
53
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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 4).
• 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 4).
• 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 7.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 5.5).
54
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 5. Variables
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 3.11 for component 5
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.
55
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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 6).
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
LN = "P_METER" The variable LN is assigned the text value
IX = 22 "P_METER" and the variable IX value 22
PRESSURE = 'LN':PAI’IX’ The variable PRESSURE is assigned the AI
attribute value of the process object
P_METER with index 22.
OBJ = LIST(LN = “P_METER”, IX = 22) Same as above but using attributes.
PRESSURE = ‘OBJ.LN’:P’OBJ.IX’
56
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 5. Variables
57
MicroSCADA Programming Language SCIL 1MRS751849-MEN
Examples
Statement Meaning
#EXEC EVENT_’VIDEO_NR’:E An event object containing the video number
#ON EVENT_’VIDEO_NR’:E !SHOW .... is activated. In combination with #ON
sequences, likewise defined with video
number, the event is directed to the same
monitor.
#IF %CURSOR_POS(2) = 40 #THEN ...... A statement is executed on the condition that
the pressed line is number 40.
#PRINT 1 ’PIC_NAME’ The current screen picture is printed.
58
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 6. Expressions
6. Expressions
This chapter describes how to compose SCIL expressions using various types of
operators:
6.1 General Principles
6.2 Arithmetical Operators
6.3 Relational Operators
6.4 Logical Operators
Use 6
In SCIL, expressions are used as follows:
• For value assignments (objects, attributes, variables).
• As arguments for functions and commands.
• As operands in expressions.
By using SCIL expressions, MicroSCADA application data can be accessed from
external Windows applications via the DDE protocol.
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 3).
• a variable or a component of a variable (Chapter 5).
• a system or application object attribute or its component (Chapter 4).
• an attribute of a Visual SCIL or window object or its component (Chapter 4).
• a function call (Chapter 8).
• a vector or a list aggregate (Chapter 3).
• a named program or a method call, provided that the program returns a value
(Chapter 4).
• 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 8).
59
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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. 6.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.
60
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 6. Expressions
)LJ $GGLWLRQUXOHV
)LJ 6XEWUDFWLRQUXOHV
When adding a numeric (integer or a real) operand to a time operand, or subtracting
it from a time operand, the numeric operand is considered as seconds and the result
is a moment of time specified number of seconds in the future or in the past.
When two time type operands are subtracted, the result is an integer number stating
the time difference in seconds.
The result of adding two texts, two bit strings or two byte strings is the concatenation
of the two strings.
When one operand is a simple value and the other one is a vector, the operation is
carried out element by element and the result is a vector.
When both operands are vectors, the operation is carried out element by element and
the result is a vector of the length of the longer operand. If the vectors are different
in length, the ’missing’ elements of the shorter vector are regarded as zero or an
empty string (depending on the data type of the ’odd’ element) and the status of the
result element is set to SUSPICIOUS_STATUS.
61
MicroSCADA Programming Language SCIL 1MRS751849-MEN
)LJ 0XOWLSOLFDWLRQUXOHV
)LJ 'LYLVLRQUXOHV
)LJ ',9DQG02'UXOHV
When one operand is a simple value and the other one is a vector, the operation is
carried out element by element and the result is a vector.
When both operands are vectors (allowed only in multiplication), the operation is
carried out element by element and the result is a vector of the length of the longer
operand. If the vectors are different in length, the ’missing’ elements of the shorter
vector are regarded as 1 and the status of the result element is set to
SUSPICIOUS_STATUS.
A vector cannot be divided by another vector.
62
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 6. Expressions
)LJ ([SRQHQWUXOHV
If both operands are integers and the right operand is non-negative, the result is an
integer. For example, (-2)**3 evaluates to integer -8. 6
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
"A" + "B" "AB"
3**2 9
3.0**2 9.0
5 DIV 2 2
5 MOD 2 1
2*3 + 4/2 8.0
(2*3 + 4)/2 5.0
BIT_SCAN("0101") + BIT_SCAN("0011") BIT_SCAN("01010011")
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
63
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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. 6.3.-1) presents rules for what data types may be compared by means of
relational operators.
Examples
Below are some examples of expressions containing relational operators.
Expression Result
"B" > "A" TRUE
%A - 30 == 0 TRUE, if %A == 30
OBJ:PRT + 60 > CLOCK TRUE, as long as less than one minute has
passed since the latest registration time
BIT_SCAN("0011") < BIT_SCAN("0101") TRUE
64
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 6. Expressions
Expression Result
BIT_SCAN("0101") < TRUE
BIT_SCAN("010101")
BIT_SCAN("000111") < TRUE
BIT_SCAN("0101")
BIT_SCAN("010100") > TRUE
BIT_SCAN("0101")
Use
With logical operators boolean values can be operated upon.
6
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:
A B A AND B A OR B A XOR B NOT A
TRUE FALSE FALSE TRUE TRUE FALSE
FALSE TRUE FALSE TRUE TRUE TRUE
TRUE TRUE TRUE TRUE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE TRUE
:URQJ A == 1 AND B == 2 OR C == 3
5LJKW (A == 1 AND B == 2) OR C ==3
RU A == 1 AND (B == 2 OR C == 3)
65
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
7. SCIL statements
This chapter describes the SCIL statements. It is divided into four sections as
follows:
7.1 General: The different types of SCIL statements, their arguments, and a table
over all general SCIL statements, Visual SCIL commands and picture
commands.
7.2 General SCIL statements: The statements listed and described
7.3 Visual SCIL Commands: The Visual SCIL commands listed and described
7.4 Picture Commands: The picture handling commands listed and described
7.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.
67
MicroSCADA Programming Language SCIL 1MRS751849-MEN
Overview
Table 7.1.-1 General SCIL statements and Visual SCIL commands.
Statement Brief Description Page
Assignment statement Assigns a value to a variable. 71
#ARGUMENT Declares arguments of the program. 71
#BLOCK , #BLOCK_END Compounds statements into one. 72
#CASE, #CASE_END Multibranched conditional execution. 72
#CLOSE_FILE Closes a keyed file. 92
#CREATE Creates a new application or base system object. 81
#CREATE_FILE Creates and opens a new keyed file. 92
#DELETE Deletes an application object. 81
#DELETE_FILE Deletes a file. 92
#DO Executes the SCIL program given as an argument. 73
#ELSE Defines a branch within an #IF statement. 75
#ELSE_IF Defines a branch within an #IF statement. 75
#ERROR CONTINUE, Defines the error handling policy. 73
#ERROR EVENT
#ERROR IGNORE,
#ERROR STOP
#ERROR RAISE Raises a SCIL error. 74
#EXEC Queues an application object for execution. 82
#EXEC_AFTER Queues an application object for execution after a time delay. 82
#GET Updates process object values. 82
#IF Conditional execution. 75
#INIT_QUERY Initiates a process query. 83
#LIST Prints process object data. 87
#LOCAL Declares local variables of the program. 75
#LOOP, #LOOP_END Executes a sequence of statements in a loop. 76
#LOOP_EXIT Interrupts a loop. 78
#LOOP_WITH, #LOOP_END Executes a loop a number of times. 77
#MODIFY Changes an application object definition. 84
#ON Declares a program block to be executed when an event occurs. 78
#ON ERROR Defines an error handler. 79
#ON KEY_ERROR Defines a key error handler. 79
#OPEN_FILE Opens a keyed file. 92
#OTHERWISE Defines the default branch within a #CASE statement 72
#PATH Defines a logical path. 88
#PAUSE Takes a pause. 79
#PRINT Prints a picture. 88
#READ Reads a data record from a keyed file. 93
#READ_KEYS Reads the keys of a keyed file. 93
#READ_NEXT Reads a data record from a keyed file. 94
#READ_PREV Reads a data record from a keyed file. 94
#REMOVE Deletes a data record from a keyed file. 94
68
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
69
MicroSCADA Programming Language SCIL 1MRS751849-MEN
70
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
>#@QDPH>FRPSRQHQW@
YDOXH
Assigns a value to a variable.
’name’ The name of the variable.
’component’ Component of structured data, see Chapter 3.
’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.
([DPSOHV
@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 7
$5*80(17QDPH>QDPH@
Declares arguments of the program.
’name’ Any valid SCIL name, the name of the argument.
The #ARGUMENT statement names the arguments to be passed to the program by
the caller (in the order they should be given by the caller). All arguments may be
listed in one statement, or several subsequent #ARGUMENT statements may be
written. The two ways are equivalent as long as the arguments are declared in same
order.
Arguments may be freely named using up to 63-character long identifiers.
Arguments and global variables may have a same name. If an argument has a name
of a predefined SCIL language element, such as a SCIL function, the predefined
meaning is hidden and it cannot be used within that SCIL program. For example, if
a SCIL program declares an argument named MAX, the predefined SCIL function
MAX is no more available in the program.
The #ARGUMENT statements must be located at the beginning of program, before
any other statements. Within the program, the argument name ’name’ may be used
as if it were a read-only local variable.
When a SCIL program that has declared its arguments is called by another SCIL
program, the number of arguments supplied by the caller is checked. If the caller
does not supply a value to each named argument, a SCIL error
SCIL_ACTUAL_ARGUMENT_MISSING is raised. On the other hand, additional
arguments are allowed. They may be handled by the called program using SCIL
functions ARGUMENT_COUNT and ARGUMENT, see the example below.
([DPSOH
This example shows how a method with two obligatory and one optional argument
may be implemented.
; Calling sequence of this method:
; MY_METHOD(A, B [,C])
; Default value for the optional argument C is 0.
71
MicroSCADA Programming Language SCIL 1MRS751849-MEN
#ARGUMENT A, B
#LOCAL C = 0
#IF ARGUMENT_COUNT == 3 #THEN C = ARGUMENT(3)
%/2&.
>VWDWHPHQW@
%/2&.B(1'
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.
([DPSOH
#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"
&$6( YDOXH
>:+(1 VHOHFWRUVWDWHPHQW@
>27+(5:,6(VWDWHPHQW@
&$6(B(1'
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.
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.
([DPSOHV
#CASE C
72
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
#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)
7
#WHEN "INTEGER" T = 1
#WHEN "REAL" T = 2
#OTHERWISE !SHOW W "SIMPLE NUMERIC DATA EXPECTED"
#CASE_END
'2SURJUDP
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 7.2.2), 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.
([DPSOH
#DO READ_TEXT("ABC.TXT")
;The SCIL program in the file ABC.TXT is executed.
#DO ABC:C
;The program (IN attribute) of the command procedure ABC is executed.
(5525,*125(
(5525&217,18(
(55256723
(5525(9(17
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
73
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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.
(55255$,6(>VWDWXV@
Raises a SCIL error.
’status’ Integer expression. The status code to be activated. Default: the
latest error code occurred in the program.
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.
([DPSOH
#ON ERROR #BLOCK
#IF STATUS == STATUS_CODE("SCIL_APL_APL_COMMUNICATION_TIMEOUT") #THEN -
74
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
,)FRQGLWLRQ7+(1VWDWHPHQW
>(/6(B,)FRQGLWLRQ7+(1VWDWHPHQW@
>(/6(VWDWHPHQW@
Conditional execution.
’condition1’
’condition2’ Boolean type expressions
’statement1’
’statement2’
’statement3’ Any SCIL statements.
If ’condition1’ is TRUE, ’statement1’ is executed and the rest of the #IF statement is
skipped. Otherwise, if any ’condition2’ is TRUE, the corresponding ’statement2’ is
executed and the rest is skipped. If none of ’condition1’ or ’condition2’ is TRUE,
7
’statement3’ is executed.
([DPSOHV
#IF HOUR >= 7 AND HOUR < 15 #THEN SHIFT = "MORNING"
#ELSE_IF HOUR >= 15 AND HOUR < 23 #THEN SHIFT = "EVENING"
#ELSE SHIFT = "NIGHT"
75
MicroSCADA Programming Language SCIL 1MRS751849-MEN
Additionally, in every SCIL command that takes a variable name as its parameter, a
local variable name may be used (but not an argument name, because arguments are
read-only). The list of such SCIL commands follows:
#LOOP_WITH YDU = low .. high
#OPEN_FILE n apl file NH\OHQJWK
#READ n key GDWD[GDWD]
#READ_KEYS n YHFWRU[key1 [key2]]
#READ_NEXT n key GDWD[GDWD]
#READ_PREV n key GDWD[GDWD]
.MOUSE [, \, [,EXWWRQ [,EXWWRQV [,RELATIVE]]]
!INPUT_KEY keytext YDU
!INPUT_POS YDU
!INPUT_VAR [picture path]window YDULDEOH [max_length]
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.
([DPSOH
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()
/223>FRQGLWLRQ@
>VWDWHPHQW@
/223B(1'>PD[@
Executes a sequence of statements in a loop.
’condition’ A boolean expression, a precondition for entering the body of the
loop. Default value: TRUE.
’statement’ Any SCIL statements, the body of the loop.
’max’ The maximum number of times the loop is iterated. An integer
expression. Default value: 1000.
The body of the loop is executed repeatedly as long as the ’condition’ is TRUE, or
until the loop is interrupted in one of the following ways:
• Statement #LOOP_EXIT (see below) is executed in the loop body. This is no
error situation.
• The maximum number of loop iterations is reached. In this case, error
SCIL_MAX_LOOP_COUNT_EXCEEDED is raised.
76
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
/223B:,7+YDU ORZKLJK
>VWDWHPHQW@
/223B(1'
Executes a loop a number of times.
'var' The name of the control variable of the loop. The name refers to
a local variable by that name, if such a variable is declared,
otherwise to a global variable.
'low' The value of the control variable at the first loop execution, an
integer expression.
'high' The value of the control variable at the last loop execution, an
integer expression.
'statement' Any SCIL statements, the body of the loop.
77
MicroSCADA Programming Language SCIL 1MRS751849-MEN
The body of the loop is executed repeatedly a number of times, calculated as ’high’
- ’low’ + 1. Each time the loop is completed, the variable ’var’ is incremented by one.
If ’high’ is less than ’low’, the body is not executed at all.
The loop may be interrupted before ’var’ reaching ’high’ in the following ways:
• Statement #LOOP_EXIT (see below) is executed in the loop body. This is no
error situation.
• An emergency interruption is done from another SCIL program (in another
monitor). In this case error SCIL_PROGRAM_EXTERNALLY_TERMINATED
is raised. See command #LOOP above for details of emergency interruption.
([DPSOH
#LOOP_WITH I = 1 .. LENGTH(%V)
!SHOW WIN’I’ %V(%I)
#LOOP_END
;Each element of the vector variable V is shown in a separate window.
/223B(;,7
Interrupts a loop.
The statement interrupts the innermost loop (#LOOP or #LOOP_WITH) it is
textually located in.
([DPSOH
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
21 HYHQW>VWDWHPHQW@
Declares a program block to be executed when an event occurs.
'event' An event object notation.
'statement' Any SCIL statement.
#ON command stores the 'statement' as the event program for 'event' in the current
user interface object (main picture, window picture, picture function or Visual SCIL
object). Later, the 'statement' will be executed each time the event object is activated.
If 'statement' is omitted, the previous #ON command for the same event object is
cancelled.
Only one event program for a particular event is stored in each user interface object,
second #ON command for the same event replaces the first one. However, each
window picture, picture function or VS object may have its own event program for
each event.
This command can be used only in user interface programs. It has no effect in
command procedures. Only events from the current application can be caught.
In Visual SCIL objects, it is recommended to define event programs as event
methods of the object (instead of #ON blocks) using the Dialog Editor.
78
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
([DPSOHV
#ON TEMP:E1 !SHOW W TEMP:PAI1
;When the event object TEMP:E1 is activated, the value of the process object
;TEMP is shown in the window W.
#ON TEMP:E1
;The former statement is cancelled.
21(5525>VWDWHPHQW@
Defines an error handler.
’statement’ A SCIL statement to be executed when an error occurs.
The command defines a statement, or block of statements, to be executed each time 7
an error occurs, in the cases where the error handling is defined by #ERROR STOP
or #ERROR EVENT (see above). The command is valid only for the program or
#ON block in which it has been executed. The #ON ERROR command takes
precedence over the #ON KEY_ERROR command (see below).
([DPSOH
#ON ERROR !SHOW MESSAGE STATUS
;The window MESSAGE is shown when an error occurs.
21.(<B(5525>VWDWHPHQW@
Defines a key error handler.
’statement’ A SCIL statement to be executed when an error occurs.
The command defines a statement, or a block of statements, to be executed in a
picture each time an error occurs in a function key program. The command applies
only to the window picture where it has been executed. If there is no key error
handler in a picture, the error handler of its parent picture is used, if any. The #ON
ERROR command (see above) takes precedence over the #ON KEY_ERROR
command.
([DPSOH
#ON KEY_ERROR !SHOW MESSAGE "FUNCTION KEY ERROR"
3$86( LQWHUYDO
Takes a pause.
’interval’ Time interval in seconds given as a real expression.
This command is used to momentarily suspend the program execution.
Be careful when using this command in command procedures! The pause delays the
execution of all the other objects in the same queue as well.
79
MicroSCADA Programming Language SCIL 1MRS751849-MEN
([DPSOHV
#PAUSE 3.5
;The system waits for 3.5 seconds before the next statement is executed.
#PAUSE %T
;The length of the pause is specified by the variable T.
5(7851 >YDOXH@
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 8) 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".
([DPSOH
;Suppose you have the following named programs:
6(7B7,0(WLPH
Sets the system time.
The command sets the time of the system clock. If the computer has an external
clock, the command has no relevance.
’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.
80
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
'(/(7(REMHFW
Deletes an application object.
’object’ An object notation of type P, C, D, A, T, X, V or F. 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.
([DPSOHV
@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
81
MicroSCADA Programming Language SCIL 1MRS751849-MEN
(;(&REMHFW>YDULDEOHBOLVW@
Queues an application object for execution.
’object’ An application object notation of type D, C, T, A or E.
’variable_list’ A list of variable assignments separated by commas.
This command queues an application object (data object, command procedure, time
channel, event channel or event object) for execution. Because the object does not
necessarily execute immediately, the subsequent statements should not assume that
the object has been completed. See Section 4.3 for the overview of application
objects, or the Application Objects manual for details.
Any number of argument variables may be passed in ’variable_list’ to the activated
object (except for event objects that do not take any arguments).
A syntactic note: At least one space is required before the left parenthesis of the
variable list.
When executed by a command procedure, #EXEC command may fail by status
REPF_EXECUTION_QUEUE_FULL if the maximum queue length (attribute
APL:BQM(2) or APL:BQM(3)) has been reached (see the System Objects manual).
([DPSOHV
#EXEC TASK:C (@LN = "DEFG", @IX = 1)
;The command procedure TASK is queued for execution.
#EXEC EVENT:E1
;An event object named EVENT is activated.
(;(&B$)7(5GHOD\REMHFW>YDULDEOHBOLVW@
Queues an application object for execution after a time delay.
’delay’ The delay time in seconds given as and integer or real
expression.
’object’ An object notation of type D, C, T, A or E.
’variable_list’ A list of variable assignments separated by commas.
The command works like #EXEC (see above), but the execution is delayed for
’delay’ seconds.
#EXEC_AFTER command may fail by status
REPF_EXECUTION_QUEUE_FULL if the maximum queue length (attribute
APL:BQM(4)) has been reached (see the System Objects manual).
([DPSOH
#EXEC_AFTER 10 TASK:C (@LN = "DEFG", @IX = 1)
;The command procedure TASK is started after 10 seconds.
*(7 REMHFW
Updates process object values.
82
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
,1,7B48(5< Q>FRQGLWLRQ@
Initiates a process query.
7
’n’ Text expression, either "A", "P" , "L", "H" or "E":
"A" (Alphabetical)The entire process database is searched
in alphabetical order.
"P" (Physical) The entire process database is searched
in the order of the physical addresses of objects
(UN + OA + OB).
"L" (alarm List) The alarm list is searched in reverse time
order, the latest alarms first. The alarm list
contains all alarming and unacknowledged
process objects in time order according to
the alarm time (the AT and AM attributes).
"H" (History) The history buffer is searched in time order,
the oldest events first. A history buffer is an
obsolete way of storing event history, selected by
the application attribute APL:BHP value
"EVENT_LOG".
"E" (Event) The history buffer is searched in reverse time
order, the latest events first. See "H" above.
’condition’ A boolean type expression which selects the objects to be
included in the query. The condition is comprised of relations
and logical operators. The relations have an attribute as the left
operand. All attributes (including CA), except those of vector or
list type, can be used. The objects that fulfil the condition are
included in the query. Wildcard characters % and * can be used
in conjunction with text attributes. % represents one character
anywhere in the name, * represents none, one or several
characters at the end of the name.
This command only selects the objects included in the query. The objects along with
some of their attribute values are then listed by function PROD_QUERY (Chapter
8). Only one query at a time may be active within the SCIL context. Only own
application may be queried.
83
MicroSCADA Programming Language SCIL 1MRS751849-MEN
([DPSOHV
#INIT_QUERY "A"
;The process query includes all objects in alphabetical order.
#INIT_QUERY "P" UN == 5
;The objects of unit 5 in address order.
02',)<REMHFW DWWULEXWHV
Changes an application object definition.
’object’ An application object notation. Allowed object types are P, C, D,
A, T, X, V and F.
’attributes’ A value of data type list.
The object is assigned the attribute values of the list expression ’attributes’.
Modifying the LN attribute of an object (or the IX attribute of a process object)
effectively renames the object.
([DPSOHV
#LOCAL V = LIST(HR = 24, TC = "TC_1H")
#MODIFY DEF:D = V
;The HR and TC attributes of the data object DEF are changed.
6($5&+ QDSOW\SHRUGHU>VWDUW>FRQGLWLRQ@@
Initialises a search among objects.
’n’ The identification number of the search. An integer expression 1
.. 10 that identifies the search within the SCIL context.
’apl’ Logical application number. Integer expression, 0 . . . 99. 0 = the
own application. The application must be local.
’type’ The object type, "P", "D", "C", "A", "T", "X" or "F" given as a
text expression.
’order’ The search order given as a text expression:
"A" = Alphabetical order. Searching through the object
names in alphabetical order (no index).Regarding
process objects, only group names are included in
the search.
84
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
85
MicroSCADA Programming Language SCIL 1MRS751849-MEN
This command is more or less obsolete. Use more powerful SCIL functions
APPLICATION_OBJECT_LIST and APPLICATION_OBJECT_ATTRIBUTES
instead.
6(7REMHFWBDWWULEXWH> YDOXH@
Assigns a value to an attribute of an object.
’object_attribute’ An object notation of type P, D, S, C, T, A, X, V, B or F,
including the attribute to be set. See Chapter 4.
’value’ A value of the type specified by the attribute. Default = 1.
With this command all types of system and application objects, except event objects,
may be given values through their attributes. For real process objects of output type,
setting the OV attribute implies control of the process via NET.
Depending on the object type and the attribute, the object notation may be indexed
by a single index or an index range. If the object notation has an index range, the
’value’ may be a vector or of a simple data type. If it is a vector, its elements list the
values to be assigned. If it is simple data, all indices receive the same value.
Data object and process object notations may be used without an attribute. It is then
assumed to be the OV attribute.
The attributes which are described as “read-only” in the attribute descriptions
(Application Objects and System Objects manuals) cannot be set with the #SET
command.
([DPSOHV
#SET SWITCH:PBO1 = 1
;The switch is set to 1. If the object is in AUTO state, the command is passed
;out to the process.
86
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
#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.
87
MicroSCADA Programming Language SCIL 1MRS751849-MEN
35,17SULQWHUSLFWXUH>YDULDEOHOLVW@
Prints a picture.
’printer’ Logical printer number. Integer expression, 1 .. 20.
’picture’ The picture to be printed, specified as:
[path/] picture name
where
’picture name’ is the name of the picture
’path’ is a logical path name.
If ’path’ is omitted, the default path names are used. See the
#PATH command, Section 7.2.4.
’variable list’ A list of variable assignments, separated by commas.
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
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
In conjunction with #PRINT command, the default value of FORM_FEED is 1.
([DPSOHV
#PRINT 1 REPORT (@VAR = TEMP:PAI(1..20))
;The picture named REPORT is output to printer 1. The printer starts a new
;page both before and after the 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.
88
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
’dir’ A directory name in the SCIL file name format (starting with /)
or in the operating system format, see Section 4.5.1 for valid
directory names. A trailing / or \ is stripped off, so the path can
be written either with or without it. Up to 255 directories are
allowed in the command. If a directory does not exist, it is
automatically created. However, if the word NO_CREATE is
included in the directory list, the subsequent directories are not
created. If they do not exist, the error
FILE_DIRECTORY_DOES_NOT_EXIST is raised.
Logical path names can be used in all commands where files are called by name, e.g.
together with picture names. Each path name may correspond to several directories,
which are given in the search order and separated by commas. When a file is
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
7
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
89
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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
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 8.
([DPSOH
#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.
5(3B/,%OLEUDU\>ILOH>ILOH@
@
5(3B/,%OLEUDU\>ILOH>ILOH@
@
5(3B/,%OLEUDU\>ILOH>ILOH@
@
Defines a logical representation library.
’library’ A logical library name, up to 10 characters.
’file’ A representation library file name, see Section 4.5.1 for valid file
names. Up to 255 representation library files can be included in
the command.
Logical library names can be used everywhere, where library representations are
requested. Each library name may correspond to several library files, given in the
search order and separated by commas. When a library representation is requested,
it is first sought for in the first library, then in the next one, etc. If a library name is
used when a new library representation is created, the new representation will be
stored in the first file of the logical library.
90
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
A #REP_LIB command without any sign defines a ’global’ library name. Such a
name is monitor specific, when executed in a picture or dialog. If executed in a
printed picture, it applies to all pictures printed with #PRINT. If the file list is
omitted, all files defined for the library name are removed, but the library name is
preserved. Global libraries should be defined only once, for example in the start
picture or dialog. System and application specific representation libraries should be
defined by using the base system attributes SYS:BRL and APL:BRL, respectively
(see the System Objects manual).
A #REP_LIB command with a + or - sign defines ’local’ and temporary library
names by adding files to or removing files from the given library name. Local
representation libraries are valid only in the SCIL context where they are defined
and take precedence over the global libraries with the same name. A + sign means
that files are added to the beginning of the file list of the library name. A - sign means
that files are removed from the list. If the file list is omitted from the command, the
minus sign removes all locally added files from the actual library name. (Note: as a
terminating - sign means that the statement is continued on the next line, this case 7
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 representation library definitions are
inherited as local library definitions in the activated object. If, for example, a picture
program starts a printout, the representation libraries of the picture will be local
libraries in the format picture and, hence, take precedence over the global libraries.
The latest definition of a library name is valid. Hence, by defining library names
locally (with + and -), you ensure that no inherited definitions will override the
desired library name definitions.
If no library name is given, a representation is searched for in the library called
DEFAULT. Unless changed with a #REP_LIB command, the library name
DEFAULT corresponds to the files:
1. /APL/application/APL_STAND.PIR
2. /LAN/ACTIVE/LAN_/LAN_STAND.PIR
in this search order.
Defined library names can be read with the replib functions, see Chapter 8.
([DPSOH
#PATH PATH + /APL/APPL2/PICT
#REP_LIB PROCESS PATH/MYLIB
!WIN_REP WINDOW PROCESS/MYREP
;The library representation MYREP, which is to be shown in the window WINDOW,
;is sought from the file MYLIB in the application APPL2.
91
MicroSCADA Programming Language SCIL 1MRS751849-MEN
&/26(B),/(Q
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.
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.
([DPSOH
#CLOSE_FILE 2
;The file opened as number 2 is closed.
&5($7(B),/(QDSOILOHNH\OHQJWK
Creates and opens a new keyed file.
’n’ File number. A number that identifies the file within the SCIL
context. Integer expression, 1 .. 10.
’apl’ Logical application number, integer expression 0 .. 99. 0 is the
own application. The application must be local.
’file’ Text or byte string expression, the name of the file. See Section
4.5.1 for file naming.
’keylength’ The key length. Integer expression, 1 .. 253.
The command creates a keyed file with the given key length and opens the file.
When no longer used it should be closed with the #CLOSE_FILE command, see
above.
([DPSOH
#CREATE_FILE 3 0 "RTU5" 5
;A file called RTU5 with the key length 5 is created and opened in the current
;application.
'(/(7(B),/(DSOILOH
Deletes a file.
’apl’ Logical application number. Integer expression, 0 .. 99. 0 = the
current application. The application must be local.
’file’ Text or byte string expression, the name of the file. See Section
4.5.1 for file naming.
The command deletes the named file in the given application. This command can be
used to delete any file, not just keyed files.
([DPSOH
#DELETE_FILE 3 "RTU52"
;The file RTU5 in application 3 is deleted.
23(1B),/(QDSOILOHNH\OHQJWK
Opens a keyed file.
’n’ File number. A number that identifies the file within the SCIL
context. Integer expression 1..10.
92
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
5($'B.(<6QNH\V>NH\>NH\@@
Reads the keys of 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 expression, 1..10.
’keys’ The name of the variable to receive the keys. If a local variable
by that name exists, it is used, otherwise a global variable.
’key1’ The first key to be read. A text expression containing up to
’keylength’ characters (see the #OPEN_FILE command above).
Not obligatory.
’key2’ The last key to be read. A text expression containing up to
’keylength’ characters. Not obligatory.
93
MicroSCADA Programming Language SCIL 1MRS751849-MEN
The command reads the keys of the file defined by ’n’ and stores them in the variable
’keys’. Up to 10000 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
(10000 keys). If ’key1’ and ’key2’ are omitted, the keys of the entire file, up to 10000,
are read.
([DPSOH
#READ_KEYS 2 V "A" "B"
;Reads the keys starting with letter "A" (supposing that key length is > 1).
5($'B1(;7QNH\GDWD>GDWD@
Reads 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 expression, 1..10 .
’key’ A reference record key. A text expression.
’data1’, ’data2’ The names of variables to receive the data. If local variables by
these names exist, they are used, otherwise global variables.
The command reads the contents of the record next to ’key’ and places it as text in
one or two variables, ’data1’ (up to 255 characters) and ’data2’ (the rest of the
contents if the length of the record exceeds 255 characters).
([DPSOH
#READ_NEXT 2 RTU_KEY(A:POA1) V1 V2
;The record following process object A1 is read. The RTU_KEY function is
;described in Chapter 8.
5($'B35(9QNH\GDWD>GDWD@
Reads 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’ A reference record key. A text expression.
’data1’, ’data2’ The names of variables to receive the data. If local variables by
these names exist, they are used, otherwise global variables.
The command reads the contents of the record previous to ’key’ and places it as text
in one or two variables, ’data1’ (up to 255 characters) and ’data2’ (the rest of the
contents if the length of the record exceeds 255 characters).
([DPSOH
#READ_PREV 2 RTU_KEY(A:POA1) V1 V2
;The record previous to the process object A is read. The RTU_KEY function
is ;described in Chapter 8.
5(029(QNH\
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.
94
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
5(1$0(B),/(DSOROGQHZ
Renames a file.
’apl’ Logical application number. Integer value, 0 .. 99. 0 is the
current application. The application must be local.
’old’ Text or byte string expression, the name of the file to be
renamed. See Section 4.5.1 for file naming.
’new’ Text or byte string expression, the new file name.
The command renames the file ’old’ to ’new’. If ’new’already exists, an error is raised.
7
This command may be used to rename any file, not just keyed files.
([DPSOH
#RENAME_FILE 0 "W89" "W90"
;The file W89 in the current application is renamed to W90.
:5,7(QGDWD>GDWD@
Writes a data record into a keyed file.
’n’ File number. The file number assigned to the file when opened
with the #OPEN_FILE or #CREATE_FILE command (see
above). Integer 1 .. 10.
’data1’, ’data2’ Two text values containing the data to be written.
The command writes a record to the file defined by ’n’. ’data1’ contains as a text the
key of the record and data to be written, up to 255 characters. The rest of the data to
be written, if any, is in ’data2’. The key is included as the first characters in ’data1’.
If there is a record by the same key in the file, it is overwritten.
([DPSOH
#WRITE 2 V1 V2
;The data of the variables V1 and V2 is written in the file opened as number 2.
95
MicroSCADA Programming Language SCIL 1MRS751849-MEN
’object’ The name of the object or an object reference including the path
(see Chapter 4). Giving a path means that the object is created as
the last child in the object chain. The object name must be unique
among the objects with the same parent.
’type’ The name of the Visual SCIL object type. See the Visual SCIL
Objects manual.
’attribute’ The name of an attribute which is assigned the subsequent value.
If no predefined attribute with the given name exists, the
attribute is created as a user defined attribute.
’value’ The value assigned to the attribute. If the attribute is predefined,
the value must be of the correct data type (see the Visual SCIL
Objects manual). If the attribute is user defined, the value may
be of any data type.
The .CREATE command creates the object and loads it into the dialog system.
Unless an object path is given, the object will be the child object of the object
containing the .CREATE command.
The predefined attributes which are not assigned values in the attribute list are given
default values. After an object has been created, its attributes can be changed with
the .MODIFY and .SET commands, see below.
The .CREATE command is normally used for creating objects whose appearance is
dynamically defined, based on some run time information. It must also be used for
creating objects of the ready-built types which are not accessed in the Dialog Editor.
The .LOAD command described below is used for loading dialogs and dialog items
drawn in the editor.
Generally, methods cannot be written with this command. However, if the object has
action methods, these can be written with attributes, see the Visual SCIL Objects
manual. Except for this type of methods, objects created with .CREATE will only
have the predefined methods with predefined contents.
([DPSOHV
.create CANCEL = VS_BUTTON(_TITLE = "Cancel", _NOTIFY = vector(".delete DLG"))
;The statements above creates a button with the label text Cancel and the
;NOTIFY program .delete DLG (deletes the dialog DLG).
96
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
The example above creates a dialog containing two containers, each of which
contains dialog items. The last statement makes the dialog visible on screen.
'(/(7(REMHFW
Deletes a Visual SCIL object.
’object’ The object name, possibly including a path (see Chapter 4).
Deleting a Visual SCIL object means that it is removed from the screen (if shown) 7
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.
([DPSOHV
.DELETE DIALOG1 ;Deletes the object DIALOG1 and all its child objects.
97
MicroSCADA Programming Language SCIL 1MRS751849-MEN
This command is used for loading objects built in the dialog editor and stored in
files. It loads the specified object as a Visual SCIL object with the given name. If a
loaded dialog or dialog item contains other dialog items, they are also loaded. The
contained dialog items will be known as Visual SCIL objects with the names they
were given in the dialog editor. The loaded object is incorporated with all its child
objects into the existing object hierarchy.
When loaded, the create methods of the objects are executed (see the Visual SCIL
User Interface Design manual). If the load command contains attribute definitions,
the attributes are set after the create methods.
A stored dialog, dialog item or image can be concurrently loaded several times in
parallel under different object names or in different contexts.
([DPSOH
.load DIALOG = VS_DIALOG("MYFILE.VSO", "MYDIALOG", _OPEN = TRUE)
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.
6(7>REMHFW@DWWULEXWH>FRPSRQHQW@
YDOXH
Assigns a value to a user interface object attribute.
’object’ A Visual SCIL object reference or a picture reference (see
Chapter 4). THIS object, if omitted.
98
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
99
MicroSCADA Programming Language SCIL 1MRS751849-MEN
)$67B3,&>SLFWXUH@
)$67B3,&>SLFWXUH@
)$67B3,&>@>SLFWXUH@>@>SLFWXUH@
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 7.2.4.
Default: the present picture.
The command applies to semi-graphic monitors only and has no effect in full
graphic monitors.
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.
([DPSOH
!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.
100
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
,17B3,&
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.
/$67B3,&
Displays the previous picture.
This command causes the picture handling process to go one step backwards in the
queue built up by !NEW_PIC, see Figure 7.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. 7
In other respects, the command works like !NEW_PIC.
1(:B3,&SLFWXUH
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 7.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 7.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
7.2.4.
An error status is produced if the picture does not exist.
([DPSOHV
!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
101
MicroSCADA Programming Language SCIL 1MRS751849-MEN
)LJ 7KHSLFWXUHTXHXH(DFKPRQLWRURUSLFWXUHFRQWDLQHUKDVLWVRZQ
SLFWXUHTXHXH
5(&$//B3,&
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.
5(6725(
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.
6725(B3,&
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.
83'$7(LQWHUYDO
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.
102
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
103
MicroSCADA Programming Language SCIL 1MRS751849-MEN
The command erases the named window from the screen. If the window is of type
PICTURE, a possible exit program is executed when the window is erased. If it
contains windows, these windows are erased, too.
([DPSOHV
!ERASE MESSAGE
;The window MESSAGE is erased.
!ERASE TREND/COLUMN
;The window COLUMN in the window (or picture function) TREND is erased.
6+2:>SLFWXUHSDWK@ZLQGRZ>H[SUHVVLRQ@
Shows a window.
’window’ The name of the window to be shown.
’picture path’ A picture path according to the format described in Chapter 4. If
omitted, the window is searched from the picture or picture
function where the command was issued. If the window is not
found there, the window is searched from the entire picture.
’expression’ The expression to be shown in the window. Not obligatory.
The window is displayed on screen at the location determined by the window
definition. The value of the expression is calculated before the window is displayed.
If the expression is given by the !SHOW command, the expression in the window
definition is disregarded. If the expression is omitted here, you may define it by the
command !WIN_INPUT. Only as the last alternative, the expression is taken from
the window definition. If the window is defined as PICTURE or FIGURE, the
expression is disregarded.
If the window is of PICTURE type, possible background, draw and start programs
are executed when the picture is shown. The update program is executed in the
interval given in the window picture, which may differ from that of the main picture.
An error status is produced if the window cannot be found.
Windows are erased with the !ERASE command.
([DPSOHV
!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.
6+2:B%$&. >SLFWXUHSDWK@ZLQGRZ>H[SUHVVLRQ@
Shows the picture background of a window.
’window’ The name of the window to be shown.
’picture path’ A picture path according to the format described in Chapter 4. If
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 picture.
’expression’ The expression to be shown in the window. Not obligatory.
This command shows the picture background of a window picture. The background
of the picture functions included in the picture are shown as well. The background
104
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
and draw programs of the picture are executed. No other programs are executed. No
windows are shown and the function keys do not function.
If the window is of some other type than PICTURE, the command works like
!SHOW.
An error status is produced if the window cannot be found.
The window background is erased with the !ERASE command.
([DPSOH
!SHOW_BACK SCHEME
;The picture background of the window SCHEME is displayed.
:,1B%*B&2/25 >SLFWXUHSDWK@ZLQGRZFRORU
Specifies the color of the background behind the window.
’window’ The name of the window
’picture path’ A picture path according to the format described in Chapter 4. If 7
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 picture.
’color’ The requested background color given as a named color, a vector
of RGB values or a reference, see Chapter 9. Default color: the
color defined by the MONn:BWC attribute (see the System
Objects manual).
When a window is displayed, the background color can be seen for a moment until
the window is drawn on screen. Likewise, when a window is erased, the background
color appears for a moment until the background behind the window is redrawn on
screen. By choosing an appropriate background color for the window, disturbing
color switches can be avoided.
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.
:,1B&5($7( >SLFWXUHSDWK@ZLQGRZ
Creates a window.
’window’ The name of the window
’picture path’ A picture path according to the format described in Chapter 4. If
omitted, the window is created in the picture or picture function
where the command was issued.
The command creates a new window during the picture handling. Once the window
has been created with this command, it can be assigned a position with the
!WIN_POS command (default position: the upper left corner of the picture), a
105
MicroSCADA Programming Language SCIL 1MRS751849-MEN
:,1B/(9(/>SLFWXUHSDWK@ZLQGRZOHYHO
Specifies the level parameter of the window.
’window’ The name of the window.
’picture path’ A picture path according to the format described in Chapter 4.
’level’ An integer value in the range -100 .. +100. -100 = the window is
placed on bottom, +100 = the window is placed on top. Default
value = 0. Instead of values, the following two predefined
constants can be used: ON_BOTTOM ( = -100) and ON_TOP (=
+100).
106
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
The command specifies the level of the window in relation to other windows on the
same level in the picture hierarchy (see Chapter 4). See the general part of this sub-
section.
:,1B1$0(>SLFWXUHSDWK@ZLQGRZ
Creates a new window.
’picture path’ A picture path according to the format described in Chapter 4.
’window’ The name of the window.
The command has the same function as the !WIN_CREATE command, except for
the following:
If no picture reference is given, the !WIN_NAME command searches throughout
the whole main picture. If a window with the given name is found, no new window
is created.
([DPSOH
!WIN_NAME A
7
!WIN_POS A (1,1)
!WIN_PIC A A_PIC
!SHOW A
;A window A is created and placed in the upper left corner. The picture A_PIC
;is shown in the window.
:,1B3,&>SLFWXUHSDWK@ZLQGRZSLFWXUH
Selects a picture to be shown in the window.
’window’ The name of the window in which the picture will be shown.
’picture path’ A picture path according to the format described in Chapter 4.
’picture’ The name of the picture to be shown in the window specified as:
[logical path/] picture name
where
‘picture name' is picture name exclusive the extension, and
'logical path' is a logical path name.
If 'logical path' is omitted, the default path names are used. See
the #PATH command, Section 7.2.4.
With this command you can change the picture name during program execution. The
latest issued picture name is the valid one. The name of the window picture is stored
as long as the main picture is displayed on screen or stored as a fast picture. The
command entails that the picture name in the window definition is ignored.
If 'picture path' is excluded, 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.
([DPSOH
!WIN_PIC AREA TABLE
!SHOW AREA
;The picture TABLE is shown in the window AREA.
107
MicroSCADA Programming Language SCIL 1MRS751849-MEN
:,1B326 >SLFWXUHSDWK@ZLQGRZSRV
Positions a window.
’window’ The name of the window to be positioned.
’picture path’ A picture path according to the format described in Chapter 7.
’pos’ The new window position as a vector with two positive integer
elements. The first element is the x-position (horizontal
coordinate, 1 .. 160) and the second one the y-position (vertical
coordinate, 1 .. 96). If ’pos’contains more than two elements (e.g.
the variable generated with the !INPUT_POS command), these
elements are ignored.
The upper left corner of the window ’window’ is positioned to the semi-graphic
character position specified by ’pos’. If the x-coordinate is larger than 80 or the y-
coordinate larger than 48, the window is placed on the control board, outside the
screen.
If the window is currently shown, it is immediately erased from the old location and
displayed at the new one. The window is placed on the top of all windows with the
same level parameter and the same parent. The new location is stored as long as the
main picture is displayed on screen or stored as a fast picture.
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.
([DPSOHV
!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.
:,1B5(3 >SLFWXUHSDWK@ZLQGRZUHSUHVHQWDWLRQ
Selects a library representation for a window.
’window’ The name of the window to be assigned a library representation.
’picture path’ A picture path according to the format described in Chapter 4.
’representation’ The library representation to be used in the window specified as:
[library/] representation
where:
’representation’ is the name of the representation, and
’library’ is a logical library name.
If library name is omitted, the representation is sought from the
library DEFAULT. See the command #REP_LIB in Section
7.2.4.
With this command the representation to be used in the window may be changed
during the program execution. The most recently given representation is valid. The
given representation name is stored as long as the main picture is displayed or stored
108
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
as a fast picture. The command entails that the representation given in the window
definition is ignored.
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.
([DPSOHV
!WIN_REP LINE PASSWORD
!SHOW LINE
;The representation PASSWORD states the form for what is to be shown in the
;window LINE. The representation is sought from the file(s) defined by the
;library name DEFAULT.
!WIN_REP LINE ENG/PASSWORD
!SHOW LINE
;The same as above, but the representation is sought from the file(s) defined
;by the library name ENG.
109
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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.
([DPSOH
!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.
,1387B326YDU
Reads 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.
([DPSOHV
!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).
,1387B9$5>SLFWXUHSDWK@ZLQGRZYDULDEOHPD[BOHQJWK
Reads an input value from the user.
’window’ Window name of the input field.
’picture path’ A picture reference according to the format described in Chapter
4.
110
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 7. SCIL statements
58%287
58%287B&85
58%287B%2/
58%287B(2/
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.
72**/(B02'
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.
111
MicroSCADA Programming Language SCIL 1MRS751849-MEN
5(6(7
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 7.4.1) is executed.
([DPSOH
@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.
112
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
8. Functions
This chapter describes the predefined SCIL functions. The chapter is organized into
the following sections:
8.1 General
8.2 Generic Functions
8.3 Arithmetic Functions
8.4 Time Functions
8.5 String Functions
8.6 Bit Functions
8.7 Vector Handling Functions
8.8 List Handling Functions
8.9 Functions Related to Program Execution
8.10 Functions Related to the Run-time Environment
8.11 Functions Related to the Programming Environment
8.12 Error Tracing Functions 8
8.13 Database Functions
8.14 File Handling Functions
8.15 File Management Functions
8.16 Communication Functions
8.17 DDE Client Functions
8.18 DDE Server Functions
8.19 ODBC Functions
8.20 RTU Functions
8.21 Printout Functions
8.22 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 9.
8.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))
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 6).
113
MicroSCADA Programming Language SCIL 1MRS751849-MEN
114
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
Overview
Table 8.1.-1 SCIL functions and the tasks they perform
Function Brief Description Page
115
MicroSCADA Programming Language SCIL 1MRS751849-MEN
116
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
117
MicroSCADA Programming Language SCIL 1MRS751849-MEN
FM_COMBINE(tag1 [,tagi ]*, tagn ) Combines two or more drive, directory or file tags to a new 211
directory or file tag.
FM_COMBINE_NAME(name, extension) Combines a proper file name and an extension to a file name. 211
FM_DIRECTORY(path [,check]) Creates a directory tag out of a directory path or checks a 211
directory path.
FM_DRIVE(name [,check]) Creates a drive tag out of a drive name or checks a drive 212
name.
FM_EXTRACT(tag, component) Extracts a component from one or more directory or file tags. 212
FM_FILE(path [,check]) Creates a file tag out of a file path or checks a file path. 212
FM_REPRESENT(tag [,option]* ) Converts one or more drive, directory or file tags into an OS 213
dependent text representation.
FM_SCIL_DIRECTORY(name [,check]) Creates a directory tag out of a SCIL file name or checks a 213
SCIL file name.
FM_SCIL_FILE(name [,option [,option]]) Creates a file tag out of a SCIL file name or checks a SCIL file 213
name.
FM_SCIL_REPRESENT(tag [,case]) Converts one or more directory or file tags into a SCIL file 214
name text representation.
FM_SPLIT_NAME(file) Extracts the proper name and the extension from one or more 214
file names.
GET_STATUS(data) Returns the status code(s) of a value. 125
HEX(n) Represents an integer as text in hexadecimal format. 147
HEX_SCAN(string) Creates an integer or real value out of its hexadecimal text 147
representation.
HIGH(v) The largest element in a vector. 157
HIGH_INDEX(v) The index of the largest element in a vector. 158
HIGH_PRECISION_ADD(n1 [,n]*) Adds up two or more high precision numbers. 128
HIGH_PRECISION_DIV(n1, n2) Divides a high precision number by another. 128
HIGH_PRECISION_MUL(n1, n2) Multiplies two high precision numbers. 129
HIGH_PRECISION_SHOW(n [,decimals]) Displays a high precision number in various formats. 129
HIGH_PRECISION_SUB(n1, n2) Subtracts a high precision number from another. 129
HIGH_PRECISION_SUM(v) Calculates the sum of the high precision number elements of 129
a vector.
HISTORY_DATABASE_MANAGER(command Function for handling the history database 186
[,command_arguments])
HOD[(time)] Hours passed since the beginning of the day. 134
HOUR[(time)] The hour. 134
HOY[(time)] Hours passed since the beginning of the year. 134
HR_CLOCK SYS time in seconds and microseconds. 134
INSERT_ELEMENT(v, pos, contents) Inserts new elements into a vector. 158
INTEGER_TO_BCD(int [,digits ]) Represents an integer value as a BCD coded bit string. 148
INTERP(v, x) Interpolates a value from a curve. 159
INVERSE(v, n, low, high) Inverts a curve. 159
IP_PROGRAMS Lists the running Integrated Programs in the system. 171
118
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
119
MicroSCADA Programming Language SCIL 1MRS751849-MEN
120
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
REVISION_COMPATIBILITY(issue [,enable]) Selects the compatibility issues to be used in the context. 169
ROUND (arg [,decimals])) Rounds off a real value. 131
RTU_ADDR(key) Returns a list with the address of the object in a certain re- 227
cord.
RTU_AINT(i) Converts an integer to ASCII characters (according to the 228
RP570 protocol).
RTU_AREAL(r) Converts a real number to four ASCII-characters (float 228
DS801).
RTU_ATIME[(t [,msec])] Converts time data (operating system time) to ASCII (RTU200 228
time).
RTU_BIN(h) Converts hex-ASCII numbers given as a text to binary 228
numbers in text form.
RTU_HEXASC(b) Converts binary numbers given as a text to hex-ASCII 229
numbers as a text.
RTU_INT(a) Converts two ASCII characters (2’s Complement RP570) to 229
RTU_KEY(oa)
an integer.
Returns the search key for a record in an RTU200 229
8
configuration file.
RTU_MSEC(atime) Returns the milliseconds of the 6-byte RTU time string atime. 229
RTU_OA(type,ba) Returns the object address. 229
RTU_REAL(a) Converts 4 ASCII characters (float DS801) to a real number. 230
RTU_TIME(a) Converts ASCII (RTU200 time) to MicroSCADA time data. 230
SCALE(v, scale_object [,direction]) Scales a value using a scale object. 234
SCIL_HOST Returns the type and number of the process that is running 172
this SCIL code.
SECOND[(time)] The second. 137
SELECT(source, condition [,wildcards]) Selects the elements of a vector or a list of vectors that fulfil 161
given condition.
SEPARATE(text , delimiter) Extracts fields of a text. 151
SET_CLOCK(time) Sets the SYS time. 137
SET_LOCAL_TIME(time) Sets the local time of the system. 137
SET_STATUS(source, status) Modifies the status code of SCIL data. 126
SET_SYS_TIME(time) Sets the SYS time of the system. 138
SET_UTC_TIME(time) Sets the UTC time of the system. 138
SHADOW_FILE(file_name) Queues a file for shadowing. 199
SHUFFLE(n) Shuffles integers 1 to n into a random order. 162
SIN(arg) The sine of the argument. 131
SORT(v [,start [,length]]) Sorts a vector. 163
SPACOM(message) Communicates with a SPACOM unit connected to a COM 215
port.
SPREAD(v, indices, new_value) Replaces vector elements by a new value. 163
SQL_BEGIN_TRANSACTION(connection_id) Marks the beginning of a SQL transaction. 225
SQL_COMMIT(connection_id) Commits a SQL transaction. 226
121
MicroSCADA Programming Language SCIL 1MRS751849-MEN
122
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
UTC_TIME_INTERVAL(from, to) The length of the time interval between two UTC times. 143
UTC_TO_LOCAL_TIME(time) Converts UTC time to local time. 143
UTC_TO_SYS_TIME(time) Converts UTC time to SYS time. 143
VALIDATE(as, string) Validates a text string as a SCIL object name. 176
VARIABLE_NAMES Lists the names of global variables defined in the SCIL 169
context.
VECTOR[(element1,[element]*)] Creates a vector out of given elements. 165
WEEK(time)] The number of the week within a year. 143
WORKSTATION_CALL(command [,arg]*) Executes a command in the workstation. 170
WRITE_BYTES(file, data [,append]) Writes a binary file. 200
WRITE_COLUMNS(file, pos, width, data Writes a text file as columns. 200
[,append])
WRITE_PARAMETER(file, section, key, value) Writes a parameter into a parameter file. 200
WRITE_TEXT(file, text [,append]) Writes a text file. 201
YEAR(time)] The year. 143 8
8.2. Generic functions
'$7$B7<3(H[SUHVVLRQ
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)
([DPSOH
DATA_TYPE(CLOCK) == "TIME"
#IF DATA_TYPE(DATA:DOV) == "NONE" #THEN .......
'803GDWD>OLQHBOHQJWK@
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.
123
MicroSCADA Programming Language SCIL 1MRS751849-MEN
(48$/YY>VWDWXVBKDQGOLQJ@
Compares two SCIL values for equality.
’v1’ First value of any type.
’v2’ Second value of any type.
’status_handling’ Text keyword value, either "CONSIDER_STATUS" or
"IGNORE_STATUS"), default = "IGNORE_STATUS"
Value: Boolean value TRUE if ’v1’ is equal to ’v2’, otherwise FALSE.
Two values are considered equal if
• the value types are the same and
• the values are the same and
• the status values are the same (when "CONSIDER_STATUS") or else both valid
(< 10) (when "IGNORE_STATUS")
The test for equality is recursive, i.e. if the value is a vector or list, its components
are tested for equality.
([DPSOH
EQUAL(1,1) ;returns TRUE
EQUAL(1,1.0) ;returns FALSE (different types)
EQUAL(RANDOM(1,10),RANDOM(1,10));returns TRUE or FALSE
(9$/8$7((H[SUHVVLRQ
Evaluates an expression given as text in SCIL syntax.
124
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
For any value v, EVALUATE(DUMP(v)) results to v, except for one case: Real
numbers may slightly lose their precision.
([DPSOH
The following example shows how to store any data value (such as complicated
list) in a disk file and then read it back:
WRITE_STATUS = WRITE_TEXT("DUMP.TXT",DUMP(V))
#IF WRITE_STATUS == 0 #THEN -
W = EVALUATE(READ_TEXT("DUMP.TXT"))
*(7B67$786(GDWD
8
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.
/(1*7+(DUJ
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.
([DPSOHV
LENGTH(340) == 1
125
MicroSCADA Programming Language SCIL 1MRS751849-MEN
LENGTH("ABCD") == 4
LENGTH(PROD_QUERY(20)) == 18
LENGTH(" ") == 1
LENGTH("") == 0
6(7B67$786(VRXUFHVWDWXV
Modifies the status code of SCIL data.
’source’ A value of any data type.
’status’ An integer expression, 0 .. 65535, 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.
([DPSOHV
@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.
7<3(B&$67VRXUFHW\SH
Views data as if it were of different data type.
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.
'source' The source data to be viewed. Integer, real, time, boolean, text or
bit string.
126
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
$5&&26DUJ
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.
$5&6,1DUJ
Arcus sinus.
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.
$5&7$1DUJ
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.
&26DUJ
127
MicroSCADA Programming Language SCIL 1MRS751849-MEN
128
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
129
MicroSCADA Programming Language SCIL 1MRS751849-MEN
/1DUJ
Natural logarithm.
’arg’ A real value > 0, or a vector of such values.
Value: A real value or a vector of real values.
0$;DUJ>DUJ@
The largest value in the argument list.
’arg1’ ... Up to 32 integer or real values or vectors of integer or real
values.
Value: An integer, a real number or a vector. If all arguments or all
compared elements are integers, the result is an integer or an
integer element, otherwise a real/real element.
If the argument list contains both numbers and vectors, the numbers are compared
to each vector element and corresponding vector elements are compared. If the
number of vector elements is unequal, odd elements get SUSPICIOUS_STATUS
(see the Status Codes manual). See also function MIN.
0,1DUJ>DUJ@
The smallest value in the argument list.
’arg1’ .. Up to 32 integer or real values or vectors of integer or real
values.
Value: An integer, a real number or a vector. If all arguments or all
compared elements are integers, the result is an integer or an
integer element, otherwise a real/real element.
If the argument list contains both numbers and vectors, the numbers are compared
to each vector element and corresponding vector elements are compared. If the
number of vector elements is unequal, odd elements get SUSPICIOUS_STATUS
(see the Status Codes manual). See also function MAX.
([DPSOH
MIN(4,83,-1.8,-3) ;returns -3.0
@A = (2,4)
@B = (5,6,1)
MIN(3,%A,%B) ;returns vector (2,3,1)
;The last element has SUSPICIOUS_STATUS.
2''DUJ
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.
([DPSOH
ODD(5) ;returns TRUE
EVEN(5) ;returns FALSE
5$1'20QQ
Generates a random number.
’n1’ An integer or real value.
130
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
6,1DUJ
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.
6457DUJ
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.
7581&DUJ>GHFLPDOV@
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.
([DPSOHV
TRUNC(4.5) == 4
TRUNC(-4.5) == -4
TRUNC(2.7456,2) == 2.74
131
MicroSCADA Programming Language SCIL 1MRS751849-MEN
Qualified time
A qualified time represents a moment of time uniquely by adding a daylight saving
time flag and status information to the one-millisecond resolution time. A qualified
time is implemented as a list with predefined attributes as follows:
CL Clock Time type, the time in one-second resolution.
MS Milliseconds Integer 0 .. 999, the milliseconds
DS Daylight saving Boolean
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).
132
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
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
8
set to its minimum or maximum value and its status is set to 3
(FAULTY_TIME_STATUS).
([DPSOH
; 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
&/2&.
The present SYS time.
Value: Time value.
'$7(>WLPH@
The date (year, month and day) as text.
The date is given in the format "yy-mm-dd" or "dd-mm-yy" depending on the value
of the attribute SYS:BTF.
’time’ A time value or a vector of time values.
Default value is the present SYS time.
Value: A text or text vector.
133
MicroSCADA Programming Language SCIL 1MRS751849-MEN
'$<>WLPH@
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.
'2:>WLPH@
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.
'2<>WLPH@
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.
+2'>WLPH@
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.
+285[WLPH@
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.
+2<>WLPH@
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.
+5B&/2&.
SYS time in seconds and microseconds.
Value: A list containing the following two attributes:
CL The seconds of the SYS time as time data.
134
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
/2&$/B7,0(B,1)250$7,21>WLPH@
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.
135
MicroSCADA Programming Language SCIL 1MRS751849-MEN
136
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
137
MicroSCADA Programming Language SCIL 1MRS751849-MEN
138
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
([DPSOH
The following three calls each return the moment of time 3 seconds from now:
SYS_TIME_ADD(SYS_TIME, 3)
SYS_TIME_ADD(SYS_TIME, 0, 30000)
SYS_TIME_ADD(SYS_TIME, 4, -1000)
6<6B7,0(B,17(59$/IURPWR
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.
For the 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
8
(SYS:BTR).
6<6B72B/2&$/B7,0(WLPH
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).
6<6B72B87&B7,0(WLPH
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).
7,0(>WLPH@
Date and time as text, excluding seconds.
139
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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.
’time’ A time value or a vector of time values.
Default value is the present SYS time.
Value: A text or a text vector.
7,0(B=21(B58/(6>UXOH@
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.
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.
140
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
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 MicroSCADA 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
141
MicroSCADA Programming Language SCIL 1MRS751849-MEN
zone rule: Change the operating system time zone settings and restart
MicroSCADA. 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 MicroSCADA time
counting, 1st of January, 1978.
7,0(6>WLPH@
Date and time as text, including seconds.
The date and time is given in format "yy-mm-dd hh:mm:ss" or "dd-mm-yy
hh:mm:ss" depending on the value of the attribute SYS:BTF.
'time' A time value or a vector of time values.
Default value is the present SYS time.
Value: A text or a text vector.
72'>WLPH@
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".
72'6>WLPH@
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".
87&B7,0(
The present UTC time.
Value: A list (qualified time), UTC time.
87&B7,0(B$''WLPHV>PV@
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.
([DPSOH
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, 30000)
UTC_TIME_ADD(UTC_TIME, 4, -1000)
142
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
87&B7,0(B,17(59$/IURPWR
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:
S Integer (positive or negative), the seconds.
MS Integer -999 .. 999, the milliseconds.
87&B72B/2&$/B7,0(WLPH
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).
87&B72B6<6B7,0(WLPH
Converts UTC time to SYS time.
’time’ A time or list (qualified time) value or a vector of such values,
8
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).
:((.WLPH@
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.
<($5WLPH@
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.
Table 8.4.-1
([DPSOHV
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"
143
MicroSCADA Programming Language SCIL 1MRS751849-MEN
Table 8.4.-1
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"
$6&,,B&2'(F
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.
([DPSOH
ASCII_CODE("A") == 65
%&'B72B,17(*(5EFG
Converts BCD coded numbers to integers.
BCD (Binary Coded Decimal) values are represented in SCIL by values of
BIT_STRING data type. Each digit takes 4 bits (called a nibble), so the length of a
BCD bit string is a multiple of 4. The length of a BCD value is limited to 9 digits.
’bcd’ Bit string value containing the BCD coded number.
Value: List value with attributes
STATUS Integer, status code of the conversion
144
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
%,1E 8
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. Each text element converted from an
integer will contain 32 characters. A text element converted from
a bit string will contain the same number of characters as the bit
string, however, at most 255 characters.
See function BIN_SCAN for the reverse operation.
([DPSOH
BIN(BIT_SCAN("010101")) ;returns "010101"
BIN(23) ;returns "0000...0010111" (27 leading zeroes)
%,1B6&$1VWULQJ
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.
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 3), the overflown (high
order) bits are discarded.
See function BIN for the reverse operation.
%,7B6&$1VWULQJ
Creates a bit string out of its text representation.
’string’ A text containing characters "0" and "1" only, or a vector of such
texts.
145
MicroSCADA Programming Language SCIL 1MRS751849-MEN
&$3,7$/,=(WH[W
Capitalizes a text.
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.
’text’ A text or a text vector.
Value: A text or a text vector.
See also functions LOWER_CASE and UPPER_CASE.
([DPSOH
CAPITALIZE("VÄSTERÅS") == "Västerås"
&2//(&7YGHOLPLWHU
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.
([DPSOH
COLLECT(VECTOR("Alpha","Beta","Gamma"), "+") == "Alpha+Beta+Gamma"
'(&YDOXH>OHQJWK>GHFLPDOV@@
Represents integer and real values as text.
’value’ An integer or real value, or a vector of such values.
’length’ An integer 0 .. 255. The minimum length of the text
representation. Default = 6.
’decimals’ An integer 0 .. 253. The number of decimals included in the
conversion of real or integer data to text. Default = 0.
Value: A text of ’length’ characters or more, or a vector of such texts. If
the number is shorter than ’length’, the string is filled up by
leading blanks.
See function DEC_SCAN for the reverse operation.
([DPSOHV
DEC(1000) ;returns " 1000"
DEC(-1,0) ;returns "-1"
DEC(1.3002,6,3);returns " 1.300"
146
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
(',7WH[WNH\
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.
"COLLAPSE" = Removes all spaces and tabs.
"COMPRESS" = Replaces multiple spaces or tabs with single
spaces.
Value: A text or a text vector.
+(;Q
Represents an integer as text in hexadecimal format. 8
’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 -32768 ..
32767, otherwise an 8-character text is returned. Leading zeroes
are used when necessary.
See function HEX_SCAN for the reverse operation.
([DPSOH
HEX(26) ;returns "001A"
HEX(-1) ;returns "FFFF"
HEX(123456) ;returns "0001E240"
'(&B6&$1VWULQJ
+(;B6&$1VWULQJ
2&7B6&$1VWULQJ
Creates an integer or real value out of its text representation.
The text representation may contain leading blanks, a sign (+/-), digits of implied
radix and a decimal point. Any other character is considered as an error generating
a bad status. The allowed ‘digits’ are 0 .. 9 (DEC_SCAN), 0 .. 9, A .. F and a .. f
(HEX_SCAN) or 0 .. 7 (OCT_SCAN).
'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 3), DEC_SCAN returns a
real value, while OCT_SCAN and HEX_SCAN discard the
overflown bits.
See functions DEC, HEX and OCT for the reverse operation.
147
MicroSCADA Programming Language SCIL 1MRS751849-MEN
([DPSOHV
@A = BIN_SCAN("10011")
;returns 19
@A = BIN_SCAN("10.1")
;returns 2.5
@A = DEC_SCAN(" -5")
;returns -5
@A = DEC_SCAN("40000")
;returns 40000
@A = OCT_SCAN("10")
;returns 8
@A = OCT_SCAN("1.2")
;returns 1.25
@A = HEX_SCAN("F")
;returns 15
@A = HEX_SCAN("A.8")
;returns 10.5
,17(*(5B72B%&'LQW>GLJLWV@
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.
([DPSOH
@i_A=9876
@l_bcd=INTEGER_TO_BCD(%i_A,9)
;converts the value of the variable ’i_A’
;returns a list with attributes ’BCD’ and ’STATUS’
@t_bcd=bin(l_bcd:vbcd)
;returns the BCD code converted to textformat
@t_status=dec(l_bcd:vSTATUS)
;returns the status converted to textformat
@l_converted=BCD_TO_INTEGER(l_bcd:vbcd)
;returns a list with attributes ’INT’ and ’STATUS’
@i_converted=l_converted:vINT
;returns an integer as value of the attribute ’INT’
;from the list named ’l_converted’
@t_converted_status=dec(l_converted:vSTATUS)
148
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
/2&$7(VWULQJVWULQJ>DOO@
Locates a text string in a text.
’string1’ A text or text vector. The text to be searched.
’string2’ A text value. The text string to be located.
’all’ Text keyword "ALL". If given, LOCATE searches for all
occurrences of ’string2’ in ’string1’.
Value: An integer (>=0), a vector of such integers or a vector of vectors
of such integers. It represents the start position(s) of ’string2’ in
’string1’. Zero result means that the string was not found.
Without "ALL" The result represents the start position of the
first found ’string2’ in ’string1’. The result is
an integer if ’string1’ is a text value. If
’string1’ is a vector, the result is a vector of
the same length.
With "ALL" The result represents the start positions of all 8
occurrences of ’string2’ in ’string1’. The
result is a vector if ’string1’ is a text value.
If ’string1’ is a vector, the result is a
vector of the same length containing vectors
of integers.
([DPSOH
@A = LOCATE ("ABC","BC")
;returns 2
@A = LOCATE ("ABC","BC ")
;returns 0
@A = LOCATE ("ABB","B","ALL")
;returns vector(2,3)
@A = LOCATE (("FGHBBN","ABBBB"),"BB","ALL")
;returns (vector(4), vector(2,4))
@A = LOCATE (("HBBN","ABBBB","BB","AA"),"BB","ALL")
;returns (vector(2), vector(2, 4), vector(1), vector(0))
/2:(5B&$6(WH[W
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.
See also functions UPPER_CASE and CAPITALIZE.
([DPSOH
LOWER_CASE("VÄSTERÅS") == "västerås"
2&7(Q
Represents an integer as text in octal format.
’n’ An integer or an integer vector.
149
MicroSCADA Programming Language SCIL 1MRS751849-MEN
3$&.B675(VRXUFHW\SH>OHQJWK>E\WHBRUGHU@@
Creates a text, a bit string or a byte string out of its elements.
The function creates a text value out of a vector of its substrings, or a bit string or a
byte string out of a vector of integers that represent the values of bit or byte fields of
given length.
’source’ A vector of integer or text values.
’type’ Text keyword. The data type of the result: "TEXT",
"BIT_STRING" or "BYTE_STRING".
’length’ An integer value, 1, 2, 4, 8, 16 or 32.
If ’type’ = "BIT_STRING", this is the number of bits in each
element of the source vector.
If ’type’ = "TEXT", ’length’ is ignored.
If ’type’ = "BYTE_STRING", the ’length’ argument specifies
how many bytes are initialized by each element of the vector.
The length may be 1, 2 or 4. For example, if the length is 2, each
element of the vector is taken as a 2-byte integer and then
appended to the resulting byte string (The two high order bytes
of the element are ignored).
Default = 1.
’byte_order’ Text keyword: "BIG_ENDIAN" or "LITTLE_ENDIAN". This
argument is relevant only when ’type’ is "BYTE_STRING". The
’byte_order’ argument may be used to create byte strings for an
application running in a computer of a different architecture. In
a little endian architecture (e.g. Intel, Alpha), integers are stored
with the least significant byte first. In a big endian architecture
(e.g. Motorola), integers are stored with the most significant byte
first. This argument should be used only if the resulting byte
string is going to be exported into a foreign system requiring a
specific byte ordering. If omitted, the byte string is created with
the byte ordering of the underlying architecture.
Value: Text, bit string or byte string depending on the ’type’ argument.
See function UNPACK_STR for the reverse operation.
([DPSOHV
PACK_STR(("A","B","CD"),"TEXT") == "ABCD"
PACK_STR((0,1,0),"BIT_STRING") == BIT_SCAN("010")
PACK_STR((0,3,1),"BIT_STRING",2) == BIT_SCAN("001110")
150
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
5(3/$&((WH[WVWULQJQHZBVWULQJ
Replaces text strings by another string.
’text’ Text or text vector containing the input text.
’string’ Text value, the string to be replaced.
’new_string’ Text value, the replacing string.
Value: Text or text vector containing the text in ’text’ with all
occurrences of ’string’ replaced by ’new_string’.
68%675(VWULQJVWDUW>OHQJWK@
Extracts a substring from a text, bit string or byte string value.
'string' A text, a bit string or a byte string value, or a vector of such
values.
'start' An integer 1 .. 255 (texts) or 1 .. 65535 (bit strings) or 1 ..
1048576 (byte strings). The starting position of the substring.
'length' An integer 0 .. 255 (texts) or 0 .. 65535 (bit strings) or 0 ..
1048576 (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).
151
MicroSCADA Programming Language SCIL 1MRS751849-MEN
@V = BIT_SCAN("1010101")
@B = BIN(SUBSTR(%V,2,3))
;returns "010"
@A = SUBSTR(%BYTES, 1, 100000)
;returns a byte string containing the first 100000 bytes of byte string %BYTES.
813$&.B675(VRXUFH>OHQJWK>E\WHBRUGHU@@
Splits a text, a bit string or a byte string to a vector of its elements.
The function splits a text to a vector of substrings, or a bit string or a byte string into
a vector of integers that represent the values of bit or byte fields of given length.
’source’ A text, bit string or byte string value.
’length’ Integer value. The length of the elements in the result vector.
If ’source’ is a text, ’length’ is the number of characters in each
substring.
If ’source’ is a bit string, ’length’ is the number of bits in each bit
field. The following values are allowed: 1, 2, 4, 8, 16, 32. If the
length of ’source’ is not a multiple of ’length’, the excess bits are
ignored.
If ’source’ is a byte string, ’length’ is the number of bytes in the
byte fields. The values 1, 2 and 4 are allowed. ’length’ may also
be negative (-1, -2 or -4), in which case the integers in the byte
string are taken as signed, otherwise they are taken as unsigned.
If the length of ’source’ is not a multiple of ’length’, the excess
bytes are ignored.
Default = 1.
’byte_order’ Text keyword "BIG_ENDIAN" or "LITTLE_ENDIAN". The
’byte_order’ argument specifies the byte ordering of the byte
string (see PACK_STR above). It should only be used if the byte
string has been imported from a foreign system. If omitted, the
byte string is supposed to have the byte ordering of the
underlying architecture.
Value: A text or integer vector.
See function PACK_STR for the reverse operation.
([DPSOHV
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)
152
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
833(5B&$6(WH[W
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.
([DPSOH
UPPER_CASE("Västerås") == "VÄSTERÅS"
%,7B$1'DD
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.
153
MicroSCADA Programming Language SCIL 1MRS751849-MEN
([DPSOHV
BIT_AND(6,5) == 4
BIT_AND(BIT_MASK(0,2,4), BIT_MASK(1,2,4)) == BIT_MASK(2,4)
%,7B&/($5D>E@
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 .. 65535
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’.
([DPSOHV
BIT_CLEAR(3,0) == 2
BIT_CLEAR(2,0) == 2
BIT_CLEAR(BIT_SCAN("01111"),2,4,5) == BIT_SCAN("00100")
%,7B&203/D
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’.
([DPSOHV
BIT_COMPL(0) == -1
HEX(BIT_COMPL(HEX_SCAN("207F"))) == "DF80"
BIT_COMPL(BIT_SCAN("0101")) == BIT_SCAN("1010")
%,7B0$6.>E>E@@
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. 0...32 integer values in the range 0 .. 31.
Value: An integer.
([DPSOHV
BIT_MASK() == 0
BIT_MASK(0) == 1
BIT_MASK(4,0) == 17
%,7B25DD
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
154
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
%,7B6(7D>E@
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 .. 65535
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’.
([DPSOHV 8
BIT_SET(0,3) == 8
BIT_SET(-1,15) == -1
BIT_SET(BIT_SCAN("0101"),1,3) == BIT_SCAN("1111")
%,7B675,1*OHQJWK>E@
Creates a bit string by setting given bits to 1 and the other ones to 0.
’length’ An integer, 1 .. 65535. 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.
([DPSOH
BIT_STRING(5,1,3,5) == BIT_SCAN("10101")
%,7B;25DD
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.
([DPSOHV
BIT_XOR(6,5) == 3
BIT_XOR(BIT_MASK(0,2,4), BIT_MASK(1,2,4)) == BIT_MASK(0,1)
155
MicroSCADA Programming Language SCIL 1MRS751849-MEN
&/$66,)<YQORZKLJK
Classifies the elements of a vector into size classes and returns the counts of each
class.
’v’ A vector with real elements. The vector to be classified.
’n’ An integer in the range 1 .. 10000. The number of classes.
’low’, ’high’ Integer or real numbers (’high’ > ’low’).
Value: A vector of length ’n’ with real elements. The number of
elements in each class.
The range ’low’ .. ’high’ is divided into ’n’ size classes of equal length (’high’ - ’low’)/
’n’. The function calculates the count of elements of ’v’ in each class. If an element
in ’v’ is smaller than or equal to ’low’, it is counted to the lowest class. Elements
larger than or equal to ’high’ are counted to the highest class. An element on a class
boundary is classified to the upper class.
This function is frequently used when calculating duration curves.
([DPSOH
A = (1.0, 5.0, 3.0)
B = CLASSIFY(A, 2, 0.0, 10.0)
;The contents of B:
;B(1) == 2.0 (the range 0.0 .. 5.0)
;B(2) == 1.0 (the range 5.0 .. 10.0)
&808/$7(Y
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.
156
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
'(/(7(B(/(0(17YLQGH[>LQGH[@
Deletes individual elements of a vector.
’v’ Any vector expression.
’index’ A positive integer or an integer vector specifying the elements to
be deleted. If index is higher than the length of vector ’v’ or
negative, nothing is deleted.
’index2’ A positive integer (>= index). If given, the range index .. index2
is deleted. If omitted, only the element(s) specified by ’index’ are 8
deleted.
Value: A vector which is otherwise identical to ’v’, but the element(s)
specified by the index or index range are deleted.
([DPSOH
@V = (1,3,5,7,9)
@I = (6,2,4,0,4)
@R = DELETE_ELEMENT(%V,%I) ;returns vector (1,5,9)
),1'B(/(0(17YYDOXH>VWDUWBLQGH[>FDVHBSROLF\@@
Searches a vector by its element contents.
’v’ A vector of any element type.
’value’ Value to be searched for, may be of any type.
’start_index’ Positive integer, default is 1. The element index to start search.
’case_policy’ Text keyword "CASE_SENSITIVE" or
"CASE_INSENSITIVE", default is "CASE_SENSITIVE".
Meaningful only if the data type of ’value’ is TEXT.
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.
([DPSOH
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)
+,*+Y
/2:Y
The largest (HIGH) or the smallest (LOW) element in a vector.
’v’ A vector with elements of integer, real or time type.
157
MicroSCADA Programming Language SCIL 1MRS751849-MEN
+,*+B,1'(;Y
/2:B,1'(;(Y
The index of the largest or smallest element in a vector.
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.
‘v' A vector with elements of integer, real or time type.
Value: An integer.
([DPSOHV
@V = (1,-5.6,3.3,37)
@A = HIGH_INDEX(%V) ;returns 4
@B = LOW_INDEX(%V) ;returns 2
,16(57B(/(0(17YSRVFRQWHQWV
Inserts new elements into a vector.
'v' Any vector.
'pos' Integer 1 .. MAX_VECTOR_LENGTH or a vector of such
integers. The position(s) where to insert new elements.
'contents' Any type value. The value(s) assigned to inserted element(s).
Value: A vector combined from the elements of 'v' and inserted new
elements.
Position 'pos' (or each element of it, if a vector) is given as the index of the element
in vector 'v' that is to succeed the inserted element in the result vector. As an
example, if 'pos' is 1, the new element(s) are inserted at the beginning of vector. If
'pos' specifies an index that is larger than the length of 'v', the vector is expanded and
elements that are not assigned a value will have status 10
(NOT_SAMPLED_STATUS).
The allowed combinations of 'pos' and 'contents' types are the following:
1. 'pos' is an integer
158
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
,17(53(Y[
Interpolates a value from a curve.
’v’ A vector with real type elements.
’x’ A real value.
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.
([DPSOHV
@A(1) = 1.0 ;X1
@A(2) = 6.0 ;Y1
@A(3) = 3.0 ;X2
@A(4) = 7.0 ;Y2
Y3=INTERP(%A,1.0) ;returns 6.0
Y4=INTERP(%A,2.0) ;returns 6.5
Y5=INTERP(%A,5.0) ;returns 7.0
,19(56((YQORZKLJK
Inverts a curve.
The elements in ’v’ are interpreted to define a monotonously ascending curve y =
y(x), where the index of the vector represents the x-coordinate (1.0 .. length(v)) and
159
MicroSCADA Programming Language SCIL 1MRS751849-MEN
the element value represents the y-coordinate. The INVERSE function inverts this
curve, i.e. solves the curve x = x(y) by linear interpolation.
’v’ A vector with real elements given in ascending order.
’n’ An integer in the range 1...10000, the length of the resulting
vector.
’low’, ’high’ Real numbers (high > low).
Value: A vector of length ’n’ with real elements.
The numeric solution is returned in the resulting vector elements so that the i:th
element gives the x-coordinate corresponding to y = ’low’ + i * (’high’ - ’low’)/’n’. If
y < v(1), value 1.0 is assigned. If y > v(n), where n is the length of ’v’, value n is
assigned.
This function is frequently used when calculating duration curves.
([DPSOHV
@A(1) = 3.0
@A(2) = 4.0
@A(3) = 9.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.
0($1(Y
The mean value of 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.
([DPSOH
@V = (1,-5.6,3.3,37)
@M = MEAN(%V) ;Now %M(1) == 8.925
3,&.(YLQGLFHV
Picks up specified elements from a vector.
’v’ Any vector value.
160
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
5(029(B'83/,&$7(6(Y>VWDWXVBKDQGOLQJ@
Removes duplicate elements of a vector. 8
’v’ Vector value to be examined.
’status_handling’ Text keyword "CONSIDER_STATUS" or
"IGNORE_STATUS"), default = "IGNORE_STATUS"
Value: Vector containing the different element values of ’v’.
Two elements are considered equal if all the following conditions are satisfied:
• The value types are the same.
• The values are the same.
• The status values are the same (when "CONSIDER_STATUS") or else both valid
(<=LAST_VALID_STATUS) (when "IGNORE_STATUS").
The test for equality is recursive, i.e. if an element is a vector or list, its components
are tested for equality.
The element values are returned in the order of appearance in 'v'.
5(9(56((Y
Reverses the order of elements of a vector.
'v' Any vector.
Value: A vector of the same length as the argument vector.
([DPSOH
@V = (1,-5.6,3.3,37)
REVERSE(%V)
;returns (37,3.3,-5.6,1)
6(/(&7(VRXUFHFRQGLWLRQ>ZLOGFDUGV@
Selects the elements of a vector or a list of vectors that fulfil given condition.
'source' A vector or a list of vector attributes of equal length.
'condition' A text containing the selection criterion. The syntax depends on
the data type of the source, see below.
161
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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
6+8))/((Q
Shuffles integers 1 to n into a random order.
162
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
6257(Y>VWDUW>OHQJWK@@
Sorts a vector.
The function sorts a vector of numeric (integer, real or time) or text data into
ascending order or alphabetical order (ASCII code order), respectively. When text
data is sorted, a substring of the text may be selected to be used as the sort key.
’v’ The vector to be sorted. The elements of the vector must be
uniform, either numeric or text.
’start’ The start position (1 .. 255) of the sort key when text data is
sorted. Default = 1, i.e., the first character of the text.
8
’length’ The length of the sort key (1 .. 255). If omitted, the substring
from start position to the end of text is used as the key.
Value: An integer vector. If the length of ‘v' is n, the length of the
resulting vector is also n and it contains integers 1 to n in the
collating sequence of the elements of 'v'. For instance, if the first
element of the result vector is 25, the 25th element of the 'v'
vector is the ‘smallest’ one.
If descending order is required, apply function REVERSE to the result of SORT.
Function PICK is frequently used to physically rearrange the elements into the sort
order.
([DPSOH
@UNSORTED = (7,9,4,3,35,6)
@INDEX = SORT(%UNSORTED)
635($'(YLQGLFHVQHZBYDOXH
Replaces vector elements by new value.
The function creates a vector that is otherwise identical to the argument vector, but
the elements specified by an index vector are replaced by a new value.
'v' Any vector. The source vector.
'indices' A vector of integer elements, 1 .. 10000. The index vector
containing the indices to be replaced.
'new_value' Any SCIL data type. The replacing value(s).
Value: A vector of the same length as 'v'.
163
MicroSCADA Programming Language SCIL 1MRS751849-MEN
If ’new_value’ is of simple (non-vector) data type, the elements listed by ’indices’ are
replaced by that value. If ’new_value’ is a vector, its elements replace the elements
listed the index vector. If vectors ’indices’ and ’new_value’ are unequal in length, the
extra elements of the longer vector are disregarded. indices in the index vector that
are greater than the length of ’v’ are disregarded.
([DPSOH
@V = (1,2,3,4,5)
@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)
680(Y
680B326Y
680B1(*Y
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.
([DPSOHV
@V = (1,-5.6,3.3,37)
@POS = SUM_POS(%V)
@NEG = SUM_NEG(%V)
;Now
;%POS(1) == 41.3
;%NEG(1) = = -5.6
75(1'(YQ
Returns the last (‘newest’) elements of a vector.
'v' Any vector.
'n' An integer in the range 0...10000. 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.
([DPSOHV
@V = (1,-5.6,3.3,37)
164
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
TREND(%V,2) == (3.3,37)
;returns vector (3.3,37)
9(&725>>HOHPHQW>HOHPHQW@
@
Creates a vector out of given elements.
’element’ An expression of any data type. Up to 10000 elements can be
given. Using VECTOR without an argument list creates an
empty vector.
Value: A vector with the given elements.
([DPSOH
@A = VECTOR()
;The variable A will be an empty vector.
165
MicroSCADA Programming Language SCIL 1MRS751849-MEN
([DPSOH
#LOCAL STUFF = LIST(NUMBERS = (1, 2 ,3), NAMES = ("A", "B", "C"))
/,67B$775OLVW
Names of attributes of a list.
’list’ A list value.
Value: A text vector containing the names of attributes of ’list’ in
alphabetical order.
([DPSOH
@X = LIST(AA = 1, BB = 2, CM = "TEST")
LIST_ATTR(%X) ;returns VECTOR("AA", "BB", "CM")
0(5*(B$775,%87(6OHIWULJKW
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.
([DPSOH
#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)
$5*80(17B&2817
The total number of arguments of the program call.
Value: Integer, 0 .. 32.
166
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
$5*80(176
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.
([DPSOH
@A = ARGUMENTS
@B = DO(%PROGRAM, %A)
'2SURJUDP>D@
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
8
return values are not supported by #DO command.
([DPSOH
;An example that calculates the tangent function of its argument.
RESULT = DO(READ_TEXT("TANGENT.SCL"), 0.5)
(5525B67$7(
Returns the current error handling policy.
Value: Text value depicting the current error handling policy: "STOP",
"CONTINUE", "IGNORE" or "EVENT".
([DPSOH
PREVIOUS_ERROR_STATE = ERROR_STATE
#ERROR IGNORE
; Run ignoring errors
...
#ERROR ’PREVIOUS_ERROR_STATE’
0(025<B86$*(NH\ZRUGDUJ
The amount of pool memory allocated for the argument.
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).
’keyword’ Text keyword, "EXPRESSION" or "VARIABLE".
167
MicroSCADA Programming Language SCIL 1MRS751849-MEN
236B&$//FRPPDQG>@
Executes an operating system command.
’command’ A text value. The command to be executed.
’0’ Constant integer. If not included, the OPS_CALL starts the
execution of the command and waits until it has finished. If
included, termination is not waited.
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 when Windows
operating system is used.
([DPSOH
@A = OPS_CALL("mons -d rbsnt 4 -n") ;Opening a MicroSCADA monitor.
236B352&(66FRPPDQG>GLUHFWRU\>ZDLW@@
Starts an external program as a separate process.
The functionality is close to that of OPS_CALL function. However,
OPS_PROCESS does not start the command interpreter, it simply runs the program
given as an argument of the function call. In Windows this means that only "EXE"
files may be started this way. To execute "BAT" files, OPS_CALL should be used.
’command’ Text value containing the command to start the process, e.g.
"\tools\my_tool my_file -my_option".
’directory’ Optional text value containing the work or default directory to be
used by the process. The directory is given in OS dependent
format (see PARSE_FILE_NAME function to obtain OS
directory names). An empty name, "", denotes the work
directory of the caller. Default value = "".
’wait’ Optional text keyword, either "WAIT" or "NOWAIT". If
"WAIT" is given, termination of the created process is waited
for. Otherwise, the function returns immediately after the
process has started. Default is "NOWAIT".
Value: A list value containing the following attributes:
168
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
9$5,$%/(B1$0(6
Lists the names of global variables defined in the SCIL context.
Value: A text vector, the names of global variables in alphabetic order.
169
MicroSCADA Programming Language SCIL 1MRS751849-MEN
:25.67$7,21B&$//FRPPDQG>DUJ@
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.
Return value: 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
([DPSOHV
@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
170
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
This function may be used to supervise the execution of external programs. See also
IP_PROGRAMS below.
&2162/(B287387WH[W
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.
(19,5210(17YDULDEOH
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.
([DPSOH 8
OPERATING_SYSTEM = ENVIRONMENT("OS")
,3B352*5$06
171
MicroSCADA Programming Language SCIL 1MRS751849-MEN
6&,/B+267
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:
172
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
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.
173
MicroSCADA Programming Language SCIL 1MRS751849-MEN
174
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
0$;B021,725B180%(5
Maximum number of monitor objects.
Value: Integer, 50 in MicroSCADA rev. 8.4.4.
0$;B12'(B180%(5
Maximum number of node objects.
Value: Integer, 250 in MicroSCADA rev. 8.4.4.
0$;B2%-(&7B1$0(B/(1*7+
Maximum length of application and Visual SCIL object names.
Value: Integer, 63 in MicroSCADA rev. 8.4.4.
0$;B3,&785(B1$0(B/(1*7+
Maximum length of picture names.
Value: Integer, 10 in MicroSCADA rev. 8.4.4.
0$;B35,17(5B180%(5
8
Maximum number of printer objects.
Value: Integer, 20 in MicroSCADA rev. 8.4.4.
0$;B352&(66B2%-(&7B,1'(;
Maximum number of process objects in a process object group.
Value: Integer, 10000 in MicroSCADA rev. 8.4.4.
0$;B5(35(6(17$7,21B1$0(B/(1*7+
Maximum length of representation names.
Value: Integer, 10 in MicroSCADA rev. 8.4.4.
0$;B67$7,21B180%(5
Maximum number of station objects.
Value: Integer, 5000 in MicroSCADA rev. 8.4.4.
0$;B67$7,21B7<3(B180%(5
Maximum number of station type objects.
Value: Integer, 31 in MicroSCADA rev. 8.4.4.
0$;B7(;7B/(1*7+
Maximum number of characters in a text type value.
Value: Integer, 255 in MicroSCADA rev. 8.4.4.
0$;B9(&725B/(1*7+
Maximum number of elements in a vector.
Value: Integer, 10000 in MicroSCADA rev. 8.4.4.
0$;B:,1'2:B1$0(B/(1*7+
Maximum length of window and picture function names.
175
MicroSCADA Programming Language SCIL 1MRS751849-MEN
9$/,'$7(DVVWULQJ
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" or
"PICTURE_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 or a picture 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.
([DPSOH
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))
176
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
'append'
output is written. See Section 4.5.1 for file naming.
Text keyword "APPEND". If given, the trace output is appended
8
to the file if it already exists.
'time_tags' Text keyword "TIME_TAGS". If omitted, no time tags are
written.
Value: Integer value. The status of file creation (0 = successful).
75$&(B(1'
Stops trace logging.
Value: Integer value. The status of closing the trace file (0 = successful).
75$&(B3$86(
Pauses trace logging.
Value: Integer value. The status the operation (0 = successful).
75$&(B5(680(
Resumes trace logging.
Value: Integer value. The status of the operation (0 = successful).
177
MicroSCADA Programming Language SCIL 1MRS751849-MEN
’objects’ A text vector containing the names of the objects or a list with a
text vector attribute LN containing the names. In the case where
the ’type’ argument (second argument) is "IX" or
"IX_AND_UP", the ’objects’ argument is a list with two
attributes:
LN Text vector containing the object names
IX Integer vector containing the indices
’attributes’ Text vector containing the names of attributes to be read.
Value: A list with attributes specified by ’attributes’. Each attribute is a
vector containing the values of that attribute in the specified
objects.
([DPSOH
OBJECTS = LIST(LN = ("BREAKER1", "BREAKER1"), IX = (10, 22))
ATTRS = ("OV", "OS", "RQ")
VALUES = APPLICATION_OBJECT_ATTRIBUTES(0, "IX", OBJECTS, ATTRS)
OV10 = VALUES.OV(1)
OS10 = VALUES.OS(1)
RQ10 = VALUES.RQ(1)
OV22 = VALUES.OV(2)
OS22 = VALUES.OS(2)
RQ22 = VALUES.RQ(2)
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
Because of modifications to types "P" and "IX", the behaviour in revision 8.4.2 is
not fully compatible with 8.4.1. Types "P" and "IX" no longer count process objects
of user defined types.
178
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
([DPSOH
ALARMS_IN_UNIT_5 = APPLICATION_OBJECT_COUNT(0, "IX", "UNIT", "", 5, "AL == 1")
TIME_CHANNEL_COUNT = APPLICATION_OBJECT_COUNT(0, "T")
$33/,&$7,21B2%-(&7B/,67DSOW\SH>RUGHU>GLUHFWLRQ>VWDUW
>FRQGLWLRQ>DWWULEXWHV>PD[@@@@@
Lists application objects that fulfil given conditions.
’apl’ Integer. The number of the application to navigate in. 0 = current
application. Both local and external applications are supported.
’type’ Text value. Object type: "P", "IX", "UP", "IX_AND_UP", "X",
"F", "D", "C", "T" or "A".
"P" denotes process object groups.
"IX" denotes indices of process objects of
predefined types.
"UP" denotes process objects of user defined
types.
"IX_AND_UP" denotes process objects of both predefined
and user defined types. 8
"X" denotes scales.
"F" denotes free type objects.
"D" denotes data objects.
"C" denotes command procedures.
"T" denotes time channels.
"A" denotes event channels.
’order’ Text. The search order given as a text expression:
"A" or "ALPHABETICAL"
Alphabetical order. When used with type
"P", only group names are included in the
search. If used with type "IX" or
"IX_AND_UP", the indices are searched in
name / index order.
"I" or "INDEX" Index order (only for process objects of
predefined types). Searches the indices of the
process object group given as ’start’.
"P" or "PHYSICAL"
Address order. Applicable only when ’type’
is "IX", "UP" or "IX_AND_UP".
"U" or "UNIT" Alphabetic (name / index) order within the
unit given as ’start’ (types "IX", "UP" and
"IX_AND_UP" only).
"E" or "EXECUTION"
Execution order within a time channel.
’type’ can be either "D" or "C". Whichever
is given, both data objects and command
procedures are searched.
"" Default value (= "A")
179
MicroSCADA Programming Language SCIL 1MRS751849-MEN
180
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
Because of modifications to types "P" and "IX", the behaviour in revision 8.4.2 is
not fully compatible with 8.4.1. Types "P" and "IX" no longer returns process
objects of user defined types. 8
([DPSOH
APPLICATION_OBJECT_LIST(0, "IX")
; All (or 10000 first) process objects (of predefined type) are listed
APPLICATION_OBJECT_LIST(0, "IX", "UNIT", "", 5)
; All objects of unit 5 are listed
APPLICATION_OBJECT_LIST(0, "IX", "UNIT", "", 5, "AL == 1")
; Alarming objects of unit 5 are listed
APPLICATION_OBJECT_LIST(0, "IX", "UNIT", "", 5, "AL == 1", ("OV", "OS", "RQ"))
; Alarming objects of unit 5 are listed,
; attributes LN, IX, OV, OS and RQ are read
([DPSOH
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
181
MicroSCADA Programming Language SCIL 1MRS751849-MEN
)(7&+DSOW\SHQDPH>LQGH[@
Fetches the configuration attributes of an object.
The function makes a list containing all configuration attributes of any application
object (process object, data object, command procedure, time channel, event
channel, scale or free type object).
Additionally, the function may be applied to a base system object. In this case, all
the attributes of the base system object are fetched.
’apl’ Integer expression, 0 .. 99. The number of the application. 0 = the
own application. The function supports both local and external
applications.
’type’ Text expression. The type of the object: "D", "C", "T", "A", "P",
"X", "B" or "F".
’name’ Text expression. The name of the object.
’index’ Integer expression, 0...255. The index of a process object of a
predefined type (not obligatory). If ’index’ is omitted or == 0 for
process objects of the predefined types, the function returns the
attributes that are common to the process object group.
Value: A list containing the configuration attributes of the object, the
dynamic run-time attributes are not returned. If the named object
does not exist, a list is returned with only one attribute, IU, which
has the value -1.
([DPSOH
@V = FETCH(0,"P","A",1)
;V:VLN has value "A"
;V:VIX has value 1
1(;7Q
35(9Q
Fetches the configuration attributes of an object within a search result.
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 7.2.2.
’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.
([DPSOH
#SEARCH 2 0 "P" "A" "A"
@OBJ = NEXT(2)
!SHOW NAME OBJ:VLN
The name of the process object group following A in alphabetical order is shown.
182
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
3+<6B)(7&+DSOXQLWDGGUHVV>ELWBDGGUHVV@
Fetches the configuration attributes of a process object
The process object is specified with its physical address.
’apl’ Integer, 0 .. 99. The logical application number. 0 = the own
application. Only local applications are supported.
’unit’ Integer. The unit number of the process unit where the object is
situated. This is the station number as known to the application.
’address’ Integer. Object address. The OA attribute of the process object.
’bit_address’ Integer, 0...15. Bit number (can be omitted). The OB attribute of
the object.
Value: A list containing the configuration attributes of the object, the
dynamic run-time attributes are not returned. If the object does
not exist, the list contains only one attribute, IU, which has the
value -1.
([DPSOH
@OBJ = PHYS_FETCH (0,3,1010,5) 8
Data object functions
Data objects functions read and write the history registrations of data objects.
'$7$B)(7&+DSOQDPHLQGH[>VWHS>FRXQW@@
'$7$B)(7&+DSOQDPHWLPHWLPH>VWHS>VKLIW@@
'$7$B)(7&+DSOQDPHWLPH>VWHS>FRXQW>VKLIW@@@
'$7$B)(7&+DSOQDPHLQGLFHV
Reads history records of a data object.
’apl’ Integer, 0 .. 99. The logical application number (0 = the own
application). External applications are supported.
’name’ Text data. The name of the data object.
’index1’ Integer, 0 .. 500000. The index of the first record to be fetched.
’step’ Integer, positive or negative. Defines the step between records to
be fetched. The default value = 1 (all records are fetched). If
’step’ is negative, the values are returned in reverse time order.
For example, if ’step’ = 2, records ’index1’, ’index1’ + 2, ’index1’
+ 4, etc. are fetched.
If ’step’ = -2, records ’index1’, ’index1’ - 2, ’index1’ - 4, etc. are
fetched.
’count’ Integer, 0 .. 10000. The number of records to be fetched. 0
(default) means all existing records up to 10000.
’indices’ Vector. An integer vector defining explicitly the records to be
fetched.
’time1’ Time data. The start of the time interval to be fetched.
’time2’ Time data. The end of the time interval. If ’time1’ < ’time2’, the
values are returned in time order regardless of the sign of ’step’.
If ’time1’ > ’time2’, the values are returned in reversed time order
regardless of the sign of ’step’. The given time range is regarded
183
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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.
([DPSOHV
DATA_FETCH (0,"ABC",1,5,0)
;Every fifth history record of the data object ABC is read.
T1 = PACK_TIME (1989,9,10,0,0,0)
T2 = PACK_TIME (1989,9,10,12,0,0)
;Two time data values are defined.
'$7$B6725(DSOQDPHGDWDLQGH[>VWHS@
'$7$B6725(DSOQDPHGDWDLQGLFHV
Writes historical records of a data object.
’apl’ Integer, 0 .. 99. The logical application number. 0 = the own
application. External applications are supported.
’name’ Text. The name of the data object.
’data’ List. The values to be stored, 3 attributes:
OV Real vector - recorded values
RT Time vector - registration times
OS Integer vector - status codes
If the RT attribute is missing from ’data’, the original registration
times are kept. If the OS attribute is missing, the status codes of
the elements of OV vector are stored as the OS attribute.
184
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
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.
8
Process object query functions
Process object query functions are used to browse the results of a process object
query defined by preceding #INIT_QUERY command.
These functions are more or less obsolete. Use more powerful SCIL functions
APPLICATION_OBJECT_LIST and APPLICATION_OBJECT_ATTRIBUTES
for a query of the process database and HISTORY_DATABASE_MANAGER to
browse the event history.
(1'B48(5<
Tells whether a process object query is completed.
The function tests whether all objects matching a process query initiated by the
#INIT_QUERY command (Chapter 7) have been read with the PROD_QUERY
function.
Value: Boolean data. TRUE = the query is completed. FALSE = the
query is not completed.
([DPSOH
#IF END_QUERY #THEN #BLOCK
!SHOW MESSAGE "READY"
#BLOCK_END
#ELSE #BLOCK
@LIST = PROD_QUERY(20)
!SHOW NAME LIST:VLN
!SHOW VALUE LIST:VOV
#BLOCK_END
If the query has been completed, the message READY is shown on screen.
Otherwise, 20 more process objects are handled.
352'B48(5<Q
Returns attributes of objects selected by a process object query.
185
MicroSCADA Programming Language SCIL 1MRS751849-MEN
The function returns attribute values of the process objects selected by the preceding
#INIT_QUERY command (see Chapter 7). The query concerns always the current
application.
After one #INIT_QUERY, the function may be called several times. Each time it
continues from where it finished previously.
’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)
Object value: OV (Object Value), OS (Object Status)
Alarm state: AL (Alarm), AS (Alarm State), AR (Alarm Receipt), AZ (Alarm
Zone)
Time stamps: RT (Registration Time), RM (Registration Milliseconds), AT
(Alarm Time), AM (Alarm Milliseconds), YT, YM
RTU attributes: SE (Selection), SP (Stop Execution), OF (Overflow),
Stamps set by the station: BL, CT, OR, RA, RB, SB
Blocking attributes: AB, HB, PB, UP, XB
Miscellaneous attributes: RI, RX
In addition, when the query concerns the history buffer: CA (Changed Attribute)
The attribute values of a certain attribute form a vector. For example, the LN
attribute is a vector of all object names included in the query. Vector elements with
the same index refer to the same process object.
([DPSOHV
The result of the function call PROD_QUERY(4) could be:
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.
186
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
187
MicroSCADA Programming Language SCIL 1MRS751849-MEN
188
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
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.
189
MicroSCADA Programming Language SCIL 1MRS751849-MEN
190
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
191
MicroSCADA Programming Language SCIL 1MRS751849-MEN
When a query is interrupted by TIMEOUT and the query order is EVENT, it is not
guaranteed that the events returned by two subsequent queries are returned in
exactly correct order. It is possible, that events contained in database files not yet
processed should have been included in the results of the interrupted query.
The following example reads the latest 20 events, then waits a second and reads the
new ones. For clarity, error handling is omitted.
([DPSOH
@R = HISTORY_DATABASE_MANAGER("OPEN")
@SESSION = R:VSESSION
@PER=HISTORY_DATABASE_MANAGER("SET_PERIOD", SES:VSESSION,
PACK_TIME(1998,4,1,0,0,0),CLOCK)
@FIRST = HISTORY_DATABASE_MANAGER("QUERY",%SESSION,20)
#IF FIRST:VCOUNT > 0 #THEN #BLOCK
#PAUSE 1
@R = HISTORY_DATABASE_MANAGER("SET_ORDER",%SESSION,"FORWARD")
@SECOND = HISTORY_DATABASE_MANAGER("QUERY",%SESSION,100,FIRST:VID(1))
#BLOCK_END
The second query may miss a new event if its time-stamp is out of order.
+,6725<B'$7$%$6(B0$1$*(55($'VHVVLRQHYHQW
Read all the attributes of the event specified by the event identifier. 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.
+,6725<B'$7$%$6(B0$1$*(56(7B&200(17VHVVLRQHYHQW
FRPPHQW
Set 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.
+,6725<B'$7$%$6(B0$1$*(5:5,7(VHVVLRQGDWD
Writes an event into the history database.
’data’ List value describing all the attributes of one event.
’session’ Integer value returned by OPEN command.
Value: List.
192
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
193
MicroSCADA Programming Language SCIL 1MRS751849-MEN
194
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
195
MicroSCADA Programming Language SCIL 1MRS751849-MEN
3$56(B),/(B1$0(QDPH>ILOH@
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.
3$7+QDPH
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 7.2.4 for details of logical paths.
196
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
3$7+6OHYHO
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 7.2.4 for details of logical paths.
5($'B%<7(6ILOH>VWDUW>OHQJWK@@
Reads a binary file.
Using this function any file may be read as a sequential binary file, i.e. an
unstructured string of bytes. It is usually used to import data generated by some 8
external application or to read a compiled SCIL program from a file.
’file’ Text or byte string (file tag). The name of the file. See Section
4.5.1 for file naming.
’start’ Positive integer value, defaults to 1. Specifies the byte position
within the file where to start reading.
’length’ Non-negative integer value. Specifies the maximum number of
bytes to be read. Default value = 1048576 (max. byte string
length).
Return value: Byte string containing the read data.
See also function WRITE_BYTES.
5($'B&2/8016ILOHSRVZLGWK>VWDUW>FRXQW@@
Reads a text file as columns.
The function reads a text file as columns and stores them in a vector where each
element is a text vector containing the text of one column.
’file’ Text or byte string (file tag). The name of the file. See Section
4.5.1 for file naming.
’pos’ Integer vector. Specifies the start positions of the columns to be
read (1 .. 510). The positions do not have to be in ascending
order.
’width’ Integer vector. The ’width’ argument must be of the same length
as the ’pos’argument. Specifies the column widths (1 .. 255). The
columns are allowed to overlap. Columns are read up to
character position 510 only.
’start’ Positive integer value, defaults to 1. Specifies the line number
within the file where to start reading.
’count’ Non-negative integer value, defaults to 10000. Specifies the
maximum number of lines to be read.
197
MicroSCADA Programming Language SCIL 1MRS751849-MEN
Value: A vector of the same length as ’pos’ and ’width’. Each element of
the vector is a text vector containing the text of one column.
This function can be used to read text files containing long (256 .. 510) lines by
specifying two columns, for example 255 characacters wide each.
See also function WRITE_COLUMNS.
5($'B3$5$0(7(5ILOHVHFWLRQNH\>GHIDXOW@
Reads a parameter from a parameter file.
’file’ Text or byte string (file tag). The name of the parameter file. See
Section 4.5.1 for file naming.
’section’ Text. The name of the section.
’key’ Text. The key of the parameter.
’default’ Text. The value to be returned if ’section’ or ’key’ does not exist
in the specified file.
Value: A list with the following two attributes:
STATUS = The status code of the read operation.
VALUE = The value of the parameter. Returned only if
STATUS = 0.
The parameter files are described in Section 4.5.2.
If the given section or key does not exist, error code
SCIL_SECTION_DOES_NOT_EXIST or SCIL_KEY_DOES_NOT_EXIST is
returned in the STATUS attribute.
See also functions WRITE_PARAMETER and DELETE_PARAMETER.
([DPSOH
PORT = READ_PARAMETER("C:\WINNT\WIN.INI","MCILAU","UDP PORT")
5($'B7(;7ILOH>VWDUW>QXPEHU@@
Reads a text file.
’file’ Text or byte string (file tag). The file name. See Section 4.5.1 for
file naming.
’start’ Positive or negative integer. If positive, it is the number of the
first line to be read from the text file counted from the beginning
of the file (1 = the first line). If negative, it is the number of the
last line to be read counted from the end of the file (-1 = the last
line). Default: 1.
’number’ Integer, 0 .. 10000. The number of lines to be read from the file.
0 = nothing is read. Default: 1000.
If ’start’ is omitted, reading starts from the beginning of the file. If ’number’ is
omitted, reading is performed to the end of file, or until 1000 lines have been read.
Value: A text vector containing the lines read from the file.
See also function WRITE_TEXT.
([DPSOH
!SHOW DIRECTIVE READ_TEXT("DIRECTIVE.TXT")
198
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
;The contents of the file DIRECTIVE.TXT are shown in the window DIRECTIVE.
5(3B/,%QDPH
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 7.2.4 for details of logical representation
libraries.
5(3B/,%6OHYHO
8
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 librariess
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 7.2.4 for details of logical representation
libraries.
6+$'2:B),/(ILOHBQDPH
Queues a file for shadowing.
’file_name’ Text or byte string (file tag). The name of the file. See Section
4.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.
199
MicroSCADA Programming Language SCIL 1MRS751849-MEN
200
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
’file’ Text or byte string (file tag). The name of the parameter file. See
Section 4.5.1 for file naming.
’section’ Text. The name of the section.
’key’ Text. The key of the parameter.
’value’ Text. The value to be assigned to the parameter.
Return value: A list with one attribute:
STATUS = The status code of the write operation.
The file and/or the section is created if it does not exist. The parameter files are
described in Section 4.5.2.
Parameter file lines may be up to 510 characters long. If both the key and the data
are exactly 255 characters long, error
SCIL_PARAMETER_FILE_LINE_TOO_LONG is raised.
Because the spaces before and after the equal sign are insignificant, it is not possible
to write a key value with a leading space character.
See also functions READ_PARAMETER and DELETE_PARAMETER.
:5,7(B7(;7ILOHWH[W>DSSHQG@
8
Writes a text file.
’file’ Text or byte string (file tag). The name of the file. See Section
4.5.1 for file naming.
’text’ A text vector containing the text to be written.
’append’ An integer value, 0 or 1. Default = 0.
If 0, the old contents of ’file’ are lost.
If 1, the ’text’ is appended to the file.
Value: An integer. The status code of the file write, 0 = OK.
See also function READ_TEXT.
([DPSOH
S = WRITE_TEXT("A", V, 1)
#IF S == 0 #THEN !SHOW INFO "File successfully appended"
#ELSE !SHOW INFO "Append failed by " + STATUS_CODE_NAME(S)
201
MicroSCADA Programming Language SCIL 1MRS751849-MEN
202
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
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: 8
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 7.2.5) and file handling functions (Section 8.14)
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.
The following commands are recognized by DRIVE_MANAGER:
• LIST
• EXISTS
• GET_DEFAULT
• GET_ATTRIBUTES
'5,9(B0$1$*(5/,67
Returns the drives available in the system.
Value: Vector value containing the drive tags of the available drives.
203
MicroSCADA Programming Language SCIL 1MRS751849-MEN
'5,9(B0$1$*(5(;,676GULYH
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.
'5,9(B0$1$*(5*(7B'()$8/7
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.
'5,9(B0$1$*(5*(7B$775,%87(6WDJ
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. Bad status is not
returned if TYPE is "REMOVABLE" and
device is not available.
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"
CAPACITY Integer or integer vector value: The total
capacity of the drive in kilobytes. 0 is
returned for unavailable device of TYPE
"REMOVABLE".
FREE Integer or integer value: The unused capacity
of the drive in kilobytes. 0 is returned for
unavailable device of TYPE
"REMOVABLE".
DIRECTORY_MANAGER
The following commands are recognized by DIRECTORY_MANAGER:
• LIST
• CREATE
• DELETE
• DELETE_CONTENTS
204
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
• EXISTS
• COPY
• COPY_CONTENTS
• MOVE
• RENAME
• GET_ATTRIBUTES
',5(&725<B0$1$*(5/,67GLUHFWRU\>ILOWHU>UHFXUVLRQ@>KLGGHQ@@
Lists the directories contained in a given directory.
'directory' Absolute directory tag of the directory whose contents are listed.
'filter' Text value: The filter for the directory names to be listed. May
contain wildcard characters * , % and ?.
Default value is "" (no filter).
'recursion' Text keyword "RECURSIVE" or "NON_RECURSIVE".
Recursive listing means that whole directory hierarchy rooted in
'root' is listed.
Default value is "NON_RECURSIVE". 8
'hidden' Text keyword "EXCLUDE_HIDDEN" or
"INCLUDE_HIDDEN". Specifies whether hidden directories
are listed or not. Default value is "EXCLUDE_HIDDEN"
Value: Vector value containing the relative directory tags of the
directories found.
Arguments 'recursion' and 'hidden' may be given in any order.
',5(&725<B0$1$*(5&5($7(GLUHFWRU\>UHFXUVLRQ@
Creates a directory or a hierarchy of directories.
'directory' Absolute directory tag of the directory to be created.
'recursion' Text keyword "RECURSIVE" or "NON_RECURSIVE".
Recursive creation means that all missing directories contained
in ‘directory' are created.
Default value is "NON_RECURSIVE".
Value: Integer value: The status code of the operation.
',5(&725<B0$1$*(5'(/(7(GLUHFWRU\
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.
205
MicroSCADA Programming Language SCIL 1MRS751849-MEN
',5(&725<B0$1$*(5'(/(7(B&217(176GLUHFWRU\>ILOWHU
>VXEGLUHFWRULHV@@
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.
',5(&725<B0$1$*(5(;,676GLUHFWRU\
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.
',5(&725<B0$1$*(5&23<VRXUFHWDUJHW
Copies a directory and all its contents into a new directory.
’source’ Absolute directory tag of the source directory.
’target’ Absolute directory tag of the target directory, which is created by
COPY.
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 copied.
Missing if OK == TRUE.
STATUS An integer vector containing the status codes
of failed copies. Missing if OK == TRUE.
206
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
',5(&725<B0$1$*(5&23<B&217(176VRXUFHWDUJHW>ILOWHU
>VXEGLUHFWRULHV>RYHUZULWH@@@
Copies the files of a directory into another directory. Optionally, the subdirectories
are recursively copied as well.
’source’ Absolute directory tag of the source directory.
’target’ Absolute directory tag of the target directory (not created by
COPY_CONTENTS).
’filter’ Text value: The filter for the file and directory names to be
copied.
May contain wildcard characters * , % and ?.
Default value is "" (no filter).
’subdirectories’ Text keyword "INCLUDE_DIRECTORIES" or
"OMIT_DIRECTORIES"
Specifies whether the subdirectories are copied or not.
If subdirectories are copied, the filter is applied to the name of
subdirectories (not to the contained files).
’overwrite’
Default value is "OMIT_DIRECTORIES".
Text keyword "OVERWRITE" or "DONT_OVERWRITE"
8
Specifies whether an existing file in target directory is
overwritten or not.
Default value is "DONT_OVERWRITE"
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 copied.
Missing if OK == TRUE.
STATUS An integer vector containing the status codes
of failed copies. Missing if OK == TRUE.
',5(&725<B0$1$*(5029(GLUHFWRU\WDUJHW
Moves a directory to another directory.
’directory’ Absolute directory tag of the directory to be moved.
’target’ Absolute directory tag of the directory to become the new parent
directory.
Value: List value with following attributes:
STATUS Integer value, the status code of the
operation.
NEW_TAG New tag for the moved directory
(if STATUS == 0)
207
MicroSCADA Programming Language SCIL 1MRS751849-MEN
',5(&725<B0$1$*(55(1$0(GLUHFWRU\QDPH
Renames a directory.
’directory’ Absolute directory tag of the directory to be renamed.
’name’ Text value, the new directory name.
Value: List value with following attributes:
STATUS Integer value, the status code of the
operation.
NEW_TAG New tag for the renamed directory
(if STATUS == 0)
',5(&725<B0$1$*(5*(7B$775,%87(6GLUHFWRU\
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.
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
),/(B0$1$*(5/,67GLUHFWRU\>ILOWHU>UHFXUVLRQ@>KLGGHQ@@
Lists the files contained in a given directory.
'directory' Absolute directory tag of the directory whose contents are listed.
'filter' Text value: The filter for the file names to be listed.
May contain wildcard characters * % and ?.
Default value is "" (no filter).
'recursion' Text keyword "RECURSIVE" or "NON_RECURSIVE".
Recursive listing means that all files in the directory hierarchy
rooted in 'directory' is listed.
Default value is "NON_RECURSIVE".
208
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
209
MicroSCADA Programming Language SCIL 1MRS751849-MEN
Auxiliary functions
)0B$33/,&$7,21B',5(&725<>SDWK@
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.
210
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
211
MicroSCADA Programming Language SCIL 1MRS751849-MEN
212
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
213
MicroSCADA Programming Language SCIL 1MRS751849-MEN
214
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
’link’ Integer. The base system object number of the link, the LINn:B
object, to which the communication unit is connected. The LIN
object (the LINn:BSD attribute) defines the system device name
of the unit, RM00 or RM01, which was given to the unit during
installation. Hence, the program given with ’file’ is loaded to the
NET unit with the device name defined in the LIN object
specified with ’link’.
’start’ An integer stating whether the NET unit will be started or not
after the program has been loaded: 0 = the NET is not started,
anything else = the NET is started.
Value: The function always returns the value 0.
([DPSOH
@LOAD = LOAD_DCP("SYS_NET2",2,1)
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).
63$&20PHVVDJH
Communicates with a SPACOM unit connected to a COM port.
8
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).
7,0(287PLOOLVHFV
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).
([DPSOH
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.
215
MicroSCADA Programming Language SCIL 1MRS751849-MEN
216
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
DMLERR_REENTRANCY 16397
DMLERR_SERVER_DIED 16398
DMLERR_SYS_ERROR 16399
DMLERR_UNADVACKTIMEOUT 16400
DMLERR_UNFOUND_QUEUE_ID 16401
DMLERR_ITEM_TOO_LONG 20483
''(B&211(&7VHUYLFHWRSLF
Opens a connection to an external application.
The connection gets an identification number which is used in the subsequent DDE
operations. The DDE connections are SCIL context specific which means that they
are automatically closed when a picture is exited, when a command procedure has
been executed to the end or when the dialog system is deleted. Each SCIL context
can have up to 10 open DDE connections simultaneously.
The remote application must be running when the DDE_CONNECT function is
issued. Likewise, the topic for which DDE_CONNECT is issued must be available.
For instance, for Excel this means that the desired spreadsheet must be opened. The 8
remote application can be started from SCIL with the OPS_CALL command. At the
same time the desired topic (e.g. a file) can be opened. A topic can also be opened
later by sending an open command to the server application using the
DDE_EXECUTE function.
’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.
CONNECTION_ID = Integer, 1 .. 10. The Id-number of
the connection. If the connection
did not succeed (STATUS <>
DMLERR_NO_ERROR), the
CONNECTION_ID is undefined.
([DPSOH
Connecting to Excel 5.0, sheet 1:
@RESULT=DDE_CONNECT("EXCEL", "SHEET1")
#IF RESULT:VSTATUS == DMLERR_NO_ERROR #THEN #BLOCK
@CONN = RESULT:VCONNECTION_ID
#BLOCK_END ; Connection was successful
#ELSE #BLOCK ; Connection not successful
#BLOCK_END
217
MicroSCADA Programming Language SCIL 1MRS751849-MEN
''(B',6&211(&7FRQQHFWLRQBLG
Closes the connection specified by the argument.
’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.
([DPSOH
Disconnecting from a remote application (e.g. Excel):
@RESULT=DDE_DISCONNECT(%CONN )
#IF RESULT:VSTATUS == DMLERR_NO_ERROR #THEN #BLOCK
;Connection was successfully closed.
#BLOCK_END
#ELSE
;Connection not successfully closed.
''(B5(48(67FRQQHFWLRQBLGLWHP>WLPHRXW@
Requests data from a remote application.
A connection to the application must be open (see above).
’connection_id’ Integer, 1 .. 10. The DDE identifier obtained using the
DDE_CONNECT.
’item’ Text. A valid DDE item in the remote application.
’timeout’ Integer, 0 .. 1000. The DDE transaction timeout in seconds. The
parameter is optional. Default value = 20 s.
Value: A list containing the following two attributes:
STATUS = A predefined integer (see above). The value
indicates whether the function was
successfully executed.
DMLERR_NO_ERROR (= 0) means that
the operation succeeded.
DATA = Text (max length 255). Includes requested
data. If STATUS is NOT equal to
DMLERR_NO_ERROR, the DATA is
undefined.
([DPSOH
Requesting data from Excel:
@RESULT=DDE_REQUEST(%CONN, "R1C1", 30)
#IF RESULT:VSTATUS== DMLERR_NO_ERROR #THEN #BLOCK
@ITEM_VALUE=RESULT:VDATA
;The request was successful
#BLOCK_END
#ELSE #BLOCK
;The request was NOT successful
#BLOCK_END
218
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
The cell references in Excel are language dependent if the reference style R1C1 is
used (R for row and C for column). To check the type of reference style and the cell
reference notation of your Excel version select: Tools|Options|General tab.
''(B32.(FRQQHFWLRQBLGLWHPYDOXH>WLPHRXW@
Sets the value of ’item’ in a remote application.
A connection to the application must be open (see above).
’connection_id’ Integer, 1 .. 10. The DDE identifier obtained using the
DDE_CONNECT.
’item’ Text. A valid DDE item in the remote application.
’value’ Text. The value which will be set into item.
’timeout’ Integer, 0 .. 1000. The DDE transaction time-out in seconds. The
parameter is optional. Default value = 20 s.
Value: A list containing the following attribute:
STATUS = A predefined integer (see above). The value
8
indicates whether the function was
successfully executed.
DMLERR_NO_ERROR (= 0) means that
the operation succeeded.
([DPSOH
Setting "Time of Day" in cell "R1C1" in Excel:
@RESULT=DDE_POKE(%CONN, "R1C1", TOD, 30)
#IF RESULT:VSTATUS == DMLERR_NO_ERROR #THEN #BLOCK
;The value was successfully set.
#BLOCK_END
#ELSE #BLOCK
;The value was NOT successfully set.
#BLOCK_END
''(B(;(&87(FRQQHFWLRQBLGVWDWHPHQW>WLPHRXW@
Executes a statement in a remote application.
The connection to the application must be open. To be able to use this function you
need to have the DDE documentation of the server application.
’connection_id’ Integer, 1 .. 10. The DDE connection identifier obtained using
the DDE_CONNECT.
’statement’ Text. A valid executable statement in the remote application (see
the documentation of the application in question).
’timeout’ Integer, 0 .. 1000. The DDE transaction time-out in seconds. The
parameter is optional. Default value = 20 s.
Value: A list containing the following attribute:
219
MicroSCADA Programming Language SCIL 1MRS751849-MEN
The string "%o~" corresponds to <Alt+o><ENTER> in Excel and opens a dialog for
cell formatting.
Use the DDE_EXECUTE function with caution! Different applications respond
differently to the DDE_EXECUTE statement. Excel, for example, must be the
active application on the desktop to be able to execute a submitted DDE_EXECUTE
command.
220
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
’vector’ Vector. A valid SCIL expression. The vector may only contain
real, integer, text and boolean elements. Note that the vector will
be transformed into a text which can contain no more than 256
characters.
’decimal_separator’Text. A valid separator in the client application.
’list_separator’ Text. A valid separator in client application.
Return value: A text composed of the elements in ’vector’ separated by the list
separator (see the example below).
If a vector element is of invalid data type or missing, there is an
empty value in result string. In other words, there are two
consecutive list separator characters in the result string.
([DPSOH
#SET APL:BUV = (TEST,1,2.0)
@A = DDE_VECTOR(APL:BUV," ." ," ;" )
;Result: %A = TEST;1;2.0
''(B5($/UHDOVHSDUDWRU
Creates a text format real number with a user defined decimal separator.
8
’real’ Real. A valid SCIL expression.
’separator’ Text. A valid decimal separator in client application.
Return value: A text value with defined decimal separator.
([DPSOH
#SET APL:BUV1 = 1.23
@A = DDE_REAL(APL:BUV1,",")
;Result: %A = 1,23
221
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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 B.
64/B&211(&7VRXUFHXVHUSDVVZRUG
Opens an ODBC connection to a data source.
The data source may be situated in the same computer or in another computer on the
network. The connection gets an identification number which is used in the
subsequent ODBC functions.
The ODBC connections are SCIL context specific. This means that when the
context, e.g. the picture or command procedure, is exited, the connections are
automatically closed.
Up to 10 ODBC connections may be open simultaneously.
’source’ Text. The data source name as defined by the ODBC
administration tool.
’user’ Text. A text string containing the user name that is to be used
when accessing the data source specified in ’source’. An empty
string if no user name needed.
’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 value indicates whether the
function was successfully
executed or not.
CONNECTION_ID = Integer, 1...10. The identification
number of the connection. If the
operation did not succeed, i.e.,
STATUS is neither
SQL_SUCCESS nor
SQL_SUCCESS_WITH_INFO,
CONNECTION_ID is undefined.
ERROR_CODE = Text. A five characters long
ODBC-error code. If STATUS is
anything else than SQL_ERROR
or
SQL_SUCCESS_WITH_INFO,
ERROR_CODE is undefined.
([DPSOH
Opening the connection to a data source named ACCESS:
@RESULT = SQL_CONNECT("ACCESS", "MICRO", "SCADA")
222
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
64/B',6&211(&7FRQQHFWLRQBLG
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). A value
that indicates whether the function was
successfully executed.
8
ERROR_CODE = Text. A five characters long ODBC-error
code. If STATUS is anything else than
SQL_ERROR or
SQL_SUCCESS_WITH_INFO,
ERROR_CODE is undefined.
([DPSOH
Closing the connection opened in the example above:
@RESULT = SQL_DISCONNECT(%CONN)
#IF RESULT:VSTATUS <> SQL_SUCCESS AND-
RESULT:VSTATUS <> SQL_SUCCESS_WITH_INFO #THEN #BLOCK
;The connection was not successfully disconnected.
#BLOCK_END
64/B(;(&87(FRQQHFWLRQBLG64/VWULQJ
Executes an SQL statement.
The function executes the SQL statement on the connection specified by the
’connection_id’ argument. It reserves a statement identification number which is
used in a possible subsequent SQL_FETCH function. Each connection may have up
to ten simultaneous execute statements.
’connection_id’ Integer 1 .. 10. The identification number of the connection on
which the statement is to be executed.
’SQLstring’ Text or text vector. The SQL statement that is to be executed. For
more information, see SQL manuals.
Value: A list containing the following three attributes:
STATUS = A predefined integer
(see above).
A value that indicates whether the
function was successfully
executed.
223
MicroSCADA Programming Language SCIL 1MRS751849-MEN
224
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
([DPSOH
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.
64/B)5((B67$7(0(17VWDWHPHQWBLG
Frees the specified statement and stops processing associated with the statement.
8
This function must be used if several calls to SQL_EXECUTE are issued on the
same connection. All open statements associated with the connection will be freed
automatically when a connection is closed.
’statement_id’ Integer, 1... 100. The statement identification returned from
SQL_EXECUTE.
Value: A list containing the following two attributes:
STATUS = A predefined integer (see above). A value
that indicates whether the function was
successfully executed.
ERROR_CODE = Text. A five characters long ODBC-error
code. If STATUS is anything else than
SQL_ERROR or
SQL_SUCCESS_WITH_INFO,
ERROR_CODE is undefined.
([DPSOH
@RESULT=SQL_FREE_STATEMENT(%STMT)
#IF RESULT:VSTATUS <> SQL_SUCCESS AND-
RESULT:VSTATUS <> SQL_SUCCESS_WITH_INFO -
#THEN #BLOCK
;The statement was not successfully freed.
#BLOCK_END
64/B%(*,1B75$16$&7,21FRQQHFWLRQBLG
Marks the beginning of a transaction.
The transaction will be completed when SQL_COMMIT or SQL_ROLLBACK is
encountered (see below). Disconnecting the connection will also commit the
transaction.
’connection_id’ Integer, 1 .. 10. The identification of the connection on which the
transaction is to be executed.
225
MicroSCADA Programming Language SCIL 1MRS751849-MEN
64/B&200,7FRQQHFWLRQBLG
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). A value that
indicates whether the function was successfully
executed.
226
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
227
MicroSCADA Programming Language SCIL 1MRS751849-MEN
6= Analog value
7= Indication (single or double)
8= Pulse counter
9= Digital value
10 = Indication event recording (indication with time stamp)
11 = Analog event recording
([DPSOH
RTU = RTU_ADDR(RTU_KEY(X:POA1))
;Now
;RTU:VTP = = 5
;RTU:VBA = = 201
578B$,17L
Converts an integer to ASCII characters (according to the RP570 protocol).
’i’ An integer number.
Value: A text of two characters.
([DPSOH
RTU_HEXASC(RTU_AINT(342))
;returns "0156"
578B$5($/U
Converts a real number to four ASCII characters (float DS801).
’r’ A real number.
Value: A text of four ASCII characters.
([DPSOH
RTU_HEXASC (RTU_AREAL(5.5))
;returns "40B00000"
578B%,1K
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.
([DPSOH
RTU_BIN("414243")
;returns "ABC"
228
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
578B+(;$6&E
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.
([DPSOH
RTU_HEXASC("ABC")
;returns "414243"
578B,17D
Converts two ASCII characters (2’s complement RP570) to an integer.
’a’ A text of two ASCII characters.
Value: Integer.
([DPSOH
RTU_INT(RTU_BIN("0156"))
;returns 342
578B.(<RD 8
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.
([DPSOH
@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.
578B06(&DWLPH
Returns the milliseconds of the 6-byte RTU time string ’atime’.
’atime’ Text. The RTU time.
Value: Integer. The number of milliseconds.
578B2$W\SHED
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.
([DPSOH
RTU_OA(5,201)
;returns 20681
229
MicroSCADA Programming Language SCIL 1MRS751849-MEN
578B5($/D
Converts 4 ASCII characters (float DS801) to a real number.
’a’ A text of four ASCII characters.
Value: A real number.
([DPSOH
RTU_REAL(RTU_BIN("40B00000"))
;returns 5.5
578B7,0(D
Converts ASCII (RTU200 time) to MicroSCADA time data.
’a’ A text of 6 ASCII characters.
Value: Time data.
230
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
)LJ 6&,/GHILQHGRU³WUDQVSDUHQW´SULQWRXW
The target printer(s) of the printout are defined by the initiating #PRINT or #LIST
command or the LD attribute of the process object. If there is no ‘transparent’ printer
among the target printers, the function has no effect. Printers defined as ‘transparent’
can only handle printout defined by this function.
Unlike the semi-graphic picture based printout, the printout produced with the
PRINT_TRANSPARENT function does not automatically include any
231
MicroSCADA Programming Language SCIL 1MRS751849-MEN
MicroSCADA 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).
232
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
’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.
([DPSOH
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 8
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.
35,17(5B6(7
Returns the target printer numbers.
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.
Value: A vector of integer elements.
233
MicroSCADA Programming Language SCIL 1MRS751849-MEN
75$16/$7((WH[W>ODQJXDJH@
Translates texts defined in Visual SCIL objects.
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.
'text' A text value. Reference to a text identifier defined in the dialog
editor. The reference starts with an @.
'language' A text keyword. Language identifier as defined in the ISO
standard 639.
234
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 8. Functions
235
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 9. Graphics primitives
9. Graphics primitives
This chapter describes the use of the graphics primitives, which constitute the base
of all full graphics elements in MicroSCADA pictures, partly also in dialogs. The
first section introduces some concepts related to the graphics primitives.
9.1. Introduction
MicroSCADA 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 MicroSCADA picture program (see
Section 2.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 7), the graphics commands
are not allowed in command procedures, unless they are executed by #DO 9
commands or DO functions situated in user interface objects. The graphics
commands are described in Section 9.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 9.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 9.4. to learn about the SCIL and VS
coordinates, and the mouse input commands.
237
MicroSCADA Programming Language SCIL 1MRS751849-MEN
Miscellaneous
The context definitions, canvas selection and scaling can be temporarily stored and
restored within the same picture. See Section 9.5.
The display of the graphics on screen can be controlled by some display handling
commands (Section 9.5.2).
238
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 9. Graphics primitives
If the FILL option is given, the arc is filled according to the ARC_MODE
component of the graphics context.
)LJ 'UDZLQJDQDUFZLWKWKH$5&FRPPDQG
%2;>>VFRSH@Q@[\ZLGWKKHLJKW>),//@
Draws one or several boxes (rectangles).
’scope’ The scope of the context, see Section 9.3. 9
’n’ Graphics context number, integer 0 .. 20 or 0 .. 50 depending on
the scope. Default = 0. Used components: FUNCTION,
FOREGROUND, BACKGROUND, LINE_WIDTH,
LINE_STYLE, CAP_STYLE, JOIN_STYLE,
DASH_OFFSET, DASH_LIST. See Section 9.3.
’x,y’ Integer or real, or vector of integer or real data. The coordinates
of the upper left corner of the rectangle.
’width’ Integer or real or vector of integer or real data. The width of the
rectangle given in coordinate units, see Section 9.4.
’height’ Integer or real or vector of integer or real data. The height of the
rectangle given in coordinate units, see Section 9.4.
If the FILL option is given, the box is filled (in the FOREGROUND color).
&,5&/(>>VFRSH@Q@[\U>),//@
Draws one or several circles.
’scope’ is the scope of the context, see Section 9.3.
’n’ Graphics context number, integer 0 .. 20 or 0 .. 50 depending on
the scope. Default = 0. Used components: FUNCTION,
FOREGROUND, BACKGROUND, LINE_WIDTH,
LINE_STYLE, CAP_STYLE, DASH_OFFSET, DASH_LIST.
See Section 9.3.
’x,y’ Integer or real data, or integer or real vector. The coordinates for
the center of the circle.
’r’ Integer or real data, or integer or real vector. The radius given in
coordinate units, see Section 9.4.
If the FILL option is given, the circle is filled.
239
MicroSCADA Programming Language SCIL 1MRS751849-MEN
(//,36(>>VFRSH@Q@[\DE>),//@
Draws one or more ellipses.
’scope’ The scope of the context, see Section 9.3.
’n’ Graphics context number, 0 .. 20 or 0 .. 50 depending on the
scope. Default = 0. Used components: FUNCTION,
FOREGROUND, BACKGROUND, LINE_WIDTH,
LINE_STYLE, CAP_STYLE, DASH_OFFSET, DASH_LIST
’x,y’ Integer or real data, or integer or real vectors. The coordinates of
the center of the ellipse.
’a,b’ Integer or real data, or integer or real vectors. The axes of the
ellipse given in coordinate units, see Section 9.4.
If the FILL option is given, the ellipse is filled.
,0$*([\ZKILOHQDPHWDJB>WDJB>WDJB>WDJB@@@
.IMAGE command draws a VS_IMAGE object into the current window or VS
object.
’x’ Real, x coordinate
’y’ Real, y coordinate
’w’ Real, width, 0 .. 32767
’h’ Real, height, 0 .. 32767
’filename’ Text, vso file name
’tag_n’
’tag_8_10’ Text, tag name within the vso file, image to be used when 8 x 10
font is used.
’tag_12_15’ Text, tag name within the vso file, image to be used when 12 x
15 font is used.
’tag_16_20’ Text, tag name within the vso file, image to be used when 16 x
20 font is used.
’tag_20_25’ Text, tag name within the vso file, image to be used when 20 x
25 font is used.
The current coordinate system is SCIL, the coordinates x and y define the position
of the upper left corner of the image, otherwise the lower left corner.
’w’ and ’h’ specify the size of the rectangle the image is drawn into, the image is
scaled to fill the rectangle.
If ’w’ is 0, no horisontal scaling is done. If ’h’ is 0, no vertical scaling is done.
’filename’ specifies the VSO file where the image is stored.
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.
240
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 9. Graphics primitives
/,1(>>VFRSH@Q@[\[\
Draws one or more lines from (x1,y1) to (x2,y2).
’scope’ The scope of the context, see Section 9.3.
’n’ Graphics context number, integer 0 .. 20 or 0 .. 50 depending on
the scope. Default = 0 Used components: FUNCTION,
FOREGROUND, BACKGROUND, LINE_WIDTH,
LINE_STYLE, CAP_STYLE, DASH_OFFSET, DASH_LIST.
See Section 9.3.
’x1,y1’ Integer or real, or vector of integer or real data. The coordinates
of the start point. See Section 9.4.
’x2,y2’ Integer or real, or vector of integer or real data. The coordinates
of the end point. See Section 9.4.
32,17>>VFRSH@Q@[\>5(/$7,9(@
Draws one or several points of one pixel’s size at the coordinates (x,y). If any of x or
y or both are vectors, and the option RELATIVE is given, the first point is taken as
canvas relative, the next one as relative to the previous one, etc.
’scope’ The scope of the context, see Section 9.3.
’n’ Graphics context number, integer 0 .. 20 or 0 .. 50 depending on
the scope. Default: 0. Used components: FUNCTION,
9
FOREGROUND. See Section 9.3.
’x,y’ Integer or real, or vector of integer or real data. coordinates for
the point, see Section 9.4.
32/</,1(>>VFRSH@Q@[\>5(/$7,9(@>),//@
Draws a polyline or a polygon.
’scope’ is the scope of the context, see Section 9.3.
’n’ Graphics context number, integer 0 .. 20 or 0 .. 50 depending on
the scope. Default = 0. Used components: FUNCTION,
FOREGROUND, BACKGROUND, LINE_WIDTH,
LINE_STYLE, CAP_STYLE, JOIN_STYLE,
DASH_OFFSET, DASH_LIST.
’x’ real or integer, or vector with real and integer elements, the x-
coordinates in SCIL or VS coordinate units.
’y’ real or integer, or vector of real and integers, the y-coordinates
in SCIL or VS coordinate units.
The corresponding elements in the x and y vectors are taken as x,y-coordinates (see
Figure 9.2.1.-2). The command draws a line between each of the coordinates.
If the RELATIVE option is included in the argument list, the first coordinate pair is
placed relative to the upper left corner of the canvas and each of the following
coordinates are drawn relative to the previous one.
If the first and last point coincide, the polyline will form a closed figure (a polygon),
where the end points are joined according to the JOIN_STYLE component of the
graphical context.
241
MicroSCADA Programming Language SCIL 1MRS751849-MEN
If the FILL option is included in the argument list, the polygon outlined will be filled
(with the FOREGROUND color). In this case, the polyline is always closed.
)LJ 'UDZLQJDSRO\OLQHZLWK32/</,1(
7(;7>>VFRSH@Q@[\WH[W>),//@>(;7(1'('@>DOLJQ@
This command draws horizontal text starting at (x,y). The size and font of the texts
is determined by the graphics context.
’scope’ The scope of the context, see Section 9.3.
’n’ Graphics context number, integer expression 0 .. 20 or 0 .. 50
depending on the scope. Default = 0. Used components:
FUNCTION, FOREGROUND, BACKGROUND, FONT. See
Section 9.3.
’x,y’ Integer, real or vector of integer or real. The coordinates of the
start point of the text. The starting-point (x,y) defines the
location of the origin pixel of the first character (if left
alignment). The location of the origin pixel is font dependent.
For the MicroSCADA semi-graphic font, it is the upper left
corner of a character.
’text’ A SCIL expression of type text or a text vector. The text to be
displayed. The SCIL text functions LOWER_CASE,
UPPER_CASE and CAPITALIZE can be used for converting
the text to lower-case, upper-case or capitalized text
respectively, see Section 8.5.
’align’ The alignment of the text: LEFT, RIGHT or CENTER. The
default is LEFT, if the font is a left-to-right font, and RIGHT if
the font is a right-to-left font (e.g. Hebrew).
When multiple lines are drawn, i.e. ’text’ is a text vector, the x,y coordinates can be
vectors with the coordinates for each new line or they can be scalars. In the latter
case, the text lines are displayed under one another starting from x,y with a line
space adjusted to the font characteristics.
If the EXTENDED option is given, extended (2 byte) character coding is used,
otherwise, normal (1 byte) coding is used. The EXTENDED option is only valid in
X-type monitors.
If the FILL option is given, the background of the text is filled with the
BACKGROUND color of the graphics context, otherwise the background is
transparent.
242
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 9. Graphics primitives
9.3.1. General
A graphics context is a collection of components (Section 9.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 2000.
The defined graphics contexts (together with the canvas selection and the scaling)
can be temporarily stored and restored, see Section 9.5.
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 9.3.3. The contexts (except number 99) can be modified any time with the
commands described in Section 9.3.2.
Context number 99 contains the default settings of the components. This contexts
cannot be changed. It contains the following components:
FUNCTION = "COPY"
243
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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.
244
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 9. Graphics primitives
([DPSOH
("C",5), ("R",5), ("M",5) and ("U",5) are all different graphics contexts. The
contexts ("C",5) and ("P",5) may be the same or different contexts: When a part
picture is shown, its context is the same as the one of the parent (i.e. CURRENT =
PARENT). If the parent’s context is changed later, they become two different
contexts and the parent’s context is referred to as ("P",5).
The PARENT scope could, e.g., be used in a general purpose tool designed to
change the appearance of any picture it is used in. The MONITOR and USER scopes
are suitable for defining monitor specific graphics contexts in the start program of
the APL_INIT picture, which is shown each time a monitor is mapped for an
application (either at system start-up or later).
([DPSOH
.GC 0 = DEFAULT_GC : FOREGROUND = "RED"
245
MicroSCADA Programming Language SCIL 1MRS751849-MEN
&6 &$3B67</(
Specifies the endpoints of the line, see Figure 9.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"
"PROJECTING" and "ROUND" are meaningful only for lines with a width larger
than 1 pixel.
'/ '$6+B/,67
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 9.4.
Default: The dashes as well as the gaps are four pixels long.
)LJ :LGHOLQHVDUHGUDZQFHQWHUHGLQUHODWLRQWRWKHVWDUWDQGHQG
SRLQWV
)LJ 7KH&$3B67</(FRPSRQHQW
246
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 9. Graphics primitives
)LJ 7KH-2,1B67</(FRPSRQHQW
'2 '$6+B2))6(7
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. 9
Default value: 0.
)7 )217
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 9.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".
)* )25(*5281'
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 9.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.
247
MicroSCADA Programming Language SCIL 1MRS751849-MEN
248
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 9. Graphics primitives
Default: "MITER".
/6 /,1(B67</(
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
in the foreground color and the gaps between
the dashes in the background color.
Default value: "SOLID".
/: /,1(B:,'7+
Specifies the width of the line in coordinate units (see Section 9.4). Wide lines are
drawn centered between the start and the end point given in the drawing command,
see Figure 9.3.3.-1.
Values: Integer or real, >= 0.
Default value: 0.
9
LINE_WIDTH=0 specifies the width to one pixel regardless of the scaling. LW=0
is the most efficient line width and fastest to draw. However, width 0 is X server
dependent and may not match exactly with lines of pixel width 1 (which is X server
independent)
1$ 1$0(
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 9.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 .. 65535.
Consequently, for example, (0,0,0) is black and (65535,65535,65535) is white.
249
MicroSCADA Programming Language SCIL 1MRS751849-MEN
• 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).
If the operating system or X-server is not capable to provide the requested color
exactly (e.g. because the palette of the server is full due to the use of many different
colors on screen), the nearest possible color is used.
The .COLOR command below is used for creating and modifying color mix
numbers, and the COLOR function for reading the numbers.
&2/25>VFRSH@QXPEHUFRORU>6+$5('@
&2/25>VFRSH@QXPEHUFRORU>35,9$7(@
The .COLOR command defines the color mix number.
'scope' The scope of the color number. The scope is given in the same
way as for graphics contexts in Section 9.3.2.
'number' Color number given as a positive integer expression. Each scope
can have the following maximal number of colors: “C": 20, "R":
20, "M": 50, "U": 50.
'color' Color definition given in one of the four manners described
above.
The color mix number can be used for color selection in the graphics contexts
(BACKGROUND and FOREGROUND).
The color allocation policy may be private or shared. Private colors allocate a
dedicated palette entry for the color, shared colors do not.
If there are several MicroSCADA 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.
&2/25>VFRSH@QXPEHU
Returns the RGB values of the color specified by the arguments.
250
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 9. Graphics primitives
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 9.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. 9
• 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.
)217>VFRSH@QXPEHUIRQW
Defines a font number.
'scope' The scope of the font number. The scope is given in the same
way as for graphics contexts in Section 9.3.2
'number' Font number given as a positive integer expression. Each scope
can have the following maximal number of fonts: "C": 10, "R":
10, "P": 10, "M": 20, "U": 20. 0 = the MicroSCADA semi-
graphic font. Do not change that!
'font' Font definition given in any of the four ways allowed for the
FONT component, see Section 9.3.3.
)217>VFRSH@QXPEHU
'scope' The scope of the font.
'number' The number of the font.
Result: The font function returns a list with the attributes shown in
Figure 9.3.4.-1. Each attribute has a two-letter alias name.
251
MicroSCADA Programming Language SCIL 1MRS751849-MEN
)LJ 7KHDWWULEXWHVUHWXUQHGE\WKHIRQWIXQFWLRQ
NAME, NA Name
HEIGHT, HE Height (number of pixels)
ASCENT, AS Ascent (logical extent above baseline in number of pixels)
DESCENT, DE Descent (logical descent below baseline in number of pixels)
WIDTH, WI Width (width of the widest character in the font in number of
pixels)
FAMILY, FA Family (the name of the font family)
POINT_SIZE, PS Point size
SCIL_SIZE, SS SCIL size
FACE, FC Face
ENCODING, EN Encoding
252
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 9. Graphics primitives
&2/25B,1>VFRSH@Q
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. 9
)217B,1>VFRSH@Q
The function returns a list value with the same attributes as for the FONT function,
see Section 9.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 9.5.
253
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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:
&$19$6REMHFW
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 4.
&$19$65227
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.
&$19$63$5(17
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.
&$19$6&855(17
The current object is used as canvas, i.e., the object containing the graphics
command. Hence, this command returns the canvas to the default.
&225',1$7(B6<67(0FRRUGLQDWHBV\VWHP
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.
([DPSOH
.COORDINATE_SYSTEM SCIL
254
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 9. Graphics primitives
)LJ 7KH6&,/FRRUGLQDWHV\VWHP
255
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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).
0286([\>EXWWRQ>EXWWRQV>5(/$7,9(@@@
Reads the SCIL coordinates of the cursor and the mouse button states.
’x’ and ’y’ two variables that get the value of the x and y coordinates
respectively (SCIL or VS coordinates).
’button’ a variable that gets the value of the pressed or released mouse
button number (1, 2 or 3). If the registered mouse event was a
motion event, the variable gets the value 0. If tracing is OFF, the
variable gets the value 0. If a local variable by the name exists,
it is used, otherwise a global variable.
’buttons’ a variable that receives the current mouse button states if tracing
is OFF, or the button states immediately before the mouse event
if tracing is ON. The states are returned as a bit mask, where each
bit number represents a mouse button. The bit values have the
following meanings: 0 = the button is released, 1 = the button is
held down. If a local variable by the name exists, it is used,
otherwise a global variable.
RELATIVE an optional keyword. If RELATIVE is given as the last argument
of the command, the coordinates are relative to the current
canvas (If the canvas is not explicitly set, the window or picture
function executing the .MOUSE command acts as the current
canvas). If RELATIVE is not given, the coordinates returned by
.MOUSE command are relative to the part picture (picture
shown in window) executing the command.
([DPSOHV
.MOUSE X, Y, RELATIVE
.MOUSE X, Y, BUTTON, RELATIVE
.MOUSE X, Y, BUTTON, BUTTON_MASK, RELATIVE
256
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 9. Graphics primitives
0286(21>027,21@
0286(2))
.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.
([DPSOH
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"
9
.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.
257
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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.
258
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 10. Using motif widgets
in SCIL
10. Using motif widgets in SCIL
This chapter describes the SCIL interface to the Motif programming, which is
supported in the X/OSF/Motif environment. Motif programming is briefly described
in Section 10.1. Section 10.2 describes the SCIL commands for creating, deleting
and modifying widget instances. Section 10.3 describes the use of widget methods
for managing and unmanaging widget instances. Section 10.4 describes the handling
of widget resources with SCIL.
The reader is assumed to be familiar with Motif programming. Refer to the
following Motif programming manuals: Motif Programming Manual, O’Reilly &
Associates, Inc. and OSF/Motif Programmer’s Reference Manual. Motif support in
MicroSCADA 8.4.1 is based on Motif version 1.1.
The Motif Widgets described in this chapter can be used only in MicroSCADA
monitors defined as type “X”. Using this monitor type excludes the possibility to use
Visual SCIL and Visual SCIL based tools. It is therefore not recommendable to use
Motif Widgets when building new MicroSCADA 8.4 applications
10.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 10
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 aZLGJHWLQVWDQFH or an REMHFW. A
widget instance is always also an X window, except for the widgets called JDGJHWV.
The top-level window of a MicroSCADA operator process window, i.e. the window
directly under the URRWZLQGRZ (= the screen), is always a widget of the class.
$SSOLFDWLRQ6KHOO. The MicroSCADA main window is implemented as a
'UDZLQJ$UHD widget.
Composite widget classes support the containment of other widgets within them.
The contained widgets are called FKLOGZLGJHWV, and the containing widgets are
called SDUHQWZLGJHWV. Widgets of the classes below 0DQDJHUPDQDJHUZLGJHWV
- have the ability to PDQDJH the position and size of their children. Generally, for
space reserving reasons, the GHVFHQGDQWVof a widget, ie., its children in one or more
links, must be managed before the widget itself and its DQFHVWRUVare 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 UHVRXUFHV (Section 10.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.
259
MicroSCADA Programming Language SCIL 1MRS751849-MEN
)LJ 7KHFODVVKLHUDUFK\RIWKH0RWLI:LGJHWVHW
260
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 10. Using motif widgets
in SCIL
parent. If ’parent’ is omitted, the application shell containing the
MicroSCADA main window will be the parent.
([DPSOH MOTHER/MY_PUSH_BUTTON.
’routine’ The Motif creation routine used to create the widget (or gadget)
or group of widgets. Any of the 57 Motif creation routines
staring with XmCreate may be used along with the
TopLevelShell defined in Xt (see appendix A of Motif
Programming Manual or OSF Motif Programmer’s Reference
Manual). ’routine’ is formed by removing XmCreate from the
creation routine name, adding an underscore preceding any
upper case letter in the name and prefixing the result with
’MOTIF’.
([DPSOH: ;P&UHDWH6LPSOH0HQX%DUbecomes
027,)B6,03/(B0(18B%$5 in SCIL.
1RWH The XtTopLevelShell widget class can be used in
SCIL under the name
MOTIF_TOP_LEVEL_SHELL.
’resources’ A list of resource assignments in the format:
resource_name = value
If there are several assignments, they are separated by commas. Read about
resources in Section 10.4.
The created widget is not displayed on screen until the widget and all its ancestors
have been managed. It can be managed and unmanaged by means of widget
10
methods, see Section 10.3. If you want the widget to be managed immediately, use
the CREATE_MANAGED command instead of CREATE.
([DPSOHV
.CREATE PB = MOTIF_PUSH_BUTTON (label_string = "Close")
Creating a push button labelled "Close".
02',)<>SDUHQW@ZLGJHW H[SUHVVLRQ
Modifies the resource values of a widget instance (corresponds to the XtSetValues
function of Xt).
’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 modified.
’expression’ A list type expression containing the names and values of the
resources to be set. See Section 10.4.
The modifications come into effect immediately. The resources not included in the
list command remains unchanged.
([DPSOH
.MODIFY RUNNING_WIDGET = LIST(X = RUNNING_WIDGET.X + 10,-
Y = RUNNING_WIDGET.Y + 10)
261
MicroSCADA Programming Language SCIL 1MRS751849-MEN
262
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 10. Using motif widgets
in SCIL
B.Manage
A.Manage
MAIN_DIALOG.MANAGE_ALL_CHILDREN
10.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 10.4.3). In SCIL, the Motif resources are
recognized by names which resembles the Motif resource names (see Section
10.4.2). The data types of the resources are translated to SCIL data types (see
Section 10.4.3). The value of a resource can be written as described in Section
10.4.4, and read as an expression as described in Section 10.4.5.
263
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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.
;P)RQW/LVWUHVRXUFHV
Font lists are given as vectors, the elements of which are SCIL font specifications
(see Section 9.3.4).
([DPSOHV
@FL(1) = ("M",2) ;Monitor specific font number 2
.CREATE W = MOTIF_LABEL(FONT_LIST = %FL, ...)
Table 10.4.3-1 The Motif resource data types and the corresponding SCIL
data types
Resource Type SCIL Data Type Comments
264
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 10. Using motif widgets
in SCIL
3L[HOUHVRXUFHV
Pixel resources are given as SCIL color specifications (see Section 9.3.4).
([DPSOHV
BACKGROUND = "NAVY BLUE" ;by name
FOREGROUND = (10000,20000,30000) ;by RGB values
BORDER_COLOR = ("M", 5) ;monitor specific color # 5
;P6WULQJDQG;P6WULQJ7DEOHUHVRXUFHV
XmString resources are given as a text and XmStringTable resources as a vector of
text elements. No other properties of XmString type are implemented.
:LGJHWUHVRXUFHV
Widget resources are given either by a text value specifying the widget (path) name
or by an integer value specifying the widget id (Currently, the only way to get a
widget id is to read the PARENT ’pseudoresource’ of a widget. See Section 10.4).
265
MicroSCADA Programming Language SCIL 1MRS751849-MEN
.CREATE TB = MOTIF_TOGGLE_BUTTON
.SET TB.NOTIFY = FALSE
.SET TB.STATE = TRUE
TB.SET_STATE
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).
266
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 10. Using motif widgets
in SCIL
SET A.Work_Area = S.PARENT
The parent of widget S will be the work area of widget A.
@STATE = TB.GET_STATE
*,)B3,;0$3ILOHBQDPH
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.
10
Result: Integer value, which can be used as a pixmap resource value in
Motif.
([DPSOH
.CREATE_MANAGED BUTTON = MOTIF_PUSH_BUTTON(-
SCIL_X = 200,-
SCIL_Y = 200,-
LABEL_TYPE = "PIXMAP",-
LABEL_PIXMAP = GIF_PIXMAP("/USR/SC/GIF/BUTTON.GIF"))
A Motif button is created. The image drawn in the button is imported from a GIF file.
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.
267
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 11. SCIL programming
guide
11. SCIL programming guide
This chapter provides a programming guide for the most important SCIL tasks. The
guide gives brief instructions for accomplishing various tasks with SCIL and refers
to the sections in this manual and other manuals where the used SCIL elements are
detailed. The following main subjects are discussed:
• Picture handling.
• Visual SCIL object handling.
• Program execution.
• Process supervision and control.
• Alarm and event handling.
• Calculations and reports.
• System configuration and communication.
• Application database management.
• Error handling.
269
MicroSCADA Programming Language SCIL 1MRS751849-MEN
270
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 11. SCIL programming
guide
Table 11.2.-2 Executing Methods
Task Use Comments
271
MicroSCADA Programming Language SCIL 1MRS751849-MEN
272
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 11. SCIL programming
guide
Table 11.3.-4 Alarm and Event Handling
Task Use Comments
273
MicroSCADA Programming Language SCIL 1MRS751849-MEN
274
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 11. SCIL programming
guide
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:
The picture - main picture, window picture or picture function - where the error
occurred.
11
275
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 12. SCIL editor
12.1. General
12
)LJ 7KH6&,/HGLWRUDVDFFHVVHGIURPWKH7RRO0DQDJHU
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 12.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.
277
MicroSCADA Programming Language SCIL 1MRS751849-MEN
12.2. Menus
Commands of the )LOH menu:
1HZ 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.
2SHQ Open an existing file. Clicking 2SHQ displays a File
Chooser dialog box for selecting the file to open.
6DYH Save the file without changing the filename. The 6DYH
command acts as 6DYH$V if invoked on a new file.
6DYH$V Save the file. A File Chooser dialog box for choosing path
and file name is opened.
,PSRUW Insert the contents of a text file after the current line.
Opens a File Chooser dialog box for selecting the file to
be imported.
([SRUW 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.
3ULQW6HWXS On a VS local monitor this command opens a standard
Print Setup dialog provided by the Windows NT operating
system.
3ULQW« On a VS local monitor this command opens a standard
Print dialog provided by the Windows NT operating
system. On a VS remote monitor the current text is printed
immediately.
)LOHKLVWRU\FRPPDQGV 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 )LOH+LVWRU\/HQJWKin the
2SWLRQVmenu.
0RUH+LVWRU\ This submenu is placed under the 5th file history
command and displays the possible commands from 6 to
20. The submenu is visible if )LOH+LVWRU\/HQJWKis 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.
([LW Exit the SCIL editor. The user is informed if there are
unsaved changes to the text.
The commands of the )LOHmenu 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 )LOHmenu contains the commands 1HZ2SHQ6DYHand 6DYH
$Vwhile opened from within another tool these commands are replaced by the
8SGDWHcommand.
Commands of the (GLW menu:
8QGR Undo last executed command.
5HGR Redo last executed command.
&XW Cut selected text and place on the Clipboard.
278
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 12. SCIL editor
279
MicroSCADA Programming Language SCIL 1MRS751849-MEN
280
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 12. SCIL editor
)RQW_(QODUJH6L]H Find the next larger point size and set the editor font.
)RQW_5HGXFH6L]H Find the next smaller point size and set the editor font.
)RQW_5HVHW)RQW Set the editor font to the default value: Courier
Medium Modern 10 for VS Local monitor, and
Courier Medium 14 for VS Remote monitor.
Commands of the +HOS menu:
6KRUWFXW.H\V Shows a dialog with the sequences of keystrokes that
corresponds to certain actions not included in the
menus.
8VHU3DUDPHWHU6DYLQJ Shows information about whether tool or user specific
parameters are used to save the properties and
geometry of the SCIL editor.
$ERXW6&,/HGLWRU Shows a dialog with Tool information and System
information.
12.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 12.3.-1. The corresponding
command of each button is explained in Table 12.3.-1.The last button ‘Evaluate in
Test Dialog’ (in Table 12.3.-1) is present on the tool bar when the editor is opened
from the Test Dialog.
12
)LJ 7RROEDURIWKH6&,/HGLWRUDVRSHQHGIURPWKH7RRO0DQDJHU
281
MicroSCADA Programming Language SCIL 1MRS751849-MEN
Table 12.3.-2
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:
Click 2SHQ from the )LOH menu. A file chooser dialox box appears.
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
MicroSCADA 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.
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.
282
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 12. SCIL editor
Click 2SHQ.
To close a file and start editing of another file, open another file or click 1HZ from
the )LOH 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 MicroSCADA path format
relative to the current MicroSCADA application
home directory. The application home directory itself
can’t be referenced.
MicroSCADA Relative PathsPath representation in the MicroSCADA path format
relative to the MicroSCADA root directory. The
MicroSCADA root directory itself can’t be
referenced.
Logical Paths Path representation in the MicroSCADA 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:
Click 6DYHor 6DYH$Vfrom the )LOH menu. The 6DYH command saves the file
with the same name, if it already exists. Use the 6DYH$V command to save the
12
file with another name.
When selecting 6DYH for the first time or6DYH$V, 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.
Click 6DYH.
If you have opened the SCIL Editor from an object tool, save the program by
choosing 8SGDWH on the )LOH menu.
Undo operation
To undo the last editing operation, click 8QGR on the (GLW menu. The undo
operation revokes the last editing operation. The maximum number of actions that
can be undone is 50.
283
MicroSCADA Programming Language SCIL 1MRS751849-MEN
If you have made changes since the last time you saved the program, a dialog box
appears asking if you want to save changes.
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 6KRUWFXW.H\V from the
+HOS menu.
Copying
To copy a text within the program or from one program to another:
Choose &RS\ from the (GLW menu or press the <Ctrl> and C keys at the same
time (<Ctrl>+C). The text is copied to the clipboard.
284
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 12. SCIL editor
If you want to move text from one program to another, activate the program to
which you want to copy.
Place the cursor at the position where you want to insert the copied text.
Moving text
To move text:
Choose Cut from the Edit menu or press <Ctrl>+X. The selection is removed
from the screen and placed in the clipboard.
If you want to move text from one program to another, activate the program to
which you want to move.
Deleting
To delete text:
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 &RPPHQW and 8QFRPPHQW commands of
the (GLW menu.
To mark a program section as comments:
Select the lines from which you want to remove the comment marks.
285
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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 ,QGHQW from the 2SWLRQV menu. The checkbox ‘Auto-indent enabled’
means that a new line is indented according to previous line.
To indent a section:
Select the lines you want to indent. If no text is selected, the current line is
indented.
Finding text
The )LQG5HSODFH 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 )LQG5HSODFH
command:
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.
Click Find/Replace from the Edit menu. The dialog box shown in Figure 12.5.-1
appears. Moving the cursor is possible in the main window while the Find/
Replace dialog box is open.
)LJ <RXFDQVHDUFKIRUWH[WWKDWLVORFDWHGVRPHZKHUHLQWKHVDPHSURJUDP
XVLQJWKH)LQG5HSODFHFRPPDQGRQWKH(GLWPHQX
286
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 12. SCIL editor
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.
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.
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:
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.
Click Find/Replace from the Edit menu. The dialog shown in Figure 12.5.-2
appears. Moving the cursor is possible in the main window while the Find/
Replace dialog box is open. 12
)LJ :LWKWKLVGLDORJ\RXFDQUHSODFHRQHWH[WZLWKDQRWKHU
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’.
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
287
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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.
Finding blocks
If you want to go to a certain SCIL block in the program, click )LQG%ORFN in the
(GLW 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 )LQG%ORFN
again.
Finding a line
If you want to move quickly to a certain line number:
Click Go To Line from the Edit menu or pressing <Ctrl>+L on the keyboard.
The dialog shown in Figure 12.5.-3 appears.
)LJ <RXFDQPRYHWRDFHUWDLQOLQHXVLQJWKLVGLDORJ
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.
288
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 12. SCIL editor
Click Import… from the File menu. The file chooser dialog box appears.
Select the correct folder from the directory tree and click on the name of the file.
Click OK.
Exporting a file means that the selected or the whole text is stored in a file. To
export a text:
Click Export from the File menu. The file chooser dialog box appears with the
default file name Exported.txt in the File name text box.
Select the correct folder from the directory tree and enter a name for the file in
the File name text box. A new folder can also be created by clicking on the
Create New Folder button ( ) above the file list.
Click OK.
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 197. 12
Undoing and redoing operations
Most editing operations can be cancelled using the 8QGR command, for example
&XW&RS\3DVWH and 5HSODFH commands. When you undo typing, undo will affect
all that was written since the last editing operation, for example &RS\8QGR6DYH.
To undo an operation, click 8QGR from the (GLWmenu.
The operations that you have cancelled using 8QGR, can be done again. This means
that you are also able to cancel an Undo operation. To do this click 5HGR from the
(GLW menu.
289
MicroSCADA Programming Language SCIL 1MRS751849-MEN
Repeat steps 3 to 6 to insert next command or click Close to exit the tool. The
cursor position may also be moved while the ‘Insert SCIL Commands,
Functions & Objects dialog’ is open.
290
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 12. SCIL editor
procedure continues until no more errors are found and the ‘Syntax checking
successful’ message is shown. To exit the dialog while errors still exist, click &ORVH.
)LJ 7KH6\QWD[FKHFNFRPPDQGVKRZVDGLDORJOLNHWKLVZKHQDV\QWD[
HUURULVHQFRXQWHUHG
To check the syntax of a SCIL program:
Click Syntax Check on the SCIL menu. If an error is found a dialog showing the
invalid code is displayed. If no errors are found in the program code, ‘Syntax
checking successful’ is displayed.
The erroneous line is shown in the ‘SCIL Syntax Error’ dialog and the line is
selected in the editor.
In the text window, correct the invalid code and click the Check button in ‘SCIL
Syntax Error’ dialog. The next found error is displayed.
12
Repeat steps 3 and 4 until ‘Syntax checking successful’ is displayed in a
message box.
291
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 13. The SCIL compiler
13.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.
13
13.3. Impact on SCIL programs
In most cases, a valid SCIL program executes exactly in the same way (apart from
the speed) whether compiled or not. However, there are some rare cases that must
be considered:
A SCIL program may compile but generates a run-time error when run by the
Virtual SCIL Machine.
293
MicroSCADA Programming Language SCIL 1MRS751849-MEN
In most cases, the problems arise from wild usage of variable expansions. The cases
are described in more detail below. Recommendations how to avoid this kind of
problems are given as well.
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.
([DPSOH
@END = "_END"
#BLOCK
.DO_SOMETHING
#BLOCK’END’
([DPSOH
@A = "1 + "
@B = ’A’ 2
294
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual 13. The SCIL compiler
([DPSOH
@A = 1
@B = 2
@C = ’A’.’B’ ;The compiler assumes that the right hand
;expression is a VS object or window attribute
;reference
13.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: 13
• 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.
([DPSOHV 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
295
MicroSCADA Programming Language SCIL 1MRS751849-MEN
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.
([DPSOHV 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
296
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual
8VHU,QWHUIDFH'HVLJQ
MicroSCADA version 8.4 introduces a new method for user interface design, the
Visual SCIL method. In SCIL, the new method implicates the introduction of a new
object category, the Visual SCIL objects. The Visual SCIL objects are handled by a
set of new SCIL commands, the Visual SCIL commands.
The Visual SCIL method is described in the manual Visual SCIL, User Interface
Design.
''(&OLHQW6HUYHU&RPPXQLFDWLRQ
MicroSCADA now supports data exchange with other Windows applications,
namely those Windows applications that support the DDE (Dynamic Data
Exchange) protocol. Most Windows applications support this protocol. By using
DDE a MicroSCADA application can read and write data produced by applications
such as Microsoft Excel and Word. Likewise, external Windows applications can
access MicroSCADA applications. In the former case, MicroSCADA works as a
client, and in the latter case as a server. The MicroSCADA client communication is
implemented through a number of SCIL functions (the DDE Client functions in
chapter 8). The MicroSCADA server communication is effectuated by using the
DDE functions of the external applications. In MicroSCADA, the data handling is
supported by two SCIL functions (the DDE Server functions in chapter 8).
64/&RPPXQLFDWLRQ
MicroSCADA supports the access to external databases and applications by means
of SQL statements. Hence, a MicroSCADA application can access databases
developed with database management systems such as Access, Oracle and Paradox.
MicroSCADA uses the ODBC (Open database connectivity) interface and the
database access is implemented by means of a number of SCIL functions (the ODBC
functions).
9DULDEOHDQG)XQFWLRQ1DPHV
Variable names may be up to 63 characters long. Likewise, command and function
names may be up to 63 characters long.
'DWD7\SHV
A new simple data type has been implemented: byte string. Data of type byte string
can be used in additions, and two byte strings can be compared with relational
297
MicroSCADA Programming Language SCIL 1MRS751849-MEN
9HFWRU+DQGOLQJ
Data of vector type can be created with a new SCIL function, namely the VECTOR
function. This enables the programmer to easily create empty and single element
vectors. Another new vector function, DELETE_ELEMENT, enables the deletion
of individual vector elements in a vector. Text vectors can be created from data of
text type and transformed to data of text type using new SCIL functions,
SEPARATE and COLLAPSE.
:LQGRZ+DQGOLQJ
Windows can now have attributes which are defined and assigned values by a SCIL
command (.SET). The window attributes are accessed by means of attribute
references which may be used as operands in SCIL expressions.
Windows can be shown on specified levels in relation to other windows. The level
is set by a new SCIL command, !WIN_LEVEL.
The creation of new windows using SCIL has been improved by a new command,
!WIN_CREATE.
9DULDEOH([SDQVLRQ
Besides variables, the variable object attributes and the user interface attributes
(picture attributes and Visual SCIL object attributes) can be used in variable
expansion.
3URJUDP$UJXPHQWVDQG5HWXUQ9DOXHV
A new command, #RETURN, makes it possible to build programs that return values.
This possibility applies to named programs, methods (the programs of the Visual
SCIL objects) and programs executed with the new SCIL function DO. The
programs can be assigned arguments (input data) which are used in the evaluation
of the return value. New SCIL functions (the ARGUMENT functions) have been
implemented for reading the arguments.
The named program and method calls, like the DO function, can be included as
operands in expressions where the return value replaces the program call. Hence,
they can be used as user defined SCIL functions.
(UURU+DQGOLQJ
The standard error messages shown in the upper left corner of pictures can now be
avoided. Each picture may contain a named program with predefined name,
ERROR_HANDLER, where the programmer can define the error handling to be
used in the picture. The ERROR_HANDLER program receives information about
the errors.
298
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual
5HDGLQJDQG:ULWLQJ)LOHV
Two new SCIL functions (READ_BYTES and WRITE_BYTES) enable importing
and exporting binary (non-ASCII) data between MicroSCADA and other
applications.
*UDSKLFV3ULPLWLYHV
It is now possible to easily reset the graphics contexts to default values.
Color handling has been improved in order to avoid the color palette from becoming
full.
The .MOUSE command has been given a new keyword, RELATIVE, which enables
the programmer to relate it to the current canvas, e.g. the picture function.
/RJLFDO3DWKVDQG/LEUDULHV
The creation of new directories when using the #PATH command can be avoided by
using the new keyword, NO_CREATE.
Up to 255 directories or library files can be used in the logical path and library
definitions. The directories and library files can be read by new SCIL functions
(PATH and REP_LIB).
9HUVLRQ&RPSDWLELOLW\
Compatibility with previous versions can to some degree be selected by means of a
new application attribute. The selected compatibility may be temporarily
sidestepped with a SCIL function (REVISION_COMPATIBILITY).
.H\HG)LOH0DLQWHQDQFH
A new SCIL function, KEYED_FILE_MANAGER, is implemented to retrieve
corrupted files and to perform other file maintenance procedures. This function
replaces the off-line programs SAVER and REORG.
7UDFLQJRI3URJUDP([HFXWLRQ
For debugging purposes, tracing of SCIL program execution is implemented as a
number of SCIL functions. Tracing implies recording of the SCIL statements that
are executed.
'DWDEDVH1DYLJDWLRQ
To support navigation through process and report databases, three new SCIL
functions are implemented: APPLICATION_OBJECT_COUNT,
APPLICATION_OBJECT_LIST and APPLICATION_OBJECT_ATTRIBUTES.
The functionality of the functions APPLICATION_OBJECT_LIST and
APPLICATION_OBJECT_ATTRIBUTES resembles that of the command
#SEARCH used with the functions NEXT and PREV. However, there are two
important differences. Firstly, the new functions operate in memory, they do not
read the database files. Secondly, they return a vector of object names/attributes in
299
MicroSCADA Programming Language SCIL 1MRS751849-MEN
one call. Consequently, they are much faster than the #SEARCH command followed
by a loop of NEXT/PREV function calls.
0LVFHOODQHRXV
Two random number generating SCIL functions (RANDOM and SHUFFLE) have
been implemented for system and application testing and other purposes.
Compatibility with previous versions
1DPHVDQG:RUGV
Variable names may now be up to 63 characters long. All the characters are
significant. In MicroSCADA version 8.2, only the first 10 characters were
significant, and the rest were ignored. This may result in a slight incompatibility. For
example, in version 8.2, the variable names LONG_VARIABLE and
LONG_VARIABL were considered as identical. In version 8.4, they are two
different variables.
Similarly, SCIL command and function names are now up to 63 characters long. In
MicroSCADA version 8.2, only the first 10 characters were significant and the rest
were simply ignored. For compatibility reasons, shortened names are still accepted
if they are correct. For example, #CREATE_FIL is accepted for #CREATE_FILE,
and PRINT_TRANSPAR or PRINT_TRAN is accepted for
PRINT_TRANSPARENT. However, PRINT_TRANSPRENT is no longer
accepted, though the spelling error went undetected in version 8.2.
+(;B6&$12&7B6&$1
The result of these functions is always an integer value if the argument lacks a
decimal point. If the result falls outside the integer value range (-2.247.483.648 ...
+2.147.483.647), it is shortened. In 8.2, the result was given as a real value if it was
outside the integer value range.
300
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual
301
MicroSCADA Programming Language SCIL 1MRS751849-MEN
302
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual
303
MicroSCADA Programming Language SCIL 1MRS751849-MEN
304
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual Index
6\PEROV
_ATTRIBUTE_NAMES ............................................................................................... 46
_CHILD_OBJECTS ...................................................................................................... 46
_FILE_REVISION ........................................................................................................ 46
_FLAG_FOR_EXECUTION ........................................................................................ 45
_OBJECT_CLASS ........................................................................................................ 46
_OBJECT_NAME ......................................................................................................... 46
_OBJECT_PATH ........................................................................................................... 46
_QUEUE_FOR_EXECUTION ..................................................................................... 45
_SG_GEOMETRY ........................................................................................................ 46
_SOURCE_FILE_NAME ............................................................................................. 47
_VARIABLE_NAMES ................................................................................................. 47
$
ABS ............................................................................................................................. 127
Absolute value ............................................................................................................. 127
Accuracy ........................................................................................................................ 18
ADD_INTERLOCKED .............................................................................................. 233
Addition ...................................................................................................................60, 61
AEP_PROGRAMS ..................................................................................................... 170
Alarm buffer .................................................................................................................. 31
Alarm list ....................................................................................................................... 31
Alarm picture ............................................................................................................... 101
Alarm picture queue .................................................................................................... 101
AM ............................................................................................................................... 245
AND .............................................................................................................................. 65
APL .........................................................................................................................27, 29
APPEND ..................................................................................................................... 156
Application ..............................................................................................................27, 30
Application engineering .................................................................................................. 1
Application objects ........................................................................................................ 25
APPLICATION_OBJECT_ATTRIBUTES ................................................................. 177
APPLICATION_OBJECT_COUNT ........................................................................... 178
APPLICATION_OBJECT_LIST ................................................................................ 179
ARC .....................................................................................................................238, 239
Arc .............................................................................................................. 238, 239, 245
ARC_MODE ............................................................................................................... 245
ARCCOS ..................................................................................................................... 127
ARCSIN ...................................................................................................................... 127
ARCTAN ..................................................................................................................... 127
ARGUMENT ........................................................................................................71, 166
Argument ....................................................................................................................... 59
Argument list ............................................................................................................... 113
ARGUMENT_COUNT ............................................................................................... 166
ARGUMENTS ............................................................................................................ 167
Arguments ..................................................................................................................... 67
Arithmetical operator .................................................................................................... 60
ASCII ........................................................................................................................... 144
ASCII_CODE .............................................................................................................. 144
Assignment .................................................................................................................... 53
Assignment statement .................................................................................................... 71
Attribute ......................................................................................................22, 26, 27, 30
ATTRIBUTE_EXISTS ................................................................................................ 165
AUDIO_ALARM ........................................................................................................ 234
MicroSCADA Programming Language SCIL 1MRS751849-MEN
%
BACKGROUND ........................................................................................................ 245
Background color ........................................................................................................ 245
Background program ....................................................................................................... 8
Base system object .................................................................................................. 26, 27
BCD .................................................................................................................... 144, 148
BCD_TO_INTEGER .................................................................................................. 144
BG ............................................................................................................................... 245
BIN .............................................................................................................................. 145
BIN_SCAN ................................................................................................................. 145
Binary Coded Decimal numbers ......................................................................... 144, 148
Binary files .................................................................................................................... 49
BIT .............................................................................................................................. 153
Bit function ................................................................................................................. 153
Bit string ..........................................................................................................17, 20, 153
BIT_AND .................................................................................................................... 153
BIT_CLEAR ............................................................................................................... 154
BIT_COMPL .............................................................................................................. 154
BIT_MASK ................................................................................................................. 154
BIT_OR ....................................................................................................................... 154
BIT_SCAN .................................................................................................................. 145
BIT_SET ..................................................................................................................... 155
BIT_STRING .............................................................................................................. 155
BIT_XOR .................................................................................................................... 155
BLOCK ......................................................................................................................... 72
BLOCK_END ............................................................................................................... 72
Boolean ................................................................................................................... 19, 63
BOX ............................................................................................................................ 239
Box .............................................................................................................................. 239
Byte string ..................................................................................................................... 20
&
Canceling in SCIL Program Editor ............................................................................. 289
CANVAS ..................................................................................................................... 254
Canvas ....................................................................... 237, 238, 241, 243, 254, 257, 258
CANVAS CURRENT ................................................................................................. 254
CANVAS PARENT ..................................................................................................... 254
CANVAS ROOT ......................................................................................................... 254
CAP_STYLE .............................................................................................................. 246
CAPITALIZE .............................................................................................................. 146
CASE ............................................................................................................................ 72
CASE_END .................................................................................................................. 72
Characters ...................................................................................................................... 14
Child object ................................................................................................................... 40
CIRCLE ...................................................................................................................... 239
Circle ........................................................................................................................... 239
CLASSIFY .................................................................................................................. 156
CLOCK ....................................................................................................................... 133
CLOSE .......................................................................................................................... 99
Close ............................................................................................................................ 283
CLOSE_FILE ................................................................................................................ 92
COLLECT ................................................................................................................... 146
COLOR ....................................................................................................................... 250
Color .................................................................................................................... 247, 249
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual Index
'
DASH_LIST ................................................................................................................ 246
DASH_OFFSET .......................................................................................................... 247
Dashed line .................................................................................................................. 246
Data object ........................................................................................................ 10, 30, 33
Data type ................................................................................................................17, 263
DATA_FETCH ............................................................................................................ 183
DATA_STORE ............................................................................................................ 184
DATA_TYPE ............................................................................................................... 123
DATE ........................................................................................................................... 133
DAY ............................................................................................................................. 134
Day of Week ................................................................................................................ 134
Day of Year .................................................................................................................. 134
DCP-NET .................................................................................................................... 214
DDE client ................................................................................................................... 216
DDE protocol ........................................................................................................12, 220
DDE Server ................................................................................................................. 220
DDE_CONNECT ........................................................................................................ 217
DDE_DISCONNECT ................................................................................................. 218
DDE_EXECUTE ......................................................................................................... 219
DDE_POKE ................................................................................................................ 219
DDE_REAL ................................................................................................................ 221
DDE_REQUEST ......................................................................................................... 218
DDE_VECTOR ........................................................................................................... 220
MicroSCADA Programming Language SCIL 1MRS751849-MEN
(
EDIT ............................................................................................................................ 147
Element ......................................................................................................................... 21
ELEMENT_LENGTH ................................................................................................ 124
ELLIPSE ..................................................................................................................... 240
Ellipse .......................................................................................................................... 240
ELSE ............................................................................................................................. 75
ELSE_IF ........................................................................................................................ 75
Endpoints .................................................................................................................... 246
ENTER ........................................................................................................................ 109
ENTER_POS ................................................................................................................ 57
ENVIRONMENT ....................................................................................................... 171
EQUAL ....................................................................................................................... 124
Equal to ......................................................................................................................... 63
ERASE ........................................................................................................................ 103
ERROR CONTINUE .................................................................................................... 73
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual Index
)
FALSE ........................................................................................................................... 19
FAST_PIC ................................................................................................................... 100
FG ........................................................................................................................247, 251
Fictitious process objects ............................................................................................... 31
File name ....................................................................................................................... 48
File naming .................................................................................................................... 47
File tag ........................................................................................................................... 47
FILE_LOCK_MANAGER ......................................................................................... 193
FILE_MANAGER COPY ........................................................................................... 209
FILE_MANAGER DELETE ...................................................................................... 209
FILE_MANAGER EXISTS ........................................................................................ 209
FILE_MANAGER GET_ATTRIBUTES .................................................................... 210
FILE_MANAGER LIST ............................................................................................. 208
FILE_MANAGER MOVE .......................................................................................... 209
FILE_MANAGER RENAME .................................................................................... 209
FIND_ELEMENT ....................................................................................................... 157
Finding ......................................................................................................................... 286
FLUSH ........................................................................................................................ 258
FM_APPLICATION_DIRECTORY ........................................................................... 210
FM_APPLICATION_FILE ......................................................................................... 211
FM_COMBINE ........................................................................................................... 211
FM_COMBINE_NAME ............................................................................................. 211
FM_DIRECTORY ....................................................................................................... 211
FM_DRIVE ................................................................................................................. 212
FM_EXTRACT ........................................................................................................... 212
FM_FILE ..................................................................................................................... 212
FM_REPRESENT ....................................................................................................... 213
FM_SCIL_DIRECTORY ............................................................................................ 213
FM_SCIL_FILE .......................................................................................................... 213
FM_SCIL_REPRESENT ............................................................................................ 214
MicroSCADA Programming Language SCIL 1MRS751849-MEN
*
GC ....................................................................................................................... 244, 253
General SCIL commands .............................................................................................. 67
GET ............................................................................................................................... 82
GET_STATUS ............................................................................................................. 125
GIF_PIXMAP ............................................................................................................. 267
Global variables ............................................................................................................ 53
Go To ........................................................................................................................... 288
Graphical element .............................................................................. 237, 238, 244, 253
Graphics command .....................................................................................237, 244, 254
Graphics commands ...................................................................................................... 67
Graphics context ...................................... 237, 238, 243, 244, 245, 249, 251, 253, 258
Greater than ................................................................................................................... 63
Greater than or equal to ................................................................................................. 63
Group ............................................................................................................................ 32
+
HEADER .................................................................................................................... 109
HELP ........................................................................................................................... 109
HEX ............................................................................................................................ 147
HEX_SCAN ................................................................................................................ 147
HIGH ........................................................................................................................... 157
High precision arithmetics .......................................................................................... 128
HIGH_INDEX ............................................................................................................ 158
HIGH_PRECISION_ADD ......................................................................................... 128
HIGH_PRECISION_DIV ........................................................................................... 128
HIGH_PRECISION_MUL ......................................................................................... 129
HIGH_PRECISION_SHOW ...................................................................................... 129
HIGH_PRECISION_SUB .......................................................................................... 129
HIGH_PRECISION_SUM ......................................................................................... 129
History database ............................................................................................................ 31
HISTORY_DATABASE_MANAGER CLOSE ......................................................... 187
HISTORY_DATABASE_MANAGER GET_PARAMETERS .................................. 190
HISTORY_DATABASE_MANAGER OPEN ........................................................... 186
HISTORY_DATABASE_MANAGER QUERY ........................................................ 191
HISTORY_DATABASE_MANAGER READ ........................................................... 192
HISTORY_DATABASE_MANAGER SET_ATTRIBUTES ..................................... 190
HISTORY_DATABASE_MANAGER SET_COMMENT ........................................ 192
HISTORY_DATABASE_MANAGER SET_CONDITION ....................................... 190
HISTORY_DATABASE_MANAGER SET_DIRECTION ....................................... 189
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual Index
,
Identifiers ....................................................................................................................... 15
IF ................................................................................................................................... 75
IGNORE ........................................................................................................................ 73
IMAGE ........................................................................................................................ 240
Import .......................................................................................................................... 289
IND ................................................................................................................................ 27
Index ................................................................................................................. 27, 31, 32
INIT_QUERY .......................................................................................................83, 186
Initialization time .......................................................................................................... 36
INPUT_KEY ............................................................................................................... 109
INPUT_POS ................................................................................................................ 110
INPUT_VAR ............................................................................................................... 110
INSERT_ELEMENT ................................................................................................... 158
Inserting SCIL commands, functions and objects ....................................................... 289
INT_PIC ...................................................................................................................... 101
Integer ............................................................................................................................ 17
INTEGER_TO_BCD .................................................................................................. 148
INTERP ....................................................................................................................... 159
INVERSE .................................................................................................................... 159
IP_PROGRAMS ......................................................................................................... 171
Item ................................................................................................................................ 12
Item name .................................................................................................................... 216
-
JOIN_STYLE ......................................................................................................247, 248
JS ................................................................................................................................. 248
.
KEY_POS ..................................................................................................................... 57
Keyed files ..................................................................................................................... 49
KEYED_FILE_MANAGER ....................................................................................... 194
/
LAST_PIC ................................................................................................................... 101
Less than ........................................................................................................................ 63
Less than or equal to ...................................................................................................... 63
Level parameter ...................................................................................................103, 106
LIB500 ............................................................................................................................. 1
Library representation ................................................................................................. 108
LIN ................................................................................................................................ 28
LINE ............................................................................................................................ 241
MicroSCADA Programming Language SCIL 1MRS751849-MEN
0
Main picture .................................................................................................................... 7
MAX ........................................................................................................................... 130
MAX_APPLICATION_NUMBER ............................................................................ 174
MAX_BIT_STRING_LENGTH ................................................................................. 174
MAX_BYTE_STRING_LENGTH ............................................................................. 174
MAX_INPUT_DEVICE_NUMBER .......................................................................... 174
MAX_INTEGER ........................................................................................................ 174
MAX_LINK_NUMBER ............................................................................................. 174
MAX_LIST_ATTRIBUTE_COUNT ......................................................................... 174
MAX_MONITOR_NUMBER .................................................................................... 175
MAX_NODE_NUMBER ........................................................................................... 175
MAX_OBJECT_NAME_LENGTH ........................................................................... 175
MAX_PICTURE_NAME_LENGTH ......................................................................... 175
MAX_PRINTER_NUMBER ...................................................................................... 175
MAX_PROCESS_OBJECT_INDEX ......................................................................... 175
MAX_REPRESENTATION_NAME_LENGTH ........................................................ 175
MAX_STATION_NUMBER ...................................................................................... 175
MAX_STATION_TYPE_NUMBER .......................................................................... 175
MAX_TEXT_LENGTH .............................................................................................. 175
MAX_VECTOR_LENGTH ........................................................................................ 175
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual Index
1
NA ............................................................................................................................... 249
NAME ......................................................................................................................... 249
Name .......................................................................................................................27, 30
Named program .........................................................................................................8, 44
Natural logarithm ........................................................................................................ 130
NET ............................................................................................................................... 28
New Folder ..........................................................................................................283, 289
NEW_PIC .................................................................................................................... 101
NOD .............................................................................................................................. 28
NOT ............................................................................................................................... 65
Notification window .................................................................................................... 171
2
Object ...........................................................................................................5, 25, 29, 81
Object notation ........................................................................................................27, 30
Object query .................................................................................................................. 83
OCT ............................................................................................................................. 149
OCT_SCAN ................................................................................................................ 147
Octal number ................................................................................................................. 17
ODBC functions .......................................................................................................... 221
ODD ............................................................................................................................ 130
ON ...........................................................................................................................37, 78
ON ERROR ................................................................................................................... 79
ON KEY_ERROR ......................................................................................................... 79
OPEN_FILE .................................................................................................................. 92
MicroSCADA Programming Language SCIL 1MRS751849-MEN
Operands ....................................................................................................................... 59
Operator ............................................................................................................59, 60, 65
OPS_CALL ................................................................................................................. 168
OPS_PROCESS .......................................................................................................... 168
OR ................................................................................................................................. 65
OTHERWISE ................................................................................................................ 72
3
PACK _TIME .............................................................................................................. 137
PACK_STR ................................................................................................................. 150
Parameter files ............................................................................................................... 48
PARENT .............................................................................................................. 243, 244
Parent object .................................................................................................................. 40
PARSE_FILE_NAME ................................................................................................ 196
Part picture ...................................................................................................................... 7
PATH ..................................................................................................................... 88, 196
PATHS ......................................................................................................................... 197
PAUSE .......................................................................................................................... 79
PEND OFF .................................................................................................................. 258
PEND ON ................................................................................................................... 258
Pending ........................................................................................................................ 258
Peripherals equipment ................................................................................................... 28
PIC_NAME ................................................................................................................... 57
PICK .................................................................................................................... 160, 163
Picture ...............................................................................................................1, 42, 107
Picture commands ......................................................................................................... 67
Picture Editor .................................................................................................................. 8
Picture handling commands .......................................................................................... 99
Picture path ................................................................................................................... 43
Picture programs ............................................................................................................. 8
Picture queue ............................................................................................................... 102
PIXMAP ...................................................................................................................... 267
POINT ......................................................................................................................... 241
Point ............................................................................................................................ 241
Poke ............................................................................................................................. 216
Polygon ....................................................................................................................... 241
POLYLINE .......................................................................................................... 241, 242
Polyline ............................................................................................................... 241, 242
POP ..................................................................................................................... 257, 258
Predefined picture variable ........................................................................................... 57
PRI .......................................................................................................................... 27, 29
PRINT ........................................................................................................................... 88
PRINT_TRANSPARENT ........................................................................................... 230
PRINTER_SET ........................................................................................................... 233
Printout .................................................................................................................... 87, 88
Printout function ......................................................................................................... 230
Process database ............................................................................................................ 30
Process object .......................................................................................................... 30, 31
Process query .......................................................................................................... 31, 83
PROGRAM ................................................................................................................. 109
PUSH .......................................................................................................................... 257
5
RANDOM ................................................................................................................... 130
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual Index
RUBOUT_EOL ...........................................................................................................111
6
Save ............................................................................................................................. 283
SCALE ........................................................................................................................ 234
Scale ........................................................................................................................ 30, 33
SCALING ................................................................................................................... 255
Scaling factor .................................................................... 237, 253, 255, 256, 257, 258
SCIL ................................................................................................................................ 1
SCIL coordinate .......................................................................................................... 255
SCIL defined printout ................................................................................................. 231
SCIL Editor ................................................................................................................. 277
SCIL program ............................................................................................................... 13
SCIL Program Editor .............................................................................................. 7, 284
SCIL_HOST ................................................................................................................ 172
Scope ........................................................................................................................... 244
SEARCH ............................................................................................................... 84, 182
Searching ..................................................................................................................... 286
SECOND ..................................................................................................................... 137
SELECT ...................................................................................................................... 161
Selecting Text .............................................................................................................. 284
SEND_PIC .................................................................................................................. 112
SEPARATE ................................................................................................................. 151
Service ........................................................................................................................... 12
Service name ............................................................................................................... 216
SET ....................................................................................................................31, 86, 98
SET_CLOCK .............................................................................................................. 137
SET_LOCAL_TIME .................................................................................................. 137
SET_STATUS ............................................................................................................. 126
SET_SYS_TIME ........................................................................................................ 138
SET_TIME .................................................................................................................... 80
SET_UTC_TIME ........................................................................................................ 138
SHADOW_FILE ......................................................................................................... 199
SHOW ......................................................................................................................... 104
SHOW_BACK ............................................................................................................ 104
SHUFFLE ................................................................................................................... 162
SIN .............................................................................................................................. 131
Sine .............................................................................................................................. 127
Snapshot variables ......................................................................................................... 54
SORT ........................................................................................................................... 163
SPACOM ..................................................................................................................... 215
SPREAD ..................................................................................................................... 163
SQL ............................................................................................................................. 221
SQL statement ............................................................................................................. 223
SQL_BEGIN_TRANSACTION ................................................................................. 225
SQL_COMMIT ........................................................................................................... 226
SQL_CONNECT ........................................................................................................ 222
SQL_DISCONNECT .................................................................................................. 223
SQL_EXECUTE ......................................................................................................... 223
SQL_FETCH .............................................................................................................. 224
SQL_FREE_STATEMENT ........................................................................................ 225
SQL_ROLLBACK ...................................................................................................... 227
SQRT ........................................................................................................................... 131
Square root .................................................................................................................. 131
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual Index
STA ..........................................................................................................................28, 29
Stacking order .............................................................................................................. 103
Start program ................................................................................................................... 8
Statement .....................................................................................................................3, 5
Station ............................................................................................................................ 30
STATUS ....................................................................................................................... 169
Status code ....................................................................................... 17, 34, 74, 125, 126
STATUS_CODE .......................................................................................................... 176
STATUS_CODE_NAME ............................................................................................ 176
STOP ............................................................................................................................. 74
STORE_PIC ................................................................................................................ 102
String function ............................................................................................................. 144
STY ............................................................................................................................... 28
Sub-picture ...................................................................................................................... 7
SUBSTR ...................................................................................................................... 151
Subtraction ...............................................................................................................60, 61
SUM ............................................................................................................................ 164
SUM_NEG .................................................................................................................. 164
SUM_POS ................................................................................................................... 164
Syntax check ................................................................................................................ 290
SYS ................................................................................................................................ 27
SYS_TIME .................................................................................................................. 138
SYS_TIME.PAR ......................................................................................................... 141
SYS_TIME_ADD ....................................................................................................... 138
SYS_TIME_INTERVAL ............................................................................................. 139
SYS_TO_LOCAL_TIME ........................................................................................... 139
SYS_TO_UTC_TIME ................................................................................................. 139
System Objects ........................................................................................................25, 26
7
tangent ......................................................................................................................... 127
TEXT ........................................................................................................................... 242
Text ................................................................................................................. 17, 20, 242
Text files ........................................................................................................................ 48
Text Selecting .............................................................................................................. 284
THEN ............................................................................................................................ 75
TIME ........................................................................................................................... 139
Time ............................................................................................................................... 17
Time channel .................................................................................................... 11, 30, 36
time functions .............................................................................................................. 132
Time of day .................................................................................................................. 142
Time stamp .................................................................................................................... 34
TIME_ZONE_RULES ................................................................................................ 140
TIMEOUT ................................................................................................................... 215
Time-out ...................................................................................................................... 215
TIMES ......................................................................................................................... 142
TOD ............................................................................................................................. 142
TODS ........................................................................................................................... 142
TOGGLE_MOD .......................................................................................................... 111
Topic .............................................................................................................................. 12
Topic name .................................................................................................................. 216
TRACE_BEGIN .......................................................................................................... 177
TRACE_END .............................................................................................................. 177
TRACE_PAUSE .......................................................................................................... 177
MicroSCADA Programming Language SCIL 1MRS751849-MEN
8
Uncommenting ............................................................................................................ 285
Undo ............................................................................................................................ 283
Undoing in SCIL Program Editor ............................................................................... 289
Unequal ......................................................................................................................... 63
UNLOCK_PICTURE ................................................................................................. 235
UNPACK_STR ........................................................................................................... 152
UPDATE ..................................................................................................................... 102
Update program ............................................................................................................... 8
Update time interval .................................................................................................... 102
UPPER_CASE ............................................................................................................ 153
USER .................................................................................................................. 243, 244
User Interface Objects ............................................................................................. 25, 42
UTC_TIME ................................................................................................................. 142
UTC_TIME_ADD ...................................................................................................... 142
UTC_TIME_INTERVAL ............................................................................................ 143
UTC_TO_LOCAL_TIME .......................................................................................... 143
UTC_TO_SYS_TIME ................................................................................................ 143
9
VALIDATE ................................................................................................................. 176
Variable ..................................................................................................................... 5, 53
Variable Assignment ..................................................................................................... 55
Variable expansion ........................................................................................................ 56
Variable object ......................................................................................................... 30, 38
VARIABLE_NAMES ................................................................................................. 169
VECTOR ..................................................................................................................... 165
Vector ...................................................................................................................... 17, 21
Vector aggregate ............................................................................................................ 21
Vector function ............................................................................................................ 156
VIDEO_NR ................................................................................................................... 57
Visual SCIL ..................................................................................................................... 1
Visual SCIL Commands ................................................................................................ 67
Visual SCIL objects ................................................................................................ 39, 95
:
WEEK ......................................................................................................................... 143
WHEN ........................................................................................................................... 72
Widget ......................................................................................................................... 259
Widget methods ........................................................................................................... 262
Widget resource ........................................................................................................... 263
Widget.method ............................................................................................................ 262
WIN_BG_COLOR ...................................................................................................... 105
WIN_CREATE ............................................................................................................ 105
1MRS751849-MEN Programming Language SCIL MicroSCADA
Technical Reference Manual Index
;
XOR ............................................................................................................................... 65
<
YEAR .......................................................................................................................... 143