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 <2025> | 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 <2025> |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: Streams format converters question ( how to convert 10100 to 1.0E+00, 10011 to 1.0E-11) |
From: | Zimoch Dirk via Tech-talk <tech-talk at aps.anl.gov> |
To: | Peter Sx <xinss0017 at gmail.com>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov> |
Cc: | "sxin at bnl.gov" <sxin at bnl.gov> |
Date: | Thu, 27 Mar 2025 15:24:31 +0000 |
Hi Susheng Nice format. People always invent something new. I would try to pre-process the format with regular _expression_ substitution (%#/regex/subs/) so that it fits the normal %f format. We need to keep one digit, then insert a period dot, then take the next digit, insert an “e”, convert a 0 to a – and a 1 to a + and
then copy the next two digits. The sign magic is the nasty part. This may do the trick: (I have not tested it yet) in "%#/([0-9])([0-9])0([0-9][0-9])/\1.\2e-\3/%#/([0-9])([0-9])1([0-9][0-9])/\1.\2e+\3/%f"; Output too? From: Tech-talk <tech-talk-bounces at aps.anl.gov>
On Behalf Of Peter Sx via Tech-talk Hi EPICS Specialists: I've run into a problem converting data to exponential readings. I have a device that outputs messages and data in the same channel. I have separated the readings from messages with data by using the following records and protocol.
I am wondering whether I can add some arguments in the protocol and convert the data through calcout, but I am new to Streams and can't figure out the details.
Data format: ppsee (p.p * 10see):
Symbols Description
pp Mantissa of the reading (1.0 to 9.9)
s Sign of the exponent (0 = negative, 1 = positive)
ee Exponent (00 to 11)
record(ai, "$(Sys)$(Dev)Ch1_Reading") get_Ch1_reading {
Current channel readback examples:
[sxin@eic-905-pc01 ~]$ caget 905-HC1-Televac:Ch5_Reading device panel reading 1.0E-11
Thank you!
Susheng
|