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  <20232024  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  <20232024 
<== Date ==> <== Thread ==>

Subject: Re: record with constant input link
From: "Johnson, Andrew N. via Tech-talk" <tech-talk at aps.anl.gov>
To: Gerrit Kühn <gerrit.kuehn at aei.mpg.de>, Rolf Keitel via Tech-talk <tech-talk at aps.anl.gov>
Date: Fri, 3 Nov 2023 16:36:31 +0000

Hi Gerrit,

 

On 11/3/23, 11:05 AM, "Tech-talk" <tech-talk-bounces at aps.anl.gov> wrote:

> Am Fri, 3 Nov 2023 08:50:33 -0700

> schrieb Rolf Keitel via Tech-talk <tech-talk at aps.anl.gov>:

>

> > One should not initialize the VAL field of a stringin record by setting

> > the INP field to a string

> > (or the VAL field of a stringout record by setting DOL), as the field

> > value might be interpreted as

> > a record name and the link as a channel access link.

> 

> I see. But why is this written in the manual for stringin records then?

 

In recent EPICS 7 versions a stringin record can use a JSON "const" link in its INP field to provide an initial constant string value, the older CONSTANT link type was limited to numeric values (see below). Even simpler though is just to set the VAL field in your .db file — this works fine as long as the INP field isn't also set.

 

> > The INP field determines where the string input record gets its string. It

> > can be a database or channel access link, or a constant. If constant, the

> > VAL field is initialized with the constant and can be changed via dbPuts.

> 

> This is not what I see when setting the INP field to a constant string

> value. Or does "constant" mean something different in this context?

 

By "constant" it means a numeric literal. The problem with supporting constant strings was that the IOC couldn't easily distinguish between some string values and the PV name of a local or Channel Access channel. More recently we added the JSON link types which allow us to now be explicit that this is a constant string and not the name of some other record. We can also now use a JSON constant link to initialize an aai or waveform record with an array of values, which was not previously possible at all.

 

> > Keep in mind that on records where INP expects a number, a constant

> > value is used to initialize VAL, but

> > a constant INP link is only processed at record initialization. Writing

> > a new value to INP via channel access

> > or dbput will not update the VAL field.

> 

> This is also quite the opposite of what I get from the manual?!

 

Most record types only perform constant initialization of their VAL field from their INP link just once, at IOC initialization time. Writing to the INP field at run-time will still change the INP field itself, but if what you write is a numeric literal it will be parsed as a CONSTANT link and the record process routine will ignore that and just use whatever is in the VAL field at the time. Note that my use of the field names INP and VAL above also applies to other pairs of fields in most record types.

 

However, some record types such as the printf record (I think this is the only one in Base) do perform the constant initialization every time they process the record; this record type has a series of INP links but no equivalent to the VAL field for each one where it could store the constant value from the link between process runs. That was deliberate, to allow the data type read through the link to not be fixed.

 

HTH,

 

- Andrew

 

-- 

Complexity comes for free, Simplicity you have to work for.

 

 


Replies:
Re: record with constant input link Gerrit Kühn via Tech-talk
References:
record with constant input link Gerrit Kühn via Tech-talk
Re: record with constant input link Simon Rose via Tech-talk
Re: record with constant input link Gerrit Kühn via Tech-talk
Re: record with constant input link Rolf Keitel via Tech-talk
Re: record with constant input link Gerrit Kühn via Tech-talk

Navigate by Date:
Prev: RE: Sequencer interpretation of PV names with {,} characters Ivashkevych, Oksana via Tech-talk
Next: Re: record with constant input link Gerrit Kühn 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  <20232024 
Navigate by Thread:
Prev: Re: record with constant input link Ralph Lange via Tech-talk
Next: Re: record with constant input link Gerrit Kühn 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  <20232024 
ANJ, 03 Nov 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·