I'm trying to create the PV names from parameters inside the script because the channels displayed on the screen are defined by a configuration file that will be updated as channels are added or removed. The idea was to have a script get the PV names rather
than passing all of the required PVs as inputs to avoid having to type in all the channels and again to make it easier to update the screens if the channel configuration changes.
From the replies it seems that the best way is to use pyepics or some other outside software to generate the final array that is displayed by the screen.
Thank you for your advise.
Hello,
why are you trying to create the PV names from a parameter inside the script? If you pass all the required PVs as inputs to the script your code may work.
By the way, in my opinion a better solution would be to do this kind of stuff with a dedicated script running somewhere on the network, and not in the GUI. If you don't have access to the original IOC you can use pyepics to create a simple script to concatenate
values from different PVs to a single array, and then launch it as a daemon.
Davide
On 13/05/19 7:14 PM, Tyler Lemon via Tech-talk wrote:
Hello,
I am trying to develop a Python script that is executed by CSS that reads several PV values and combines them into one array. We do not have access to the IOC's database file to be able to create the array there, so that is why we are trying to make a Python
script to do it.
I have tried to use function PVUtil.getDouble, but its argument has to be an
org.csstudio.simplepv.IPV data type.
Below is an example of what I am trying to do in the script:
from org.csstudio.opibuilder.scriptUtil import PVUtil
from array import array
arrayPV = 'loc://testArray' #PV name of array to write values to.
vals = array('f')
for i in range(1,6):
pv = 'devIOC:ai'+str(i)
pvVal = PVUtil.getDouble(pv)
vals.append(pvVal)
PVUtil.writePV(arrayPV,vals)
When this is run in CSS, it gives the error:
TypeError: getDouble(): 1st arg can't be coerced to org.csstudio.simplepv.IPV
Is there a way to convert a string to the org.csstudio.simplepv.IPV type to be able to use it with PVUtil.getDouble?
Or is there an equivalent function that can be used whose input argument can be a string?
Any advise would be appreciated. Thanks!
Best regards,
Tyler Lemon
Jefferson Lab
Detector Support Group
--
Davide Marcato
INFN - Laboratori Nazionali di Legnaro
Viale dell'Universita', 2
35020 Legnaro (PD) - ITALY
Phone: +39 0498068439
Mail: [email protected]