|
1 |
| -""" |
2 |
| -General: optimetrics setup |
3 |
| --------------------------- |
4 |
| -This example shows how you can use PyAEDT to create a project in HFSS and create all optimetrics setups. |
5 |
| -""" |
6 |
| - |
7 |
| -############################################################################### |
8 |
| -# Perform required imports |
9 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1 | +# # General: optimetrics setup |
| 2 | +# |
| 3 | +# This example shows how you can use PyAEDT to create a project in HFSS and create all optimetrics setups. |
| 4 | + |
| 5 | + |
| 6 | +# ## Perform required imports |
| 7 | +# |
10 | 8 | # Perform required imports.
|
11 | 9 |
|
12 | 10 | import pyaedt
|
13 | 11 |
|
14 | 12 | import os
|
15 | 13 |
|
16 |
| -############################################################################### |
17 |
| -# Set non-graphical mode |
18 |
| -# ~~~~~~~~~~~~~~~~~~~~~~ |
| 14 | +# ## Set non-graphical mode |
| 15 | +# |
19 | 16 | # Set non-graphical mode.
|
20 | 17 | # You can set ``non_graphical`` either to ``True`` or ``False``.
|
21 | 18 |
|
22 | 19 | non_graphical = False
|
23 | 20 |
|
24 |
| -############################################################################### |
25 |
| -# Initialize object and create variables |
26 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 21 | +# ## Initialize object and create variables |
| 22 | +# |
27 | 23 | # Initialize the ``Hfss`` object and create two needed design variables,
|
28 | 24 | # ``w1`` and ``w2``.
|
29 | 25 |
|
30 | 26 | hfss = pyaedt.Hfss(specified_version="2023.2", new_desktop_session=True, non_graphical=non_graphical)
|
31 | 27 | hfss["w1"] = "1mm"
|
32 | 28 | hfss["w2"] = "100mm"
|
33 | 29 |
|
34 |
| -############################################################################### |
35 |
| -# Create waveguide with sheets on it |
36 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 30 | +# ## Create waveguide with sheets on it |
| 31 | +# |
37 | 32 | # Create one of the standard waveguide structures and parametrize it.
|
38 | 33 | # You can also create rectangles of waveguide openings and assign ports later.
|
39 | 34 |
|
|
51 | 46 | model.show_grid = False
|
52 | 47 | model.plot(os.path.join(hfss.working_directory, "Image.jpg"))
|
53 | 48 |
|
54 |
| -############################################################################### |
55 |
| -# Create wave ports on sheets |
56 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
57 | 49 | # Create two wave ports on the sheets.
|
58 | 50 |
|
59 | 51 | hfss.wave_port(p1, integration_line=hfss.AxisDir.ZPos, name="1")
|
60 | 52 | hfss.wave_port(p2, integration_line=hfss.AxisDir.ZPos, name="2")
|
61 | 53 |
|
62 |
| -############################################################################### |
63 |
| -# Create setup and frequency sweep |
64 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 54 | +# ## Create setup and frequency sweep |
| 55 | +# |
65 | 56 | # Create a setup and a frequency sweep to use as the base for optimetrics
|
66 | 57 | # setups.
|
67 | 58 |
|
|
70 | 61 | setupname=setup.name, unit="GHz", freqstart=1, freqstop=5, step_size=0.1, sweepname="Sweep1", save_fields=True
|
71 | 62 | )
|
72 | 63 |
|
73 |
| -############################################################################### |
74 |
| -# Optimetrics analysis |
75 |
| -# ---------------------- |
76 |
| -# Create parametrics analysis |
77 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 64 | +# ## Optimetrics analysis |
| 65 | +# |
| 66 | +# ### Parametric Analysis |
| 67 | +# |
78 | 68 | # Create a simple optimetrics parametrics analysis with output calculations.
|
79 | 69 |
|
80 | 70 | sweep = hfss.parametrics.add("w2", 90, 200, 5)
|
81 | 71 | sweep.add_variation("w1", 0.1, 2, 10)
|
82 | 72 | sweep.add_calculation(calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"})
|
83 | 73 | sweep.add_calculation(calculation="dB(S(1,1))", ranges={"Freq": "2.6GHz"})
|
84 | 74 |
|
85 |
| -############################################################################### |
86 |
| -# Create sensitivity analysis |
87 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
88 | 75 | # Create an optimetrics sensitivity analysis with output calculations.
|
89 | 76 |
|
90 | 77 | sweep2 = hfss.optimizations.add(calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}, optim_type="Sensitivity")
|
91 | 78 | sweep2.add_variation("w1", 0.1, 3, 0.5)
|
92 | 79 | sweep2.add_calculation(calculation="dB(S(1,1))", ranges={"Freq": "2.6GHz"})
|
93 | 80 |
|
94 |
| -############################################################################### |
95 |
| -# Create optimization based on goals and calculations |
96 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
97 | 81 | # Create an optimization analysis based on goals and calculations.
|
98 | 82 |
|
99 | 83 | sweep3 = hfss.optimizations.add(calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"})
|
|
106 | 90 | condition="Maximize",
|
107 | 91 | )
|
108 | 92 |
|
109 |
| -############################################################################### |
110 |
| -# Create DX optimization based on a goal and calculation |
111 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
112 | 93 | # Create a DX (DesignXplorer) optimization based on a goal and a calculation.
|
113 | 94 |
|
114 | 95 | sweep4 = hfss.optimizations.add(calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}, optim_type="DesignExplorer")
|
115 | 96 | sweep4.add_goal(calculation="dB(S(1,1))", ranges={"Freq": "2.6GHz"})
|
116 | 97 |
|
117 |
| -############################################################################### |
118 |
| -# Create DOE based on a goal and calculation |
119 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 98 | +# ## Create DOE based on a goal and calculation |
| 99 | +# |
120 | 100 | # Create a DOE (Design of Experiments) based on a goal and a calculation.
|
121 | 101 |
|
122 | 102 | sweep5 = hfss.optimizations.add(calculation="dB(S(1,1))", ranges={"Freq": "2.5GHz"}, optim_type="DXDOE")
|
123 | 103 |
|
124 |
| -############################################################################### |
125 |
| -# Create DOE based on a goal and calculation |
126 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 104 | +# ## Create DOE based on a goal and calculation |
| 105 | +# |
127 | 106 | # Create a DOE based on a goal and a calculation.
|
128 | 107 |
|
129 | 108 | region = hfss.modeler.create_region()
|
|
136 | 115 | context="Infinite_1",
|
137 | 116 | )
|
138 | 117 |
|
139 |
| -############################################################################### |
140 |
| -# Close AEDT |
141 |
| -# ---------- |
| 118 | +# ## Close AEDT |
| 119 | +# |
142 | 120 | # After the simulaton completes, you can close AEDT or release it using the
|
143 | 121 | # :func:`pyaedt.Desktop.release_desktop` method.
|
144 | 122 | # All methods provide for saving the project before closing.
|
|
0 commit comments