Experimental Physics and Industrial Control System
|
Hello
Your suggestion solved the problem.
Thank you for your quick response.
Janko
Hi Janko,
I hope this is a right place to ask a question about pyepics.
I think it is.
I wrote a simple program to monitor their value:
import sys
import time
from epics import PV
def callback_function(pvname=None, value=None, char_value=None,
type=None,units=None, enum_strs=None, **kw):
print "------Printout from callback ------"
fmt = ' pvname \t = %s \n value \t\t = %s \n\
char_value \t = %s \n type \t\t = %s \n\
units \t\t = %s \n enum_strs \t = %s \n'
print fmt % (pvname, value, char_value, type, units, enum_strs)
print "----------------------------------\n"
pll = PV('LUCA:ENV:ENV_SC_PLL_MONITOR')
vent = PV('LUCA:ENV:ENV_FRONT_VENT_ACT_MONITOR')
pll.add_callback(callback_function)
pll.run_callbacks()
vent.add_callback(callback_function)
vent.run_callbacks()
while True:
time.sleep(0.001)
Sorry for the trouble.
The issue is that not all of the "extra control fields" (including the
names of the enumeration states, units, and precision) have been
determined when you do PV.run_callbacks(). That is only the "native
form" of the PV
The easiest fix is to explicitly make the control fields be looked up,
either with PV.get_ctrlvars() or PV.get(as_string=True) which also
makes sure that the "char_value" is well formed. That is, I think you
want
pll.add_callback(callback_function)
pll.get(as_string=True)
pll.run_callbacks()
vent.add_callback(callback_function)
vent.get(as_string=True)
vent.run_callbacks()
while True:
time.sleep(0.001)
Perhaps an option should be added to PV.add_callback() to make sure
the control fields are initialized. Either that, or this should be
better documented.
--Matt Newville <newville at cars.uchicago.edu> 630-252-0431
- References:
- pyepics callback function problem Janko Kolar
- Re: pyepics callback function problem Matt Newville
- Navigate by Date:
- Prev:
Re: GPIB to ethernet converter Eric Williams
- Next:
Re: MOXA terminal server Eric Norum
- 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
- Navigate by Thread:
- Prev:
Re: pyepics callback function problem Matt Newville
- Next:
Test, please ignore Benjamin Franksen
- 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
|
ANJ, 18 Nov 2013 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|