Transcript ASML Halo

VELA Controls in Mathematica
James Jones
ASTeC, Daresbury Laboratory
11th July 2014
Why Mathematica?
• Mathematica provides a rapid-prototyping
environment
– Wide range of in-built functionality
– From simple, to very complex, plotting capabilities
– GUI constructions available
– Interface to JAVA and .NET with low overhead
• However, not useful for long term control use
– Expensive!
– No compilation of code available
Simulations
• Additionally, large body of simulation work
has been performed in Mathematica
– Interface to GPT, Elegant, MAD, MAD-X
– Interpreters for SDDS, tfs, GDF, ASTRA &c.
• For ALICE, complete GUI based simulation tool
was created in MMA
– Interfaced to MAD/MLC
– Linear optics calculations
– Optimisation routines built in
ALICE Controls
EPICS
• There is no (AFAIK) “native” interface to EPICS
for Mathematica
• Solution is to leverage external interfaces into
Mathematica:
– ActiveX – Interface using native .NET capability
– .NET – Simple .NET interface by G. Cox
– Python – use Pythonika and PyEPICS
– JAVA – use MMA native JAVA interface ??
ActiveX & .NET
• Utilises MMA native .NET capability for fast
communications
• ActiveX Requires caRepeater
– Still quite slow
– Very buggy
– No longer supported
• .NET interface from G. Cox is fast, but:
– No arrays
– Known memory leak causes crashes…!
Pythonika
• Utilises c-based interface to MMA and Python
– Runs Python shell in the background
• Type conversion between Python & MMA
done on the fly – no user input required
• Use PyEPICS interface in Python and “push”
python commands via Pythonika
• Can use arrays
• “Very” fast – Can capture camera at ~6Hz
Other Stuff
• Can use Mathematica to import a wide variety
of data types
– Text files(!)
– Images
– Excel Spreadsheets
• Example:
– Image analysis on VELA
– Utilises compiled C-program to do pseudo-colour
Image Analysis
Programs
•
•
•
•
•
•
•
Quad-scans
Sol scans
Image analysis
BPM data analysis
Slit-scans
BURT
Degaussing
Conclusion
• Mathematica provides a useful prototyping
environment
– Quick, small programs are perfect!
• Has various interfaces to EPICS with native typecasting
• Too expensive for production use!
• Python interface allows combine Python and
Mathematica
• Can use for prototyping Python in an interactive
environment…