Experimental Physics and
| |||||||||||||||||
|
Hi Tong, On Thu, Mar 21, 2019 at 10:05 AM Tong Zhang via Tech-talk <[email protected]> wrote: Hello, Those warning messages are coming because those PVs are not connected, or have not connected yet. There are several possible reasons for that, including an IOC that is currently down or slow to respond. It might work to add a short wait before fetching values, and it might be useful to test whether PVs are actually connected. It's a little hard for me to tell what you're doing, but it should definitely be possible to create several hundred PVs and capture all those values in a loop. Perhaps something like this: import epics import time # create some PVs pvs = [] for i in range(1000, 1200): pvs.append(epics.get_pv('XXX:RFC_%d:E_RD_CAVS' % i) # wait for a brief time, to give a chance for connections to happen time.sleep(0.05) # read out the PV values for step in range(10): # read a dict of {PVname:Value} # version 1: if you are pretty sure all PVs are connected result = {pv.pvname: pv.value for pv in pvs} # version 2: if you are not confident that pvs are connected: result = {} for pv in pvs: if pv.connected: result[pv.pvname] = pv.value else: result[pv.pvname] = '<not connected>' # do something useful with the results print(results) time.sleep(1.0) The recommended use is to create all the PVs once, as this will establish an Epics Channel that is internally, asynchronously monitored for changes, and then subsequent calls to PV.get() will report the latest value. FWIW, `caget_many()` is designed especially for the use-case of wanting to get values for a very large number of PVs but *not* retain the Channel connections. That's really good for a script that runs to collect data on many PVs and then exists (as one might do in a cron job). But if the script or application is long-running and wants to have access to those PVs during the entire lifetime of the application, it is better to create and use a single PV per channel name. Hope that helps. If not, maybe you can give a little more detail on what you're doing, --Matt
| ||||||||||||||||
ANJ, 21 Mar 2019 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |