Experimental Physics and Industrial Control System
Hello
I hope this is a right place to ask a question about pyepics.
I want to monitor two epic variables in a Python script. Interactive
session gives this printout:
In [1]: import epics
In [2]: epics.__version__
Out[2]: '3.0.10'
In [5]: pll = epics.PV('LUCA:ENV:ENV_SC_PLL_MONITOR')
In [6]: print pll.info
== LUCA:ENV:ENV_SC_PLL_MONITOR (native_enum) ==
value = 1
char_value = 'LOCKED'
count = 1
type = enum
host = 10.0.4.51:5064
access = read/write
status = 0
severity = 0
timestamp = 1294304943.721 (2011-01-06 10:09:03.721306)
enum strings:
0 = UNLOCKED
1 = LOCKED
PV is internally monitored, with 0 user-defined callbacks:
=============================
In [16]: ventilator = epics.PV('LUCA:ENV:ENV_FRONT_VENT_ACT_MONITOR')
In [17]: print ventilator.info
== LUCA:ENV:ENV_FRONT_VENT_ACT_MONITOR (native_double) ==
value = 4230
char_value = '4230'
count = 1
type = double
units = RPM
precision = 0
host = 10.0.4.51:5064
access = read/write
status = 0
severity = 0
timestamp = 1294306643.047 (2011-01-06 10:37:23.046888)
upper_ctrl_limit = 0.0
lower_ctrl_limit = 0.0
upper_disp_limit = 0.0
lower_disp_limit = 0.0
upper_alarm_limit = 0.0
lower_alarm_limit = 0.0
upper_warning_limit = 5500.0
lower_warning_limit = 2000.0
PV is internally monitored, with 0 user-defined callbacks:
=============================
So I have two varibles, one of enum type and one of double type with
unit defined. They both change very slowly.
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)
But the results are strange :
------Printout from callback ------
pvname = LUCA:ENV:ENV_SC_PLL_MONITOR
value = 1
char_value = 1
type = enum
units = None
enum_strs = None
----------------------------------
------Printout from callback ------
pvname = LUCA:ENV:ENV_FRONT_VENT_ACT_MONITOR
value = 4260.0
char_value = 4260.0
type = double
units = None
enum_strs = None
----------------------------------
The problem is that only value, pvname and type is passed properly.
char_value for pll varibale (enum type) should be LOCKED , also
enum_strs shold be defined, and there is no units for vent variable.
Is this a bug or am I doing something wrong ?
Best regards,
Janko Kolar
- Replies:
- Re: pyepics callback function problem Matt Newville
- Navigate by Date:
- Prev:
Re: MOXA terminal server Dirk Zimoch
- 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
- Navigate by Thread:
- Prev:
UKIRT's Allen Bradley temperature problem - solved Maren Purves
- Next:
Re: pyepics callback function problem Matt Newville
- 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