Plotting figures and setting orientation for a waveguide in pyaedt HFSS

Options
Otty80
Otty80 Member Posts: 7
First Comment

Hi,

I need to improve waveguide simulation by plotting |s21| and port phase different (pref. in Matlab), setting a customized orientation view with theta, psi, phi=90,90,0, and by using hfss.plot (or in an alternative way) saving different views( isometric, customized, ...) in different files

This is the code I need to improve:

from pyaedt import Hfss

from pyaedt import Desktopd = Desktop(non_graphical=False, new_desktop_session=False, student_version=True)

hfss = Hfss(solution_type="DrivenModal")hfss["a"] = "20mm"hfss["b"] = "10mm"hfss["l"] = "75mm"

#WAVEGUIDE

air=hfss.modeler.create_box(["0","0","0"], ["a","b","l"],"waveguide","vacuum")

hfss.modeler.fit_all()s1=hfss.modeler.create_object_from_face(air.bottom_face_z)

s1.name=’p1’

p1=hfss.create_wave_port_from_sheet(s1,portname="1") s2=hfss.modeler.create_object_from_face(air.top_face_z)

s2.name=’p2’

p2=hfss.create_wave_port_from_sheet(s2,portname="2")

########## Apply a customized Orientation view with theta, psi, phi=90,90,0########

hfss.modeler.fit_all()

setup = hfss.create_setup("MySetup")

setup.props["Frequency"] = "10GHz"

setup.props["MaximumPasses"] = 20

hfss.create_linear_count_sweep(

  setupname=setup.name,

  unit="GHz",

  freqstart=8,

  freqstop=11,

  num_of_freq_points=451,

  sweepname="sweep",

  sweep_type="Interpolating",

  interpolation_tol=3,

  interpolation_max_solutions=50,

  save_fields=False,

)

########## PLOT |S21| AND PHASE DIFFERENT BETWEEN port 1 and 2 (creating figures in Matlab) #####

#####Using hfss.plot to save figures with different views (trimeric, xy, customized,...)


hfss.analyze_setup("MySetup")

hfss.close_project()

d.release_desktop()