Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: HFSS Setup error #5618 #5619

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
3 changes: 2 additions & 1 deletion src/ansys/aedt/core/application/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,8 @@

if setup_type is None:
setup_type = self.design_solutions.default_setup
name = self.generate_unique_setup_name(name)
if not name or name in self.setup_names:
name = self.generate_unique_setup_name(name)

Check warning on line 1359 in src/ansys/aedt/core/application/analysis.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/application/analysis.py#L1358-L1359

Added lines #L1358 - L1359 were not covered by tests
if setup_type == 0:
setup = SetupHFSSAuto(self, setup_type, name)
elif setup_type == 4:
Expand Down
8 changes: 4 additions & 4 deletions src/ansys/aedt/core/application/design_solutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,31 +342,31 @@
"name": "HFSS Modal Network",
"options": None,
"report_type": "Modal Solution Data",
"default_setup": 1,
"default_setup": 0,
"default_adaptive": "LastAdaptive",
"intrinsics": ["Freq", "Phase"],
},
"Terminal": {
"name": "HFSS Terminal Network",
"options": None,
"report_type": "Terminal Solution Data",
"default_setup": 1,
"default_setup": 0,
"default_adaptive": "LastAdaptive",
"intrinsics": ["Freq", "Phase"],
},
"DrivenModal": {
"name": "DrivenModal",
"options": None,
"report_type": "Modal Solution Data",
"default_setup": 1,
"default_setup": 0,
"default_adaptive": "LastAdaptive",
"intrinsics": ["Freq", "Phase"],
},
"DrivenTerminal": {
"name": "DrivenTerminal",
"options": None,
"report_type": "Terminal Solution Data",
"default_setup": 1,
"default_setup": 0,
"default_adaptive": "LastAdaptive",
"intrinsics": ["Freq", "Phase"],
},
Expand Down
5 changes: 2 additions & 3 deletions src/ansys/aedt/core/hfss.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,11 +809,10 @@ def create_setup(self, name="MySetupAuto", setup_type=None, **kwargs):
Name of the setup. The default is ``"Setup1"``.
setup_type : str, optional
Type of the setup, which is based on the solution type. Options are
``"HFSSDrivenAuto"``, ``"HFSSDrivenDefault"``, ``"HFSSEigen"``, ``"HFSSTransient"``,
``"HFSSDrivenAuto"``, ``"HFSSDriven"``, ``"HFSSEigen"``, ``"HFSSTransient"``,
and ``"HFSSSBR"``. The default is ``"HFSSDrivenAuto"``.
**kwargs : dict, optional
Extra arguments to set up the circuit.
Available keys depend on the setup chosen.
Keyword arguments from the native AEDT API.
For more information, see
:doc:`../SetupTemplatesHFSS`.

Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/modules/setup_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def HFSS3DLayout_AdaptiveFrequencyData(freq):


meshlink = dict({"ImportMesh": False})
autosweep = dict({"RangeType": "LinearStep", "RangeStart": "1GHz", "RangeEnd": "10GHz", "RangeStep": "1GHz"})
autosweep = dict({"RangeType": "LinearCount", "RangeStart": "1GHz", "RangeEnd": "10GHz", "RangeCount": "501"})
autosweeps = dict({"Sweep": autosweep})
multifreq = dict({"1GHz": [0.02], "2GHz": [0.02], "5GHz": [0.02]})
sweepsbr = dict({"RangeType": "LinearStep", "RangeStart": "1GHz", "RangeEnd": "10GHz", "RangeStep": "1GHz"})
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/workflows/hfss/choke_designer.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@
hfss.modeler.create_region(pad_percent=1000)

# Create setup
setup = hfss.create_setup("Setup1")
setup = hfss.create_setup("Setup1", setup_type="HFSSDriven")

Check warning on line 462 in src/ansys/aedt/core/workflows/hfss/choke_designer.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/workflows/hfss/choke_designer.py#L462

Added line #L462 was not covered by tests
setup.props["Frequency"] = "50MHz"
setup.props["MaximumPasses"] = 10

Expand Down
14 changes: 13 additions & 1 deletion tests/system/general/test_20_HFSS.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,19 @@ def test_01_save(self):
assert os.path.exists(test_project)

