简体   繁体   中英

How to control experiment in labview from python on linux?

I need to open labview experiment (.vi file) from python, pass parameters to it and start experiment. Everything should be done on ubuntu 20.4. I found out it can be done with tcp communication, but it's quite complicated, is there any easier way ? For example on windows you can do it very easily when you import win32com.client :

labview = \win32com.client.Dispatch("Labview.Application")
VI = labview.getvireference("Example.vi")
VI.setcontrolvalue('Period', 1.5)
VI.setcontrolvalue('file_path', "C:\\new.txt")

try:  # have to do this,otherwise: TypeError: 'NoneType' object is not callable
    VI.Run(False)  # False=wait until vi finishes, True=don't wait

except:
    print("Exception")
    pass

Take a look at the python_labview_automation package . While I have not tested it myself it looks as if it does exactly what you want.

It only depends on Windows to start the actual LabView instance and run the server-side VI that is contained in the package. So you can either start LabView yourself or modify the package to know how to start LabView under linux.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM