How to do custom exporting of selected results to a file every time the FEKO solver is run?
I am using an external program to process my FEKO results and would like to find a way to export the results to a custom format every time the model is solved. Is this possible?
I'm not processing the results in POSTFEKO directly since the scripts to process the results were developed a long time ago and written in Octave.
Answers
-
Users should consider using Compose instead of Octave - it is very quick and easy to convert Octave *.m files to run in Compose.
Users working with external programs such as Octave in the past parsed the FEKO *.out file for results data. This parsing is no longer necessary. Any data displayed in POSTFEKO can be exported in a user defined format to a file using Lua scripting in POSTFEKO. The export can automatically be repeated after each successful execution of running FEKO. This how-to, by means of a small example and script, shows how to do this. This is not the only (or maybe even the best) way to export the data, but it shows one possible option for exporting results from FEKO.
Background
In the past, to obtain the data in an external file users had to first plot the data in POSTFEKO and then use the export data function. This procedure had to be repeated after each successful FEKO run.
Alternatively, the OUT file was parsed using an external script or program such as Matlab.
Using Lua, it will be shown here that a script can be written in POSTFEKO that automatically writes the data chosen by the user to a file in a format chosen by the user.
Some of the images in this how-to were taken from Suite 6.1. The Lua script provided in the attachment is forwards compatible with Suite 6.2.
Example overview
Consider two dipoles excited with a plane wave. The first dipole has a load attached to its port. The second dipole has a non-radiating network attached to its port and the network is terminated in a load. The plane wave is looped over five angles. The geometry and tree view in CADFEKO is shown below.
The schematic view is shown below. Note that a load is attached to the Network Port2 (not shown in the schematic).
We will show how to export the currents in the loads to a file.
Making and using the script in POSTFEKO
After solving the model, run POSTFEKO. Plot the data that must be exported to a file. The currents in the loads are plotted and shown below.
In POSTFEKO click on the 'New Script' icon and select 'Load'. After writing the script, the script can be accessed again by clicking on 'Modify script'.
The script text and execution window is shown below. For more details on the scripting syntax, please see the FEKO User Manual.
In this example a filename, 'loads.dat' was chosen and is written automatically after each execution of RUNFEKO. To stop automatic execution of the script, uncheck the box, 'Automatically run the script with bof file reloading'.
A section of the data file is shown below.
0 -
Hi: I couldn´t find how to export a .dat file with LUA in the FEKO manual. Your previous image don´t show that part that is with I need. Could you help?
Thanks
0 -
Hi guilrod,
to see how JIF did it you need to open the POSTFEKO session (*.pfs). There is a Math script which you can open by double-click.
@JIF, where is that magic 'Automatically run the script with bof file reloading' checkbox?
0 -
Altair Forum User said:
@JIF, where is that magic 'Automatically run the script with bof file reloading' checkbox?
It is on by default, but the setting is located on the Preferences dialog (see below). It is the checkbox that has been checked and has the description 'Reload scripts with bof file reloading'.
0 -
Thanks @JIF!
0 -
Thank you!!, Torben and Jif.
0 -
sorry to bump an old thread, but do you perhaps have the file still available? it is no longer accessible and I am also trying to export data from separate sources to a single dat file directly without first having to plot them all together and using ExportTraces.
Thanks,
John
0 -
It seems the website migration has broken the attachments.
Attached the files again.
2