The waveform record support implements put_array_info as follows (note
how it handles nord):
static long put_array_info(paddr,nNew)
struct dbAddr *paddr;
long nNew;
{
struct waveformRecord *pwf=(struct waveformRecord
*)paddr->precord;
pwf->nord = nNew;
if(pwf->nord > pwf->nelm) pwf->nord = pwf->nelm;
return(0);
}
If you call dbPut instead of writing directly to the waveform record
dbPut will call put_array_info.
If you really want to write directly to the array in a record do the
following:
1) MAKE sure the link is a DB_LINK.
2) Get the value of DBADDR *pdbAddr
3) Check the following:
pdbAddr->dbr_field_type is the type you expect, e.g. DBF_DOUBLE
long max_elements = pdbAddr->no_elements;
struct rset *prset = pdbAddr->precord->rset;
if(!prset->get_array_info || !prset->put_array_info) ERROR
4) Write the array as follows:
long n, no_elements,offset
status = prset->get_array_info(pdbAddr,&no_elements,&offset)
if(!status) error
Make sure n< max_elements
double *pto = pdbAddr->pfield;
for(i=0; i<n; i++) *pto++ = *pfrom++;
status = prset->put_array_info(pdbAddr,n);
if(!status)error
This will work as long as the array is not a circular buffer. If it does
then life gets more complicated.
Kim, Kukhee wrote:
Dear ALL;
I am playing with waveform record on the R3.14.4. A subroutine record puts values to a waveform record directly, but whole reading values of the waveform were always â0â when I tried âcagetâ. So, I checked out the NORD field in the waveform record. It was always â0â. I guess, it is supposed to have same value with NELM field.
So, I made small cheating as the following. It is a part of subroutine record to set NORD field to same value with NELM field.
ãããã
DBADDR *pdbAddrLinkA = dbGetPdbAddrFromLink(&prec->inpa);
ããããDBADDR *pdbAddrLinkB = dbGetPdbAddrFromLink(&prec->inpb);
long no_elements = pdbAddrLinkA->no_elements;
ããããwaveformRecord *precord;
ããããprecord = (waveformRecord*)pdbAddrLinkA->precord;
ããããprecord->nord=no_elements;
ããããprecord = (waveformRecord*)pdbAddrLinkB->precord;
ããããprecord->nord=no_elements;
And then, I can read waveform normally.
I would like to know, what cause this problem?
Thank you.
-------------------------------
Kukhee Kim
Instrument & Control, KSTAR
Korea Basic Science Institute
52 Yeoeun-dong, Yusung-gu, Daejeon 305-333
Korea
Email: [email protected]
Tel: +82 42 870 1616 Fax: +82 42 870 1609 Cell: +82 17 513 484
ã
- References:
- Problem of NORD field in waveform (R3.14.4) Kim, Kukhee
- Navigate by Date:
- Prev:
Problem of NORD field in waveform (R3.14.4) Kim, Kukhee
- Next:
Lx ioc-shell chrashes Frank Hoeft
- 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:
Problem of NORD field in waveform (R3.14.4) Kim, Kukhee
- Next:
Lx ioc-shell chrashes Frank Hoeft
- 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
|