Using "CP" in the input link of the compress CAN (WILL NOT fail to) fetch two consecutive samples with the same value IF the MDEL field of the longin record is set to "-1".The MDEL field is only available in some "numerical" records such as ai, ao, longin, longout.
Yong
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Dirk Zimoch
Sent: Friday, September 28, 2012 3:35 AM
To: Kai Stein
Cc: [email protected]
Subject: Re: How can I collect data values
Kai Stein wrote:
Hello,
I'm working on an automatic data analysis of electron beam (emittance
measurement with a wire scanner and a magnetic lens) with EPICS.
I get values from the hardware (self build measurement cards). The
device support put the values into a longin records (this part is
fixed, because it is already used for other applications).
I need to gather the values (will be a position and a corresponding
current) for a certain amount of time (approximately 1000 to 10000
values) and then hand it over to a subroutine, to perform the
analysis (like fitting a curve onto the data). It should all run on a
debian machine.
My problem is to collect the data with EPICS. I thought about
collecting them somehow in a waveform record, but i have no idea, how
to do this by using other records instead of the device support.
Best regards,
Kai Stein
If your longin processes once for each value "automatically", then the compress record is the easiest way. FLNK from the longin to the compress. (Or if that is not possible, use "CP" in the input link of the compress. But that will fail to fetch two consecutive samples with the same value.) Set NSAM to the maximum number of values you want to keep.
You may set ALG="Circular Buffer". (If you want to average first, you may set N to the number of values that should be averaged into one sample value and set ALG="N to 1 Average".) After all values have been collected (you find the current filling in NUSE and can check it with a calcout record that you process with a FLNK from the compress) you can read VAL to get the array (probably filled up with 0 up to NSAM).
Afterwards, write a 1 to RES to clear the array for the next measurement. The subroutine can be implemented in an aSub record (of if you have an older version of base with a genSub from SynApps).
If your longin does not process automatically but you have to trigger it and probably have to set other values in between two samples, then you should use the sscan record from SynApps.
Dirk