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: sequencer and c-code
From: Benjamin Franksen <[email protected]>
To: <[email protected]>
Date: Sun, 14 Apr 2013 05:20:51 +0200
Am Samstag, 13. April 2013, 19:38:29 schrieb Pierrick Hanlet:
> Hi all,
> I'm developing a state machine for a string of superconducting magnets.
> I'm reading from an
> external configuration database (cdb) to pick up fields (alarm, adel,
> scan, etc) for each of my
> PVs as well as the state transition parameters. At present, on each
> entry block of each state, I
> call my c-function to read from the cdb and fill a global struct with
> the field values for each PV.
> Since the list may change in each state, I have arrays for each field.
> For example:
>
> PV.name[ndx] and PV.hihi[ndx] which I fill for each state and these are
> global in a header file.
>
> I also have, in another header file, all of my assignments:
> e.g.  SS2cx01[4] is assigned to MICE-SS2-CX-01:RDGK.HIHI in a header file.
>
> What I want to do is to have another c-function, SetPVFields(),  which
> invokes seq_pvPut().  Since I
> call SetPVFields(ssId,State,ndx) in a loop over ndx in my .st file, I
> want to be able to relate PV.name[ndx]
> with pvIndex() inside of my SetPVFields() function.  Is there a way to
> do this?  One thought that I had is
> to create the relationship array between pvIndex and the PV name in the
> global entry block and use
> it inside of SetPVFields(), but I'm not sure of the details and this
> does not strike me as very elegant.

Hi Pierrick

I may be wrong but I have the impression that SNL is not the right tool for
what you want to do. You should seriously consider writing your program either
in C (using the CA client API directly) or in a scripting language such as
Python or Perl, for which CA wrappers are available. I know for sure that Perl
has a very decent database access library (called DBI) but I bet Python has
something similar, so querying your cdb from Perl should be no problem. And a
Perl CA wrapper even comes with EPICS base.

That leaves the question how to realize the actual state-machine part of your
application in C or Perl or Python. I have only a few data points here. I once
wrote a small prototype in Haskell that captures the essence of what the
sequencer offers (minus the CA part) in a library; I think I spent a day or
two on that. One of my co-workers has written something similar in Tcl as the
basis for a "master" machine control program.

Cheers
--
Ben Franksen
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

________________________________

Helmholtz-Zentrum Berlin für Materialien und Energie GmbH

Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.

Aufsichtsrat: Vorsitzender Prof. Dr. Dr. h.c. mult. Joachim Treusch, stv. Vorsitzende Dr. Beatrix Vierkorn-Rudolph
Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking

Sitz Berlin, AG Charlottenburg, 89 HRB 5583

Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin

http://www.helmholtz-berlin.de


References:
sequencer and c-code Pierrick Hanlet

Navigate by Date:
Prev: sequencer and c-code Pierrick Hanlet
Next: RE: devIocStats Allison, Stephanie
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: sequencer and c-code Pierrick Hanlet
Next: Re: sequencer and c-code Wesley Moore
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 ·