EPICS Controls 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  2015  2016  <20172018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: waveform arrays within SNL
From: "Southern, Tim" <[email protected]>
To: [email protected]
Date: Tue, 20 Jun 2017 16:25:37 -0400
You need to define the SNL variable: locations as an integer array.

#define ARRAY_SIZE 4 

int locations[ARRAY_SIZE];
assign locations to "{tel}{instr}:{mech}:locations";
monitor locations;  // This tells the SNL to keep track of changes to assigned PV

There is more info on the EPICS Sequencer online documentation
http://www-csr.bessy.de/control/SoftDist/sequencer/Tutorial.html#arrays-of-variables


Here is an example code that writes values of a list of PVs to a waveform:

#define DTL_SET 10

double dtl_set[DTL_SET];
assign dtl_set to
{
    "DTL_Diag:BLM130{Loss}",
    "DTL_Diag:BLM160{Loss}",
    "DTL_Diag:BLM224{Loss}",
    "DTL_Diag:BLM248{Loss}",
    "DTL_Diag:BLM317{Loss}",
    "DTL_Diag:BLM334{Loss}",
    "DTL_Diag:BLM414{Loss}",
    "DTL_Diag:BLM428{Loss}",
    "DTL_Diag:BLM512{Loss}",
    "DTL_Diag:BLM524{Loss}"
};
monitor dtl_set;

double dtl_val[DTL_SET];
assign dtl_val to "dtl_set:wf";

double charge;
assign charge to "BCM25:Q";
monitor charge;

ss lossWFgen
{
   state update
           {
          when(delay(2.0))
          {
          // Caculate loss in rad/coulomb and write to waveform array
          for (i=0; i<DTL_SET; ++i)
                {
                pvGet(dtl_set[i]);
                if (dtl_set[i] < 0){ dtl_set[i] = 0;}
                dtl_val[i] = dtl_set[i] / charge;
                }

          pvPut(dtl_val);
             
          }state update
       
        }

}



Tim


On 6/20/17 3:22 PM, Al Honey wrote:

Hi

I cannot find an explicit example in regards to accessing the element values in a waveform array from within an SNL sequencer.

Does anybody have experience doing so?

 

Can’t seem to do this:

 

int locations;

assign locations to "{tel}{instr}:{mech}:locations";  // where locations is a waveform record with an integer array.

int locs[4] = {0,300,600,900};

 

        pvGet( locations );

        locs = locations;               // is the declaration for locations (above) correct?

 

error: incompatible types when assigning to type int[4] from type int *

         locs = locations;

 

This fails too:

         locs[0] = locations[0];

 

I guess I’m ignorant in regards to accessing the array values in the record.

 

Also, is it necessary to escape to C in order to update the elements in a waveform string record?

 

Thanks for any advice you have

Al

 



References:
waveform arrays within SNL Al Honey

Navigate by Date:
Prev: RE: waveform arrays within SNL Mark Rivers
Next: Re: EPICS build system DESTDIR support J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: waveform arrays within SNL Al Honey
Next: Re: EPICS build system DESTDIR support J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
ANJ, 21 Dec 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·