Hello,
I am currently developing a Python-based framework for a B&R PLC application using PVI to communicate with the controller.
For the Python side I’m using the wrapper Pvi.py: GitHub - hilch/Pvi.py: Python wrapper for B&R Pvi (process visualization interface) · GitHub .
Through PVI I can successfully read and write process variables using the Python wrapper (pvi.Variable). For example:
var = Variable(task, "AF_AI[6].ModuleOk")
var.value = True
However, the variable is overwritten again during the next PLC cycle because it is updated inside a cyclic task (100 ms). In Automation Studio I can solve this manually by enabling ForceActivated and setting ForceActivated Value in the watch window.
![]()
What I would like to do is activate this forcing programmatically via PVI, similar to what Automation Studio does when clicking “Force”.
So my questions are:
-
Is it possible to activate ForceActivated and set ForceActivated Value through PVI?
-
If so, which PVI API or command should be used to do this?
Currently the Variable object in the Python wrapper exposes attributes such as:
value
status
descriptor
readable
writable
but I do not see any methods related to forcing.
If forcing cannot be controlled via PVI, what would be the recommended approach for automated testing in this situation?
Thanks in advance for any guidance.