Personal tools

Lua Scripting and Automation

Lua Scripting and Automation


POSTFEKO_6_2_scripting_IDE.jpgPOSTFEKO features a scripting interface base on the open source Lua language that allows users to manipulate any data that is available within POSTFEKO.  Scripts are created or modified in a full-featured editor which includes typical IDE features such as:

  • Syntax highlighting.
  • Margin folding for collapsing of loops and decision blocks in scripts to read code easily.
  • Use of breakpoints and stepping in scripts to debug code or control its execution.
  • An active console to query variables or execute simple commands.
  • A comprehensive online help section which describes the API.

The scripting interface also provides users with convenient math scripts that refer to current POSTFEKO data such as near fields, far fields or S-parameter blocks to enable users to easily manipulate such information. This scripting interface has various uses, e.g. to create non-standard output types and plot them using the POSTFEKO interface.

Interactive Script Dialogs


Various dialog options available
in Lua script forms

Lua scripts may implement fully customisable dialogs.  This provides script designers with tools for facilitating feedback from users of the script. Various typical dialog interaction items are available via the scripting API, e.g.

  • OK/Cancel buttons
  • Check boxes
  • Radio button groups
  • Directory and file browsers

These powerful tools make it possible to develop mini-applications that perform complex FEKO operations or setups on behalf of inexperienced users, or to facilitate speedy, reliable repetition of a series of actions that are regularly performed.

Scripts that are used regularly may be added to the "Application Macro" scripts list in CADFEKO or POSTFEKO.  In this way the script is available via a button in a drop-down menu and users do not have to open the script in the editor to run it.


Users have almost 100% control over POSTFEKO via the scripting API.  Math scripts can be executed, data manipulated, views created and results plotted, reports exported, etc.  POSTFEKO automation scripts may be executed via a command line interface, providing users with a means to integrate POSTFEKO's features and abilities in a custom tool chain.  Such automation is valuable to anyone who often repeats tasks or has to perform the same operation repeatedly on large data archives.

A command line call to POSTFEKO to execute a specific Lua script will look as follows:

postfeko --run-script myluascript.lua


An integrator of communication radios on military vehicles have to report on ICNIRP compliance of 3 radiators on the roof of a vehicle.  Various positions are investigated via CADFEKO grid search optimisation and documentation is required for each scenario.

POSTFEKO automation and scripting is used to automate the following operations for each scenario:

  1. Load the near-field simulation results for each radiator in isolation.
  2. Execute a script that performs ICNIRP compliant summation of the near-field blocks, resulting in a near-field like block of data that represents ICNIRP levels around the vehicle.
  3. Setup 3D views for the ICNIRP levels of each radiator and for the combination of the radiators.
  4. Export JPG images for each 3D view for inclusion in written reports.
ICNIRP radiation hazard iso-surface images
created with single automated script
POSTFEKO_100MHz_ICNIRP_Hummer_300x300px.jpg POSTFEKO_150MHz_ICNIRP_Hummer_300x300px.jpg
100 MHz antenna transmitting
150 MHz antenna transmitting
POSTFEKO_300MHz_ICNIRP_Hummer_300x300px.jpg POSTFEKO_combined_ICNIRP_Hummer_300x300px.jpg
300 MHz antenna transmitting
Combined radiation hazard

Lua scripts in the public domain

FEKO users often log requests for special features that are not presently implemented in FEKO.  When these requests do not merit permanent inclusion into the FEKO suite, Lua scripts that implement the request are created in support of these customers.  These scripts are also published in the public domain for the benefit of all other FEKO users and can be accessed in the Lua scipts topic under the Support area of the FEKO website.

Additional Information

Additional Information