7. LW3 Programmers’ Reference
RAP-B511 series
– User's Manual
85
Applied firmware package: v1.1.0b3b3 | LDC software: v2.5.1b5
7.13.4.
Value Change with Intervals (Case)
This command can be used to change the value of a variable if it fits in any of the defined intervals.
Command and Response
ç
CALL·/CTRL/VARS/V
<loc>
:case(
<min> <max> <val>
;)
æ
mO·/CTRL/VARS/V
<loc>
:case
Parameters
Parameter
Parameter description
Value
<loc>
The location of the variable
1-30
<min>
The lowest value of the interval
Integer
<max>
The highest value of the interval
Integer
<val>
The new value that will be valid if the current value is in the interval
Integer
The parameters are divided by a space character, and the interval groups are divided by semicolon. Up to 16
cases can be defined.
Examples
ç
CALL /CTRL/VARS/V1:case(10 20 15)
æ
mO /CTRL/VARS/V1:case
A typical example when two different ranges of values have to meet:
Incoming values: between 0 and 255 (e.g. the slider of a controller can have these values).
Outgoing values: between 0 and 100 (e.g. the controlled device accepts these values).
Defined cases:
The command looks like:
ç
CALL /CTRL/VARS/V1:case(1 25 10;26 50 20;51 75 30;76 100 40;101 125 50;126 150 60;151 175 70;
176 200 80; 201 225 90; 226 255 100)
æ
mO /CTRL/VARS/V1:case
Min
Max
New value
Case 1
1
25
10
Case 2
26
50
20
Case 3
51
75
30
Case 4
76
100
40
Case 5
101
125
50
Case 6
126
150
60
Case 7
151
175
70
Case 8
176
200
80
Case 9
201
225
90
Case 10
226
255
100
7.13.5.
Scan and Store
This command can be used to get the value (or a part of the value) of an LW3 property. The defined path will
be scanned according to the pattern and the result will be the value of the variable (number or string type).
Command and Response
ç
CALL·/CTRL/VARS/V
<loc>
:scanf(
<path>
.
<property>
;
<pattern>
)
æ
mO·/CTRL/VARS/V
<loc>
:scanf
Parameters
Parameter
Parameter description
Value
<loc>
The location of the variable
1-30
<path>
.
<property>
The LW3 property with node
<pattern>
The pattern that scans the property for the desired result
see below
Pattern options
Pattern
Pattern description
%s
String of characters stopping at the first whitespace character
%
<number>
s
The next <number> of characters (string) stopping at the first whitespace
%c
One character
%
<number>
c
The next <number> of characters
%[
<characters>
]
Defined characterset, specified between brackets
%[^
<characters>
]
Negated characterset, specified between brackets which will be skipped
%*
Ignored part
<custom_text>
User-defined text
The patterns can be combined to get the desired result as shown in the examples.
ATTENTION!
Do not forget to escape the % character as shown in below example.
Examples
ç
CALL /CTRL/VARS/V1:scanf(/CTRL/TCP/C1.ActiveRx;\%6c)
æ
mO /CTRL/VARS/V1:scanf
ç
GET /CTRL/VARS/V1.Value
æ
pw /CTRL/VARS/V1.Value=autorx
A simple pattern has been applied: we need the first six characters from the property value.