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

Subject: Re: stream Device I/O error
From: Dirk Zimoch <[email protected]>
To: <[email protected]>
Date: Fri, 29 Apr 2016 08:58:32 +0200
The limits are 9 parameters \$1 ... \$9 and the length of the INP/OUT link. With examples like below where only 1 parameter is used, an arbitrary number of redirects is possible.

Dirk

On 28.04.2016 18:33, Pete Jemian wrote:
 > Redirection works only for up to 4 values read in (3 redirections).

Not certain about that limit.
Here's an example that parses 6 values from the USB port.
With this combination (plus others):
host arch = linux-arm
base-3.15.3/
synApps_5_8/
stream-2-6a/
asyn-R4-29/


protocol
-----------% snip here %-----------
Terminator = CR LF;
#Terminator = LF;

# silence most error messages
IGNORE_THIS = "#*";
@mismatch { in $IGNORE_THIS; }

ExtraInput = Ignore;

report {
   in "%(\$1:temperature.VAL)f"
   "\t"
   "%(\$1:humidity.VAL)f"
   "\t"
   "%(\$1:T:DHT11.VAL)f"
   "\t"
   "%(\$1:T:HI.VAL)f"
   "\t"
   "%(\$1:distance.VAL)f"
   "\t"
   "%(\$1:delta_t:us.VAL)d";
}
-----------% snip here %-----------

database
-----------% snip here %-----------
# received on USB port:
# NTC RH T HI dist delta_t
# 23.0 37 24 23.40 2480.1 5000668

record (stringin, "$(P)reader")
{
field (DTYP, "stream")
field (INP, "@protocol report(ioc:mega) $(PORT)")
field (SCAN, "I/O Intr")
#field (FLNK, "$(P)temperature")
}

record (ai, "$(P)temperature")
{
field (DESC, "thermistor, NTC")
field (PREC, "1")
field (EGU, "C")
#field (FLNK, "$(P)humidity")
}

record (ai, "$(P)humidity")
{
field (DESC, "relative humidity, DHT11")
field (PREC, "1")
field (EGU, "%")
#field (FLNK, "$(P)T:DHT11")
}

record (ai, "$(P)T:DHT11")
{
field (DESC, "temperature, DHT11")
field (PREC, "1")
field (EGU, "C")
#field (FLNK, "$(P)T:HI")
}

record (ai, "$(P)T:HI")
{
field (DESC, "heat index, DHT11")
field (PREC, "1")
field (EGU, "C")
#field (FLNK, "$(P)distance")
}

record (ai, "$(P)distance")
{
field (DESC, "distance, HC-SR04")
field (PREC, "1")
field (EGU, "mm")
#field (FLNK, "$(P)delta_t:us")
}

record (ai, "$(P)delta_t:us")
{
field (DESC, "reporting interval, us")
field (PREC, "6")
field (EGU, "us")
field (FLNK, "$(P)delta_t:calc")
}

record (calcout, "$(P)delta_t:calc")
{
field (DESC, "reporting interval, us")
field (PREC, "6")
field (EGU, "s")
field (INPA, "$(P)delta_t:us PP MS")
field (CALC, "A*1e-6")
field (OUT, "$(P)delta_t")
field (FLNK, "$(P)delta_t")
}

record (ai, "$(P)delta_t")
{
field (DESC, "reporting interval, us")
field (PREC, "6")
field (EGU, "s")
}

# process this record to reload all stream protocols
record (sub, "$(P)reload")
{
field (SNAM, "streamReload")
}
-----------% snip here %-----------


On 4/28/2016 11:20 AM, Gofron, Kazimierz wrote:
 > Hi Yuliang,
 > Redirection works only for up to 4 values read in (3 redirections).
