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  2019  2020  2021  <20222023  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  <20222023  2024 
<== Date ==> <== Thread ==>

Subject: Re: warnings.warn from raspberry pyepics
From: Matt Newville via Tech-talk <tech-talk at aps.anl.gov>
To: LE-DANIEL Erwann <erwann.le-daniel at alstomgroup.com>
Cc: "tech-talk-request at aps.anl.gov" <tech-talk-request at aps.anl.gov>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Mon, 19 Sep 2022 11:25:20 -0500
Hi,

On Mon, Sep 19, 2022 at 10:57 AM LE-DANIEL Erwann <erwann.le-daniel at alstomgroup.com> wrote:

True, It works and return values from network during few seconds and after the loop speed decrease and the error message occures.

 


OK.  Then, I'm less sure about what is going on.  Creating multiple instances of a PV in a loop would be an odd thing to do, though it will not create completely new connections to the CA Channel: `epics.ca._cache` should only have one Channel in it, though it will retain a large number of callbacks that are no longer accessible.  I don't know if there is a limit on the number of PVs that can be created - your script runs to at least 3000 times for me, though I did not test with raspberry pi.

But: For sure, creating a PV and then fetching its value repeatedly is recommended:

p = epics.PV(‘TL_AN_Input’)

while True:

               val = p.get()

               print (val)

               time.sleep(0.1)


There is also `epics.get_pv` which will get a cached PV or create one if needed:


while True:

               p = epics.get_(‘TL_AN_Input’)

               val = p.get()

               print (val)

               time.sleep(0.1)

this will prevent the creation of thousands of useless callbacks.

--Matt


Replies:
Re: warnings.warn from raspberry pyepics Matt Newville via Tech-talk
RE: warnings.warn from raspberry pyepics LE-DANIEL Erwann via Tech-talk
References:
warnings.warn from raspberry pyepics LE-DANIEL Erwann via Tech-talk
Re: warnings.warn from raspberry pyepics Matt Newville via Tech-talk
Re: warnings.warn from raspberry pyepics Mark Rivers via Tech-talk
RE: warnings.warn from raspberry pyepics LE-DANIEL Erwann via Tech-talk

Navigate by Date:
Prev: Re: warnings.warn from raspberry pyepics Mark Rivers via Tech-talk
Next: RE: warnings.warn from raspberry pyepics LE-DANIEL Erwann 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  2019  2020  2021  <20222023  2024 
Navigate by Thread:
Prev: RE: warnings.warn from raspberry pyepics LE-DANIEL Erwann via Tech-talk
Next: Re: warnings.warn from raspberry pyepics 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  2019  2020  2021  <20222023  2024 
ANJ, 19 Sep 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·