Parallel Robot Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Parallel-Robot Operations >

Parallel Robot Operations

PRV. - Parallel-Robot send Variable

Previous Top Next


MiniRobotLanguage (MRL)

 

PRV. Command

Parallel Robot send Variable

 

 

Intention

 

This command can be used to send variables to another running robot.

 

Its best if the parallel robot has been started using the PRR./PRE. command, because then you have his communication-Handle.

 

However parallel robots can be started anyway, as long you get his communication handle. The communication handle of a particular robot instance is inside the system-variable: #cbw# .

 

Advanced technical note: If you have the PID of a parallel-robot, you can locate his (invisible) window using STW. and the the "p" flag and then use the window-handle as communication-handle.

 

More Infos:

You can wait for a variable from another running robot using the command WFV.

However,  this is not necessary. A running robot will receive the value of a variable that is sent to him with or without WFV., anyway. This processing takes place in the execution time between two command-lines.

 

Here is a very simple example, which looks larger then it is, because its heavily documented.

 

 

' We set the variable $$NUM to 1 in the Main-Robot

' The Parallel robot will inherit all variables from the Main

' Robot on start this way he knows that $$NUM=1 also.

: $$NUM=1

' Here we start the Parallel-Robot

PRR.

' This is an endless-loop (condition 1 is always true)

 DOL.1

   ' We make a small rest (variables are received in resting time)

   PAU.0.1

' We check if the variable $$NUM changes its value to "0",

' if so we leave

   JIZ.$$NUM|out

' As long as $$NUM is not "0", we PRINT something and

' continue Looping.

   PRT.Running until i get zero ...

 OOP.

 ' Here we go when we got zero

 :out

 ' Then you get a Message-Box

 MBX.Got a zero, leaving

 ' ANd we end the parallel robot

 END.

PRE.$$CMH

' This the way of the Main-Robot

' We let him rest for 2 seconds, then signal the Parallel robot

' to end

PAU.2

' Now we have the Robot-Communication handle insde $$CMH

: $$CON=0

' We set $$NUM on the Parallel Robot to zero

PRV.$$CMH|$$NUM|$$CON

' We wait for 3 seconds and then

PAU.3

' End the script

END.

 

 

 

 

 

 

Syntax

 

PRV.P1|P2[|P3]

 

 

Parameter Explanation

 

P1 - (in) Window/Communicationhandle of a another Robots-Instance

P2 - (in) Name of a Variable which shall be sent to

    the other robot.

P3 - (in) Content which shall be sent to the other robot

    to be placed inside the given VAR-Name P2. If omitted

    content of P2 is sent.

 

If only two parameters are given, the second parameter will be taken as variable-name and as content.

 

Therefore:

PRV.$$RET|$$INP

is equal to:

PRV.$$RET|$$INP|$$INP

 

Important: Please note that P2 is taken "as is", it can not be inside another variable!

 

Alternatively use this:

PRV.$$WHN|$$NAM|$$CON

 

 

 

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

 

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  and memory capacity.

Each robot runs independently from the moment it starts.

 

 

 

Limitations:

 

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:

 

    PRR. - Parallel-Robot-Run

    PRE. - Parallelrobot-Run-End

    PRS. - Parallel Robot Set Resukt

    WFV. - Wait-For-VariableChange

    SGS - Set Global Signal (Mutex)

    WFM. - Wait-For-Message

    TWM. - Text-Window-Message