At least that is what I am seeing when increasing number of redirections.
 >
 > Kaz
 >
 > -----Original Message-----
 > From: Zhang Yuliang [mailto:[email protected]]
 > Sent: Thursday, April 28, 2016 4:33 AM
 > To: Zhang Yuliang
 > Cc: Gofron, Kazimierz; [email protected]
 > Subject: Re: Re: stream Device I/O error
 >
 > Sorry for the mistake. The protocol file should as follows:
 > InTerminator =CR LF;
 > get_gains{
 >       out "CALIB:GAI?";
 >      # read and redirect 9 values
 >      in "%d,%(\$1:Gain:1-RB)s,%(\$1:Gain:2-RB)s,%(\$1:Gain:3-RB)s",
 >         "%(\$1:Gain:4-RB)s,%(\$1:Gain:5-RB)s,%(\$1:Gain:6-RB)s",
 >         "%(\$1:Gain:7-RB)s,%(\$1:Gain:8-RB)s,%(\$1:Gain:9-RB)s";
 > }
 >
 > Regards,
 > Yuliang
 >
 >> -----????-----
 >> ???: "Zhang Yuliang" <[email protected]>
 >> ????: 2016?4?28? ???
 >> ???: "Gofron, Kazimierz" <[email protected]>
 >> ??: "[email protected]" <[email protected]>
 >> ??: Re: stream Device I/O error
 >>
 >> Hi Kaz,
 >>
 >> You can use redirection to other records to parse multiple values
