Hi Emmanuel,
> Is RVAL supposed to be an integer?
Yes.
> How can fix my current example?
I'm sure other people have a better solution but I use a subroutine record. The logic looks something like this (I snipped code that you don't care about so maybe it doesn't compile):
...
#include <cvtTable.h> /* for cvtRawToEngBpt */
...
long subBLMagField(struct subRecord *psub)
{
/*
* Inputs:
* A = Gap (mm)
* D = Breakpoint Table Index (index in menuConvert.dbd)
* Outputs:
* H = Value from the Breakpoint Table
* J = Previous Breakpoint Table Index
* DPVT = Pointer to Breakpoint Table
* L = Last Breakpoint
* VAL = Magnetic Field (T)
*/
short lbrk; /* Last breakpoint */
long lbrkStatus; /* Breakpoint conversion status */
if (psub->d != psub->j)
{
psub->j = psub->d;
psub->dpvt = 0;
}
lbrk = psub->l;
psub->h = psub->a;
lbrkStatus = cvtRawToEngBpt(&psub->h, (short)psub->d, 0,
&psub->dpvt, &lbrk);
/* If at a breakpoint table limit, OK to use the limit (status = 1) */
if ((lbrkStatus != 0) && (lbrkStatus != 1)) return -1;
psub->l = lbrk;
psub->val = psub->h;
return 0;
}
Hope this is helpful,
Stephanie Allison
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf
> Of Emmanuel Mayssat
> Sent: Friday, November 22, 2013 4:49 PM
> To: [email protected]
> Subject: Breakpoint tables: Raw value must be integer?!?
>
>
> I would like to replace a few of my existing CALC records (polynomial transformation)
> with simple breakpoint tables.
> Let's assume that my raw values are voltages between 0 and 5V, I could therefore build a
> transformation table as follow:
>
> breaktable(bptPosSlope) {
> raw=0.000000 slope=9.000000e+00 eng=-27.000000
> raw=1.000000 slope=1.800000e+01 eng=-18.000000
> raw=2.000000 slope=1.800000e+01 eng=0.000000
> raw=3.000000 slope=1.400000e+01 eng=18.000000
> raw=4.000000 slope=3.000000e+00 eng=32.000000
> raw=5.000000 slope=3.000000e+00 eng=35.000000
> }
>
> Although the table allows for double/float transformation, to my surprise, the RAW value
> stored in the AI record is an integer.
> Maybe is it because of my INP link...
>
> This record is supposed to be the raw value
> clsXdev:6175>dbpr RECORDS:BrkpntTable:Rdbck:RawAI
> ASG: DESC: Raw readback DISA: 0 DISP: 0
> DISV: 1 NAME: RECORDS:BrkpntTable:Rdbck:RawAI RVAL: 0
> SEVR: NO_ALARM STAT: NO_ALARM SVAL: 0 TPRO: 0
> VAL: 1.111
>
> Which is transformed in another ai record (which has its INP field pointing to the above
> record).
>
> clsXdev:6175>dbpr RECORDS:BrkpntTable:RdbckAI 3
> ACKS: NO_ALARM ACKT: YES ADEL: 0 ALST: -18
> AOFF: 0 ASG: ASLO: 1 BKPT: 00
> DESC: Readback DISA: 0 DISP: 0 DISS: NO_ALARM
> DISV: 1 DTYP: Raw Soft Channel EGU: mm
> EGUF: 0 EGUL: 0 EOFF: 0 ESLO: 1
> EVNT: 0 FLNK:CONSTANT 0 HHSV: NO_ALARM HIGH: 0
> HIHI: 0 HOPR: 0 HSV: NO_ALARM HYST: 0
> INIT: 0 INP:DB_LINK RECORDS:BrkpntTable:Rdbck:RawAI.VAL NPP NMS
> LALM: -18 LBRK: 0 LCNT: 0 LINR: bptPosSlope
> LLSV: NO_ALARM LOLO: 0 LOPR: 0 LOW: 0
> LSV: NO_ALARM MDEL: 0 MLST: -18
> NAME: RECORDS:BrkpntTable:RdbckAI NSEV: NO_ALARM NSTA:
> NO_ALARM
> ORAW: 1 PACT: 0 PHAS: 0 PINI: NO
> PREC: 3 PRIO: LOW PROC: 0 PUTF: 0
> ROFF: 0 RPRO: 0 RVAL: 1 SCAN: 1 second
> SDIS:CONSTANT SEVR: NO_ALARM SIML:CONSTANT SIMM: NO
> SIMS: NO_ALARM SIOL:CONSTANT SMOO: 0 STAT: NO_ALARM
> SVAL: 0 TIME: 2013-11-22 16:44:26.374133281 TPRO: 0
> TSE: 0 TSEL:CONSTANT UDF: 0 VAL: -18
>
>
> Now for some reason the RVAL of this last record is = to 1 (and not 1.1111)
> As a result, the VAL is not calculated correctly.
>
> Is RVAL supposed to be an integer?
> How can fix my current example?
>
> Thanks,
> --
> Emmanuel
- Replies:
- RE: Breakpoint tables: Raw value must be integer?!? Emmanuel Mayssat
- References:
- Breakpoint tables: Raw value must be integer?!? Emmanuel Mayssat
- Navigate by Date:
- Prev:
Breakpoint tables: Raw value must be integer?!? Emmanuel Mayssat
- Next:
Anyone using StreamDevice with local serial ports on Windows? Mark Rivers
- 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:
Breakpoint tables: Raw value must be integer?!? Emmanuel Mayssat
- Next:
RE: Breakpoint tables: Raw value must be integer?!? Emmanuel Mayssat
- 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
|