def test_01A_check_setup(self):
assert self.aedtapp.active_setup is None
# Use the built-in Waveguide Tee example.
filter_fn = os.path.join("Examples", "HFSS", "Filters", "ceramic_monoblock_MMDS_Band.aedt")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Devin-Crawford I think this is dangerous because the name of the example could change from different versions. I would create a dummy project if this is really needed, and add it to PyAEDT.

filter_fn = os.path.join(self.aedtapp.desktop_install_dir, filter_fn)
self.aedtapp.copy_design_from(filter_fn, "3pole_monoblock")
self.aedtapp.design_name = "3pole_monoblock"
assert self.aedtapp.setups[0].props["Name"] == "Setup_5GNR_Band_N41"
setup_auto = self.aedtapp.create_setup(name="auto")
assert self.aedtapp.setups[1].name == "auto"
assert setup_auto.properties["Auto Solver Setting"] == "Balanced"
assert setup_auto.properties["Type"] == "Discrete"
setup_auto.props["Type"] = "Interpolating"
assert setup_auto.props["Type"] == "Interpolating"
assert setup_auto["sweeps"]["Sweep"]["RangeType"] == "LinearCount"

def test_02_create_primitive(self):
coax1_len = 200
Expand Down
17 changes: 11 additions & 6 deletions tests/system/solvers/test_00_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,12 @@ def test_02_hfss_export_results(self, hfss_app):
hfss_app.add_3d_component_array_from_json(dict_in)
exported_files = hfss_app.export_results()
assert len(exported_files) == 0
setup = hfss_app.create_setup(name="test")
setup.props["Frequency"] = "1GHz"
setup_driven = hfss_app.create_setup(name="test", setup_type="HFSSDriven", MaximumPasses=1)
exported_files = hfss_app.export_results()
solve_freq = setup_driven.props["Frequency"]
assert len(exported_files) == 0
hfss_app.analyze_setup(name="test", cores=4)
assert setup_driven.is_solved
exported_files = hfss_app.export_results()
assert len(exported_files) == 39
exported_files = hfss_app.export_results(
Expand All @@ -215,25 +216,29 @@ def test_02_hfss_export_results(self, hfss_app):
assert len(exported_files) > 0
fld_file1 = os.path.join(self.local_scratch.path, "test_fld_hfss1.fld")
assert hfss_app.post.export_field_file(
quantity="Mag_E", output_file=fld_file1, assignment="Box1", intrinsics="1GHz", phase="5deg"
quantity="Mag_E", output_file=fld_file1, assignment="Box1", intrinsics=solve_freq, phase="5deg"
)
assert os.path.exists(fld_file1)
fld_file2 = os.path.join(self.local_scratch.path, "test_fld_hfss2.fld")
assert hfss_app.post.export_field_file(
quantity="Mag_E", output_file=fld_file2, assignment="Box1", intrinsics={"frequency": "1GHz"}
quantity="Mag_E", output_file=fld_file2, assignment="Box1", intrinsics={"frequency": solve_freq}
)
assert os.path.exists(fld_file2)
fld_file2 = os.path.join(self.local_scratch.path, "test_fld_hfss3.fld")
assert hfss_app.post.export_field_file(
quantity="Mag_E",
output_file=fld_file2,
assignment="Box1",
intrinsics={"frequency": "1GHz", "phase": "30deg"},
intrinsics={"frequency": solve_freq, "phase": "30deg"},
)
assert os.path.exists(fld_file2)
fld_file2 = os.path.join(self.local_scratch.path, "test_fld_hfss4.fld")
assert hfss_app.post.export_field_file(
quantity="Mag_E", output_file=fld_file2, assignment="Box1", intrinsics={"frequency": "1GHz"}, phase="30deg"
quantity="Mag_E",
output_file=fld_file2,
assignment="Box1",
intrinsics={"frequency": solve_freq},
phase="30deg",
)
assert os.path.exists(fld_file2)
fld_file2 = os.path.join(self.local_scratch.path, "test_fld_hfss5.fld")
Expand Down
Loading