Hello all! Do I require the runtime license of PVI Monitor to access variables’ data from external apps developed in Python? I programmed a python script to extract some data from Oerlikon machines that have B&R hardware and on the PVI Monitor I can check that when running, active process objects as linked objects are increased by 1 (so the PVI monitor accepts the communication), however the script can never extract the variables. Is it because the license is in trial mode? I guess it should work as an experiment, at least during the free 2 hours of trial license access…
Hi @jpsilvaconti ,
Welcome to the B&R Community!
Is it because the license is in trial mode? I guess it should work as an experiment, at least during the free 2 hours of trial license access…
Correct PVI is a driver that requires a license.
Ciao
Valerio
Yes, I do know that. Without the license I only can run it in Trial mode for 2 hours. My question is if the access to the PVI via external applications programmed in C++ or Python are blocked in Trial Mode license and ONLY allowed in Runtime. I am asking this because in my point of view it still should work during those 2 free hours.
Hi,
there’s no difference about the way how PVI is accessed, every type of access is supported for 2 hours in trial mode.
But please mention that if PVI is used on a system without license and is already running together with Automation Studio, then it will maybe lock immediately after using another access via the DLL interface, if the time since PVI was started already exceeds 2 hours.
The reason for that is, that using PVI exclusively together with Automation Studio but without a lincense, PVI is unlocked for AS usage, but the trial time is already running.
In that case you have to close PVI and restart it again to have the full 2 hours trial runtime also available for the DLL access (this can be done by using the PVI monitor menu “PVI → stop manager” + “PVI → start manager”.
Best regards!
Thank you for your quick response.
Then, something is wrong here… When I try to extract the variable data using Runtime Utility Center (PVI 4.12) it works perfectly and I can read the machine variables fine. However, Runtime Utility does not allow for cyclic extractions for the MES I am building on my factory.
Therefore, I decided to give it a try via Python. And with the same Device Parameters (same SA, IP, WT), on the PVI Monitor I see that the python.exe is linked to the PVI, but the script itself can not connect to extract the data… And yes, the license is within the 2 hours of trial license. What am I doing wrong here? We are buying the runtime license of course, but I don’t have it right now and I am still testing data extraction via external applications.
Okay, so I don’t think the trial mode is the cause.
Unfortunately I’ve no experience with Python.
Are you using the PviPy wrapper from Github?
I would recommend to use the PVI monitor snapshot functionality to have a deeper look into the PVI objects and their state, maybe it helps to analyse the cause:
https://help.br-automation.com/#/en/4/automationnet/pvibase/core/pvimonitordiagnosticssnapshotviewer.htm
Best regards!
Hi @jpsilvaconti ,
on my laptop I don’t have PVI license:
and just for AS you see 4 Clients are connected, as Alex suggested I opened PVI snapshotViewer and made a SnapShot:
Then I made a test with a sw developed by R&D for our simulation, in this sw you can choose 2 different connections OPC UA or PVI, so I have selected PVI:
and below the options:
As soon as I click on connect:
I did a PVI Snapshot and voila’ my additional Client is the sw for simulation Sceneviewer.
At the end I have proved that even with PVI trial version you don’t have any limitations.
The only limitation we have, as you have reported, with Trial Mode (no license) it’s the time, every 2 hours you have manually stop and start Manager.
Good luck on finding the cause of the problem on your test!
Thanks
Ciao
Valerio
Hi,
there are no limitations in PVI within the first two hours after starting any PVI applications.
Whereas Automation Studio and Runtime Utility Center (e.g. pvitransfer.exe) have an internal licence activation for PVI
all other application need a licence to run for longer than 2 hours.
As Alex mentioned: if there is a running PVItransfer.exe or as.exe in the background then these applications ‘consume your free PVI time’.
PVI- Monitor will show the elapsed time:
Hi Silva
Can you share your code?
Which libraries did you use?
Hello all! I am already pursuing this problem for a while and I feel I already tried everything. Something is wrong in the code certainly, but I do not understand what.
So, when I run this code on RuntimeUtility Center, it works fine and I can read the variables!
OnErrorResume
Connection “/IF=TCPIP /SA=34”, “/DAIP=10.205.63.223 /RT=5000”, “WT=30”
ReadVariable “bde\PDS[0].Material”, “STRING”
ReadVariable “bde\PDS[0].stStartTime.year”, “UINT”
ReadVariable “bde\SDS[0].Material”, “STRING”
ReadVariable “bde\SDS[0].ucSTATUS”, “USINT”
ReadVariable “bde\SDS[0].AktuellerFehler”, “USINT”
ReadVariable “bde\SDS[1].ucSTATUS”, “USINT”
ReadVariable “bde\SDS[1].AktuellerFehler”, “USINT”
ReadVariable “bde\SDS[0].Kreuzungswinkel”, “DINT”
ReadVariable “bde\SDS[1].Kreuzungswinkel”, “DINT”
When I run it via my python code, I can never read the variables! I am using PVI 4.12 version and pvi.py library, the one Alexander Hefner sent in a previous message.
import time
import sys
import os
# — AJUSTE DE CAMINHO —
lib_path = r"C:\\Users\\adminlou\\Desktop\\Oerlikon Test\\Pvi\\Pvi.py-main"
if lib_path not in sys.path:
sys.path.insert(0, lib_path)
try:
from pvi.pvi_objects.Connection import Connection
from pvi.pvi_objects.Line import Line
from pvi.pvi_objects.Device import Device
from pvi.pvi_objects.Cpu import Cpu
from pvi.pvi_objects.Variable import Variable
print(“✅ Módulos carregados.”)
except ImportError as e:
sys.exit(f"❌ Erro ao carregar módulos: {e}")
def main():
print(f"\\n— SINCRONIZAÇÃO COM RUNTIME (SA=34) —")
try:
pvi_conn = Connection()
# Configuração de rede validada no seu sistema
line = Line(pvi_conn.root, "LN", CD="/RT=1000")
device = Device(line, "DEV", CD="/IF=tcpip /SA=34 /AM=1")
cpu = Cpu(device, "CPU", CD="/DAIP=10.205.63.223 /RT=5000 /WT=30")
# 1. VAR: Usamos a barra invertida exata do seu Runtime bem-sucedido.
# 2. VT: Removemos o VT para evitar o erro 12033 (o PVI deteta sozinho).
# 3. AM: Usamos /AM=0 para modo manual, evitando o erro 12058.
var_address = "bde\\SDS[0].Material"
variable = Variable(cpu, var_address, CD="/AM=0")
print(f"🔍 Alvo: {var_address}")
for i in range(1, 31):
pvi_conn.doEvents()
if variable._linkID != 0:
try:
# Forçamos a leitura (Equivalente ao comando ReadVariable)
variable.refresh()
# Damos tempo para a Net2000.dll receber o pacote
for _ in range(5):
pvi_conn.doEvents()
time.sleep(0.1)
val = variable.value
if val is not None:
if isinstance(val, bytes):
val = val.decode('ascii', errors='ignore').strip('\x00')
print(f"\n🎯 [SUCESSO] VALOR: {val}")
break
except Exception:
pass
if i % 10 == 0:
print(f"⏳ Tentativa {i}: Comunicando com o PLC...")
time.sleep(1)
else:
print("❌ O PLC não respondeu. Verifique se o Utility Center está FECHADO.")
except Exception as e:
print(f"💥 Erro: {e}")
finally:
print("🔌 Sessão terminada.")
if name == "main":
main()
However, every time I run it, clients goes from 0 to 1 in PVI Monitor:
Can someone help me out here?
Moderator: Fixed code blocks, some formatting errors remain
Hi,
I assume that the variable you’re trying to read with with pvi.py is a local variable “SDS[0].Material” of the task “bde”, is that right?
If yes, from what I know about PVI, a local variable object has always to be connected with the parent task object. Therefore I think, the path “bde\SDS[0].Material” is wrong.
The syntax you see in runtime utility center is not the real PVI syntax, but a one that is interpreted from the tool itself.
Having a look into the samples from the pvi.py project, the object generation has to be done different.
I would recommend first to use exactly that sample “variable1.py”, adjust the object names and parameters to your local setup, and try if the sample connects and reads a value.
Best regards!
I tried with that template and I was not able to read the variable. Even on Runtime Utility Center, the variable reading has success but everything appears as “0” or ““.
I think I will need an extra assistance on this topic to fully understand how this works…
I work for Continental Tires and this is a priority for us. I will require some training to understand how this works. I have the communication protocol with all variables documented by the machine supplier.
Hi,
to ask B&R for offering a training, or some project work or other services, I would recommend to get into contact via a request on the website (I’m sorry, I’m not aware which region is the right one to contact, so please try first via the headquarter):
https://www.br-automation.com/en/about-us/contact/
Best regards!
In addition, I’m not experienced with python at all, but I was curious and I tried to get a variable read via pvipy.
So at least I can try to give some more information about the data model behind PVI.
I used a very simple PLC project (just one task with one variable).
The task is named “MyTask”, the variable is a local one called “myLocaleVariable”, which is changing every task cycle.
In the programming environment Automation Studio, this looks like:
When I connect with Runtime Utility Center and read this variable, it works like expected. Here’s the screenshot how the Runtime Utility Center output, and how the instruction file look like:
Now, I adapted the simple1.py demo with the task and variable information from my test project:
And here in my test, it worked like expected.
In addition, I increased the “script wait before end” timer to get the possibility getting a snapshot out of the PVI monitor:
And this is how the snapshot looks like (in comparison with the script content):
So, unfortunately I’ve no idea why it doesn’t works on your side right now, but hopefully the screenshots make the relationship between the PVI objects and the PLC variables a bit more clear.
Best regards!
Hi @jpsilvaconti , last question: Have you downloaded PVI Helps and Samples?
We have even a “Getting started“ example
Don’t tell me Alex you are an application engineer in your idle time ![]()
Hi,
I don’t know what PVI makes of it, but this ‘CD’ doesn’t make sense in a line.
try CD=‘LNANSL’ instead, please.
for i in range(1, 31):
pvi_conn.doEvents()
doEvents() must be called cyclically, but you limit that to a number of cycles. Probably it is simpler to use ‘start()’ as in the examples…
Hi @jpsilvaconti , have you found solution for your question? can you update us?
Hello all,
So I was trying to follow the steps Alexander Hefner suggested via pvi.py, but I still did not find a way of solving this problem.
When I try to use the LNASL it says there is a version conflict, so I changed it to LNINA2. Here, you can check my code:
import datetime
from pvi import *
pviConnection = Connection()
line = Line(pviConnection.root, ‘LNINA2’, CD=‘LNINA2’)
device = Device(line, ‘TCP’, CD=‘/IF=TcpIp /SA=34’)
cpu = Cpu(device, ‘myArsim’, CD=‘/DAIP=10.205.63.223 /RT=5000’)
task1 = Task(cpu, ‘bde’)
cmd_variable = Variable(task1, ‘myCmd’, CD=‘/VN=CMD\[0\].ucCmd /VT=i8’)
material_variable = Variable(task1, ‘myMat’, CD=‘/VN=SDS\[0\].Material /VT=string’)
def on_material_change(value):
print(f"📥 Material: {value}")
material_variable.valueChanged = on_material_change
startTime = datetime.datetime.now()
comando_enviado = False
def runtimeMonitor(init: bool):
global comando_enviado
if hasattr(cmd_variable, '_linkID') and cmd_variable._linkID != 0:
if not comando_enviado:
try:
print(f"🚀 Link Ativo (ID {cmd_variable._linkID}). Tentando escrever 4...")
cmd_variable.value = 4
comando_enviado = True
print("✅ SUCESSO!")
except PviError as e:
print(f"❌ Erro PVI {e.number}: {e}")
if (datetime.datetime.now() - startTime).total_seconds() > 20:
pviConnection.stop()
pviConnection.start(runtimeMonitor)
Unfortunately, when I run it I am still getting PVI errors. On RunTime Utility Center I can read all the PLC variables with no problem. When I try to do it via python, always getting different PVI errors. Most of them are Error 4813, which I think is related to the way I built the path to the variable using LNINA2, but I am not sure. Anyway, on snapshop viewer, I can check the bde task with the variables on it, but always with a Err = on status.
One more thing. I was in contact with SAURER, the machine supplier, and they told me I had to Write “4” on the variable CMD[0].ucCmd, so I could request a “SDS” variable, such as SDS[0].Material (to check the material name thats running on the machine). That is the reason why on the code I have just sent you can see me trying to write the variable “CMD[0]…” and then reading “SDSD[0]…”. At least on Runtime Utility Center, I am only able to read variables when I put the command to write a 4 on CMD[0].ucCmd. I also run the VariableListLocal function to find out the data types of these variables.
If someone of you that are more experience on these topics could help me, that would be amazing. We are already struggling a lot to put these machines in our Continental MES.



















