Personal tools

Multi-port post-processing

A plugin that facilitates the calculation of results for changes in port loading without re-running the solver.


FEKO allows, among other things, the analysis of complex coupled systems. Load impedances at ports influence the reflection coefficient at the other ports as well as field values (near fields and far fields). Any change in termination loads requires the recalculation of the method of moments matrix and performing an expensive LU-decomposition to obtain the new solution.

Through scripting in POSTFEKO, loads can be modified as a post-processing step. Pre-requisites for performing such post-processing for a given model are the availability of the scattering matrix for the model and the field requests for each configuration in the scattering parameter solution. Using the extracted S-parameters and the field values for all the configurations, it is possible to calculate (and export) near field data, far field data (including gain) and the new S-parameter matrix (taking the loading into account) without requiring further FEKO simulations.

The following scripts are provided:

  1. MultiportPostProcessing.lua: The POSTFEKO script that performs multi-port post-processing.
  2. generateMultiportConfigurations.lua: A CADFEKO script that aids in model creation for post-processing with “MultiportPostProcessing.lua”.
  3. ExtractSP.lua: A POSTFEKO script that extracts the S-parameters from a model that has been constructed by the CADFEKO script "generateMultiportConfigurations.lua".

    Calculation of S-parameter data and field values

    S-parameters are calculated in FEKO by loading all ports with the port impedance and then in turn exciting each port in the model. The voltages and currents calculated at all the ports can be combined to determine the S-parameter matrix. For multi-port post-processing, the field values (near and far fields) also need to be determined for each configuration in the S-parameter calculation. This requires that m+1 simulation solutions need to be performed by default, where m is the number of ports in the model.

    If a model can be constructed that consists of m configurations where the following restrictions are honoured, then the calculation can be reduced to m simulations:

    • The loads for all configurations must be identical and set to the port impedance at the specific port.
    • Each configuration has a single source and over all the configurations each port is excited exactly once.
    • Requests in all configurations must be identical.
    • All other configurations settings (except for the excitations) are identical.

    Since the loads are the same for all the configurations and only the source is modified between configurations, the simulation is performed very efficiently when using the method of moments. The expensive matrix fill and LU-decomposition is only performed once at each frequency. For all subsequent configurations only the right hand side vector (sources) is updated and a backwards substitution is performed before calculating the output for the requests.

    Creating the model in CADFEKO

    A CADFEKO script (“generateMultiportConfigurations.lua”) has been developed to ease the model creation process.

    The script requires a model with the following specifications (see “test_example1.cfx” as example):

    • The model should contain a single standard configuration.
    • The model should have no sources defined.
    • The model should contain more than one port.
    • All ports should have loads terminated by the reference impedance at that port.

    Create or open a model with the above specifications. Open and run the script named “generateMultiportConfigurations.lua” in CADFEKO. (Note that the script can also be added to the application macro library for ease of use.) For each port in the model a configuration will be created with a single source. Sources will also be modified to be set per configuration. The original configuration will still be available in the model, but it will be excluded (not active).

    If the model needs to be modified to include another port or an additional request, delete all the configurations except the first one. Modify the configuration as desired and run the “generateMultiportConfigurations.lua” script again to create required configurations. Run the solver so that the results are available to extract the scattering parameters.

    In versions of FEKO up to and including Suite 7.0, loads are not part of the automation framework and cannot be manipulated in the script.

    Extracting the S-parameters

    A POSTFEKO script has been developed that allows a user to extract the S-parameters from a model that has been constructed as described above. The script name is “ExtractSP.lua”. Dialogs are used to query the user for the file name as well as the output type (stored data in POSTFEKO or export to Touchstone file). It is possible to modify the script to take the settings as input parameters and to execute it from a command line without any user interactions.

    Please note that the script requires a number of other Lua modules that are also provided in the download archive. The folder containing these modules should be placed in the same directory as the script. Also note that the script shares the user interface of the multi-port post-processing script. Some settings are disabled in the user interface since they are not applicable to the S-parameter extraction script (for example, to read from a settings file or to validate the model).

    Core multi-port calculation

    The main aim of the post-processing script is to be able to calculate the port reflections and field values for a model with different load configurations without requiring a new simulation in FEKO each time the port loads are modified. The load and source configurations should be modified and the new port and field values determined as a post-processing step.

    The script (“MultiportPostProcessing.lua”) performs the following actions:

    • A new POSTFEKO session is created discarding any information in the existing session.
    • If no model is specified in the script, a model will be requested using a dialog. The model must adhere to the restrictions discussed in earlier sections.
    • The S-parameter matrix is extracted from the model.
    • The port reference impedances are extracted from the model.
    • If no load configuration information is supplied, the user is queried what ports in the model should be loaded as well as what the load impedances are at these ports. The user has the option to specify the loading at the ports as one of the following types:
      • Point loads that do not connect to other ports. These ports can be loaded with any of the following:
        • Frequency independent (constant) complex loads
        • Series RLC circuit (as in FEKO)
        • Parallel RLC circuit (as in FEKO)
        • Short circuit
        • Open circuit
        • A one-port Touchstone file
    • A single multi-port Touchstone file that contains all the port terminations (ports can be connected through the S-parameter matrix).
    • Multiple one-port Touchstone files (one at each port). This option is equivalent to selecting the first option above (point loads) and specifying all point loads via one-port Touchstone files.
    • The remaining ports are assumed to be sources. If no source information is supplied the user is queried for the source magnitude and phase at each port that is not loaded.
    • Note that the source and load configurations can be stored and read from Lua configuration files (by selecting the option “Read from settings file” on the first dialog). These files need to populate the correct data structures.
    • The calculations are performed to determine the resulting reflections at the source ports.
    • For each field request in the model, a new field request is calculated that takes the loading into account. The user is given an option to store the data as stored data entities in POSTFEKO or export the data to file (*.snp/*.efe/*.hfe/*.ffe).

    Please note that the multi-port post-processing script requires a number of other Lua modules that are also provided in the download archive. The folder containing these modules should be placed in the same directory as the script.


    • The directivity factor for far fields is not calculated. (The gain factor is calculated.) Any directivity that would be calculated would have to make a number of assumptions and the user could easily obtain incorrect results. If directivity had to be calculated, it could be done in one of the following ways:
      • The power lost in the loads added by the post-processing can be taken into account to produce an approximation to the directivity. The approximation is only valid as long as the model contains no other loads (already an assumption that was made) and the model consists of lossless materials.
      • The far field can be integrated, but this requires a sufficiently fine sampled far filed for the results to be accurate.
    • The script assumes that the power settings have not been changed from the default (PW 0). It is not possible to detect these changes with the POSTFEKO API of FEKO Suite 7.0.
    • A possible problem was noticed that at some frequencies the results don’t match perfectly with the FEKO results. This needs to be investigated further before any conclusions can be made. It does not look like a bug in the script, but rather the matrix calculations that are sensitive in some cases.


    A test model is available to test the results generated by the “MultiportPostProcessing.lua” by comparing it to the same calculation performed directly with FEKO. The model that is used as the reference is “plate4prt_test_compare.cfx”.

    Illustration of the test model (plate4prt_test_compare.cfx).


    The model consists of 4 ports. The ports have been loaded and excited as follows:

    • Port_1: Loaded with complex impedance 150 +j20
    • Port_2: Loaded with complex impedance 10 –j300
    • Port_3: Source with voltage set to 1 Volt (zero phase)
    • Port_4: Source with voltage set to 2 Volts (zero phase)

    There is one near field request (10x10x20 = 2000 points) and one far field request (31x61 = 1891 points). The simulations are performed from 200 MHz to 800 MHz at 11 frequencies.

    The field values for the reference model is compared to the stored data entities created by the “MultiportPostProcessing.lua” script using “plate4prt_opt.cfx” as the base model for the calculation (it has the same geometry, requests and configuration settings with one source for each configuration, as required).

    The plots of the near field and far field values as a function frequency at arbitrary positions for the calculated and reference results are shown below.



    Comparison of near field values as a function of frequency at an arbitrary position. Comparison of far field gain over frequency in an arbitrary direction.

    Download Archive Contents

    Main scripts

    generateMultiportConfigurations.luaAids model creation for post-processing with “MultiportPostProcessing.lua”.  Run this script from the script editor in CADFEKO or install it as an application macro in CADFEKO for regular use.

    ExtractSP.luaExtracts the S-parameters from a model that has been constructed by the CADFEKO script generateMultiportConfigurations.lua. Run this script from the script editor in POSTFEKO or install it as an application macro in POSTFEKO for regular use.

    MultiportPostProcessing.luaPerforms multiport post-processing. Run this script from the script editor in POSTFEKO or install it as an application macro in POSTFEKO for regular use.

    Helper scripts

    The following helper scripts are required by the POSTFEKO scripts. The MultiportModules folder containing these modules should be placed in the same directory as the scripts.