<< Click to Display Table of Contents >> Navigation: 3. Script Language > IPC, InterKOM and Exit Code > InterKOM Technology |
MiniRobotLanguage (MRL)
WIK. Command
Wait for a IPC-Message or Signal
Intention
Using WIK. you can wait until a defined value or mesage is set/sent by any other InterKOM program, for example using SIK.
InterKOM is like you have a shared pool of variables. As InterKOM is lightning fast, synchronization will easily be possible this way.
For more Informations on InterKOM see here ! Smart Package Robot 's InterKOM Technology.
Using SIK. you can write to this shared memory, and at the same time other processes can read the writings using GIK. or wait for it using WIK. or IIK. and react on that.
WIK. is a multi-purpose command that includes multiple possible subcommands.
Usage is simple.
' Wait unlimited time until our own Pool-Byte 1 contains
' a value that is >15
WIK.|Byte|1|>15
' Wait at most 15 seconds until our own Pool-Byte 1 contains
' a value that is NOT EQUAL 27
WIK.15|Byte|1|!27
' Wait at most 0.7 seconds until our own Pool-Long 1 contains
' a value that is smaller then 27012345
WIK.0.7|Long|1|<27012345
' Wait unlimited time
' until CUN from last started Parallelrobot is not more alive
$$PRR=#pcun#
WIK.|!Alive|$$PRR
' Note: This will do the same
WIK.!|Alive|$$PRR
In this more complex example we start a Parallel-Robot to set a Synchronisation Number in the shared Pool. Note that we also use a variable to define the subcommand.
$$SBC=Float
PRR.
PAU.2
SIK.$$SBC|1|6.5454|#fcun#
MBX.Signal Sent!
ENR.
PRE.
$$NUM=6.5453
WIK.15|$$SBC|1|>$$NUM
MBX.Ende
ENR.
Syntax
WIK.[!]P1|P2[|P3][|P4]
Parameter Explanation
[!] - If you prefix the time-value with a "!" then the Logic is negated and the given
condition is true, if its false..
P1 - [optional] If given, this is the maximum time to wait for the condition to be
true. If the condition does not become true, then the command will set the
timeout-flag and just continue with the script. You can check the timeout-flag to
immediately after this command, to see if an timeout has occurred.
P2 - Subcommand, the following Subcommands are currently supported. Note that for all of the subcommands there is a long form that is better readable, as well as a short form, that can be used to write faster.
• "Byte","B."
WIK.[!][max time]|Byte|Nr.|cond/value[|CUN]
• "Long","L."
WIK.[!][max time]|Long|Nr.|cond/value[|CUN]
• "Quad","Q."
WIK.[!][max time]|Quad|Nr.|cond/value[|CUN]
• "Float","F."
WIK.[!][max time]|Float|Nr.|cond/value[|CUN]
• "Use","u."
WIK.[!][max time]|Use|CUN
• "Alive","a."
WIK.[!][max time]|Alive||CUN
• "Message from","mf."
WIK.[!][max time]|Message from|CUN[|$$MSG]
• "Message any","ma."
WIK.[!][max time]|Message any|[$$MSG]
Depending on the chosen Subcommand the further Parameters P3 to P5 differ and may be
needed or not.
If you prefix the Subcommand or the max-time value with a "!" this will negate the logic of the command. If you prefix both, the logic will be unchanged.
cond - WIK. supports the following conditions:
! - NOT
= - Is Equal to
> - Larger then
< - Smaller then
Hint: Combined Operators like ">=" are not supported. In this case, just use ! and "<"
and switch the operators. Because A>=B is the same as NOT B<A.
Example:
WIK.!|Long|$$NUM|<12
WIK.|Long|4|>$$NAU
WIK.5|Long|2|=$$NAC
WIK.!30|Long|$$NUM|=$$NAC
P2 - Depending on the chosen Subcommand this Parameter may be the number of
the synchronization element or may have another usage.
P3 - (optional) Depending on the chosen Subcommand this Parameter may
be needed or not.
P4 - (optional) Depending on the chosen Subcommand this Parameter may
be needed or not.
P5 - (optional) Depending on the chosen Subcommand this Parameter may
be needed or not.
Example
' This example uses INTERKOM to wait until a second Robot
' has ended.
' Run Parallel Robot
PRR.
PAU.4
ENR.
PRE.
' This Script will wait until the Parallel-Robot has ended
WIK.!|Alive|#pcun#
MBX.Ende
ENR.
Remarks
There are multiple examples on InterKOM Commands within the supplied Sample Scripts.
Limitations:
Currently there are limitations to the maximum size that a message may have, using InterKOM. These are 650 kb for this release. This may change in the future.
Also the number of possible InterKOM Clients is limited to 16 at this time.
See also:
• ! Smart Package Robot 's InterKOM Technology
• IIK. - If InterCOM Condition