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  <20202021  2022  2023  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  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Setting an array to zero length
From: Michael Davidsaver via Tech-talk <tech-talk at aps.anl.gov>
To: "Johnson, Andrew N." <anj at anl.gov>, Kay Kasemir <kasemirk at ornl.gov>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Date: Wed, 8 Apr 2020 13:19:08 -0700
With QSRV a database field is mapped as a PVA "scalar" when dbChannelFinalElements()==1 .

QSRV allows writing zero length arrays.

> pvput wf value=[1]
> Old : 2020-04-08 13:15:58.618  []
> New : 2020-04-08 13:17:43.011  [1]
> pvput wf value=[]
> Old : 2020-04-08 13:17:43.011  [1]
> New : 2020-04-08 13:17:44.250  []

'wf' is a waveformRecord.



On 4/8/20 12:29 PM, Johnson, Andrew N. via Tech-talk wrote:
> I expected the PVA protocol to be able to handle zero-length arrays, thanks for confirming that. My main question is what happens if QSRV tries to put one into a waveform record or other array field, since it’s calling the IOC to actually write the value and length. From a brief look at some parts of the IOC code it might work, but I would want someone to try it to be sure. Make sure the record already has at least one element in it before testing that...
> 
> - Andrew
> 
> 
>> On Apr 8, 2020, at 2:20 PM, Kasemir, Kay <kasemirk at ornl.gov <mailto:kasemirk at ornl.gov>> wrote:
>>
>> > It is not currently (and may never be) possible to put a zero-length array through Channel Access;
>> > I don’t know if PVA and QSRV can handle them or not.
>>
>> For PVAccess, the protocol has different type identifiers for scalars and arrays, so a 'double' is  clearly distinguished from a 'double []' with exactly one element.
>> When using an array type, the length can change at runtime and include zero length == empty array.
>>
>> As for QSRV, when you create a 'compress' record with NSAM = 1, the PV is a an NTScalar. For NSAM > 1 the PV is of type NTScalarArray.
>> So it behaves just like the Channel Access example, an array of size 1 appears as a scalar.
>> Not sure if this is a quirk in QSRV that could be fixed, or if the limitation is in the database/IOC API that it needs to use.
>>
>>
>> -Kay
> 
> -- 
> Complexity comes for free, simplicity you have to work for.
> 


References:
Re: Setting an array to zero length Rogers, Will (DLSLtd, RAL, LSCI) via Tech-talk
Re: Setting an array to zero length Johnson, Andrew N. via Tech-talk
Re: Setting an array to zero length Kasemir, Kay via Tech-talk
Re: Setting an array to zero length Johnson, Andrew N. via Tech-talk

Navigate by Date:
Prev: Re: Setting an array to zero length Johnson, Andrew N. via Tech-talk
Next: Re: Setting an array to zero length Michael Davidsaver 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  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Setting an array to zero length Johnson, Andrew N. via Tech-talk
Next: Re: Setting an array to zero length Michael Davidsaver 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  <20202021  2022  2023  2024 
ANJ, 08 Apr 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·