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: Storing an array element as a scalar in a record |
From: | "Johnson, Andrew N. via Tech-talk" <tech-talk at aps.anl.gov> |
To: | "Wang, Andrew" <wang126 at llnl.gov> |
Cc: | "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov> |
Date: | Sat, 6 Mar 2021 03:05:38 +0000 |
Hi Andy, On Mar 5, 2021, at 7:39 PM, Wang, Andrew via Tech-talk <tech-talk at aps.anl.gov> wrote:
The Array Parameters section of the subArray Reference page says:
The user specifies the maximum number of elements that can be read into the subarray in the MALM field. This number should normally be equal to the number of elements of the Waveform array (found in the Waveform's NELM field). The MALM field is used to allocate memory. The subArray's Number of Elements (NELM) field is where the user specifies the actual number of elements that the subArray will extract. Because of the link API it uses the subArray record has to fetch the complete array from the waveform record before it can extract the part that you want, so it needs enough memory to hold the whole array. That’s why you need to set MALM to 4, not 1.
If you don’t need the index to change, there is a simpler way to extract a specific element from an array, and the latest EPICS release 7.0.5 makes that even better. The array channel
filter lets you specify the subarray as part of a PV name; prior to 7.0.5 you had to explicitly use the CA protocol for it, but in 7.0.5 this syntax now works with DB links as well.
An ai record retrieving the 2nd element from a waveform record named wf would have have an INP field something like this:
In 7.0.5 that can become this:
HTH,
- Andrew
--
Complexity comes for free, simplicity you have to work for.
|