EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  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  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: EPICS Python??
From: Noboru Yamamoto <[email protected]>
To: [email protected]
Cc: [email protected]
Date: Thu, 06 Sep 2007 11:51:34 +0900
Zhong Ren wrote:
> I use both Newville's EpicsCA and the KEK version.  EpicsCA
> used to have a problem that a crash happens every time the
> application exits.  Please let me know if this is fixed.

Please try the latest version:

http://www-acc.kek.jp/EPICS_Gr/products/EPICS-Python/PythonCA-1.15.1.3.tar.gz

If you still have the problem, please let me know.

> 
> Zhong
> 


> 
> ---- Original message ----
>> Date: Wed, 05 Sep 2007 09:44:24 -0400
>> From: "J. Lewis Muir" <[email protected]>  
>> Subject: Re: EPICS Python??  
>> To: [email protected]
>>
>> On 9/5/07 1:57 AM, Heinrich du Toit wrote:
>>> Hi
>>>
>>> My question is simply.
>>> Which one?
>> Hi, Heinrich.
>>
>> "No. There is another." :-)
>>
>> I use EpicsCA, written by Matthew Newville:
>>
>>   http://cars9.uchicago.edu/~newville/Epics/Python/
>>
>> It has worked quite well for me and has good documentation.
>>
>> -lewis
>>
>>> On the web-site there are 2 different CaPython links. 
>>> One from FNAL and one from KEK.
>>>
>>> I've downloaded KEK so far. Mainly because of the
> multi-threaded claim.
>>> It seems to do the basics cleanly and easily. I even manage
> to setup a
>>> monitor fairly easy.
>>> But I can't seem to find documentation on this.
What a shame!
I appologize lack of documentation.

1) please check sample/TkSample1.py , WxSample1.py. It shows basic usage
of channel object.

2) ca.Get/Put/Monitor (and ca.Put_Array in 1.15.1.3) are provided for
test purpose like caget/caput/camonitor shell command.
Definitions of Get/Put/Monitor in ca.py are also examples of use of
channel object described bellow.

Simple example:

ca.Get("fred")
ca.Put("aiExample",1.0)
ca.Monitor("jane")

After start monitoring with Monitor(),

ca.ClearMonitor("jane")

will stop moitnoring of channel "jane".

For Get(), you can specify optional parameters count and Type to specify
array size and data type to request.
Type can be one of :
                DBR_STRING,
                DBR_CHAR,
                DBR_FLOAT,
                DBR_SHORT, #/* same as DBR_TIME_INT */

                DBR_ENUM,
                DBR_LONG,
                DBR_DOUBLE,
                DBR_TIME_STRING,
                DBR_TIME_CHAR,
                DBR_TIME_FLOAT,
                DBR_TIME_SHORT, #:/* same as DBR_TIME_INT */

                DBR_TIME_ENUM,
                DBR_TIME_LONG,
                DBR_TIME_DOUBLE,
                DBR_CTRL_CHAR,
                DBR_CTRL_LONG,
                DBR_CTRL_DOUBLE,
                DBR_CTRL_ENUM,

"count" should be smaller than the native size of channel.

For Monitor you can specify callback function.
ex:

def foo(ch, vals):
   print ch.name, vals

ca.Monitor("fred",cb=foo)

In the callback function:
ch is a channel object
and vals is a tuple of (value, severity, status, time-stamp).
time-samp is number of second from EPICS_EPOCH.
ca.TS2Ascii, ca.TS2UTC, ca.TS2time are provided for convenience.

3) channle object.

you can create a new channel object.

ex:
ch=ca.channel("fred")

When you create a new channel object, you can also
specify a connection change callback function

sample/ezca.py shows a use of connection change callback.

You can check if a channel is connected or not using ch.isConnected()
member function.

Channel object has put(),put_and_notify(), get(), monitor() methods, as
you expected.
For put_and_notify, get, and monitor methods, you can supply  callback
function (optional for put_and_notify and get).

put just accept native type of the connected channel.
get() accept Type option to specify data type defined in CA library, in
this case you need to specify callback to utilize additional data.
By default get request DBR_TIME_XXXX data.

In the callback function for get, you need to call ch.update_val()
method, which is a defalut callback, before your code, otheriwise val,
ts, sever, status members of the object wiill not be updated.

To put array data into channel, you list up the values as arguments of
put() method.

ex:

ch.put(0,1,2,3,4)

or:

apply(ch.put, range(5))

has same effect.

get_info() method of a channel object will show channel information,
field_type, element_count, puser, connection_status_flag, hostname,
read_access_flag, write_access_flag.

A channel object also has pend_event(), poll(), flush() method which
call coresponding EPICS CA library functions.

Sync Group object defined in ca.py does not work,yet.


Thanks

Noboru

>>>
>>> Most of the other info is about the one from FNAL.
>>> I don't know much about this. 
>>> Accept that it has 2 parts caPython and caChannel.
>>>
>>> So which one do I use?
>>> Which one is supposedly newer?
>>> Which one is more widely used by other people?
>>> Any specific pro's cons about them?
>>>
>>> And if KEK's - where do I find documenation? The
> documentation inside
>>> the library doesn't really tell you what todo and the
> samples is way to
>>> big to figure out what is going on.
>> -- 
>> J. Lewis Muir
>> Software Engineer
>> CARS/IMCA-CAT
>>

begin:vcard
fn:Noboru Yamamoto
n:Yamamoto;Noboru
email;internet:[email protected]
tel;work:+81-29-864-1171, ext. 5209
tel;fax:+81-29-879-6130
x-mozilla-html:FALSE
version:2.1
end:vcard


References:
Re: EPICS Python?? Zhong Ren

Navigate by Date:
Prev: Re: edm John Sinclair
Next: Re: EPICS Python?? Matt Newville
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: EPICS Python?? Zhong Ren
Next: Re: EPICS Python?? Matt Newville
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·