Personal tools

Parameter sweep

Investigate the effect of changing variables. The plugin contains Lua scripts for setting up and launching a parameter sweep in CADFEKO and processing sweep data in POSTFEKO. The plugin has been developed for FEKO Suite 7.0


The parameter sweep plugin assists the user in setting up a parameter sweep for an existing model in CADFEKO and combines the results in POSTFEKO.

The user selects the parameters to sweep from the variables contained in the CADFEKO model.  For each selected variable, the sweep range and number of steps need to be defined.  The script creates the necessary models and optionally runs the FEKO solver, after which the plugin can be used in POSTFEKO to combine the results from the sweep.

The plugin comes in two primary parts:

  1. parameter_sweep.lua:  This CADFEKO macro generates all of the models and an XML file that stores all of the metadata about the sweep.
  2. combine_parameter_sweep_results.lua:  This POSTFEKO macro takes the XML file stored by the CADFEKO macro as input, loads all of the simulated data and combines the results.


Installation and usage instructions

To install the plugin:

  1. Extract the folder to a central directory.
  2. Open “parameter_sweep.lua” in CADFEKO and add it to the application macro library.
  3. Open “combine_parameter_sweep_results.lua” in POSTFEKO and add it to the application macro library.


To use the plugin:


  • Configure a parametric base model with the required geometry and the variables that need to be swept.
  • Run the plugin to generate the models and (optionally) run the solver.
  • select_sweep_variables.png



    The CADFEKO script prompts the user for the variables to sweep and the sweep ranges.
There are several input types provided:
  • Linearly spaced grid: This allows the user to perform a grid search.  The design variables are interpolated with equal spacing with a specified number of samples per variable.
  • Logarithmically spaced grid: This allows the user to perform a grid search where the samples are spaced logarithmically.  For instance, a range of "0.1 to 10" with three samples will result in "0.1", "1" and "10".
  • Variable grid: In certain situations, only a specific set of values are possible or of interest.  The variable grid allows the user to specify how many samples are required in the grid, but gives the user the freedom to manually define each value point in a variable's range.
  • List of permutations: A grid search has the potential to very quickly generate a lot of data.  By controlling exactly what the values are for each permutation of the model, the user can choose arbitrary combinations of input variables.  For instance, a workplane's position can be set to (0,0,0); (0,1,1) and (2,2,2) without having to go through every other combination on a grid.  Note that the combinations in POSTFEKO result in a highly customised set of data.



  • When the parameter sweep runs have completed, open a new POSTFEKO session (all previous results will be overwritten).
  • Run the plugin to combine all of the simulated data.
    The POSTFEKO script prompts the user for the XML file generated by the CADFEKO script.  The number of sampling points to use for continuous frequency results can be specified.



Sweep of dipole length and mutual impedance

The parameter sweep plugin is first used to determine the length of a half wavelength dipole and then to sweep the distances between two dipoles placed end-to-end and placed parallel to each other.

The FEKO models for this example can be downloaded below.

The dipole length is swept at 300 MHz to obtain the length (0.48 times the wavelength) where the imaginary part of the input impedance is closest to zero.  This dipole has an input impedance of 70.0913 + j 0.39637Ω at 300 MHz.

Input impedance values over sweep of dipole length

 Input impedance of dipole antenna

Variables s and d are swept for the collinear and parallel dipoles respectively.  The mutual impedance graphs obtained after combining the parameter sweep results in POSTFEKO are shown below.  The same results can be obtained in FEKO by using a grid search optimisation.

 Mutual impedance for two collinear dipoles  Mutual impedance for two parallel dipoles


About the plugin

  • The combined data will be saved as “Stored data” in the POSTFEKO session. A new axis will become available for all results that could be merged for each variable that was swept.
  • A “_RAW” instance of each merged result is generated in versions older than FEKO Suite 7.0.1 where some results (e.g. far/near fields) cannot be plotted as a function of the swept variable. The raw data allows you to do this, but may be more restricted in what quantities are available. The exact same information is present in the raw block, but some processing may be required.
  • The only data that can be merged by the plugin are those that are exposed in the scripting environment. For instance, currents and charges are not supported in the FEKO Suite 7.0 API and cannot be merged.

    Supported Unsupported
    • sources on
      • edge ports
      • segments/vertices
    • loads
    • far fields (discretely sampled)
    • far fields (continuously sampled)
    • near fields
    • networks
    • power
    • s-parameters
    • transmission/reflection coefficients
    • characteristic modes
    • receiving antennas (stored as power)
    • sources on
      • waveguide ports
      • modal ports
      • line ports
    • currents/charges

Download Archive Contents

The download archive contains seven files:

  • parameter_sweep.lua - The first part of the plugin to be added to CADFEKO.  Run this script from the script editor in CADFEKO or install it as an application macro in CADFEKO for regular use.
  • combine_parameter_sweep_results.lua - The second part of the plugin to be added to POSTFEKO.  Run this script from the script editor in POSTFEKO or install it as an application macro in POSTFEKO for regular use.
  • parameter_sweep_helper.lua - A helper script that contains several sub-functions that are regularly used by the primary CADFEKO script.
  • combine_parameter_sweep_results_helper.lua - A helper script that contains several sub-functions that are regularly used by the POSTFEKO primary script.
  • shared_helper.lua - A helper script that is used by both primary scripts.
  • split.png - An image file that may be used as icon for the script in the application macro library.
  • merge.png - An image file that may be used as icon for the script in the application macro library.