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

Subject: Re: record field max length?
From: Jeong Han Lee via Tech-talk <[email protected]>
To: Dirk Zimoch <[email protected]>, [email protected]
Date: Fri, 14 Dec 2018 11:14:16 +0100


I had 80 char buffers when INP/OUT could be 78 chars.
ESS committed a fix to change the buffers to 256 in August 2018 to fit EPICS 3.16 (?). This change is included in release 2.8.3.


In order to to fit "long pv names" generated by ESS site-specific program (PLCFactory). We are using 3.15.5 as the base version.

That is not "perfect", but based on Base 3.15.5, 256 is good enough to running IOC.

Best,
Han



With the unlimited link size in EPICS 7 any fixed buffer size is obviously not sufficient. More important parsing it without length check is not save any more.

I will change that.
Dirk


On 13.12.2018 16:55, Michael Davidsaver via Tech-talk wrote:
On 12/13/18 5:56 AM, Dirk Zimoch via Tech-talk wrote:
Hi William,

Even though the INP Length in EPICS 7 is not unlimited, StreamDevice may nor be able to read it. 78 bytes was the effective limit of INP/OUT in EPICS 3.14. Meanwhile I have changed my buffers from 80 to 256 bytes but not yet to "unlimited" (which is a bigger change).

In case someone is motived to help.

The buffers:

https://github.com/paulscherrerinstitute/StreamDevice/blob/acf7efcff2e29a997a5c2d21629d7ef64f1e19de/src/StreamEpics.cc#L536-L542

Parsing with sscanf()

https://github.com/paulscherrerinstitute/StreamDevice/blob/acf7efcff2e29a997a5c2d21629d7ef64f1e19de/src/StreamEpics.cc#L701-L753

However your string is cur at 78 chars like in EPICS 3.14.

I will check this with EPICS 7....

Dirk

On 13.12.2018 09:46, William Kirstaedter via Tech-talk wrote:
unlimited cant be the case, unfortunately. I'm running EPICS7 and facing the following error when starting the IOC:

2018/12/13 09:42:51.409543 _main_ Missing ')' after substitutions 'readModule(EN,CRYVISIL:LEED:ENgain,CRYVISIL:LEED:ENoffset,CRYVISIL:LEED:ENvalue,LEED_01' 2018/12/13 09:42:51.409621 _main_ CRYVISIL:LEED:getEN: Protocol parse error 2018/12/13 09:42:51.409642 _main_ CRYVISIL:LEED:getEN: Record initialization failed

with these records and streamprotocol:

# Energy
record(stringin, "$(P):$(R):getEN") {
field(DTYP,"stream")
field(INP,"@leed.proto readModule(EN,$(P):$(R):ENgain,$(P):$(R):ENoffset,$(P):$(R):ENvalue,$(P):$(R):ENmonitorU,$(P):$(R):ENmonitorI) $(PORT)")
}
record(ai, "$(P):$(R):ENgain") {
field(DESC,"Energy Gain")
field(EGU,"eV")
field(PREC,"2")
}
record(ai, "$(P):$(R):ENoffset") {
field(DESC,"Energy Offset")
field(EGU,"eV")
field(PREC,"2")
}
record(ai, "$(P):$(R):ENvalue") {
field(DESC,"Energy Value")
field(EGU,"eV")
field(PREC,"2")
}
record(ai, "$(P):$(R):ENmonitorU") {
field(DESC,"Energy Voltage Monitor")
field(EGU,"eV")
field(PREC,"2")
}
record(ai, "$(P):$(R):ENmonitorI") {
field(DESC,"Energy Current Monitor")
field(PREC,"2")
field(EGU,"A")
}
------------
OutTerminator= CR;
InTerminator= "\r\000\n>";
readModule{
# $1 : Module Name -> REN (read energy)
out"R\$1";
# answer: R $1 r NUL n $1 (what out "typed in" plus return) $1|SP|GAIN|SP|OFFSET|SP|VALUE|SP|U-monitor|SP|I-monitor (the actual answer)
# >REN
# EN +0 +500 +500 +500.85 +1.5653E-06
in"R\$1\r\000\n\$1%(\$2)f%(\$3)f%(\$4)f%(\$5)f%(\$6)f";
}

William Kirstaedter (PP&B)
Fritz-Haber-Institut der MPG
Faradayweg 4-6
14195 Berlin
Tel: 030 8413 5405
Mail:[email protected]

Am 12.12.2018 um 17:29 schrieb Johnson, Andrew N.:
On 12/12/18 8:59 AM, William Kirstaedter via Tech-talk wrote:
Short Question:

Whats the maximum length of a record field? how many chars?

record(ai,"record_name"){

     field(DESC, "I_mean_this")
     field(INP, "how_long_can_this_be")

}
Longer answer:

That depends on the field definition for the record type. DESC is defined in dbCommon.dbd  (a kind of super-class used by all record types) as:
         field(DESC,DBF_STRING) {
                 prompt("Descriptor")
                 promptgroup("10 - Common")
                 size(41)
         }
That means it's a DBF_STRING and the size() entry says it can hold up to 41 characters, but there must be a zero-byte terminator so the limit is really 40 (which matches the Channel Access dbr_string_t typedef).

For something like the ZRST field of the mbbi record which defines an enumeration string, the size is given as 26 which is the size of the enumeration strings that Channel Access can send in a struct dbr_gr_enum.

An INP or OUT field is a link and for these the maximum length depends on the version of EPICS you're running; it might be 40 for older versions, 80, 256 for some or unlimited for EPICS-7.

HTH,

- Andrew
--
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon



References:
record field max length? William Kirstaedter via Tech-talk
Re: record field max length? Johnson, Andrew N. via Tech-talk
Re: record field max length? William Kirstaedter via Tech-talk
Re: record field max length? Dirk Zimoch via Tech-talk
Re: record field max length? Michael Davidsaver via Tech-talk
Re: record field max length? Dirk Zimoch via Tech-talk

Navigate by Date:
Prev: csm module support or alternative Davide Marcato via Tech-talk
Next: Job opening at PSI Dirk Zimoch 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  <20182019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: record field max length? Dirk Zimoch via Tech-talk
Next: Re: record field max length? Dirk Zimoch 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  <20182019  2020  2021  2022  2023  2024 
ANJ, 14 Dec 2018 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·