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 2025 | 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 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: Questions about arrays |
From: | William Layne via Tech-talk <tech-talk at aps.anl.gov> |
To: | "Johnson, Andrew N." <anj at anl.gov> |
Cc: | "Wang, Andrew" <wang126 at llnl.gov>, EPICS tech-talk <tech-talk at aps.anl.gov> |
Date: | Tue, 30 Mar 2021 12:22:42 -0400 |
Hi Andy,
On Mar 29, 2021, at 10:55 PM, Wang, Andrew wrote:
>
> I have two questions pertaining to the array records in EPICS 3.15.
>
> • Suppose I have an analog input array or waveform record of size 5 that contains the values 1, 2, 3, 4, 5. Suppose I want to replace with the fourth element. Based upon what I've read, it doesn't seem like subArray is a viable choice. I've also tried to use caput but to no avail. Any recommendations other than using aSub?
Arrays have historically been second-class citizens in the EPICS database, and we don’t have many generic ways of processing them. As you’ve discovered the subArray cannot do what you want by itself.
The latest release of EPICS 7 has added a few improvements to the internals so with that release it’s possible to handle zero-element arrays, and to extract parts of an array using a DB link. We haven’t added any more record types though, so at the moment the aSub and acalcout are the best ways to handle that in the database, or you could use an SNL program but you might want to move more of the array processing into SNL if you do that since moving data between the IOC and the SNL program isn’t particularly efficient.
> • Suppose I have eight individual analog input records and I want to "concatenate their values" and store the result into an analog input array record. I'm thinking about using either aCalcout or an aub routine. Are those valid options and if not, what are alternative options I should explore?
I would suggest an aSub for that, it has lots of inputs with links for fetching the individual data points, and should be a bit more efficient than an acalcout although it does mean you would have to write some C code.
Your questions do show that we could do with adding some new record types to Base for handling these kinds of operations.
- Andrew
--
Complexity comes for free, simplicity you have to work for.