Setup Pages
X-600M Users Manual
can be used inside the square brackets. For example to send an email that shows the status of a
relay as either On or Off, the following would be entered into the body field: “The relay is
[label(“io.relay1”,”On”,”Off”)].” This will send an email with body: “The relay is On.” when the relay is
on and “The relay is Off.” when the relay is off.
If
Log
is selected, a field called
Log File
appears. Select the log file that you would like to log. All I/O
associated with the log file will be logged when the event occurs.
If
Set X equal to A
is selected, you can set (force) a register or I/O to either a fixed constant or the
value of another register or I/O.
If
Enable Event Group
is selected, a box for the
Event Group
appears. Select the
Event Group
to
be enabled.
If
Disable Event Group
is selected, a box for the
Event Group
appears. Select the
Event Group
to
be disabled.
If
Evaluate Expression
is selected a text box opens. Type the text for a Lua expression into this
box. The script must be a
Lua Expression
which runs to completion and then stops. When you click
Add
, the script is checked for correct syntax. If an error occurs, the first error will be highlighted. You
will not be able to add an expression with faulty syntax. For further information see
Section:
Control/Logic - Lua Scripts.
4.5.4 Control/Logic > Scripts (Add, edit, and delete Scripts)
Scripts are small non-compiled programs written in the Lua scripting language. Scripts are are used to
implement more complex
Events
and A
ctions.
Scripts provide power and flexibility to solve real world
applications. They allow the X-600M user interface to be relatively simple and still provide enhanced
capability for those users who need it.
Lua is a lightweight scripting language used for many web-based and industrial applications among
other things. Unlike BASIC, Lua is a modern, dynamically typed, structured language. Features include:
loops, functions, tables, arrays, and comments. With the X-600M, certain elements of Lua which allow
access to the operating system and to read/write files have been removed.
In the X-600M there are two types of scripts; expressions which run once to completion and are event
driven, and scripts which run continuously.
Expressions
Scripts which do not run in a loop are called expressions. Expressions perform a simple, specific
mathematical or logic function and then stop. Expressions have a similar look and feel of algebraic
equations. Expressions can be embedded in specific
Conditional Events (
complex events
)
or
Actions
(evaluate expression)
or defined here in the
Scripts
menu tab. If an Expression is entered here, it will run
once when the X-600M first turns on. Expressions are generally event driven and only run when needed.
If an Expression get stuck or runs too long, the X-600M shuts it down. The X-600M supports one
expression scrip
t for each
conditional event
and one
expression script
for each a
ction.
Each Lua
expression can be up to 1.5-Kbytes.
Scripts
Lua Scripts can run continuously in the background if designed to do so. The X-600M can run up to five
Lua scripts concurrently. Each script can be up to 8-Kbytes. Scripts generally poll inputs, make logic
decisions and control outputs. These scripts are created and edited here with the
Scripts
menu tab.
The
Scripts
menu tab presents a list of the current Scripts. To add a new script, click
Add New Script.
Clicking on the button
Open Debug Console
will open a popup window with a text console that can be
used to view run time errors as well as output from print statements. This can be useful for debugging
scripts, but should only be used during configuration as it has a small performance penalty. The debug
Page 78
Xytronix Research & Design, Inc.
Содержание X-600M
Страница 1: ...X 600MTitle Page Goes Here...
Страница 6: ...X 600M Users Manual Page 4 Xytronix Research Design Inc...
Страница 99: ...X 600M Users Manual Setup Pages Xytronix Research Design Inc Page 97...
Страница 116: ...Appendix B Installing New Firmware X 600M Users Manual Page 114 Xytronix Research Design Inc...