Hi Ritesh,
there are several threads in tech-talk discussing this subarray issue. You always have to allocate with MALM the size of the original array because Channel Access always transports the full array, the move of the subarray is done on the client side. Please use the search in tech-talk field on the EPICS home page - it saves you a lot of guessing and asking...
Cheers, Burkhard
-- Dr. Burkhard Kolb Tel +49 6159 712667 GSI Helmholtzzentrum für Schwerionenforschung GmbH
Gesellschaft mit beschränkter Haftung Sitz der Gesellschaft: Darmstadt Handelsregister: Amtsgericht Darmstadt, HRB 1528
Geschäftsführung: Professor Dr. Dr. h.c. Horst Stöcker, Dr. Hartmut Eickhoff Vorsitzende des Aufsichtsrates: Dr. Beatrix Vierkorn-Rudolph Stellvertreter: Ministerialdirigent Dr. Rolf Bernhard
Am 28.04.2011 um 16:23 schrieb Ritesh Sugandhi: 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
(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 <[email protected]> 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")
}
|