EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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  <20192020  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  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: pyepics callback
From: Eric Norum via Tech-talk <[email protected]>
To: Alfio Rizzo <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Mon, 9 Sep 2019 08:13:06 -0700
Try creating the object with form=‘ctrl’.
From the documentation:
The form parameter specifies which of the three variants ‘native’, ‘ctrl’ (Control) or ‘time’ (the default) to use for the PV. The ‘native’ form returns just the value, the ‘time’ form includes the timestamp from the server the PV lives on, as well as status information. The control form includes several additional fields such as limits to the PV, which can be useful in some cases. Also note that the additional ‘ctrl’ value fields (see the Table of Control Attributes) can be obtained with get_ctrlvars() even for PVs of ‘native’ or ‘time’ form.





On Sep 9, 2019, at 6:24 AM, Alfio Rizzo via Tech-talk <[email protected]> wrote:

Hi
I made a simple python script to get the updated value of my PV
with a simple callback function :
 
import epics
import time
 
def onChanges(**kw):
    print ('PV Changed! ', kw["pvname"], kw["value"], kw["units"], time.ctime())
 
mypv = epics.PV("TCU6:RF")
mypv.add_callback(onChanges)
 
while True:
    pass
    
 
The issue is that the unit is shown as None even if it defined in the .db
 
PV Changed!  TCU6:RF -39.69 None Mon Sep  9 15:03:58 2019
PV Changed!  TCU6:RF -39.73 None Mon Sep  9 15:03:59 2019
PV Changed!  TCU6:RF -39.71 None Mon Sep  9 15:04:00 2019
PV Changed!  TCU6:RF -39.7 None Mon Sep  9 15:04:01 2019
PV Changed!  TCU6:RF -39.67 None Mon Sep  9 15:04:02 2019
 
 
But if I add this line on the script before to add the callback
 
……
mypv.units
mypv.add_callback(onChanges)
……
 
Then when I restart the script it shows the unit correctly
 
 
PV Changed!  TCU6:RF -39.79 dBm Mon Sep  9 15:04:31 2019
PV Changed!  TCU6:RF -39.71 dBm Mon Sep  9 15:04:32 2019
PV Changed!  TCU6:RF -39.69 dBm Mon Sep  9 15:04:33 2019
 
 
Is this a bug/feature or I am doing something wrong ?
 
Thanks
Best
 
 
 
PhD Alfio Rizzo
Control System Integrator
Integrated Control Systems Division
European Spallation Source ERIC
 
Telephone: +46(0)721792342
Mail Address: P.O Box 176, SE 221 00 Lund, Sweden
Visiting address: Odarslövsvägen 113, Lund
 
 
<image001.png>


References:
pyepics callback Alfio Rizzo via Tech-talk

Navigate by Date:
Prev: pyepics callback Alfio Rizzo via Tech-talk
Next: Re: use CA Client in Xilinx MicroBlaze system Johnson, Andrew N. via Tech-talk
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  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: pyepics callback Alfio Rizzo via Tech-talk
Next: Re: pyepics callback Matt Newville via Tech-talk
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  <20192020  2021  2022  2023  2024 
ANJ, 09 Sep 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·