Experimental Physics and Industrial Control System
At 09:49 AM 6/11/2004 -0700, Allison, Stephanie wrote:
Here is a radical thought - it would be nice to have a new string field
(ie, .FMT) that specifies how to display the value as a string. Then I
could set up the format of our vacuums (ie, VALs that should always be
displayed using exponential notation) in the database instead of having to
override the default display format in each client. Also, some
save/restore tools won't restore the proper values of things like vacuum
limits unless you set a ridiculously large PREC.
Nice idea.
But someone can always come up with a standard situation where
a single format specifier for all fields is problematic.
How can we handle some fields differently from others?
For instance, using the "motor" record, the MRES field
has the distance (in EGU) that the motor takes with each
integer step pulse. Users always want the motor VAL and
RBV fields to be displayed in a %f format. BUT, MRES can
have significant figures which, by its very definition,
extend well past what a PREC field will show. If the PREC
field is used to format an archive of the MRES field with
a %f format specifier, such as with caGet and camonitor,
there will be a loss of precision due to truncation.
With the motor record, there is a work around for this,
store the SREV and UREV fields, which are used to compute
MRES. UREV can be represented with the standard format
and SREV is an integer. (MRES = UREV / SREV)
See this short example to illustrate this situation:
jemian,3$ camonitor iad:m58:c0:m1.{MRES,SREV,UREV}
iad:m58:c0:m1.MRES 06/11/04 12:59:58.405796463 0.00000
iad:m58:c0:m1.SREV 06/11/04 12:59:58.405796463 50800
iad:m58:c0:m1.UREV 06/11/04 12:59:58.405796463 0.13022
jemian,4$ caget iad:m58:c0:m1.MRES
iad:m58:c0:m1.MRES 2.56339e-06
jemian,5$ caget iad:m58:c0:m1.SREV
iad:m58:c0:m1.SREV 50800
jemian,6$ caget iad:m58:c0:m1.UREV
iad:m58:c0:m1.UREV 0.13022
jemian,7$ caget iad:m58:c0:m1.PREC
iad:m58:c0:m1.PREC 5
jemian,8$ caget iad:m58:c0:m1.VAL
iad:m58:c0:m1.VAL 10.7464
jemian,9$ caget iad:m58:c0:m1.RBV
iad:m58:c0:m1.RBV 10.7464
jemian,10$ echo iad:m58:c0:m1.{MRES,SREV,UREV,PREC,VAL,RBV}\\n | caGet
iad:m58:c0:m1.MRES 0.00000
iad:m58:c0:m1.SREV 50800
iad:m58:c0:m1.UREV 0.13022
iad:m58:c0:m1.PREC 5
iad:m58:c0:m1.VAL 10.74640
iad:m58:c0:m1.RBV 10.74640
*** caGet completed normally ***
Pete Jemian
- Replies:
- Re: PREC Andrew Johnson
- Navigate by Date:
- Prev:
Re: PREC Brian McAllister
- Next:
Re: Initializing a record VAL field with a constant Marty Kraimer
- 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:
Re: PREC Tim Mooney
- Next:
Re: PREC Andrew Johnson
- 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