To ensure that a communication cycle VC → PLC → VC has happened, you could create a counter that is incremented on VC side and then you receive an “echo” or “acknowledge” from the PLC.
So basically create 2 integer signals or properties in VC, one output (VC → PLC) and one input. Then write a script that listens for the input signal value change and when the value equals the output it adds 1 to the output signal’s value.
Then connect the input and output to an integer variable on the PLC using the Connectivity feature.
You may need to have the script set the output to 1 in OnStart, but after that you should get the input and output signal values incrementing as quickly as the PLC communication allows.
Using such counter to wait for communication in logic I have not actually tried, but I don’t see why it wouldn’t work either.
To use this as a mechanism to wait for PLC communication in your scripts, you could just read the current value of the intput signal (PLC → VC) and then use triggerCondition to wait for the signal to reach that value + 2. Waiting for value + 1 might not be reliable if there are some queued events still to be processed. Alternatively you could wait for the current value of the output + 1 to appear in the input instead.
You could have multiple of these input signals from same counter. Just either connect the signals on the simulation side, or pair the signals to the same PLC variable in Connectivity. If you go with the second option, have the variable pairs in the same variable group so they stay in sync.
I guess it would be feasible to create a helper component for this using action containers or something. The problem is that each script that requires such logic will have to wait for different value of the counter so it can’t be simplified to a Boolean signal.