微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微波和射频技术 > 电磁仿真讨论 > export matrix matlab

export matrix matlab

时间:03-27 整理:3721RD 点击:
Hello,

I am simulating an optimization in HFSS. I start the simulation within matlab and wrote an appropriate script file. The optimization is working good, but I have a problem with exporting the matrix data.

HFSS always writes the following error message:
Script Error (Code 80070203) in file: X.vbs
Description: Solution data is not available for %s:%s. It was either not solved or was made invalid by subsequent design changes.
Line(X): "oModule.ExportNetworkData_"


I know that the solution is always been solved.
Did anyone of you experience such a problem and can help me?

Best regards,
Jasmin

Are you following these steps properly: (done on HFSS v10.1)


Right Click "Results" and Select "Solution Data"

Click on "Matrix Data" Tab

Click on "Export Matrix Data.." Button

Save it as an M-File


This has always worked fine for me, you may want to try re-installing HFSS?

Exporting a file in HFSS works really good, but I have a problem with exporting the results of HFSS using MATLAB.

I use the matlab function "hfssExportNetworkData.m" from the HFSS API which I found in the internet:

% Copyright 2004, Vijay Ramasami (rvc@ku.edu)

function hfssExportNetworkData(fid, fileName, setupName, sweepName, ...
varargin)

% Export File Type - default is MATLAB.
if (length(varargin) > 0)
expFileType = varargin{1};
else
expFileType = 'm';
end;

% Renormalizing Impedance.
if (length(varargin) > 1)
renormZ = varargin{2};
else
renormZ = 50.0;
end;

% Export File Type Switch.
switch (expFileType)
case 'h', expType = 1;
case 't', expType = 2;
case 's', expType = 3;
case 'c', expType = 4;
case 'm', expType = 7;
case 'z', expType = 8;
otherwise, error('Export File Type Unknown !');
end;

% The usual fprintf()'s
fprintf(fid, '\n');
fprintf(fid, 'Set oModule = oDesign.GetModule("Solutions")\n');
fprintf(fid, 'oModule.ExportNetworkData _\n');
fprintf(fid, ' "", _\n');
fprintf(fid, ' Array("%s:%s"), _\n', setupName, sweepName);
fprintf(fid, ' %d, _\n', expType);
fprintf(fid, ' "%s", _\n', fileName);
fprintf(fid, ' Array("All"), _\n');
fprintf(fid, ' true, _\n');
fprintf(fid, ' %.2f \n', renormZ);

For those who are interested in the solution...

Rewrite the function "hfssExportNetworkData.m":
(eps, Leitfaeh, tanDelta are the variables which are determined by HFSS Optimization.)

function hfssExportNetworkData_Opt(fid, fileName, setupName, sweepName, path, ...
varargin)

% Export File Type - default is MATLAB.
if (length(varargin) > 0)
expFileType = varargin{1};
else
expFileType = 'm';
end;

% Renormalizing Impedance.
if (length(varargin) > 1)
renormZ = varargin{2};
else
renormZ = 50.0;
end;

% Export File Type Switch.
switch (expFileType)
case 'h', expType = 1;
case 't', expType = 2;
case 's', expType = 3;
case 'c', expType = 4;
case 'm', expType = 7;
case 'z', expType = 8;
otherwise, error('Export File Type Unknown !');
end;

fprintf(fid, '\n');
% Get the project variables values:
fprintf(fid, 'eps = oProject.GetVariableValue("Seps") \n');
fprintf(fid, 'Leitfaeh = oProject.GetVariableValue("SLeitfaeh") \n');
fprintf(fid, 'tanDelta = oProject.GetVariableValue("StanDelta") \n');


[i]% The usual fprintf()'s
fprintf(fid, '\n');
fprintf(fid, 'Set oModule = oDesign.GetModule("Solutions")\n');
fprintf(fid, 'oModule.ExportNetworkData _\n');
fprintf(fid, ' "SLeitfaeh=''" + Leitfaeh + "'' Seps=''" + eps + "'' StanDelta=''" + tanDelta + "''", _\n');
fprintf(fid, ' Array("%s:%s"), _\n', setupName, sweepName);
fprintf(fid, ' %d, _\n', expType);
fprintf(fid, ' "%s", _\n', fileName);
fprintf(fid, ' Array("All"), _\n');
fprintf(fid, ' true, _\n');
fprintf(fid, ' %.2f \n', renormZ);
[i]

my opinion

the current hfss-api can export the result when the variables are not defined in HFSS.
if the variables exist in HFSS, the export script should specify the corresponding variables you want export, just as you did above.

another simple solution is to define the variables in matlab rather than in hfss, and do the optimization in matlab, avoiding using variables in hfss.

this is what i have done in research.

I agree with you, when you are recommending "define the variables in matlab rather than in hfss... and do the optimization in matlab... avoiding using variables in hfss".

The last optimization I did (optimizing dipole length and width), I did in Matlab. I defined the variables in Matlab and it was a lot more comfortable to do so, than to optimize directly in HFSS.

perform the whole routine you are trying to do manually, but with record script on.
and then play with vbs that HFSS creates for you.
i personally think VBS can be really easy, if you first record the macro, and play with variable.

also another thing, are the variable names you set on HFSS the same as what the API is trying to read?
The experience I had is that my solution name was completely different from what was in the script, and basically, my data was junk.

hi Jasmin
whould you please upload your hfss file. i have some error in simulation of dipole.

I have been used toobox delivered by Vijay Ramasami for connecting Matlab and HFSS.However,when I run the example:dipole_example,it seems to me that the results have problem
-The simulated resonant frequency of dipole doesn't change through different iterations->I guest it is due to the results have not been updated through iterations

Does anyone experiences similar problems?Could you help me overcome this trouble?
At the moment,I am assigned the mission to develop GA optimizers to optimize antenna design.If anyone find it of interest,could you discuss with me at haidt102@yahoo.com

Thanks in advance

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top