Optimising the Bandpass Filter with HyperStudy Using Scripting

Configure the HyperStudy setup and perform the optimisation. Minimize the reflection coefficient.

  1. Copy the files from %FEKO_HOME%/help/feko/example/ExampleGuide_models/Example-I04-HyperStudy_bandpass_filter_optimisation/opt_scripting to a work directory.
    Note: Ensure that you have write permissions in the work directory and that the directory is not “read only”.

    The provided extraction script bandpassfilter.cfx_extract.lua is preconfigured to calculate s11avg for the filter and write the result to a HyperStudy .hstp file.

    -- Run into POSTFEKO to fetch results and push the scalar values to a HyperStudy .hstp file
    HstUtl = require "hst.hstutl"
    local app = pf.GetApplication()
    local config = app.Models[1].Configurations[1]
    -- Get first s-parameter result
    local sparam = pf.SParameter.GetDataSet( pf.SParameter.GetNames()[1] )
    local s11 = sparam[1][1].SParameter
    -- Calculate the average reflection coefficient across the frequency band
    local s11avg = 0
    local num_frequencies = sparam.Axes[pf.Enums.DataSetAxisEnum.Frequency].Count
    for findex = 1,num_frequencies do
    s11avg = s11avg + sparam[findex][1].SParameter:Abs()
    s11avg = s11avg/num_frequencies
    -- Create the output file
    file = HstUtl.NewOutputFile( )
    HstUtl.StoreScalarValue( file, "s11avg", s11avg )
    HstUtl.WriteFile( file )
    -- End of file
  2. Open Altair HyperStudy.
  3. Under the Study group, click New.
    The Add Study dialog is displayed.

    Figure 1. The Add Study dialog.
  4. [Optional] In the Label field, specify a name for the study.
  5. Under Location enter the path to the work directory where the bandpassfilter.cfx is located.
  6. Click Setup > Definition > Define models in the Explorer tab.

    Figure 2. Example of the Study tree in HyperStudy.
  7. Click Add Model.
    The Add dialog is displayed.

    Figure 3. The Add dialog.
  8. Under Select Type, select FEKO and click OK.
  9. Under Resource, browse to bandpassfilter.cfx in the work directory.
    Tip: Step 8 and Step 9 can be combined in a simple drag and drop of the bandpassfilter.cfx from the Windows File Explorer into HyperStudy.
    • The solver script is registered automatically. The script is accessible under Edit > Register Solver Script, which offers the possibility to register another solver or version.
    • The Solver Input Arguments show ${filebasename} by default. The argument –np can be typed here to specify the number of cores to use.
    • The provided file bandpassfilter.cfx_extract.lua is expected to be saved in the same location as the model file.
  10. Click Import Variables to import CADFEKO model variables.

    Figure 4. Example selecting the Import Variables button.
  11. Click Next.
  12. Select which variables to include in the study. Only S1 – S3 should be activated and the default ranges used.
    An example of the selected variables is displayed.

    Figure 5. Example of the variable selection
  13. Click Next.
  14. Click Run Definition.

    Figure 6. Example selecting the Run Definition button.
    During the Write phase, the bandpassfilter.cfx_extract.lua file was copied to the run directory and executed after the Feko solver was run in the Extract phase. This generated an output file that HyperStudy can process easily.
    Note: The script bandpassfilter.cfx_extract.lua is different if a .pfs file was present before importing the variables and will automatically extract the visible traces on a Cartesian graph and polar graph.
    See Figure 7 for the completed definition run for the Write, Execute and Extract phases for the initial test run done by HyperStudy.

    Figure 7. Example of the completed definition run.
  15. Click Next.
  16. Click File Assistant.

    Figure 8. Selecting the File Assistant button.
    The File Assistant dialog is displayed.

    Figure 9. The File Assistant dialog.
  17. Browse to ./m_1/hst_output.hstp in the default run directory.
  18. Confirm that Altair HyperWorks (HstReaderPdd) is selected and click Next.
  19. Confirm that Single Item in a Time Series is selected and click Next.

    Figure 10. The File Assistant dialog.
  20. Confirm that s11avg is selected and click Next.

    Figure 11. The File Assistant dialog.
  21. In the Label field, enter s11avg to change the name of the response label.

    Figure 12. The File Assistant dialog.
  22. Click Finish to close the dialog.
  23. Under Goals click to add an optimisation goal.
    The following dialog is displayed.

    Figure 13. Example adding an optimisation goal.
  24. Set the goal Type to Minimize and click OK.
  25. Click Evaluate to extract the value from the output file.

    Figure 14. Example selecting the Evaluate button.
    HyperStudy is now configured to understand which model to use, which variables are available for modification and how to process the output.
  26. Right-click on the defined study in the Explorer tab and click Add.

    Figure 15. The Add dialog and selecting an optimisation approach.
  27. Under Select Type, select Optimization and click OK.
    The optimisation approach is created in the Explorer tab

    Figure 16. Example of the Optimisation 1 approach created.
  28. Click Optimization 1 > Specifications, and select the Adaptive Response Surface Method as the optimiser.

    Figure 17. Selecting the Adaptive Response Surface Method.
  29. Click Apply and click Next.

    Figure 18. Example selecting the Apply button.
  30. Click Evaluate Tasks.

    Figure 19. Example selecting the Evaluate Tasks button.
    Each of the input variables is altered randomly, and its effect on the response analysed.

    Figure 20. Typical progress data for an ARSM optimisation.
  31. Click Iteration History tab and look for the row highlighted in green.
    The optimum values are as follows:
    • S1 = 0.4500000
    • S2 = 1.9254786
    • S3 = 2.2000000