
Language Elements
43
NetLinx Programming Language Reference Guide
The index of the last member of the array for which an event notification was received can be determined
by calling
GET_LAST(MydeviceSet)
. This is useful for determining which device in an array is
referenced in a particular notification message.
Device array examples
The command below sends
'CHARD10'
to all devices in the array,
DeviceSetA
.
DEV DeviceSetA[ ] = {Device1, Device2, Device3}
SEND_COMMAND DeviceSetA, 'CHARD10'
The command below sends
'CHARD10'
to the third device in the array,
DeviceSetA
,
SEND_COMMAND DeviceSetA[3], 'CHARD10'
and is equivalent to:
SEND_COMMAND Device3, 'CHARD10'
The intent of the feedback statement is to set channel 1 in every device in
DeviceSetA
to either on or
off, depending on the value of the right-hand expression; it is unclear what the right-hand expression
evaluates to. The compiler will issue a warning indicating the syntax is unclear and that
DeviceSetB[1]
is assumed. To avoid this warning, specify a particular device in the array. Here's an
example:
[DeviceSetA, 1] = [DeviceSetB[1], 2] (* Correct *)
Device-channels and device-channel arrays
As the name implies, a device-channel (
DEVCHAN
) is a combination of a device and a channel. It is
represented internally as a
DEVCHAN
structure. This structure combines the fields of a
DEV
structure
representing the device with a field representing the channel number.
STRUCTURE DEVCHAN
{
DEV //Device
INTEGER //Channel
}
The first component of a device-channel pair represents the device number, port, and system. It can be
specified as either a single device number, a constant
DEV
structure or as a D:P:S specification. Each
device specified in a device-channel pair should be defined in the
DEFINE_DEVICE
section.
Channels are expressed as integer constants. A
DEVCHAN
is declared in either the
DEFINE_VARIABLE
or
DEFINE_CONSTANT
section. For example, "
[128, 1]
", "
[CONSTANTDPS, 9]
" and "
[128:1:0,
5]
" are all valid representations of device-channel pairs.
A
DEVCHAN
enclosed within square brackets implies an evaluation, whereas a
DEVCHAN
enclosed within
curly braces does not, as illustrated below:
DEFINE_VARIABLE
DEVCHAN dc1 = {128:1:0, 1}
DEVCHAN dcset[ ] = { {128:1:0, 1}, {128:1:0, 2}, {128:1:0, 3} }
DEFINE_PROGRAM
IF ( [dc1] || [128:1:0, 2] ) // evaluation of 2 devchans
[dc1] = 1 // feedback
dc1 = {129:1:0, 2} // assigns a new value to dc1
[dc1] = {129:1:0, 2} // Syntax Error!
Содержание NETLINX PROGRAMMING LANGUAGE
Страница 15: ...Table of Contents xiii NetLinx Programming Language Reference Guide...
Страница 16: ...xiv NetLinx Programming Language Reference Guide Table of Contents...
Страница 18: ...Introduction 2 NetLinx Programming Language Reference Guide...
Страница 76: ...Language Elements 60 NetLinx Programming Language Reference Guide...
Страница 106: ...Combining Devices Levels and Channels 90 NetLinx Programming Language Reference Guide...
Страница 112: ...Master To Master M2M 96 NetLinx Programming Language Reference Guide...
Страница 114: ...Mainline 98 NetLinx Programming Language Reference Guide FIG 1 Message and Mainline Processing in the NetLinx System...
Страница 182: ...Reserved Identifiers 166 NetLinx Programming Language Reference Guide...
Страница 204: ...NetLinx UniCode Functions 188 NetLinx Programming Language Reference Guide...
Страница 244: ...Appendix B Glossary 228 NetLinx Programming Language Reference Guide...
Страница 245: ...Appendix B Glossary 229 NetLinx Programming Language Reference Guide...