SIMION Programming API - This is the reference documentation on the various SIMION programming libraries for Lua, C++, Perl, and Python programming languages. It consists of a number of parts.
This is the Lua 5.1 Reference Manual, which documents the Lua language itself, the C API, and the core Lua libraries.
- Lua 5.1 Reference Manual - The Language
- C API (Lua 5.1 Reference Manual)
- base - Basic standard library functions - Basic Functions
- coroutine - coroutine manipulation (standard library) - coroutine manipulation
- io - input and output facilities (standard library) - input and output facilities
- os - operating system facilities (standard library) - operating system facilities
- string - string manipulation functions (standard library) - string manipulation functions
- debug - debugging facilities (standard library) - debugging facilities
- math - mathematical functions (standard library) - mathematical functions
- package - module support (standard library) - module support
- table - table manipulation functions (standard library) - table manipulation functions
Additional general Lua documentation is available at (http://www.lua.org/docs.html). In particular, the book “Programming in Lua” or “Beginning Lua Programming” is highly recommended as a general introduction to Lua. The former is more condensed, focuses largely on only the Lua core itself, and is the more official text (very high quality). The latter is larger, broader in scope, a bit more verbose (being oriented more toward beginning programmers–hence the title), and covers third-party libraries and Lua use in practice much more broadly.
See the “User Programming” appendix of the SIMION User Manual for details on the workbench user program segments, core functions, and general programming background.
See Workbench Program Extensions in SIMION 8.1 for new reserved variables and segments added in SIMION 8.1.
Also see the “Command Line Interface” appendix of the SIMION User Manual [8.0] for functions that can be invoked from the command-line. Some additional functions can also be invoked from the SL Tools utility command-line (see SL Tools Tutorial).
The SIMION core library contains SIMION functions and objects exposed to Lua, such as for controlling various aspects of SIMION from Lua.
- simion - SIMION core functions and objects
- simion.fly2 - FLY2 particle definition
- simion.command - Executes command via the batch mode interface.
- simion.pas - Programmatic access and manipulation of SIMION potential arrays (PA’s). [8.1]
- simion.wb - Programmatic access and manipulation of SIMION workbenches (IOBs) [8.1]
- simion.window / simion.experimental.display - Programmatic access and manipulation of the SIMION window and display [8.1]
- simion.experimental - Some experimental features (subject to change) [8.1]
The functionality in these libraries is more extensive and experimental (subject to change in minor 8.0.x versions) than the SIMION Core Libraries. They are used in various SIMION examples.
- simionx.CachedField - Represents a given field whose values are computed and cached in a given field array.
- simionx.Constants - Various physical constants.
- simionx.FieldAnalysis - Functions for analyzing fields (e.g. computing total charge via Gauss’s Law or total energy).
- simionx.FieldArray - 3D vector field (e.g. Magnetic or electric) interpolated from data arrays.
- simionx.Format - String format utility functions.
- simionx.Integration - Numerical integration routines.
- simionx.MField - Wire current magnetic field calculations using Biot-Savart
- simionx.SimplexOptimizer - Simplex optimization routine (Nelder-Mead downhill)
- simionx.SpecialFunctions - Special mathematical functions (e.g. elliptic integrals, bessel, error function, ...)
- simionx.Statistics - Statistics utility functions
- simionx.Support - Support and utility functoins for use by the other modules
- simionx.Type - A type system (provides type checking).
These are libraries for a variety of programming languages, not necessarily Lua (but rather C++, Perl, and Python) for manipulating SIMION potential arrays. The SL Libraries were originally from the SL Toolkit but are now included in SIMION 8.
The SL Libraries – C++, Perl, and Python libraries for manipulating potential arrays (not currently available in Lua).
These are third-party Lua libraries included with SIMION:
- luacom - Microsoft’s Component Object Model (COM) for controlling other applications, like Excel.
- LuaFileSystem - Access file directory structure and file attributes. (docs available in External: luamodules-docs.zip or online )
- LuaSocket - TCP/UDP sockets, with HTTP/FTP/SMTP/MIME/URL/LTN12 support modules. (docs available in External: luamodules-docs.zip or online) (used in SIMION Example: multiprocess)
- lpack - Packing/unpacking binary data to/from byte strings. (docs available in External: luamodules-docs.zip)
- LPeg - String pattern matching library. (docs available in External: luamodules-docs.zip or online)
- LuaMatrix - Simple pure Lua matrix library. (see External: ../lib/lua/matrix.lua source code for details) (used in SIMION Example: multipole_expansion)
Warning: online docs might describe a newer version.