Experimental Physics and
| |||||||||||||||||
|
Touchard Dominique wrote: I am quiet beginner on Epics and I have started to try to use waveform records (specialy Asyn/modbustcp waveform records)
You can do both with the aCalcout (array calc out) record, but note that this record is not in base; it's an add-on, supplied by the calc module. (See http://www.aps.anl.gov/aod/bcda/synApps/calc/R2-6-3/aCalcoutRecord.html) The doc describes how to access a single element, but it doesn't mention setting an element. I'll describe both, after some background: The aCalcout record has scalar input fields A, B, C..., array input fields AA, BB, ..., and an array output field AVAL. Let's assume the AA field has the value[0,1,2,3,...] You can select the 4th element with the following calc expression: aa[3,3] (Numbering starts at zero.) This will actually return the result [3,0,0,0,0,...] You can get a subarray in its original place with the following expression: aa{3,5} (-1 means the last element.) This will return the result [0,0,0,3,4,5,0,0,...] Armed with this, and with the ARR() command (arr(6) = [6,6,6,6....]), you can set element 'a' of the array 'aa' to the value of 'b' with the following expression: aa[0,a-1] + aa{a+1,-1} + (arr(b)[0,0]>>a) If aa = [0,1,2,3,4,...], a = 3, and b = 20, the first term yields [0,1,2,0,0,0...] The second term yields [0,0,0,0,4,5,...] The third term yields [0,0,0,20,0,0,...] and the sum is [0,1,2,20,4,5,...] Note that this is not an efficient way to do the job. It's good for unanticipated needs, because you can program it at run time, but if I were planning to do this routinely, I would write a custom routine for the genSub record. (See http://www.observatorysciences.co.uk/images/genSubManual.pdf) -- Tim Mooney ([email protected]) (630)252-5417 Beamline Controls & Data Acquisition Group Advanced Photon Source, Argonne National Lab.
| ||||||||||||||||
ANJ, 10 Nov 2011 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |