mathlab hfss
Hi,
This is the famous HFSS-API. It works well with HFSS9x. You could just follow these examples, and adapt them to HFSS11.
Have fun!
very useful!!!
hi couless
thanks for your kindness,
but i found that the script.pdf file you uploaded is the same as my own.
ansoft didn't update their this file correctly.
the outputvariable script has been deprecated as indicated in HFSS, although it still works.
i try to implement an API to export the network parameters, such as S,Y,Z,Gamma,Zo, just like the built-in script "oModule.ExportNetworkData"
but I can only export the results of the first frequency point, the later ones are all outflow, i don't know why
abc
i try to optim antenna using PSO with HFSS
You can implement an API to create a report and extract its data. I did it and it worked.
Did you build a function which can report Gain of antenna? Can you upload this function? Thanks :)
This post has not been active for some time, but I haven't seen this information mentioned elsewhere; I will post it in the hopes that it is useful for someone.
Instead of generating VBscript code as text, writing it to a file, then executing in HFSS as the oft-mentioned MATLAB-HFSS api operates, the current version of MATLAB supports COM objects directly. This means that Matlab scripts and functions can be created to directly execute and control HFSS live, without the delay caused by generating and executing a script. This is very handy for debugging purposes and the original design of the scripts.
(Note - I don't know which versions of Matlab support COM objects. I feel as though it is a relatively new feature ( I use R2009a ), but I don't remember.)
(Another note - since the real interface is the collection of COM objects and the methods that they implement, any programming language/framework that supports COM interop would work to control HFSS, not only Matlab and VBscript)
All of the same objects and function calls as the VBscript version will apply. The only difference between the vbscript and the Matlab version of the interface is different calling semantics.
For example: Where the vbscript uses an Array(...) in a method signature, use a cell array {..} in matlab. Use single quotes instead of double quotes. Wrap all of the arguments to the functions in parentheses, unlike the VB convention. Boolean values in matlab to be passed to HFSS functions can be either in Matlab booleans (true, false), or in string format ('true','false').
Here are some examples of how to translate between VB to matlab:
The setup code is nearly the same:
hfss = actxserver('AnsoftHfss.HfssScriptInterface'); desktop = hfss.GetAppDesktop(); project = desktop.GetActiveProject(); design = project.GetActiveDesign(); editor = design.SetActiveEditor('3D Modeler'); boundary = design.GetModule('BoundarySetup');
%name = HFSSBox(editor,name,position,size,varargin) %name/value parameters: Material, Color, SolveInside,Transparency function var = HFSSBox(editor,name,position,size,varargin) p = inputParser; p.addParamValue('Material','pec'); p.addParamValue('Color','(132 132 193)'); p.addParamValue('SolveInside',false); p.addParamValue('Transparency',0); p.parse(varargin{:}); mm = @(x)sprintf('%0.4fmm',x); var = editor.CreateBox({'NAME:BoxParameters','CoordinateSystemID:=',-1,... 'XPosition:=',mm(position(1)),'YPosition:=',mm(position(2)),'ZPosition:=',mm(position(3)),... 'XSize:=',mm(size(1)),'YSize:=',mm(size(2)),'ZSize:=',mm(size(3))},... {'NAME:Attributes','Name:=',name,'Flags:=','','MaterialName:=',p.Results.Material,... 'SolveInside:=',false,'Color:=',p.Results.Color,'Transparency:=',p.Results.Transparency,... 'PartCoordinateSystem:=','global'}); end
%HFSSMove(editor,name,vector) %Arguments: % editor: HFSS Editor COM object % name: Name of object to be moved % vector: [x,y,z] movement vector. function HFSSMove(editor,name,vector) error(nargchk(3,3,nargin,'struct')); mm = @(x)sprintf('%0.4fmm',x); editor.Move({'NAME:Selections','Selections:=',name},{'NAME:TranslateParameters',... 'TranslateVectorX:=',mm(vector(1)),'TranslateVectorY:=',mm(vector(2)),... 'TranslateVectorZ:=',mm(vector(3))}); end
There is no easy way of optimizing antenna structure using your own generic algorithm in Matlab.I have successfully modelled and simulated my antenna structure in HFSS.Now i just want to Export this structure to Matlab so i can optimize it using some generic algorithm e.g PSO algorithm. There is no way or File format in which we can export the structure to matlab from HFSS.Is it a must to use VBS scripting language for this purpose and there is no other way???
Do you know any method that can save HFSS result by Matlab?
I executed Eigenmode calculation in HFSS controlled by Matlab code as follows.
oAnsoftApp=actxserver('AnsoftHfss.HfssScriptInterface.12'); oDesktop=oAnsoftApp.GetAppDesktop; oProject=oDesktop.NewProject; oDesign=oProject.InsertDesign('HFSS', 'HFSSDesign1','DrivenModal', ''); oEditor=oDesign.SetActiveEditor('3D Modeler'); ........... oDesign.Analyze('Setup1');
I made codes as follows but error message appears.
oSolutions=oDesign.GetModule('Solutions'); invoke(oSolutions,'ExportEigenmodes','Setup1', '', 'C:\Documents and Settings\sh\My Documents\Ansoft\eig1.eig')
What is the error message? Remember to check the HFSS error console for more detailed error messages than appear in the Matlab terminal.
Most of the data export to file commands can be found in the script recorder and translated to Matlab. I haven't used this function, however, so I would need to have a better idea of the error message to be of any more assistance.
Another resource is to look in the HFSS scripting help documentation for the function you are working with. Their example code for this function:
Set oModule = oDesign.GetModule("Solutions") oModule.ExportEigenmodes "Setup1 : LastAdaptive", "", _ "C:\mydir\myeigenmode" & _ ".eig"
Hello Isilb,
I'm working on designing a patch array antenna using HFSS and I want to ingrate SPST switch to make short and long range. Do you have any idea how to implement this? I'm a newbie and I just started working on it.
Thanks,
Hello; has someone a book about this prob? thanks.
The program is useful for me.After read it,I know how to use it!
hii..
im new to hfss.rght now im learing how to write the files i mean only some files are there relted to matlab hfss api.so i need the steps how to run it.
i know the commands but im not understanding to generate it.
can u please help me
samyuk!
I am also having the same problem. Have you found the solution? Or can anyone tell us how to do it?
---------- Post added at 07:50 ---------- Previous post was at 07:29 ----------
I am having this error, when I run code in MATLAB
First it says
The Initial Dipole Length is 1.00 meter ...
Running iteration #1 ...
Creating the Script File ...
then it says
??? Error using ==> fprintf
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in ==> hfssNewProject at 36
fprintf(fid, 'Dim oHfssApp\n');
Error in ==> example_antenna at 61
hfssNewProject(fid);