Experimental Physics and Industrial Control System
|
Hi Andy,
On Mar 5, 2021, at 7:39 PM, Wang, Andrew via Tech-talk < tech-talk at aps.anl.gov> wrote:
So I have a waveform record that allows four numbers to be stored. I tried to use the subArray record to get the ith element from the array. I set the MALM, NELM and INDX fields to be 1, 1, and 2 respectively. However,
when I process the subArray record, I get the first element of the array, rather than the third element.
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 this is not a viable way to go about it, are there other potential ways to store a scalar from an array in a record aside from using an asub record?
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.
|
- Replies:
- Re: Storing an array element as a scalar in a record Wang, Andrew via Tech-talk
- References:
- Storing an array element as a scalar in a record Wang, Andrew via Tech-talk
- Navigate by Date:
- Prev:
Storing an array element as a scalar in a record Wang, Andrew via Tech-talk
- Next:
Re: Storing an array element as a scalar in a record Wang, Andrew 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>
2022
2023
2024
- Navigate by Thread:
- Prev:
Storing an array element as a scalar in a record Wang, Andrew via Tech-talk
- Next:
Re: Storing an array element as a scalar in a record Wang, Andrew 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>
2022
2023
2024
|
ANJ, 07 Mar 2021 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|