Initial matlab interface

pull/1/head
Thorsten Liebig 2010-03-22 23:15:04 +01:00
parent 4de33663ad
commit 962fe5ee94
5 changed files with 60 additions and 0 deletions

7
matlab/InitFDTD.m Normal file
View File

@ -0,0 +1,7 @@
function FDTD = InitFDTD(NrTS, endCrit)
FDTD.ATTRIBUTE.NumberOfTimesteps=NrTS;
FDTD.ATTRIBUTE.endCriteria=endCrit;

8
matlab/SetBoundaryCond.m Normal file
View File

@ -0,0 +1,8 @@
function FDTD = SetBoundaryCond(FDTD,BC)
FDTD.BoundaryCond.ATTRIBUTE.xmin=BC(1);
FDTD.BoundaryCond.ATTRIBUTE.xmax=BC(2);
FDTD.BoundaryCond.ATTRIBUTE.ymin=BC(3);
FDTD.BoundaryCond.ATTRIBUTE.ymax=BC(4);
FDTD.BoundaryCond.ATTRIBUTE.zmin=BC(5);
FDTD.BoundaryCond.ATTRIBUTE.zmax=BC(6);

5
matlab/SetGaussExcite.m Normal file
View File

@ -0,0 +1,5 @@
function FDTD = SetGaussExcite(FDTD,f0,fc);
FDTD.Excitation.ATTRIBUTE.Type=0;
FDTD.Excitation.ATTRIBUTE.f0=f0;
FDTD.Excitation.ATTRIBUTE.fc=fc;

6
matlab/WriteOpenEMS.m Normal file
View File

@ -0,0 +1,6 @@
function WriteOpenEMS(filename, FDTD, CSX)
openEMS.FDTD=FDTD;
openEMS.ContinuousStructure=CSX;
xml_write(filename,openEMS);

34
matlab/examples/Helix.m Normal file
View File

@ -0,0 +1,34 @@
close all;
clear all;
clc
openEMS_Path = [pwd() '/../../']
openEMS_opts = '';
openEMS_opts = [openEMS_opts ' --disable-dumps'];
openEMS_opts = [openEMS_opts ' --debug-material'];
Sim_Path = 'tmp';
Sim_CSX = 'helix.xml';
mkdir(Sim_Path);
%setup FDTD parameter
FDTD = InitFDTD(1000,1e-6);
FDTD = SetGaussExcite(FDTD,0.5e9,0.5e9);
BC = [1 1 1 1 1 1];
FDTD = SetBoundaryCond(FDTD,BC);
%setup CSXCAD geometry
CSX = [];
%Write openEMS compatoble xml-file
WriteOpenEMS([Sim_Path '/' Sim_CSX],FDTD,CSX);
%cd to working dir and run openEMS
savePath = pwd();
cd(Sim_Path); %cd to working dir
command = [openEMS_Path 'openEMS ' openEMS_opts];
disp(command);
system(command)
cd(savePath);