Argonne National Laboratory

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  <20152016  2017  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017 
<== Date ==> <== Thread ==>

Subject: calling the output of one record into another record
From: Ana Malagon <amalagon@uw.edu>
To: "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Wed, 14 Jan 2015 11:32:10 -0800
Hi,

Sorry, this is a newbie Epics question: I'm working on making an IOC for a fieldfox network analyzer (model KT-N9918A) and need to cut off the number of values returned in a 'read measurement' command based on the number of points in the measurement, but I'm not sure how to go about doing this.

I have one record to store the number of points in the measurement, and another record that reads in the measurement values - how would I go about incorporating the number of points in the 'read measurement' record?


Here is how I've defined the read measurement command:

 /* Param 18 -- Read S21 Format: (Re,Im) dB */

    {&DSET_WF, GPIBREAD, IB_Q_HIGH, ":CALC1:PAR1:DEF S21;:CALC1:PAR1:SEL;:CALC1\

:SEL:DATA:SDAT?", NULL, 0, 1E6, readWF, 0, 0, NULL, NULL, NULL}

and here is the query of the points:

    /* Param 21 - Get Points in Sweep */

    {&DSET_AI, GPIBREAD, IB_Q_HIGH, ":SENS1:SWE:POIN?", NULL, 0, 100, readData, 0, 0, N\

ULL, NULL, NULL},

where the conversion function readWF is defined as:

static int readWF(struct gpibDpvt *pdpvt,int P1, int P2, char**P3) {

  struct waveformRecord *pwf=(struct waveformRecord *)pdpvt->precord;

  asynUser *pasynUser = pdpvt->pasynUser;

  double* value = (double *)pwf->bptr;

  const char* cpymsg = pdpvt->msg;

  double data;

  int n;

  pwf->nord=0;

  while ((pwf->nord < pwf->nelm) && sscanf(cpymsg,"%lE,%n",&data,&n)==1) {

    if (P1==1) data/=1E6;

    if (P1==2 && (pwf->nord==0 || pwf->nord==1)) data/=1E6;

    memcpy(value+pwf->nord,&data,sizeof(double));

    pwf->nord++;

    cpymsg+=n;

       asynPrint(pasynUser,ASYN_TRACE_FLOW,"(NORD,VAL) : (%i,%E)\n",pwf->nord,data);   \

  }

  if (pwf->nord == 0) return -1;

  pwf->udf = 0;

  return 0;

}

the readData conversion function is:


static int readData(struct gpibDpvt *pdpvt,int P1, int P2, char**P3) {

  struct aiRecord *pai=(struct aiRecord *)pdpvt->precord;

printf("got: %s\n",pdpvt->msg);

  double meas =(double)atof(pdpvt->msg);

  pai->val = meas;

  pai->udf = 0;

  return 0;

}

and the database definition entry for the read measurement comand is below, where NELM was defined to be 2x the maximum number of points one can request in a measurement:

record(waveform, "$(P):S21")

{

    field(DESC, "S21 (Re,Im)")

    field(EGU,"dB")

    field(SCAN, "Passive")

    field(NELM, "20002")

    field(DTYP, "fieldfox")

    field(FTVL, "DOUBLE")

    field(INP,  "#L$(L) A$(A) @18")

    field(FLNK, "$(P):FREQ")

    field(DISV, "0")

    field(SDIS, "$(P):OPC.VAL PP")

}


The reason I need to cut off the values is because the current syntax in the read measurement command not only returns the measurement data but also the x-axis values, which I don't want.


Sorry again for the very basic question, and thanks!


Ana Malagon


Replies:
RE: calling the output of one record into another record Mark Rivers

Navigate by Date:
Prev: sequencer release 2.2.1 Benjamin Franksen
Next: RE: calling the output of one record into another record Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017 
Navigate by Thread:
Prev: Re: sequencer release 2.2.1 Paul Hamadyk
Next: RE: calling the output of one record into another record Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·