FSL (FEMAG script language)¶
The script interpreter is an integral part of FEMAG and allows you to define processes before FEMAG starts. The desired FEMAG actions are programmed by the user in a text file (script file). For this purpose, a largely complete and easy-to-learn programming language can be used.
The script interpreter programming language Lua.
In addition to the range of commands from Lua, a FEMAG-specific function library is available. These can be used to initiate actions that are known from the interactive operation via the program menu.
In the simplest case, the FEMAG script interpreter can be used to automate recurring processes during model creation or model analysis. However, by defining its own functions and libraries, it also allows a user-specific extension of FEMAG. The script interpreter can also serve as a flexible interface for integrating FEMAG into an application-specific design environment or interface.
FEMAG scripts always complete with the “.fsl” file extension.
Executing a FEMAG script is done by specifying the file name when calling FEMAG as an argument (with an ending) or via the “Select Input File” and “Select Scriptfile” menus. See section Run a script file and control the flow.
Feedback from the interpreter is logged in the FEMAG-FSL.jrn and FEMAG-FSL.log files during script execution. Causes of errors are specified there with reference to the line number of the script.
Handling of global variables and optional parameters¶
Some function calls use global variables (parameters) which are optional, i.e. the assignment of permanent material properties:
m.remanenc = 1.200 -- Remanence Br (Ref: 20 Degree C) [T] m.relperm = 1.050 -- Relative permeability muer [-] m.spmaweight = 7.600 -- Specific weight of magnets [gr/cm3] m.temcoefbr = -0.100 -- Temperature coefficient for Br [%/K] m.temcoefhc = -0.100 -- Temperature coefficient for Hc [%/K] m.magntemp = 20.000 -- Magnet temperature [Degree C] m.magncond = 625000.000 -- Magnet el. conductivity [1/Ohm m] m.magsegwid = 51.100 -- Magnet segment width [mm] m.magseglen = 120.000 -- Magnet segment length z-direction [mm] pre_models("Magnet-data")
To remove an already defined parameter or expilcitly declare it as unspecified use the nil assignment, e.g.
m.remanenc = nil
previously. Thus, currently existing remanence of the permanent magnets is maintained in this example.