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  <20132014  2015  2016  2017  2018  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  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: SEQ with dynamic assignment of PV in array variable
From: Mark Rivers <[email protected]>
To: Emmanuel Mayssat <[email protected]>, Al Honey <[email protected]>, "[email protected]" <[email protected]>
Date: Mon, 3 Jun 2013 21:33:35 +0000
Hi Emmanuel,

I am doing basically what you are doing in my SNL programs, and it is working fine.  Here is an example with some unrelated lines removed.

***************************************************************************
/* Maximum number of detectors supported */
#define MAX_SIGNALS 32

int i;
int n;
int numSignals;
char temp[100];

char *prefix;
char *record;
char *field;

int   ReadArray[MAX_SIGNALS];
assign  ReadArray to
          {"","","","","","","","","","","","","","","","",
           "","","","","","","","","","","","","","","",""};
int     ReadArrays; assign ReadArrays to "{P}DoReadAll";
monitor ReadArrays; evflag ReadArraysMon; sync ReadArrays ReadArraysMon;

int     SNL_Connected;  assign SNL_Connected      to "{P}SNL_Connected";

int Acquiring; assign Acquiring to "{P}Acquiring";

ss mca_control {
  state init {
    when() {
      prefix = macValueGet("P");
      record = macValueGet("R");
      field = macValueGet("FIELD");
      numSignals = atoi(macValueGet("NUM_SIGNALS"));
      if ((numSignals <= 0) || (numSignals > MAX_SIGNALS)) {
        printf ("NUM_SIGNALS is illegal.\n");
        numSignals = 0;
      }
      for (i=0; i<numSignals; i++) {
        n = i+1;
        sprintf(temp, "%s%s%d.%s", prefix, record, n, field);
        pvAssign(ReadArray[i], temp);
       }
    } state waitConnected
  }

  state waitConnected {
    when (pvAssignCount () == pvConnectCount ()) {
      printf ("SIS: All channels connected.\n");
      SNL_Connected = 1;
      pvPut(SNL_Connected);
    } state monitor_changes
  }
***************************************************************************

Cheers,
Mark

________________________________
From: [email protected] [[email protected]] on behalf of Emmanuel Mayssat [[email protected]]
Sent: Monday, June 03, 2013 2:38 PM
To: Al Honey; [email protected]
Subject: RE: SEQ with dynamic assignment of PV in array variable

My solution compiled, didn't segment fault, but also does not work !!!

Thank you Al for your suggestion.
I assume you are passing tel, sys, and d0/1/2/3 as parameters to your seq program.
In my case, I would like to use a static array (~parameters are hard-coded in program)
as I have 'too' many of them (~ 50 parameters)

Now I expect around 20 arrays, each with 50 assign statements
That's why I am looking at a for loop with pvAssign
So far pvAssign doesn't work on my side..

Anyone else?

________________________________
From: [email protected]
To: [email protected]
Subject: RE: SEQ with dynamic assignment of PV in array variable
Date: Mon, 3 Jun 2013 18:30:03 +0000


Hi Emmanuel



We do the following at Keck:



float openLoop[4];

assign openLoop[0] to "{tel}{sys}{d0}openLoop";

assign openLoop[1] to "{tel}{sys}{d1}openLoop";

assign openLoop[2] to "{tel}{sys}{d2}openLoop";

assign openLoop[3] to "{tel}{sys}{d3}openLoop";

monitor openLoop;



Al





From: [email protected] [mailto:[email protected]] On Behalf Of Emmanuel Mayssat
Sent: Monday, June 03, 2013 7:29 AM
To: [email protected]
Subject: SEQ with dynamic assignment of PV in array variable



Hello,



I am working on a seq program.

For that program, I am interacting with magnet power supplies.

The interfaces to the power supplies are all the same (about 10 PV each).



For each interface PV, I would like do to something like this...



#define NB_OF_SUPPLIES  50

short enable[NB_OF_SUPPLIES];

assign enable[0] to "I:S001:PS:EnableBO";

assign enable[1] to "I:SO10:PS:EnableBO";

...

monitor enable;



but programmatically.



I looked at the docs and they are somewhat confusing.



Q: Is there a place to put the pvAssign statement?

Q: Should the array's cell be initialized/assigned to ""  during declaration?

Q: Can I monitor a not-yet configured PV array?

Q: How can I find out about the connection to each of the PVs?

etc.



If anyone has an example of using pvAssign on array variables (i.e. enable),  I would appreciate it.



Regards,

--

Emmanuel








Replies:
RE: SEQ with dynamic assignment of PV in array variable Emmanuel Mayssat
Re: SEQ with dynamic assignment of PV in array variable Benjamin Franksen
References:
SEQ with dynamic assignment of PV in array variable Emmanuel Mayssat
RE: SEQ with dynamic assignment of PV in array variable Emmanuel Mayssat

Navigate by Date:
Prev: Re: EPICS cross compile with buildroot problems Andrew Johnson
Next: RE: SEQ with dynamic assignment of PV in array variable Emmanuel Mayssat
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: SEQ with dynamic assignment of PV in array variable Emmanuel Mayssat
Next: RE: SEQ with dynamic assignment of PV in array variable Emmanuel Mayssat
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·