<< Click to Display Table of Contents >> Navigation: 3. Script Language > Parallel-Robot Operations > Parallel Robot Operations |
MiniRobotLanguage (MRL)
WFV. Command
Wait For Variablechange
Intention
This command can be used to wait for receipt of variables from another running robot.
It can also be used to synchronize running robots.
WFV. will use the name of the variable it has as got, as a reference. And then wait until anything is sent to this variable. It does not just wait for any variable, and it does not matter, if the variable value changes or not.
Think a moment, what can happen. If your script runs in a loop, with a WFV. and the message for that particular variable comes while your script is outside WFV. then your WFV. may wait forever for that PRV.-message.
Therefore use WFV. only if you really need it, and be sure that your parallel robot is inside the WFV. when the PRV. is done.
Using WFV. without such care can lead to a hanging script. If you are not sure, use the timeout-option P2. This will prevent a script from hanging.
Important:
WFV. is not needed for a robot to receive variables from another robot. Any robot receives variables that have been sent to him anyway, also without WFV.. This is done between the processing of the commands (code-lines).
More Infos:
You can send variables to another running robot using PRV.
You can wait for a variable from another running robot using WFV.
You can set a global Signal that multiple running Robots will see, using SGS. and check if such a signal exist, using IGS.
Syntax
WFV.P1[|P2]
Parameter Explanation
P1 - (in) - Name of a Variable which shall be received from the other robot.
P2 - (in) - Timeout time in seconds. If omitted or 0, endless time is used.
Please note that P1 is taken "as is" and not resolved.
Example
'**********************************************
' PRR./PRE./PRV. - Sample 1
' Shows that the Parallel-Robot starts with
' all variables as they have been at starting-time
' of the starting robot.
' It can also use all Subroutines in this file.
'**********************************************
VAR.$$INP=0
VAR.$$TXT=Peter
PRT. I am the Main Robot.
'-----------------------------------------------------------
PRR.
PRT.I am Parallel-Robot-Nr. #pri# from #prc#.
PRT.I am Son #pri# of $$TXT.
:Loop
WFV.$$INP|10
PRT. Variable set to: $$INP
GSB.wait
'JIV.$$INP=1|out
JMP.Loop
:out
END.
PRE.$$RET|0
GRS.$$RET|$$RES
'-----------------------------------------------------------
PRT.KOM-H: $$RET
PRT.I have #prc# running parallel robots and PlugIns.
PAU.1
FOR.$$MYL|1|300
VAN.$$INP=1.342587459
PRV.$$RET|$$INP
VAC.$$INP=12,31,(2*45),(5+67)
PRV.$$RET|$$INP
VAP.$$INP=142,32
PRV.$$RET|$$INP
PAU.0.23
NEX.
' This will end the parallel robot
VAN.$$INP=1
PRV.$$RET|$$INP
PAU.2
DMP.
MBX.!
END.
'-----------------------------------------------------------
:wait
PAU.0.5
RET.
'-----------------------------------------------------------
Remarks
-
Limitations:
It is possible to start more then one Parallel-running robot.
Each robot uses quite some system resources/memory therefore you should not run too many, depending on your CPU number and memory capacity.
Each robot runs independently from the moment he starts with his script.
There are limitations, running Parallel-running Script's on a "Private Desktop".
Each PD has its own address space.
Therefore an Robot can not easily communicate with another Robot on a PD.
Several communications features may not work on a PD.
However the ! Smart Package Robot 's InterKOM Technology should work.
See also:
• PRV. - Parallel-Robot send Variable
• PRE. - Parallelrobot-Run-End
• WFV. - Wait-For-VariableChange
• SGS - Set Global Signal (Mutex)