1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 <2019> 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 <2019> 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Using PVUtil to get PV's value when PV name is input as string in CSS |
From: | Tyler Lemon via Tech-talk <[email protected]> |
To: | "[email protected]" <[email protected]> |
Date: | Mon, 13 May 2019 17:14:38 +0000 |
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
|