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 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
<== Date ==> <== Thread ==>

Subject: Re: Streamdevice & variable length data
From: Dirk Zimoch <dirk.zimoch@psi.ch>
To: <tech-talk@aps.anl.gov>
Date: Mon, 20 Mar 2017 16:13:57 +0100
Hi Martin,

On 17.03.2017 14:31, Konrad, Martin wrote:
Hi,
I have a device that comes with a command that reads an event log like so:

-> GET ERRORS
<- BEGIN ERRORS
<- 2017-03-16 17:37:52 Cooling Water Flow Error VALUE 1.9
<- 2017-03-16 17:38:13 Sensor 1 Over-Temp Error VALUE 36.7
<- 2017-03-16 17:38:24 Sensor 2 Over-Temp Error VALUE 40.2
<- END ERRORS

Note that the number of lines between the begin and end markers can
vary. There is another command for clearing the event log.

Is there any chance I can read this into either
a) a waveform of strings or
b) one huge waveform of chars?

I'm also open to suggestions on how to improve the protocol. Should I
try to convince the vendor to replace the error log by a command for
reading out the status of all error flags? I could then easily push them
into individual PVs. That would make archiving etc. easier.

Thanks,

Martin


In principle you can put the lines into a STRING waveform, using "END ERROR" as the input terminator and newline as the array separator. But unfortunately the lines are too long for EPICS strings.

If you really want to keep it as a list (i.e. an array) you can try to pre-process the input with regular expression substitution (something added recently to StreamDevice) in order to make the line shorter.

Example:
record (waveform, "ERRORS")
{
    field (FTVL, "STRING")
    field (NELM, "100")
    field (DTYP, "stream")
    field (INP,  "@XXX.proto getErrors terminal")
}

getErrors {
inTerminator="END ERRORS\n";
Separator="\n";
out "GET ERRORS\n";
in "BEGIN ERRORS\n%#/(?m)[0-9-: ]*(.*) Error VALUE (.*)/\1:\2/%[^\n]";
}

Gives you the following array:
"Cooling Water Flow:1.9"
"Sensor 1 Over-Temp:36.7"
"Sensor 2 Over-Temp:40.2"


Another thing you can do is to sort the messages into different records using SCAN="I/O Intr" and filter on keywords like "Cooling Water Flow", "Sensor 1 Over-Temp", etc. In this case you would have 3 records updated for the 3 errors.

Dirk



References:
Streamdevice & variable length data Konrad, Martin

Navigate by Date:
Prev: RE: AreaDetector / ADURL queries Mark Rivers
Next: RE: AreaDetector / ADURL queries Heesterman, Peter J
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
Navigate by Thread:
Prev: Streamdevice & variable length data Konrad, Martin
Next: AreaDetector / ADURL queries Heesterman, Peter J
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
ANJ, 20 Mar 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·