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  <20152016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: scalcout fails to write to bo - (partially?) solved
From: "Mooney, Tim M." <[email protected]>
To: Isabella Rey <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Mon, 18 May 2015 16:41:51 +0000
Hi Isabella,

Thanks for studying this.  I forgot that the scalcout record did not honor the PREC field for conversions to string until release R3-4-1.

Tim Mooney ([email protected]) (630)252-5417
Software Services Group (www.aps.anl.gov)
Advanced Photon Source, Argonne National Lab


From: Isabella Rey [[email protected]]
Sent: Monday, May 18, 2015 6:38 AM
To: Mooney, Tim M.
Cc: [email protected]
Subject: Re: scalcout fails to write to bo - (partially?) solved

Hi Tim,

Thank you for your reply.

Option 2 is the (only) one that does the trick. I had tried before, with the variant of '1' and '0' being in the DD and EE fields, and it didn't work, but now it did, so maybe I had something not set correctly there...

Option 1 DOES write to the bo correctly, but it breaks the "When Zero" OOPT (as there is no zero output anymore), which I need. So it works in general, but in my case I need to have 1 or 0.

Option 3 doesn't work: I had tried it before, and I re-tested again now, but I get the Illegal choice message.

So overall I have a solution to go ahead with, but it works only when the CALC outputs a string and then converts it to int, I can't seem to use an int directly and push it into the bo, without going through the string.

Thanks for your help!
Isabella

On 15 May 2015 at 18:08, Mooney, Tim M. <[email protected]> wrote:
Hi Isabella,

There are three ways to get the behavior you want in this situation:

1. Have the calc _expression_ produce a string value that is one of the bo record's ZNAM or ONAM strings:

record(scalcout, "BS:CAMS_OK") {
  field(SCAN, ".1 second")
  field(CALC, "AA==CC ? 'ON' : 'OFF' ")         <---<<
  field(INAA, "CAM1:TRAFFIC_LIGHT")
  field(OUT, "BS:AUTO PP")
  field(OOPT, "When Zero")
  field(CC, "OK")
}

2. Have the calc _expression_ explicitly produce a string value that is '0' or '1':

record(scalcout, "BS:CAMS_OK") {
  field(SCAN, ".1 second")
  field(CALC, "AA==CC ? '1' : '0' ")             <---<<
  field(INAA, "CAM1:TRAFFIC_LIGHT")
  field(OUT, "BS:AUTO PP")
  field(OOPT, "When Zero")
  field(CC, "OK")
}

3. Make the scalcout record's conversion from number to string produce zero decimal digits:

record(scalcout, "BS:CAMS_OK") {
  field(PREC, "0")                                  <---<<
  field(SCAN, ".1 second")
  field(CALC, "AA==CC")
  field(INAA, "CAM1:TRAFFIC_LIGHT")
  field(OUT, "BS:AUTO PP")
  field(OOPT, "When Zero")
  field(CC, "OK")
}



Tim Mooney ([email protected]) (630)252-5417
Software Services Group (www.aps.anl.gov)
Advanced Photon Source, Argonne National Lab


From: [email protected] [[email protected]] on behalf of Isabella Rey [[email protected]]
Sent: Friday, May 15, 2015 11:21 AM
To: [email protected]
Subject: scalcout fails to write to bo

Hi All,

I have a scalcout record whose output should go into a bo record, as follows:


record(scalcout, "BS:CAMS_OK") {
  field(SCAN, ".1 second")
  field(CALC, "AA==CC")
  field(INAA, "CAM1:TRAFFIC_LIGHT")
  field(OUT, "BS:AUTO PP")
  field(OOPT, "When Zero")
  field(CC, "OK")
}

record(bo, "BS:AUTO") {
  field(PINI, "YES")
  field(VAL, "0")
  field(ZNAM, "OFF")
  field(ONAM, "ON")
}

When I run the IOC, I get this error message:
Illegal choice PV: BS:AUTO 0.00000000

After looking at other posts, I think the scalcout is trying to write a string in the bo, which generates the error. But my understanding of the scalcout documentation is that the conversion to int should be done automatically, and this should just work.

Interestingly, this workaround does the job:

record(scalcout, "BS:CAMS_OK") {
  field(CALC, "AA==CC")
  field(INAA, "CAM1:TRAFFIC_LIGHT")
  field(CC, "OK")
}

record(calcout, "BS:CAMS_OK_FAN") {
  field(SCAN, ".1 second")
  field(INPA, "BS:CAMS_OK PP")
  field(OUT, "BS:AUTO PP")
  field(OOPT, "When Zero")
}

record(bo, "BS:AUTO") {
  field(PINI, "YES")
  field(VAL, "0")
  field(ZNAM, "OFF")
  field(ONAM, "ON")
}

So it looks like if a record "pulls" the result from scalcout it's OK, but scalcout doesn't "push" it correctly.

I could live with the workaround, but it's a bit of a hack...

Any thoughts on why this is not working?

Cheers,
Isabella


References:
Re: scalcout fails to write to bo - (partially?) solved Isabella Rey

Navigate by Date:
Prev: Re: scalcout fails to write to bo - (partially?) solved Isabella Rey
Next: Re: Fortran CA Client Interface Matt Newville
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: scalcout fails to write to bo - (partially?) solved Isabella Rey
Next: Bug in camserver for Pilatus detectors with large file systems Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·