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  <20112012  2013  2014  2015  2016  2017  2018  2019  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019 
<== Date ==> <== Thread ==>

Subject: Re: regarding CaChannel v1.6 handling of dynamic subarrays
From: Matt Newville <newville@cars.uchicago.edu>
To: Ritesh Sugandhi <ritesh.sugandhi@gmail.com>
Cc: tech-talk@aps.anl.gov
Date: Thu, 28 Apr 2011 10:02:45 -0500
Hi Ritesh,

You didn't say which version of Epics base you're using.   As far as I
understand, subarrays require a patched version of 3.14.12, or
3.14.12.1.     Since they're fairly new, it's entirely possible that
client libraries made before this feature was added won't work.

If I remember correctly,  the call to ca_get and/or
ca_create_subscription would have to use an element count of 0 in
order to get back only the dynamically-sized subarray.   It would be
understandable if an older library did not do this.

--Matt

On Thu, Apr 28, 2011 at 9:23 AM, Ritesh Sugandhi
<ritesh.sugandhi@gmail.com> wrote:
> Dear Mr. Martin ,
> thanks for your reply
>
> Yes, I am gettiing 16 elements correctly for each subarray but have zeros on
> elements 17 - 63 for each subArray.
> I have put MALM for each subarray as 16 ( same as NELM = 16). Now the
> element count is coming correct but data in subArray2,3,4 is not correct.
> The output now is
> $ python2.6   ca-channel-v1.6-demo-subarray.py
> (64, [0.27133380897133985, 0.79951261848013366, 0.10564437214412981, ...
> 0.9708053208969406])
> ('subarrays = 1', 16, [0.27133380897133985, ......., 0.66130227225711835])
> ('subarrays = 2', 16, [0.66130227225711835, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
> ('subarrays = 3', 16, [0.66130227225711835, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
> ('subarrays = 4', 16, [0.66130227225711835, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
> Thanks again for anticipated suggestions,
> Best regards,
> Ritesh Sugandhi
>
>
> On Thu, Apr 28, 2011 at 2:45 PM, Martin L. Smith <mls@aps.anl.gov> wrote:
>>
>> In your subArray record set the MALM field to the same as the NELM field.
>> According to the record reference manual under the heading Array
>> Parameters
>> the MALM field is used to allocate the memory for the array. It looks like
>> you are getting the 16 elements correctly but have zeros on elements 17 -
>> 63
>> for each subArray.
>>
>> See if this helps,
>> Marty
>>
>> Ritesh Sugandhi wrote:
>>>
>>> Dear sir
>>>
>>> I am having a array of double consist of 64 elements and connected to 4
>>> sub-arrays of size 16. I assigned the random numbers to main array . now
>>> when I take elements count for each subarray array and display its output. I
>>> got each sub-array is assigned with the 64 elements (instead of 16) and
>>> appended by 0 at the end elements .
>>>
>>> The code output and database schema is included in mail. Please correct
>>> if my understanding is not correct.
>>>
>>> Thanking you and Best regards,
>>>
>>> Ritesh Sugandhi
>>>
>>>
>>> *Output is as below::*
>>>
>>> (64, [0.15680341096341543, …0.27939076994606538])
>>>
>>> ('subarrays = 1', 64, [0.15680341096341543,…, 0.6660663007380897,0.0,….
>>> 0.0])
>>>
>>> ('subarrays = 2', 64, [0.87466558395868221,… 0.59892465207930756, 0.0,
>>>  …., 0.0])
>>>
>>> ('subarrays = 3', 64, [0.20673443822330728,…., 0.34672371303892258, 0.0,…
>>> 0.0])
>>>
>>> ('subarrays = 4', 64, [0.47304895704158478,…, 0.27939076994606538, 0.0,
>>> ….0.0])
>>>
>>> [sugandr@trunk pydev]$
>>>
>>> *code is as below::*
>>>
>>> from CaChannel import *
>>> import random
>>>
>>> driver = CaChannel()
>>> driver.searchw('Py:wave_test')
>>> sub1   = CaChannel()
>>> sub1.searchw('Py:subArr1')
>>> sub2   = CaChannel()
>>> sub2.searchw('Py:subArr2')
>>> sub3   = CaChannel()
>>> sub3.searchw('Py:subArr3')
>>> sub4   = CaChannel()
>>> sub4.searchw('Py:subArr4')
>>>
>>> #put randome number in driver
>>> driver.putw([random.random() for x in range(64)])
>>>
>>> print(driver.element_count(), driver.getw())
>>>
>>> print('subarrays = 1', sub1.element_count(),sub1.getw())
>>> print('subarrays = 2', sub1.element_count(),sub2.getw())
>>> print('subarrays = 3', sub1.element_count(),sub3.getw())
>>> print('subarrays = 4', sub1.element_count(),sub4.getw())
>>>
>>> EPICS environment is 3.14.12 and RHEL 5.5  64 bit version using CaChannel
>>> v1.6 library
>>>
>>> Data base schema is
>>> record(subArray, "$(P)subArr1") {   field(NELM, "16")
>>>  field(INP, "$(P)wave_test.VAL")
>>>  field(INDX, "0")
>>>  field(FTVL, "DOUBLE")
>>>  field(MALM, "64")
>>> }
>>>
>>> record(subArray, "$(P)subArr2") {    field(NELM, "16")
>>>  field(INP, "$(P)wave_test.VAL")
>>>  field(INDX, "16")
>>>  field(FTVL, "DOUBLE")
>>>  field(MALM, "64")
>>> }
>>>
>>> record(subArray, "$(P)subArr3") {
>>>  field(NELM, "16")
>>>  field(INP, "$(P)wave_test.VAL")
>>>  field(INDX, "32")
>>>  field(FTVL, "DOUBLE")
>>>  field(MALM, "64")
>>> }
>>>
>>> record(subArray, "$(P)subArr4") {
>>>  field(NELM, "16")
>>>  field(INP, "$(P)wave_test.VAL")
>>>  field(INDX, "48")
>>>  field(FTVL, "DOUBLE")
>>>  field(MALM, "64")
>>> }
>>>
>>> record(fanout, "$(P)mylinker") {
>>>  field(FLNK, "$(P)subArr1")
>>>  field(LNK1, "$(P)subArr3")
>>>  field(LNK2, "$(P)subArr2")
>>>  field(LNK3, "$(P)subArr4")
>>> }
>>>
>>> record(waveform, "$(P)wave_test") {
>>>  field(NELM, "64")
>>>  field(FTVL, "DOUBLE")
>>>  field(EGU, "Counts")
>>>  field(SCAN, "Passive")
>>>  field(FLNK, "$(P)mylinker")
>>> }
>>>
>>>
>>
>
>


Replies:
Re: regarding CaChannel v1.6 handling of dynamic subarrays Andrew Johnson
References:
regarding CaChannel v1.6 handling of dynamic subarrays Ritesh Sugandhi
Re: regarding CaChannel v1.6 handling of dynamic subarrays Martin L. Smith
Re: regarding CaChannel v1.6 handling of dynamic subarrays Ritesh Sugandhi

Navigate by Date:
Prev: Re: regarding CaChannel v1.6 handling of dynamic subarrays Ritesh Sugandhi
Next: Re: Handling of a character waveform of 64k elements Ritesh Sugandhi
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019 
Navigate by Thread:
Prev: Re: regarding CaChannel v1.6 handling of dynamic subarrays Ritesh Sugandhi
Next: Re: regarding CaChannel v1.6 handling of dynamic subarrays Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·