WHILE Loop
A While loop performs a test at the beginning of every loop.
m = 0 while m < 5 do print("While loop count " .. m) m = m + 1 -- there is no m++ or m += 1 end
See what's new in the latest release.
The Feko Getting Started Guide contains step-by-step instructions on how to get started with Feko.
The Feko Example Guide contains a collection of examples that teaches you Feko concepts and essentials.
Feko is a comprehensive electromagnetic solver with multiple solution methods that is used for electromagnetic field analyses involving 3D objects of arbitrary shapes.
CADFEKO is used to create and mesh the geometry or model mesh, specify the solution settings and calculation requests in a graphical environment.
POSTFEKO, the Feko post processor, is used to display the model (configuration and mesh), results on graphs and 3D views.
EDITFEKO is used to construct advanced models (both the geometry and solution requirements) using a high-level scripting language which includes loops and conditional statements.
One of the key features in Feko is that it includes a broad set of unique and hybridised solution methods. Effective use of Feko features requires an understanding of the available methods.
Feko offers state-of-the-art optimisation engines based on generic algorithm (GA) and other methods, which can be used to automatically optimise the design and determine the optimum solution.
The Feko utilities consist of PREFEKO, OPTFEKO, ADAPTFEKO, the Launcher utility, Updater and the crash reporter.
Feko writes all the results to an ASCII output file .out as well as a binary output file .bof for usage by POSTFEKO. Use the .out file to obtain additional information about the solution.
A large collection of application macros are available for CADFEKO and POSTFEKO.
CADFEKO and POSTFEKO have a powerful, fast, lightweight scripting language integrated into the application allowing you to create models, get hold of simulation results and model configuration information as well as manipulation of data and automate repetitive tasks.
The scripting language that has been integrated with CADFEKO and POSTFEKO is called Lua. Lua has a syntax that is similar to Python and Matlab (or Octave) and is easy to learn and use.
The script editor allows you to create scripts based on the Lua language to control CADFEKO, POSTFEKO and other applications as well as manipulation of data to be viewed and analysed further in POSTFEKO.
Use macro recording to record actions in a script. Play the script back to automate the process or view the script to learn the Lua-based scripting language by example. Macro recording allows you to perform repetitive actions faster and with less effort.
The scripting capability is powerful and help your work to be completed faster, but you first need to learn the basics of Lua and scripting in Feko.
Learn the basic Lua language concepts by viewing small extracts of executable Lua code.
There are two methods to add a comment to Lua code.
Variable assignments in Lua are case sensitive.
Simple string assignment and concatenation can be performed directly in Lua. More advanced string manipulation is available using the string module (included as part of the Feko installation).
Variables can be assigned the boolean values, true or false. Boolean arithmetic can be performed on boolean values using not, and and or.
Tables in Lua can be dictionaries or arrays.
An if statement executes a block of code if a specified condition is true.
A While loop performs a test at the beginning of every loop.
A repeat loop performs the test condition at the end of every loop and will execute at least one loop.
A For loop is used to iterate over a predefined set of numbers, iterate over the key and value pairs of a dictionary or the values of an array.
A function is a group of statements that carry out a specific task (procedure) or a function can calculate and return values.
Some API objects allow batch modification of properties. Objects that support batch modification will have a SetProperties method that accepts a dictionary (Lua table) of properties.
A number of Lua modules are included by default.
The Feko installation also includes a number of modules that are not included by default with all Lua distributions, but are useful for many scripting applications
A selection of global keywords recognised in the Lua editor, as well as additional functionality are highlighted.
Scripts can be written such that they work both in CADFEKO and POSTFEKO.
External Lua modules can be installed and included in the Lua search path.
There are two types of scripts that are supported in Feko, API scripts and result scripts. POSTFEKO supports both types of scripts, while CADFEKO only supports API scripts. It is important to use the correct script type in POSTFEKO to ensure that the desired result is achieved.
During the execution of an automation script, custom dialogs can be used that allows the script to be more interactive. When used in conjunction with the custom command library, it is possible to extend the user interface for a variety of custom workflows.
An application macro is a reference to an automation script, an icon file and associated metadata.
The application macro library allows commonly used application macros to be stored in a repository.
Reference information is provided in the appendix.
CADFEKO and POSTFEKO have a powerful, fast, lightweight scripting language integrated into the application allowing you to create models, get hold of simulation results and model configuration information as well as manipulation of data and automate repetitive tasks.
The scripting capability is powerful and help your work to be completed faster, but you first need to learn the basics of Lua and scripting in Feko.
Learn the basic Lua language concepts by viewing small extracts of executable Lua code.
A While loop performs a test at the beginning of every loop.
A While loop performs a test at the beginning of every loop.
m = 0 while m < 5 do print("While loop count " .. m) m = m + 1 -- there is no m++ or m += 1 end
© 2022 Altair Engineering, Inc. All Rights Reserved.