Export 1D results from Characteristic Mode Analysis
Good evening,
after a simulation, I'd like to export all 1D results of Characteristic Mode Analysis (Eigenvalues, modal significance, modal excitation coefficients etc.) in a comfortable way to a txt file by using POSTFEKO, but I only seem to be able to export the Characteristic surface current. Is there a method to also export the mentioned 1D quantities?
My FEKO version is 2018.2.
Thank you very much for your help!
Answers
-
Dear ju1995
If you add these quantities as traces to a Cartesian graph in POSTFEKO, you could then right-click and select the option to export the data to a DAT file.This would give you the data as column-separated text in the DAT file.
Kind regards,
Johan H
0 -
Dear Johan,
Thank you very much for your answer. I know it works by right-clicking on the trace, but this method is impractical for me, since I need to export approximately 50 modes and I cannot do this 50 times to export the data for each single mode. There must be some other solution!
Is there a possibility to do the export by using the script editor perhaps?
0 -
Hi ju1995
Just to clarify: the option I was referring to is accessed by right-clicking in the graph and would export the data from all the traces on the graph into a single DAT file.
Plotting all your 50 traces on a single graph could be done automatically using the "Plot Characteristic Modes" tool available under the "Plotting" menu of the "Application macro" menu.
That being said, yes, it should be possible to write a script that directly accesses the CMA mode data and writes this to a text file format of your choice.0 -
Hi Johan,
thank you very much for your response, I will try the method you mentioned.
Nevertheless, a solution by scripting seems more flexible. Could you perhaps provide a kind of 'minimum working example' as script, because on the web I can hardly find any examples for FEKO scripts doing data export.
Thank you very much for your efforts!
Kind Regards
0 -
Hi Johan,
unfortunately, I cannot find this predefined Macro you mentioned to export the plotted traces. It does not seem to exist in my FEKO version.
Could you please send me this Macro?
Thank you very much!
0 -
Hi Johan,
I wrote the following script to store the eigenvalues and modal excitation coefficients in two matrices, which works fine. Before exporting this data to a txt file, I tried at first to export an examplary string to a txt file in order to see how the export works, but the txt file remains empty. Can you give me an example how to export a string to a txt file, so that afterwards I can store my actual data as strings in a txt file?
charmodes = pf.CharacteristicModes.GetDataSet(names[1])
num_freqs=8
num_modes=8
eigs = pf.ComplexMatrix.Zeros(num_freqs)
mec = pf.ComplexMatrix.Zeros(num_freqs)
for freqIndex = 1, num_freqs do
for modeIndex = 1, num_modes do
indexedValue = charmodes[freqIndex][modeIndex]
eigs[freqIndex][modeIndex] = indexedValue.EigenValue
mec[freqIndex][modeIndex] = indexedValue.ModalExcitationCoefficient
end
end
--Export data
absPath = "C:\Users\ZTSMT\Desktop"
filename = "daten.txt"
f = io.open(absPath..filename,"w")
f:write("Some String")0 -
ju1995 said:
Hi Johan,
unfortunately, I cannot find this predefined Macro you mentioned to export the plotted traces. It does not seem to exist in my FEKO version.
Could you please send me this Macro?
Thank you very much!
Hi ju1995
I see that you are using Feko 2018.2. The macro tool I mentioned is included directly in the Feko installation in later versions of Feko.0 -
ju1995 said:
Hi Johan,
I wrote the following script to store the eigenvalues and modal excitation coefficients in two matrices, which works fine. Before exporting this data to a txt file, I tried at first to export an examplary string to a txt file in order to see how the export works, but the txt file remains empty. Can you give me an example how to export a string to a txt file, so that afterwards I can store my actual data as strings in a txt file?
charmodes = pf.CharacteristicModes.GetDataSet(names[1])
num_freqs=8
num_modes=8
eigs = pf.ComplexMatrix.Zeros(num_freqs)
mec = pf.ComplexMatrix.Zeros(num_freqs)
for freqIndex = 1, num_freqs do
for modeIndex = 1, num_modes do
indexedValue = charmodes[freqIndex][modeIndex]
eigs[freqIndex][modeIndex] = indexedValue.EigenValue
mec[freqIndex][modeIndex] = indexedValue.ModalExcitationCoefficient
end
end
--Export data
absPath = "C:\Users\ZTSMT\Desktop"
filename = "daten.txt"
f = io.open(absPath..filename,"w")
f:write("Some String")Hi ju1995
I believe your file write test is incomplete... the content will only appear in the file after the io close() function as been called.
0 -
Hi Johan,
I added the line
f = io.close(absPath..filename,"w")
to my file, but the file is still empty. Since I cannot find any FEKO example script concerning data export, I don't even know if the syntax of my code is correct. Could you help me out here or at least name a source where I can find example scripts or a description of data export? The functions io.close and io.open e.g. appear nowhere in the FEKO manual.
Thank you very much for your help!
0 -
Hi ju1995
The scripting in Feko uses the Lua programming language. The "Scripting and API Reference Guide" available under the Feko Help documentation would be very helpful in guiding you.
Specifically regarding general Lau functionality such as the io library that you are using, some useful links would be:For your specific question above, the close() function is called similar to the write() function but without inputs required, as follows:
f:close()0 -
Hi Johan,
thanks a lot for your additional information, that was really helpful!
0