EPICS Controls 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  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  <2025 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
<== Date ==> <== Thread ==>

Subject: Waveform to single ai (again)
From: "Dr. Simon Friederich via Tech-talk" <tech-talk at aps.anl.gov>
To: <tech-talk at aps.anl.gov>
Date: Mon, 28 Apr 2025 16:54:15 +0200
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")
    }


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")
    }


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

Replies:
Re: Waveform to single ai (again) Érico Nogueira Rolim via Tech-talk

Navigate by Date:
Prev: Re: Problems setting up MCA BrukerQM100 Lott, Eva via Tech-talk
Next: Handling Polling and CPU Bottleneck for Large Image Capture in areaDetector Kim, Kuktae 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: Re: Problems setting up MCA BrukerQM100 Lott, Eva via Tech-talk
Next: Re: Waveform to single ai (again) Érico Nogueira Rolim 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
ANJ, 29 Apr 2025 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions ·
· Download · Search · IRMIS · Talk · Documents · Links · Licensing ·