Hi Simon!
I'm responding inline.
On 28/04/2025 11:54, Dr. Simon Friederich via Tech-talk wrote:
> Dear EPICS-Community,
>
> I have a 128 channel power supply for magnets.
> Every 10 seconds a waveform record reads the measured voltages and
> currents for all channels (transmitted as one string from the device):
> Pattern send by device = U0, I0, U1, I1, U2, I2,..., U127, I127
>
> record(waveform, "$(WEDLKI)imem_get")
> {
> field(DESC, "Read current of all channels 0-127")
> field(DTYP, "stream")
> field(INP, "@wedlkiste.proto getmemarea $(PORT)")
> field(SCAN, "10 second")
> field(NELM, "256")
> field(FTVL, "DOUBLE")
> field(PREC, "7")
> }
>
>
> Now I want to put/assign these values to single ai-records for the
> different magnets, i.e. in my substition file I have the channel
> number as macro (+Prefix,+Subprefix,etc.):
> channel = $(CH) = 0, 1, 2, ..., 127
>
> I now need to extract
> Index_voltage = 2*$(CH)
> Index_current = 2*$(CH) + 1
>
>
> I am aware of array filters, e.g. $(WEDLKI)imem_get.VAL[INDEX], which
> would fit my needs, but I don't know how to calculate the INDEX for this.
>
> record (ai, "$(P)$(R)i_get_ai")
> {
> field(DESC, "Extr curr for each channel")
> field(INP, "$(WEDLKI)imem_get.[$(2*CH+1)] CP") #
> unfortunately that does not work
> field(EGU, "A")
> field(PREC, "7")
> }
Maybe you could try computing the string using sCalcout? Though I think
the solution with subArray below is better.
>
>
> I could calculate this by hand and enter the INDEX via Macro, but I'd
> like to keep my substition file simple:
> file ./db/debug_wedlerchannels.db {
> pattern
> {CH, P, R, INDEX} # not desired to calculate INDEX by hand
> { 0, wed:, c0:, 1}
> { 1, wed:, c1:, 3}
> ...
> { 6, wed:, c6:, 13}
> { 7, wed:, c7:, 15}
> ...
> { 13, wed:, c13:, 27}
> { 14, wed:, c14:, 29}
> ....
> }
>
> Do you have a suggestion for me how to solve this?
>
> I've also tried a single element subarray and calculated INDX via a
> calc record. But unfortunately the single values do only refer to the
> first value (index = 0) and are not updated although I've added the
> "CP" flag.
>
> record(calcout, "$(P)$(R)__calci_INDX")
> {
> field(DESC, "Calcuate the index for the subArray")
> field(INPA, "$(P)$(R)i_get CP")
> field(CALC, "(2*$(CH))+1")
> field(OUT, "$(P)$(R)i_get.INDX NPP") # works, or at least
> caget shows that i_get.INDX is correct
> field(DISP, 1)
> }
>
> record (subArray, "$(P)$(R)i_get")
> {
> field(DESC, "Extr curr for each channel")
> field(SCAN, "Passive")
> field(INP, "$(WEDLKI)imem_get CP") # Process linking record
> every time the target record processes
> field(FTVL, "DOUBLE")
> field(MALM, "1")
> field(NELM, "1")
> field(EGU, "A")
> field(PREC, "7")
> }
Using a subArray seems the easiest to scale.
The issue you're having with subArray is that MALM needs to be at least
big enough to fit the input array up to the index you're grabbing. I
faced the same issue with [1], where reading the last 80 elements of a
160 value array required MALM=160.
One thing to note with this is that your PVs will be arrays with a max
count of MALM, so it might be interesting to you to simplify client
interaction by adding an additional ai record reading from i_get. That
would even allow you to use a single subArray with NELM=2, which reads
voltage and current, and your separate ai records read from hardcoded
indexes 0 and 1 using CA filters.
>
>
> Some background:
> The imem_get-PV is on the same IOC. Currently we use EPICS R7.0.7.
>
> Thank you very much in advance.
> Best regards
> Simon
Aviso Legal: Esta mensagem e seus anexos podem conter informações confidenciais e/ou de uso restrito. Observe atentamente seu conteúdo e considere eventual consulta ao remetente antes de copiá-la, divulgá-la ou distribuí-la. Se você recebeu esta mensagem por engano, por favor avise o remetente e apague-a imediatamente.
Disclaimer: This email and its attachments may contain confidential and/or privileged information. Observe its content carefully and consider possible querying to the sender before copying, disclosing or distributing it. If you have received this email by mistake, please notify the sender and delete it immediately.
- Replies:
- Re: Waveform to single ai (again) Dr. Simon Friederich via Tech-talk
- References:
- Waveform to single ai (again) Dr. Simon Friederich via Tech-talk
- Navigate by Date:
- Prev:
Handling Polling and CPU Bottleneck for Large Image Capture in areaDetector Kim, Kuktae via Tech-talk
- Next:
RE: Handling Polling and CPU Bottleneck for Large Image Capture in areaDetector Mark Rivers 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
2020
2021
2022
2023
2024
<2025>
- Navigate by Thread:
- Prev:
Waveform to single ai (again) Dr. Simon Friederich via Tech-talk
- Next:
Re: Waveform to single ai (again) Dr. Simon Friederich 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
2020
2021
2022
2023
2024
<2025>
|