EPICS Home

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  2018  <20192020  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  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Stream device - parsing array of pairs of floats
From: Dirk Zimoch via Tech-talk <[email protected]>
To: <[email protected]>
Date: Fri, 15 Feb 2019 11:09:14 +0100
The | in the regexp needs to be escaped:

in "%#/[.0-9]+\|//%f";

in "%#/\|[.0-9E+-]+//%f";

Without the escape it means "a number or an empty string". The empty string matches always and is replaced by an empty string, not changing the string at all and advancing by 0 bytes. Looking for the next match starts the endless loop.

Need to fix that.

But otherwise it works. I got the two arrays.

If you want to do further processing on the arrays, be aware that the "I/O Intr" record gets the value before the active one. So by the time the active record processes its FLNK or triggers any monitors, the "I/O Intr" record has already the corresponding value.

Dirk

On 15.02.19 10:58, Dirk Zimoch via Tech-talk wrote:
I tested it and it hung up my ioc. Seems I have a bug in regsub.

On 15.02.19 09:55, Dirk Zimoch via Tech-talk wrote:
Unfortunately StreamDevice cannot easily parse such interlaced arrays at the moment.

Maybe the following works:

For the values:
Separator=",";
in "%#/[.0-9]+|//%f";

For the Timestamps:
Separator=",";
in "%#/|[.0-9E+-]+//%f";

%#/regexp/subs/ is the regular expression pre-processor, here removing the "other" array from the input. Performance may be not so good and scales like O(n²) with the array length because of all the copying involved.

One of the records should be active having the 'out' command that produces the reply. The other should be "I/O Intr" reading the time stamps passively.

Not tested. Hope it works.
Dirk


On 14.02.19 18:35, Joao Afonso via Tech-talk wrote:
Hello,

I have a string returned by a device, representing an array where each element is a pair <time, value>:

- each pair is separated by "|": <timestamp>|<value>
- each element of the array separated by ","
- all values are floats
- the timestamp increment may not be linear (that is why it needs to be recorded)

Example
0.1000|0.1230000E+00,0.2000|0.4560000E+00,0.3000|0.7890000E+00, [...]

Is it possible to parse this using stream device (into two waveform records)?
Or do I have to use something more powerful such as asynDriver?
I have seen several examples, but only with using simple type elements, not like this.

As a followup, is it possible to do the inverse, merging two waveform records into a string?

Thank you in advance,
Joao
CERN TE-EPC-CCS


References:
Stream device - parsing array of pairs of floats Joao Afonso via Tech-talk
Re: Stream device - parsing array of pairs of floats Dirk Zimoch via Tech-talk
Re: Stream device - parsing array of pairs of floats Dirk Zimoch via Tech-talk

Navigate by Date:
Prev: Re: Stream device - parsing array of pairs of floats Dirk Zimoch via Tech-talk
Next: archiverAppliance access to Heinz Junkes 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  2018  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Stream device - parsing array of pairs of floats Dirk Zimoch via Tech-talk
Next: Re: Stream device - parsing array of pairs of floats Johnson, Andrew N. 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  2018  <20192020  2021  2022  2023  2024