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 | 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 |
<== Date ==> | <== Thread ==> |
---|
Subject: | 回复: Reading multiple parameters from an incoming message. |
From: | "Li, Ji via Tech-talk" <tech-talk at aps.anl.gov> |
To: | Mark Rivers <rivers at cars.uchicago.edu> |
Cc: | "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov> |
Date: | Wed, 30 Dec 2020 18:12:56 +0000 |
Hi Mark,
I included PollPeriod in my protocol file. Currently these PVs (FORCE, STATUS) look fine without alarms. But I still couldn't get RateA out of the incoming message after I had issued a "status" message.
=================
epics> 2020/12/30 13:07:42.654 /dev/ttyUSB0 write 8
status\r\n
2020/12/30 13:07:42.681 /dev/ttyUSB0 read 48
50000000000 0 0 w...I.\n83333333330 0 0 i...I.\n::
=================
XF:28ID2-ES:1{Pump:1}ASYN.ERRS is showing "Overflow nread 40" with MAJOR(READ_ALARM).
XF:28ID2-ES:1{Pump:1}ASYN.TINP is showing "50000000000 0 0 w...I.\n83333333330 0 0" with MINOR(READ_ALARM).
XF:28ID2-ES:1{Pump:1-Ax:A}:RATE:RBV is shown INVALID(UDF_ALARM).
Does that mean the last 8 bytes of the message got lost which caused streamdevice failed to read correctly?
Best,
-Ji Li
发件人: Mark Rivers <rivers at cars.uchicago.edu>
发送时间: 2020年12月30日 12:22 收件人: Li, Ji <liji at bnl.gov> 抄送: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov> 主题: RE: Reading multiple parameters from an incoming message. Hi Ji Li,
Ø The last two characters are the status of the two axes. Each of them can be anyone of the six characters (":", ">", "<", "*", "T", "?").
I understand. I just looked at the protocol file I wrote for the Harvard PHD2000 pump. It is in the synApps “ip” module. It looks like the command/reply syntax is very similar to your pump.
That protocol file starts like this:
OutTerminator = "\r"; ExtraInput = Ignore; ReplyTimeout = 3000; PollPeriod = 500;
getString { out "\$1"; in "\n%[ A-Z]\r\n%*[><:/*^]"; }
setString { out "\$1 %s"; in "\n%*[><:/*^]"; }
Note that I did not set an input terminator, but I did tell it what possible reply characters to expect for each command. I set the ReplyTimeout to be 3000 ms, but the PollPeriod to 500 ms. I believe this keeps StreamDevice from timing out, because it will poll before it times out.
You should try this approach.
Mark
From: Li, Ji <liji at bnl.gov>
Hi Mark,
The last two characters are the status of the two axes. Each of them can be anyone of the six characters (":", ">", "<", "*", "T", "?").
=================== : The pump is idle > The pump is infusing < The pump is withdrawing * The pump stalled T The target was reached ? The pump status is unknown ===================
"::" means both axes are idle. If axis A is idle and axis B is infusing, they become ":>". These two characters are parsed by macro:
ax_status = "%(\$1{\$2-Ax:A}:STATUS){:|>|<|*|T|?}%(\$1{\$2-Ax:B}:STATUS){:|>|<|*|T|?}";
Best,
-Ji Li
发件人:
Mark Rivers <rivers at cars.uchicago.edu>
Hi Ji Li,
It appears to me from your output that the device always terminates its reply with the characters “::”. Try setting the input terminator to “::”.
Mark
From: Li, Ji <liji at bnl.gov>
Hi Mark,
I had the asyn traceError, traceODriver, traceIOEscape and streamError on. I tried both cases with InTerminator defined and undefined and set the force of axis A.
The PVs related to force of axis A:
They are defined as:
======================================== record(ao, "$(P){$(Q)-Ax:$(AX)}:$(CMD)") { field(DESC, "Axis $(AX) $(CMD)") field(DTYP, "stream") field(FLNK, "$(P){$(Q)-Ax:$(AX)}:$(CMD):RBV") field(OUT, "@pump33dds.proto setIntAx($(P), $(Q), $(AX), $(CMD)) $(PORT)") field(PREC, "0") field(EGU, "$(EGU)") field(DRVH, "100") field(DRVL, "0") # field(SDIS, "$(P){$(Q)-Ax:$(AX)}:DISABLE") }
record(ai, "$(P){$(Q)-Ax:$(AX)}:$(CMD):RBV") { field(DESC, "Axis $(AX) $(CMD) readback") field(DTYP, "stream") field(INP, "@pump33dds.proto getIntEGUAx($(P), $(Q), $(AX), $(CMD), $(EGU)) $(PORT)") field(PREC, "0") field(EGU, "$(EGU)") # field(SDIS, "$(P){$(Q)-Ax:$(AX)}:DISABLE") }
record(mbbi, "$(P){$(Q)-Ax:$(AX)}:$(CMD):RBV:EGU") { field(ZRVL, "0") field(ZRST, "$(EGU)") field(SDIS, "$(P){$(Q)-Ax:$(AX)}:DISABLE") } ========================================
substituted as:
======================================== file "$(HARVARD)/db/pump33dds-ax-int.db" { pattern { AX , CMD , EGU } { "A" , "FORCE" , "%" } { "B" , "FORCE" , "%" } { "AB" , "FORCE" , "%" } } ======================================== Protocols used:
======================================== setIntAx { out "\$4 \$3 %d"; in $ax_status; in "%*s"; }
out "\$4 \$3"; in "\$3: %d%(\$1{\$2-Ax:\$3}:\$4:RBV:EGU){%}\n" $ax_status; @mismatch { in "\$3: %d%(\$1{\$2-Ax:A}:\$4:RBV:EGU){%|mm}\n\$3: %d%(\$1{\$2-Ax:B}:\$4:RBV:EGU){%|mm}\n" $ax_status; } } ======================================== The PVs for the status of two axes:
========================================
defined as:
======================================== record(mbbi, "$(P){$(Q)-Ax:$(AX)}:STATUS") { field(DESC, "Pump Status") field(ZRVL, "0") field(ZRST, "Idle") field(ONVL, "1") field(ONST, "Infusing") field(TWVL, "2") field(TWST, "Withdrawing") field(THVL, "3") field(THST, "Stalled") field(FRVL, "4") field(FRST, "Target Reached") field(FVVL, "5") field(FVST, "Unknown") } ========================================
With InTerminator on.
###################################################### Since the manual doesn't give what terminating character in the incoming message, I tried
Both of them procuded the same result.
======================================== 2020/12/30 10:34:42.411 /dev/ttyUSB0 write 12 FORCE A 10\r\n 2020/12/30 10:34:42.432 /dev/ttyUSB0 read 2 :: 2020/12/30 10:34:42.636009 L0 XF:28ID2-ES:1{Pump:1-Ax:A}:FORCE: Timeout after reading 2 bytes "::" 2020/12/30 10:34:42.636 /dev/ttyUSB0 write 9 FORCE A\r\n 2020/12/30 10:34:42.656 /dev/ttyUSB0 read 9 A: 10%\n:: 2020/12/30 10:34:42.856032 L0 XF:28ID2-ES:1{Pump:1-Ax:A}:FORCE:RBV: Timeout after reading 9 bytes "A: 10%<0a>::" ========================================
The force of axis A was changed to 10 as checked on the pump. Both XF:28ID2-ES:1{Pump:1-Ax:A}:FORCE and XF:28ID2-ES:1{Pump:1-Ax:A}:FORCE:RBV have value 10, and both are showing READ_ALARM. XF:28ID2-ES:1{Pump:1-Ax:A}:STATUS and XF:28ID2-ES:1{Pump:1-Ax:B}:STATUS are not updated. ######################################################
With InTerminator off.
######################################################
Write 10 to the PV:
======================================== epics> 2020/12/30 10:26:21.765 /dev/ttyUSB0 write 12 FORCE A 10\r\n 2020/12/30 10:26:21.791 /dev/ttyUSB0 read 2 :: 2020/12/30 10:26:21.993 /dev/ttyUSB0 write 9 FORCE A\r\n 2020/12/30 10:26:22.015 /dev/ttyUSB0 read 9 A: 10%\n:: ========================================
The force of axis A was changed to 10 as checked on the pump. Both XF:28ID2-ES:1{Pump:1-Ax:A}:FORCE and XF:28ID2-ES:1{Pump:1-Ax:A}:FORCE:RBV have value 10. No alarms shown. XF:28ID2-ES:1{Pump:1-Ax:A}:STATUS and XF:28ID2-ES:1{Pump:1-Ax:B}:STATUS are in normal state. No alarms shown.
Best,
-Ji Li
发件人:
Mark Rivers <rivers at cars.uchicago.edu>
Hi Ji Li, |