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
>
>
>
>
- Replies:
- Re: Re: stream Device I/O error Zhang Yuliang
- References:
- stream Device I/O error Gofron, Kazimierz
- Navigate by Date:
- Prev:
Question about relational database setup ? lzfneu
- Next:
Re: Re: stream Device I/O error Zhang Yuliang
- 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
2023
2024
- Navigate by Thread:
- Prev:
stream Device I/O error Gofron, Kazimierz
- Next:
Re: Re: stream Device I/O error Zhang Yuliang
- 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
2023
2024
|