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  <20112012  2013  2014  2015  2016  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  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Transform Record no_inlink test
From: Tim Mooney <[email protected]>
To: Bruce Hill <[email protected]>
Cc: [email protected]
Date: Thu, 29 Sep 2011 11:39:11 -0500 (CDT)
Bruce,
I'm not very clear on what you're trying to do, but it seems
like you want the record to recalculate A, G, and O when someone
sets B, and recalculate B, G, and O when someone sets A, etc.
If so, you're right that this requires external records to drive
the value fields.

Input links don't work in this case, because the record doesn't
use value changes alone to determine whether to recalculate.  (An
early version of the record did use only value changes, but that
strategy failed to please when a user wrote exactly the same
value twice: the first time the record honored the user's write;
the second time it recalculated, ignoring the user's wishes
because the user failed to write a value that was different
from the previous value.  It was ugly.)

In the database you show, you don't have to add dfanout records
to have the ao records write to the transform record.  You could
use the ao records' OUT fields instead.  (Maybe you deleted those
fields for clarity.  If so, thanks and never mind.)

Tim

----- Original Message -----
> From: "Bruce Hill" <[email protected]>
> To: "Tim Mooney" <[email protected]>
> Cc: [email protected]
> Sent: Wednesday, September 28, 2011 7:32:45 PM
> Subject: Re: Transform Record no_inlink test
> Hi Tim,
> I tried the COPT "Always" setting and it doesn't work for me as it
> re-computes and steps on the new values. I've got a solution working
> where I deleted the transform record input links and replaced my ao
> value
> PV's with dfanout records that write to the transform record fields
> directly.
> 
> However, I think I'm still not understanding how the transform record
> is intended to operate.
> 
> 
> an input link disables the associated calculation
> because the value field will have been fetched by the record
> before the calculation was to be performed. Each input link will fetch
> a value, but that code doesn't set the map bit,
> and the new_value variable detects whether or not the value has
> changed.
> It would seem to be safe to do the calculations for any new values
> whether
> they came from input links or from direct writes to the transform
> record fields.
> 
> Regards,
> - Bruce
> 
> On 09/27/2011 04:05 PM, Tim Mooney wrote:
> 
> Bruce,
> 
> The transform record has two modes of operation. The mode is
> selected by the field COPT, which can take one of two values:
> 
> 0) ("Conditional") do calculations only for fields that have
> not been written to since the last time the record processed.
> This is the default, because it's the behavior for which the
> record was originally written, and for backward compatibility
> with databases written before the COPT field was added. In
> this mode, an input link disables the associated calculation
> because the value field will have been fetched by the record
> before the calculation was to be performed.
> 
> 1) ("Always") do all calculations regardless of whether fields
> have been written to. This is relatively new, and it's the
> behavior you want.
> 
> In either mode it's ok for an output link to point to the same
> PV as the associated input link.
> 
> The idea of conditional, by the way, is to separate value fields
> into independent variables (written to) and dependent variables
> (not written to; recalculated from independent variables), to
> implement bidirectional coordinate transformations. More
> details are in the documentation:
> https://subversion.xor.aps.anl.gov/synApps/calc/trunk/documentation/transformRecord.html
> Tim
> 
> ----- Original Message -----
> 
> From: "Bruce Hill" <[email protected]> To: [email protected]
> Cc: [email protected] Sent: Tuesday, September 27, 2011 5:05:16 PM
> Subject: Transform Record no_inlink test
> In using the transform record V5.7 from calc 2.8, I found that the
> record has
> a test in transformRecord.c line 398 that disables output calculations
> for each variable that
> has an input link.
> 
> If I disable that test for no_inlink, my transform record behaves as I
> expect.
> 
> Does anyone know why that test is there?
> 
> It seems to preclude using the transform record input links which
> select the same PV as the output links.
> I can get around it by adding dfanout records to write the values
> directly to the
> transform record input fields, A-P, but it seems like an ugly
> workaround.
> 
> Regards,
> - Bruce
> 
> 
> 
> record( ao, "$(CAM):Gain" )
> {
> field( DESC, "Set camera gain" )
> field( DRVH, "100" )
> field( DRVL, "0" )
> field( HOPR, "100" )
> field( LOPR, "0" )
> field( PINI, "YES" )
> field( FLNK, "$(CAM):Gain:Calc PP" )
> }
> 
> record( ao, "$(CAM):GainA" )
> {
> field( DESC, "Gain for side A" )
> field( FLNK, "$(CAM):Gain:Calc PP" )
> field( DOL, "0x042" )
> field( DRVL, "0x042" )
> field( DRVH, "0x1E8" )
> }
> 
> record( ao, "$(CAM):GainB" )
> {
> field( DESC, "Gain for side B" )
> field( FLNK, "$(CAM):Gain:Calc PP" )
> field( DOL, "0x042" )
> field( DRVL, "0x042" )
> field( DRVH, "0x1E8" )
> }
> 
> record( ao, "$(CAM):Gain:Offset" )
> {
> field( DESC, "Offset between gain halves" )
> field( PINI, "YES" )
> field( FLNK, "$(CAM):Gain:Calc PP" )
> }
> 
> record( transform, "$(CAM):Gain:Calc" )
> {
> field( DESC, "Calc camera gain" )
> field( INPA, "$(CAM):GainA" )
> field( INPB, "$(CAM):GainB" )
> field( INPH, "0x1E8" )
> field( INPL, "0x042" )
> field( INPO, "$(CAM):Gain:Offset" )
> field( INPG, "$(CAM):Gain" )
> field( CLCA, "(G/100)*(H-L)+L-(O/2)" )
> field( CLCB, "(G/100)*(H-L)+L+(O/2)" )
> field( CLCG, "(((A+B)/2)-L)*100/(H-L)" )
> field( CLCO, "B-A" )
> field( PINI, "YES" )
> field( OUTA, "$(CAM):GainA PP" )
> field( OUTB, "$(CAM):GainB PP" )
> field( OUTG, "$(CAM):Gain PP" )
> field( OUTO, "$(CAM):Gain:Offset PP" )
> }
> --
> Bruce Hill
> Member Technical Staff
> SLAC National Accelerator Lab
> 2575 Sand Hill Road M/S 10
> Menlo Park, CA 94025

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


Replies:
Re: Transform Record no_inlink test Bruce Hill
References:
Re: Transform Record no_inlink test Bruce Hill

Navigate by Date:
Prev: Regarding Labjack and Xcode Kamleshkumar Suthar (suthar)
Next: Re: Combing Two State Sets into One Bradley Pietrzak
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Transform Record no_inlink test Tim Mooney
Next: Re: Transform Record no_inlink test Bruce Hill
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·