from one message. Here is an example:
 >>
 >> # Let this be the master record
 >> record (ai, "$(DEVICE):m1)
 >> {
 >>     field (DTYP, "stream")
 >>     field (SCAN, "1 second")
 >>     # pass $(DEVICE) to the protocol as parameter 1
 >>     field (INP, "@I404.protocol get_gains($(DEVICE)) $(PORT)") }
 >>
 >> record (stringin, $(DEVICE):Gain:1-RB) {
 >>     # this record is passive and use Soft Channel (both default) }
 >>
 >> # records Gain:2-RB...Gain:9-RB the same
 >>
 >> In the protocol file I404.protocol define get_gains:
 >>
 >> InTerminator =CR LF;
 >> get_gains{
 >>      out "CALIB:GAI?";
 >>     # read and redirect 9 values
 >>     in "%*d,%(\$1:Gain:1-RB)s,%(\$1:Gain:2-RB)s,%(\$1:Gain:3-RB)s",
 >>        "%(\$1:Gain:4-RB)s,%(\$1:Gain:5-RB)s,%(\$1:Gain:6-RB)s",
 >>        "%(\$1:Gain:7-RB)s,%(\$1:Gain:8-RB)s,%(\$1:Gain:9-RB)s";
 >> }
 >> HTH!
 >> Regards,
 >> Yuliang
 >>
 >>
 >>> -----????-----
 >>> ???: "Gofron, Kazimierz" <[email protected]>
 >>> ????: 2016?4?28? ???
 >>> ???: "[email protected]" <[email protected]>
 >>> ??:
 >>> ??: stream Device I/O error
 >>>
 >>> Hi,
 >>>
 >>> For  i404 device, the gains need to be read in. There are 9 values
in the response string of which 8 last values are gains:
 >>>
 >>> 15,9.4377e-01,9.3736e-01,9.3128e-01,9.4361e-01,1.0179e+00,1.0184e+00
 >>> ,1.0195e+00
 >>>
 >>> ------------------
 >>> For method C, discussed here:
 >>> http://epics.web.psi.ch/software/streamdevice/doc/tipsandtricks.html
 >>> only up to 4 PVs can be read with streamDevice, otherwise "Forgot
the leading '@' or confused INP with OUT" somewhat misleading message
appears.
 >>>
 >>> http://www.aps.anl.gov/epics/tech-talk/2015/msg00689.php
 >>>
 >>>   int items = sscanf(ioLink->value.instio.string, "%s%s%s%n%i%n",
 >>>          filename, protocol, busname, &n, addr, &n);
 >>>      if (items <= 0)
 >>>      {
 >>>          error("%s: Empty I/O link. "
 >>>              "Forgot the leading '@' or confused INP with OUT ?\n",
 >>>              name());
 >>>          return S_dev_badInitRet;
 >>>      }
 >>>
 >>> So this can not be done with method C .protocol file like this would
 >>> not work:
 >>> getKs {out "CALIB:GAI?"; in
 >>> "CALIB:GAI?\10\06%*d,%e,%(\$1\$2.VAL)e,%(\$1\$3.VAL)e,%(\$1\$4.VAL)e
 >>> ,%(\$1\$5.VAL)e,%(\$1\$6.VAL)e,%(\$1\$7.VAL)e,%(\$1\$8.VAL)e";
 >>> InTerminator = CR LF; } ====================
 >>>
 >>> -------------
 >>> Using  method B for reading multiple values, the protocol, and
database look as follows:
 >>>
 >>> getGc1 {out "CALIB:GAI?"; in
 >>> "CALIB:GAI?\10\06%*d,%e,%*e,%*e,%*e,%*e,%*e,%*e,%*e"; InTerminator =
 >>> CR LF; }
 >>> getGc2 {in "CALIB:GAI?\10\06%*d,%*e,%e,%*e,%*e,%*e,%*e,%*e,%*e";
 >>> InTerminator = CR LF; }
 >>> getGc3 {in "CALIB:GAI?\10\06%*d,%*e,%*e,%e,%*e,%*e,%*e,%*e,%*e";
 >>> InTerminator = CR LF; }
 >>> getGc4 {in "CALIB:GAI?\10\06%*d,%*e,%*e,%*e,%e,%*e,%*e,%*e,%*e";
 >>> InTerminator = CR LF; }
 >>> getGc5 {in "CALIB:GAI?\10\06%*d,%*e,%*e,%*e,%*e,%e,%*e,%*e,%*e";
 >>> InTerminator = CR LF; }
 >>> getGc6 {in "CALIB:GAI?\10\06%*d,%*e,%*e,%*e,%*e,%*e,%e,%*e,%*e";
 >>> InTerminator = CR LF; }
 >>> getGc7 {in "CALIB:GAI?\10\06%*d,%*e,%*e,%*e,%*e,%*e,%*e,%e,%*e";
 >>> InTerminator = CR LF; }
 >>> getGc8 {in "CALIB:GAI?\10\06%*d,%*e,%*e,%*e,%*e,%*e,%*e,%*e,%e";
 >>> InTerminator = CR LF; } getGst {in
 >>> "CALIB:GAI?\10\06%d,%*e,%*e,%*e,%*e,%*e,%*e,%*e,%*e"; InTerminator =
 >>> CR LF; } #
 >>>
 >>> record(ai, "$(Sys)$(Dev)Gain:1-RB") {
 >>>    field(DESC, "COMPENSATION FACTOR A IN")
 >>>    field(DTYP, "stream")
 >>>    field(INP, "@I404.protocol getGc1 $(PORT) 0")
 >>>    field(PINI, "YES")
 >>>    field(SCAN, "Passive")
 >>> }
 >>>
 >>> record(ai, "$(Sys)$(Dev)Gain:2-RB") {
 >>>    field(DTYP, "stream")
 >>>    field(DESC, "COMPENSATION FACTOR B IN")
 >>>    field(INP, "@I404.protocol getGc2 $(PORT) 0")
 >>>    field(SCAN, "I/O Intr")
 >>> }
 >>>
 >>> record(ai, "$(Sys)$(Dev)Gain:3-RB") {
 >>>    field(DTYP, "stream")
 >>>    field(DESC, "COMPENSATION FACTOR C IN")
 >>>    field(INP, "@I404.protocol getGc3 $(PORT) 0")
 >>>    field(SCAN, "I/O Intr")
 >>> }
 >>> ....
 >>> record(ai, "$(Sys)$(Dev)Gain:8-RB") {
 >>>    field(DTYP, "stream")
 >>>    field(DESC, "COMPENSATION FACTOR 3300pF D IN")
 >>>    field(INP, "@I404.protocol getGc8 $(PORT) 0")
 >>>    field(SCAN, "I/O Intr")
 >>> }
 >>>
 >>> However, when IOC exits, a message shows:
 >>>
 >>> exit
 >>> 2016/04/27 21:31:06.523109 COM1 XF:10IDC-BI{i404:2}Gain:2-RB:
asynError in read: 10.10.2.64:4003 disconnected:
 >>> 2016/04/27 21:31:06.523155 COM1 XF:10IDC-BI{i404:2}Gain:2-RB: I/O
error after reading 0 bytes: ""
 >>> 2016/04/27 21:31:06.523191 COM1 XF:10IDC-BI{i404:2}Gain:2-RB:
 >>> Protocol aborted
 >>> 2016/04/27 21:31:06.523220 COM1 XF:10IDC-BI{i404:2}Gain:3-RB:
asynError in read: 10.10.2.64:4003 disconnected:
 >>> 2016/04/27 21:31:06.523236 COM1 XF:10IDC-BI{i404:2}Gain:3-RB: I/O
error after reading 0 bytes: ""
 >>> 2016/04/27 21:31:06.523252 COM1 XF:10IDC-BI{i404:2}Gain:3-RB:
 >>> Protocol aborted
 >>> 2016/04/27 21:31:06.523268 COM1 XF:10IDC-BI{i404:2}Gain:4-RB:
asynError in read: 10.10.2.64:4003 disconnected:
 >>> 2016/04/27 21:31:06.523293 COM1 XF:10IDC-BI{i404:2}Gain:4-RB: I/O
error after reading 0 bytes: ""
 >>> 2016/04/27 21:31:06.523308 COM1 XF:10IDC-BI{i404:2}Gain:4-RB:
 >>> Protocol aborted
 >>> 2016/04/27 21:31:06.523333 COM1 XF:10IDC-BI{i404:2}Gain:5-RB:
asynError in read: 10.10.2.64:4003 disconnected:
 >>> 2016/04/27 21:31:06.523349 COM1 XF:10IDC-BI{i404:2}Gain:5-RB: I/O
error after reading 0 bytes: ""
 >>> 2016/04/27 21:31:06.523364 COM1 XF:10IDC-BI{i404:2}Gain:5-RB:
 >>> Protocol aborted
 >>> 2016/04/27 21:31:06.523379 COM1 XF:10IDC-BI{i404:2}Gain:6-RB:
asynError in read: 10.10.2.64:4003 disconnected:
 >>> 2016/04/27 21:31:06.523395 COM1 XF:10IDC-BI{i404:2}Gain:6-RB: I/O
error after reading 0 bytes: ""
 >>> 2016/04/27 21:31:06.523410 COM1 XF:10IDC-BI{i404:2}Gain:6-RB:
 >>> Protocol aborted
 >>> 2016/04/27 21:31:06.523425 COM1 XF:10IDC-BI{i404:2}Gain:7-RB:
asynError in read: 10.10.2.64:4003 disconnected:
 >>> 2016/04/27 21:31:06.523441 COM1 XF:10IDC-BI{i404:2}Gain:7-RB: I/O
error after reading 0 bytes: ""
 >>> 2016/04/27 21:31:06.523455 COM1 XF:10IDC-BI{i404:2}Gain:7-RB:
 >>> Protocol aborted
 >>> 2016/04/27 21:31:06.523471 COM1 XF:10IDC-BI{i404:2}Gain:8-RB:
asynError in read: 10.10.2.64:4003 disconnected:
 >>> 2016/04/27 21:31:06.523487 COM1 XF:10IDC-BI{i404:2}Gain:8-RB: I/O
error after reading 0 bytes: ""
 >>> 2016/04/27 21:31:06.523501 COM1 XF:10IDC-BI{i404:2}Gain:8-RB:
 >>> Protocol aborted
 >>> 2016/04/27 21:31:06.523518 COM1 XF:10IDC-BI{i404:2}Gain:Sts-RB:
asynError in read: 10.10.2.64:4003 disconnected:
 >>> 2016/04/27 21:31:06.523533 COM1 XF:10IDC-BI{i404:2}Gain:Sts-RB: I/O
error after reading 0 bytes: ""
 >>> 2016/04/27 21:31:06.523548 COM1 XF:10IDC-BI{i404:2}Gain:Sts-RB:
 >>> Protocol aborted
 >>>
 >>> Not sure if anyone else sees same behavior?
 >>>
 >>> Kaz
 >>>
 >>>
 >>>
 >>>
 >>
 >>
 >
 >


References:
stream Device I/O error Gofron, Kazimierz
Re: stream Device I/O error Zhang Yuliang
Re: Re: stream Device I/O error Zhang Yuliang
RE: Re: stream Device I/O error Gofron, Kazimierz
Re: stream Device I/O error Pete Jemian

Navigate by Date:
Prev: Re: stream Device I/O error Dirk Zimoch
Next: RE: Frame grabber for linux box Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: stream Device I/O error Pete Jemian
Next: Re: stream Device I/O error Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 15 Jul 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·