EPICS Home

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  <20192020  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  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: stream device @init and LINEAR conversion
From: "Kasemir, Kay via Tech-talk" <[email protected]>
To: "'[email protected]'" <[email protected]>
Date: Fri, 25 Oct 2019 13:20:55 +0000
Hi:

When using the stream device, I'm seeing a problem where both the '@init' mechanism and the support for LINR work as described, but not when both are used  with the same AO record.

This is the protocol:

getFreq {
    out "freq?";
    in "%i";
}

setFreq {
    out "freq %i";
    @init { getFreq; }
}

The raw number read and written is some frequency in units of Hz, while we'd like to use MHz for the records and the display.
So added LINEAR conversion to the records:

record(ai, "getFreq")
{
    field(DTYP, "stream")
    field(INP,  "@proto getFreq PS1")
    field(LINR, "LINEAR")
    field(ESLO, "0.000001")
    field(EGU,  "MHz")
    field(PREC, "3")
    field(SCAN, "1 second")
}

record(ao, "setFreq")
{
    field(DTYP, "stream")
    field(OUT,  "@proto setFreq PS1")
    field(LINR, "LINEAR")
    field(ESLO, "0.000001")
    field(EGU,  "MHz")
    field(PREC, "3")
}

That works well at runtime, but at initialization time, the stream device '@init' mechanism seems to be unaware of the LINEAR conversion.
So when I write "402.5" to the AO record, it correctly writes "freq 402500000" to the device.
The AI record reads "402500000" from the device and correctly scales that into "402.500 MHz" based on LINR, ESLO, PREC and EGU.
But right after bootup of the IOC, the '@init' mechanism reads "402500000" from the device into the AO RVAL, then puts that without scaling into the AO VAL.
https://paulscherrerinstitute.github.io/StreamDevice/ao.html specifically mentions support for LINR==LINEAR.
Just in case, I tried LINR==SLOPE, but that has the same effect: Works fine when writing to the record, but skips the linear conversion for '@init'.

Am I missing something in the stream device usage?

Thanks,
Kay


Navigate by Date:
Prev: Re: CA exception Michael Davidsaver via Tech-talk
Next: CA Gateway 2.1.2 released Ralph Lange 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  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: CA exception Michael Davidsaver via Tech-talk
Next: CA Gateway 2.1.2 released Ralph Lange 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  <20192020  2021  2022  2023  2024