%vlnovod v HFSS
clear all; close all; clc;

global fid Module Design Desktop;
% Namapovani cest k dodatecnym souborum.
addpath('../3D modeler/');
addpath('../analysis/');
addpath('../general/');
addpath('../boundary/');
addpath('../other/');

% Adresa docasneho souboru temp.
tempScriptFileHfss = 'C:/hfss_temp/tmpDataHfss.m';

%Nazev ukladaneho souboru xxx.hfss
hfssSkriptTemp = 'C:/hfss_temp/pokus.hfss';

%parametry vlnovodu
a=10; %sirka
b=70; %vyska
l=50; %delka

% Vytvoreni docasneho m-file.
fid = fopen(tempScriptFileHfss, 'wt');
%--------------------------------------------------------------------------
HfssNewProject(fid);
HfssInsertDesign(fid,'Muj_vln');
HfssBox(fid,'vlnovod','Vacuum',[0,0,0],[a,b,l],'mm');
hfssAssignMaterial(fid, 'vlnovod', 'pec');
HfssBox(fid,'vzduch','vacuum',[1,1,0],[a-2,b-2,l],'mm');
HfssSubtract(fid,'vlnovod','vzduch');
HfssBox(fid,'airvol','air',[0,0,0],[a,b,l],'mm');
HfssRectangle(fid, 'Port1', 'Z', [0,0,0], a, b, 'mm');
HfssAssignWavePort(fid,'P1','Port1',[0,0,0],[a,b,0],'mm');
HfssRectangle(fid, 'Port2', 'Z', [0,0,l], a, b, 'mm');
HfssAssignWavePort(fid,'P2','Port2',[0,0,l],[a,b,l],'mm');
HfssInsertSolution(fid,'Setup10GHz',10,0.02,25);
HfssInterpolatingSweep(fid,'sweep1to10GHz','Setup10GHz',1,10, 1000, 101, 0.5);
HfssSolveSetup(fid, 'Setup10GHz');
