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  <20222023  2024  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  <20222023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Implementing transform field
From: "Marco A. Barra Montevechi Filho via Tech-talk" <tech-talk at aps.anl.gov>
To: "Mooney, Tim M." <mooney at anl.gov>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Thu, 4 Aug 2022 15:58:44 +0000
Wait, i think im still having difficulties with the transform record:

i have a record defined as:

record(transform, "${BL}:${H}:${EQ}:StatusSeparator"){
    field(DESC, "PV to process status bitmask")
    field(COPT, "Always")
    field(SCAN, "1 second")
    field(INPA, "${BL}:${H}:${EQ}:StatusBitmask")
    field(CLCA, "A&1")
    field(OUTA, "${BL}:${H}:${EQ}:EnableStatus")
 }

And it behaves as expected: dbpf StatusBitmask 1 makes StatusSeparator.A field go to 1. Any other value in StatusBitmask that i tried makes StatusSeparator go to 0.
Now if i add field(CLCB, "A&1") to the record, dbpf StatusBitmask 1 makes both StatusSeparator.A and StatusSeparator.B go to 1. Ok, makes sense.
Now if i change CLCB to "A&2", then dbpf StatusBitmask 1 makes dbgf StatusSeparator.A return 1 and dbgf StatusSeparator.B return 0. Makes sense: bitwise AND between 1 and 2 is 0.

The curious thing now: dbpf StatusBitmask 2 makes dbgf StatusSeparator.A return 0 (makes sense: 1&2=0) and dbgf StatusSeparator.B return 0. This doesnt make sense to me since 2&2=2.

Am i doing something wrong?

Yet weirder: if i comment out CLCB field and leave the record exactely as in the begginning, but now change CLCA to "A&2", now dbpf StatusBitmask 1 makes dbgf StatusSeparator.A return 0 and dbpf StatusBitmask 2 makes dbgf StatusSeparator.A return 1. So CLCX ="A&2" works well for X=A but not for X=B? Why?

Thanks in advance.

From: Marco A. Barra Montevechi Filho <marco.filho at lnls.br>
Sent: 04 August 2022 11:39
To: Mooney, Tim M. <mooney at anl.gov>; tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: Re: Implementing transform field
 
Thanks, Tim! Thats exactly what was missing, the record works as expected now.

Apparently i was looking at another documentation page which does not have the COPT field specification: https://epics.anl.gov/bcda/synApps/calc/R2-4/transformRecord.html

This page has it: https://epics.anl.gov/bcda/synApps/calc/transformRecord.html

Best regards,

Marco


From: Mooney, Tim M. <mooney at anl.gov>
Sent: 04 August 2022 11:29
To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>; Marco A. Barra Montevechi Filho <marco.filho at lnls.br>
Subject: Re: Implementing transform field
 
Hi Marco,

I think you need to look at the transform record's COPT field.  To serve the original purpose of the record, CLCA is not performed if A has changed since the last time the record was processed.  The non-default behavior you want requires that you set COPT to "Always"

Tim Mooney (mooney at anl.gov) (630)252-5417
Beamline Controls Group (www.aps.anl.gov)
Advanced Photon Source, Argonne National Lab


From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Marco A. Barra Montevechi Filho via Tech-talk <tech-talk at aps.anl.gov>
Sent: Thursday, August 4, 2022 9:19 AM
To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: Implementing transform field
 
Good morning, all!
Im trying to implement the transform field in an IOC but im not getting the expected result:

i have an analog in record reading a bitmask value from a modbus register. Since the bitmask has 16 bits, i want to perform 16 bitwise operations to transform each bit in a binary in record thus transforming each 0 or 1 into a different string.
Since i dont want to need to create 16 calcout records, i thought i could use the transform record to perform all bitwise operations and push each one of them into a different binary in record. So after reading the documentation i tried to perform a calculation with transform just for testing:

record(ai, "${BL}:${H}:${EQ}:BitmaskGetter") {
    field(DESC, "Bitmask used by other pvs.")
    field(DTYP,"asynInt32")
    field(INP,"@asyn(SIP_EMODBUS_1_1_Rd_Status,0,1000)MODBUS_DATA")
    field(SCAN, "I/O Intr")
    field(FLNK, "${BL}:${H}:${EQ}:StatusSeparator")
}
record(transform, "${BL}:${H}:${EQ}:StatusSeparator"){
    field(DESC, "PV to process status bitmask")
    field(INPA, "${BL}:${H}:${EQ}:StatusBitmask")
    field(CLCA, "A+1")
    field(OUTA, "${BL}:${H}:${EQ}:EnableStatus")
    field(SCAN, "Passive")
}
record(bi, "${BL}:${H}:${EQ}:EnableStatus"){
    field(DESC, "Power supply status")
    field(ZNAM, "Stopped")
    field(ONAM, "Started")
}
So i expected that while caget in BitmaskGetter returns 0, caget into StatusSeparator.A would return 1 and EnableStatus would return "Started". It is not what happens: StatusSeparator returns 0 and EnableStatus returns "Stopped".

To test if the calculation is right, i tried substituting the transform record to a calc one:
record(ai, "${BL}:${H}:${EQ}:BitmaskGetter") {
    field(DESC, "Bitmask used by other pvs.")
    field(DTYP,"asynInt32")
    field(INP,"@asyn(SIP_EMODBUS_1_1_Rd_Status,0,1000)MODBUS_DATA")
    field(SCAN, "I/O Intr")
    field(FLNK, "test_calc")
}
record(calcout, "${BL}:${H}:${EQ}:StatusSeparator""){
    field(DESC, "PV to process status bitmask")
    field(INPA, "${BL}:${H}:${EQ}:StatusBitmask")
    field(CALC, "A+1")
    field(OUT, "${BL}:${H}:${EQ}:EnableStatus")
}
record(bi, "${BL}:${H}:${EQ}:EnableStatus"){
    field(DESC, "Power supply status")
    field(ZNAM, "Stopped")
    field(ONAM, "Started")
}
And now caget into StatusSeparator returns 1, StatusSeparator.A returns 0, BitmaskGetter returns 0 and EnableStatus returns "Started", as expected.

So i figure field OUTA from the transform record pushes the value in field A (which is zero) to the EnableStatus link. If this is the case, is there any way at all to push the result from CLCA to the EnableStatus link? Also,in which field is the result from CLCA field stored, if any?

Thanks in advance,

Marco

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: Implementing transform field Mooney, Tim M. via Tech-talk
Re: Implementing transform field Andrew Johnson via Tech-talk
References:
Implementing transform field Marco A. Barra Montevechi Filho via Tech-talk
Re: Implementing transform field Mooney, Tim M. via Tech-talk
Re: Implementing transform field Marco A. Barra Montevechi Filho via Tech-talk

Navigate by Date:
Prev: Re: Retrieving record name from aSub input/output fields Michael Davidsaver via Tech-talk
Next: Re: Implementing transform field Mooney, Tim M. 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  <20222023  2024 
Navigate by Thread:
Prev: Re: Implementing transform field Marco A. Barra Montevechi Filho via Tech-talk
Next: Re: Implementing transform field Mooney, Tim M. 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  <20222023  2024 
ANJ, 14 Sep 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·