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  <20132014  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  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Convertion for asynFloat64
From: "J. Lewis Muir" <[email protected]>
To: Benoit <[email protected]>
Cc: [email protected]
Date: Fri, 22 Nov 2013 10:53:19 -0600
On 11/22/13 9:37 AM, J. Lewis Muir wrote:
> On 11/22/13 4:10 AM, Benoit wrote:
>> Hi Lewis,
>>
>> about my previous problem I was wondering if I could do the
>> conversion in one step with something similar as below (This does not
>> work)
>>
>> record(ao, "$(S):$(D)_$(C):CavVSet")
>> {
>>   field(DTYP, "asynFloat64")
>>   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))cavvolt")
>>   field(VAL, "0")
>>   field(PREC, "2")
>> }
>> record(calcout, "$(S):$(D)_$(C):CavMilliVSet")
>> {
>>   field(OUT, "$(S):$(D)_$(C):CavVSet PP")
>>   field(OCAL, "1000 * VAL")
>>   field(PINI, "YES")
>>   field(PREC, "1")
>> }
>>
>>
>> Actually I am doing as below, but I need a temporary record to
>> perform this conversion, and It would be simpler to use one record
>> less.
>>
>> record(ao, "$(S):$(D)_$(C):CavMilliVSet")
>> {
>>   field(DESC, "CavMilliVSet Temporary Set Record")
>>   field(PINI, "YES")
>>   field(EGU,  "mV")
>>   field(PREC, "1")
>> }
>> record(calcout, "$(S):$(D)_$(C):CavMilliVCalc")
>> {
>>   field(OUT, "$(S):$(D)_$(C):CavVSet PP")
>>   field(CALC, "1000 * A")
>>   field(INPA, "$(S):$(D)_$(C):CavMilliVSet.VAL CP MS")
>>   field(PINI, "YES")
>> }
>
> Hi, Benoit.
>
> I'm not sure what you're asking.  There are two records in both of
> your examples, so I don't see how the first one uses one less record
> than the second.
>
> Regardless, I think I see the problem with your first example.  You
> have your calculation expression in the OCAL field of the calcout
> record, but it should instead be in the CALC field.  The OCAL field
> is an additional calculation expression that would only be used if
> you set the DOPT field to "Use OCAL".  But you don't need that.  You
> should just use the CALC field which will put the result of the
> expression in the VAL field which will be written to the OUT link.
>
> Lewis

Hi, Benoit.

Hmm, I just tried this, and it doesn't work.  Bummer.  It seems this
won't work because the calcout VAL field is not declared to trigger
record processing when it is written to.

EPICS Base developers, it would be great if a write to the calcout VAL
field did trigger record processing.  But maybe there's a reason why it
doesn't?

Anyway, to make it work, you'd have to write to the calcout VAL field
and then write to the calcout PROC field (or some other field that will
trigger record processing) to make it process.

Looking at the documentation at

  https://wiki-ext.aps.anl.gov/epics/index.php/RRM_3-14_Calcout

the OVAL field is declared to trigger record processing.  So maybe you
could write to that, and use the OCAL expression and set DOPT to "Use
OCAL" and get the behavior you want by writing to OVAL instead of VAL
(albeit confusing)?  Nope, the documentation is wrong.  (I'll fix it.)
The field definition for OVAL in src/rec/calcoutRecord.dbd does not
contain pp(TRUE).

I guess that leaves you with your original second example.

Or you could write to the calcout A field, or any of the letter fields,
and get the behavior you're wanting, but it's not very natural since you
can't just write to the VAL field like most records:

  record(calcout, "$(P)Millivolt") {
    field(CALC, "A / 1000")
    field(OUT, "$(P)Volt PP MS")
  }

  record(ao, "$(P)Volt") {
  }

But if you're OK with adding a third record, which really isn't a big
deal in most cases, you can make your "public" PV interface use the VAL
field like this:

  record(ao, "$(P)Millivolt") {
    field(OUT, "$(P)MillivoltCalc.A PP MS")
  }

  record(calcout, "$(P)MillivoltCalc") {
    field(CALC, "A / 1000")
    field(OUT, "$(P)Volt PP MS")
  }

  record(ao, "$(P)Volt") {
  }

Lewis

Replies:
Re: Convertion for asynFloat64 Andrew Johnson
References:
Convertion for asynFloat64 Benoit
Re: Convertion for asynFloat64 J. Lewis Muir
Re: Convertion for asynFloat64 Benoit
Re: Convertion for asynFloat64 Benoit
Re: Convertion for asynFloat64 J. Lewis Muir

Navigate by Date:
Prev: Re: Convertion for asynFloat64 J. Lewis Muir
Next: Re: Convertion for asynFloat64 Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Convertion for asynFloat64 J. Lewis Muir
Next: Re: Convertion for asynFloat64 Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·