Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
<== Date ==> <== Thread ==>

Subject: Re: Matlab interfaces
From: Till Straumann <strauman@slac.stanford.edu>
To: "Allison, Stephanie" <saa@slac.stanford.edu>
Cc: Korhonen Timo <Timo.Korhonen@psi.ch>, tech-talk@aps.anl.gov
Date: Mon, 03 Jul 2006 13:00:33 -0700
Allison, Stephanie wrote:

Hi Timo,



we at PSI have been looking at the Matlab-EPICS interfaces. There seems to exist two: labCA and mca.

...snip...


What are the advantages of one package vs. the other?



LabCA Advantages:
(1) Ability to set timeout on CA gets and puts (the old version of mca hardcodes 1 second, maybe newer versions allow for it to be tuned).
(2) Nice documentation.
(3) Multithreading available for 3.14 (don't know if mca allows for it).


(4) Easier to install than mca (my opinion).


Should also be fairly easy to port to other programs (matlab and scilab
are currently supported), i.e., doing an octave interface wouldn't be
very hard.

LabCA Disadvantages:
(1) Uses the EZCA package which some think (after looking at the code) is a challenge to maintain. Till has moved a copy of EZCA into labCA and keeps that one up-to-date (not the one distributed in EPICS extensions).
(2) In the past, people have mentioned that EZCA doesn't handle monitors properly, in particular, reconnecting on IOC restart. But I believe Till has fixed those problems with his latest version of labCA.


I think I did. The disadvantage I see is that ezca (and therefore labCa)
basically uses 'ca_pend_event()' and this means that any call to ezca
has a timeout granularity of no less than the timeout given to ca_pend_event().


If for example a pend-timeout of 0.1s is used no lcaGet() will ever return
in less than 0.1s - even if the data arrive faster.

The total timeout (which, as Steph has pointed out, is configurable)
equals the basic ca_pend_event() timout times a number of 'retries'.

If you want the system to be more responsive then the pend-timeout
has to be shorter and the CPU ends up burning more cycles since
there is essentially a loop

for (i=0; i<nRetries; i++) {
   ca_pend_event( 0.1 seconds );
   do_ezca_work();
   if ( all_outstanding_requests_satisfied() )
      break;
}

I don't claim that labCA is perfect. At the time, I needed an interface
to scilab and using ezca was just the fastest to get something going.
Later, some people here at SSRL liked it and the fact that it supported
EPICS-3.14 (which MCA at the time did not) permitted transferring
large arrays and they asked me for the matlab interface.

IMO it could be worthwile to develop a clean CA interface for packages
like matlab/scilab/octave from scratch -  with emphasis on a 'properly
layered' approach so that different packages can easily be supported.

-- Till

BTW: working on a CA interface for integration with an existing
application (matlab/scilab) painfully exposes (one of) the weaknesses
of C++ (compatibility issues of run-time libraries/executables)
-- innumerable hours I spent debugging exception handling and
wishing CA had never gone C++. There always arise subtle and
compiler-version dependent problems...

Stephanie Allison




Replies:
Re: Matlab interfaces D. Peter Siddons
References:
RE: Matlab interfaces Allison, Stephanie

Navigate by Date:
Prev: RE: Matlab interfaces Liyu, Andrei
Next: Re: record programming and share oblects Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
Navigate by Thread:
Prev: Re: record programming and share oblects Benjamin Franksen
Next: Re: Matlab interfaces D. Peter Siddons
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·