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

New array class #3850

Merged
merged 76 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
a9e7ef8
First array class commit
Samuelopez-ansys Oct 16, 2023
aa5b5d3
Array class first properties
Samuelopez-ansys Oct 17, 2023
6a1b289
Add array properties
Samuelopez-ansys Oct 19, 2023
be712a4
Merge branch 'main' into new_array_class
Samuelopez-ansys Oct 19, 2023
6a0fe1d
Add coordinate system
Samuelopez-ansys Oct 23, 2023
069f38a
Merge branch 'main' into new_array_class
Samuelopez-ansys Oct 23, 2023
81c32cd
Merge branch 'main' into new_array_class
Samuelopez-ansys Oct 30, 2023
52949e3
Array parser
Samuelopez-ansys Oct 31, 2023
1d49d4e
Edit Array implementation
Samuelopez-ansys Oct 31, 2023
5ce62b2
Cells property
Samuelopez-ansys Oct 31, 2023
dfb129c
Merge branch 'main' into new_array_class
Samuelopez-ansys Nov 2, 2023
68484a5
Add empty cell
Samuelopez-ansys Nov 3, 2023
bb3aa9a
Add empty cell
Samuelopez-ansys Nov 3, 2023
bf82a57
Create array
Samuelopez-ansys Nov 3, 2023
4f36620
Unit test and documentation
Samuelopez-ansys Nov 6, 2023
b0b7c45
Unit test and documentation
Samuelopez-ansys Nov 6, 2023
aaf55aa
Merge branch 'main' into new_array_class
Samuelopez-ansys Nov 6, 2023
ebc15f6
Fix codacy
Samuelopez-ansys Nov 6, 2023
7cddc74
Fix codecov
Samuelopez-ansys Nov 6, 2023
23c134c
Fix tests
Samuelopez-ansys Nov 6, 2023
e6ae464
Fix codacy
Samuelopez-ansys Nov 6, 2023
fac3161
Merge remote-tracking branch 'origin/main' into new_array_class
Samuelopez-ansys Nov 7, 2023
b1bb414
Update pyaedt/hfss.py
Samuelopez-ansys Nov 7, 2023
404f5e6
Merge remote-tracking branch 'origin/new_array_class' into new_array_…
Samuelopez-ansys Nov 7, 2023
0bf361e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 7, 2023
81ccd77
Fix comment
Samuelopez-ansys Nov 7, 2023
018d447
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
be7a9de
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
3b35a63
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
0468577
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
3603173
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
51a88ab
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
acf78d8
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
9f4b8d0
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
c6b5b8a
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
0ec7e95
Merge remote-tracking branch 'origin/new_array_class' into new_array_…
Samuelopez-ansys Nov 7, 2023
8b3b566
Fix comment
Samuelopez-ansys Nov 7, 2023
6b7357e
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
fa1899f
Merge remote-tracking branch 'origin/new_array_class' into new_array_…
Samuelopez-ansys Nov 7, 2023
f91c061
Fix export_array_info
Samuelopez-ansys Nov 7, 2023
c877393
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
ae3f150
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
eb1e2a8
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
ad0d6e9
Fix comments
Samuelopez-ansys Nov 7, 2023
778d55b
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
efbefa5
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
43ef02d
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
1612e34
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
d06b462
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
be8e80f
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
6f1ef3b
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
bad2c67
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
f346b06
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
59bac5f
Merge remote-tracking branch 'origin/new_array_class' into new_array_…
Samuelopez-ansys Nov 7, 2023
042da37
Fix comments
Samuelopez-ansys Nov 7, 2023
6e55bfb
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 7, 2023
8655917
Fix comments
Samuelopez-ansys Nov 7, 2023
b0eeb6e
Merge remote-tracking branch 'origin/new_array_class' into new_array_…
Samuelopez-ansys Nov 7, 2023
4fbe078
Merged Sebastien refactoring
Samuelopez-ansys Nov 7, 2023
50839ea
Fix typo
Samuelopez-ansys Nov 7, 2023
3899508
Merge branch 'main' into new_array_class
Samuelopez-ansys Nov 7, 2023
7a7171e
Fix codacy
Samuelopez-ansys Nov 7, 2023
8f714ac
Merge remote-tracking branch 'origin/new_array_class' into new_array_…
Samuelopez-ansys Nov 7, 2023
24246d0
Add getitem method
Samuelopez-ansys Nov 7, 2023
3c2c733
Add getitem method
Samuelopez-ansys Nov 7, 2023
315445d
Add getitem method
Samuelopez-ansys Nov 7, 2023
a3ae7db
Merge branch 'main' into new_array_class
Samuelopez-ansys Nov 7, 2023
7edd9e2
Fix component dictionary
Samuelopez-ansys Nov 7, 2023
27d784f
Merge remote-tracking branch 'origin/new_array_class' into new_array_…
Samuelopez-ansys Nov 7, 2023
3211d5a
Merge branch 'main' into new_array_class
Samuelopez-ansys Nov 7, 2023
6aff7b7
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 8, 2023
93b5dfc
Update pyaedt/modeler/cad/component_array.py
Samuelopez-ansys Nov 8, 2023
5f00506
Add Sebastien comments
Samuelopez-ansys Nov 8, 2023
0aab1e3
Merge remote-tracking branch 'origin/new_array_class' into new_array_…
Samuelopez-ansys Nov 8, 2023
647a370
Merge branch 'main' into new_array_class
Samuelopez-ansys Nov 8, 2023
b9dc8c6
Add TODO comment
Samuelopez-ansys Nov 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15,602 changes: 15,602 additions & 0 deletions _unittest/example_models/T20/Array_232.aedt

Large diffs are not rendered by default.

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions _unittest/example_models/T20/array_info.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
ArrayName,A1
Size Along A Vector,8
Size Along B Vector,8
A Vector,02_Patch1_LatticePair1
B Vector,02_Patch1_LatticePair2
Component Index,Component Name
1,02_Patch1
2,01_Metal_Only1
3,03_Radome_Side1
4,Radome_Corner1
Source Row,Source Column,Source Name,Magnitude,Phase
3,3,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (2*ScanPhaseShiftA + 2*ScanPhaseShiftB)
3,4,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (2*ScanPhaseShiftA + 3*ScanPhaseShiftB)
3,5,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (2*ScanPhaseShiftA + 4*ScanPhaseShiftB)
3,6,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (2*ScanPhaseShiftA + 5*ScanPhaseShiftB)
4,3,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (3*ScanPhaseShiftA + 2*ScanPhaseShiftB)
4,4,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (3*ScanPhaseShiftA + 3*ScanPhaseShiftB)
4,5,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (3*ScanPhaseShiftA + 4*ScanPhaseShiftB)
4,6,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (3*ScanPhaseShiftA + 5*ScanPhaseShiftB)
5,3,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (4*ScanPhaseShiftA + 2*ScanPhaseShiftB)
5,4,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (4*ScanPhaseShiftA + 3*ScanPhaseShiftB)
5,5,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (4*ScanPhaseShiftA + 4*ScanPhaseShiftB)
5,6,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (4*ScanPhaseShiftA + 5*ScanPhaseShiftB)
6,3,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (5*ScanPhaseShiftA + 2*ScanPhaseShiftB)
6,4,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (5*ScanPhaseShiftA + 3*ScanPhaseShiftB)
6,5,02_Patch1_1:1,ScanMag1*1,ScanPhase1 + (5*ScanPhaseShiftA + 4*ScanPhaseShiftB)
Array,Format: Component_index:Rotation_angle:Active_or_Passive
4,3,3,3,3,3,3,4:90.0deg,
3:270.0deg,2,2,2,2,2,2,3:90.0deg,
3:270.0deg,2:0,1,1,1,1,2,3:90.0deg,
3:270.0deg,2,1,1,1,1,2,3:90.0deg,
3:270.0deg,2,1,1,1,1,2,3:90.0deg:0,
3:270.0deg,2,1,1,1,1:0,2,,
3:270.0deg,2,2,,2,2,2,3:90.0deg,
4:270.0deg,3:180.0deg,3:180.0deg,,3:180.0deg,3:180.0deg,3:180.0deg,4:180.0deg,
44 changes: 44 additions & 0 deletions _unittest/example_models/T20/array_simple_232.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"primarylattice": "Circ_Patch_5GHz_232_1_Primary1",
"secondarylattice": "Circ_Patch_5GHz_232_1_Primary2",
"useairobjects": true,
"rowdimension": 3,
"columndimension": 3,
"visible": false,
"showcellnumber": false,
"paddingcells": 0,
"referencecsid": 1,
"cells": {
"(1,1)": {
"name": "Circ_Patch_5GHz_232_1",
"color": "(255,0,20)",
"active": true,
"postprocessing": true,
"rotation": 0.0
},
"(1,2)": {
"name": "Circ_Patch_5GHz_232_1"
},
"(1,3)": {
"name": "Circ_Patch_5GHz_232_1"
},
"(2,1)": {
"name": "Circ_Patch_5GHz_232_1"
},
"(2,2)": {
"name": "Circ_Patch_5GHz_232_1"
},
"(2,3)": {
"name": "Circ_Patch_5GHz_232_1"
},
"(3,1)": {
"name": "Circ_Patch_5GHz_232_1"
},
"(3,2)": {
"name": "Circ_Patch_5GHz_232_1"
},
"(3,3)": {
"name": "Circ_Patch_5GHz_232_1"
}
}
}
152 changes: 144 additions & 8 deletions _unittest/test_20_HFSS.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@
test_subfolder = "T20"

if config["desktopVersion"] > "2022.2":
component = "Circ_Patch_5GHz_232.a3dcomp"
else:
component = "Circ_Patch_5GHz.a3dcomp"

if config["desktopVersion"] > "2023.1":
diff_proj_name = "differential_pairs_231"
else:
diff_proj_name = "differential_pairs"

component_array = "Array_232"


@pytest.fixture(scope="class")
def aedtapp(add_app):
Expand Down Expand Up @@ -1257,16 +1264,32 @@ def test_51a_array(self):
self.aedtapp.insert_design("Array_simple", "Modal")
from pyaedt.generic.DataHandlers import json_to_dict

dict_in = json_to_dict(
os.path.join(local_path, "../_unittest/example_models", test_subfolder, "array_simple.json")
)
dict_in["Circ_Patch_5GHz1"] = os.path.join(
local_path, "../_unittest/example_models", test_subfolder, "Circ_Patch_5GHz.a3dcomp"
)
dict_in["cells"][(3, 3)] = {"name": "Circ_Patch_5GHz1"}
if config["desktopVersion"] > "2023.1":
dict_in = json_to_dict(
os.path.join(local_path, "../_unittest/example_models", test_subfolder, "array_simple_232.json")
)
dict_in["Circ_Patch_5GHz_232_1"] = os.path.join(
local_path, "../_unittest/example_models", test_subfolder, component
)
dict_in["cells"][(3, 3)] = {"name": "Circ_Patch_5GHz_232_1"}
else:
dict_in = json_to_dict(
os.path.join(local_path, "../_unittest/example_models", test_subfolder, "array_simple.json")
)
dict_in["Circ_Patch_5GHz1"] = os.path.join(
local_path, "../_unittest/example_models", test_subfolder, component
)
dict_in["cells"][(3, 3)] = {"name": "Circ_Patch_5GHz1"}

assert self.aedtapp.add_3d_component_array_from_json(dict_in)
array_name = self.aedtapp.component_array_names[0]
assert self.aedtapp.component_array[array_name].cells[2][2].rotation == 0
assert self.aedtapp.component_array_names
dict_in["cells"][(3, 3)]["rotation"] = 90
assert self.aedtapp.add_3d_component_array_from_json(dict_in)
component_array = self.aedtapp.add_3d_component_array_from_json(dict_in)
assert component_array.cells[2][2].rotation == 90
component_array.cells[2][2].rotation = 0
assert component_array.cells[2][2].rotation == 0

def test_51b_set_material_threshold(self):
assert self.aedtapp.set_material_threshold()
Expand Down Expand Up @@ -1470,3 +1493,116 @@ def test_64_import_dxf(self):
dxf_layers = self.aedtapp.get_dxf_layers(dxf_file)
assert isinstance(dxf_layers, list)
assert self.aedtapp.import_dxf(dxf_file, dxf_layers)

def test_65_component_array(self, add_app):
hfss_array = add_app(project_name=component_array, subfolder=test_subfolder)
assert len(hfss_array.component_array) == 1

array = hfss_array.component_array["A1"]
assert array.name == hfss_array.component_array_names[0]

cell1 = array.get_cell(1, 1)
cell2 = array[1, 1]
assert cell2
assert cell1.rotation == 0

assert not array.get_cell(0, 0)
assert not array.get_cell(10, 0)

lc = array.lattice_vector()
assert len(lc) == 6

assert len(array.component_names) == 4

assert len(array.post_processing_cells) == 4
post_cells = array.post_processing_cells
post_cells["Radome_Corner1"] = [8, 1]
array.post_processing_cells = post_cells
assert array.post_processing_cells["Radome_Corner1"] == [8, 1]

array.cells[0][1].component = None
assert not array.cells[0][1].component

array.cells[1][1].rotation = 90
assert array.cells[1][1].rotation == 90

array.cells[1][1].rotation = 10
assert not array.cells[1][1].rotation == 10

array.cells[1][1].is_active = False
array.cells[1][1].is_active = 1
assert not array.cells[1][1].is_active

assert array.cells[1][2].component == array.component_names[2]
assert not array.cells[1][2].component == "test"

array.cells[0][1].component = array.component_names[3]
assert array.cells[0][1].component == array.component_names[3]

hfss_array.component_array["A1"].name = "Array_new"
assert hfss_array.component_array_names[0] == "Array_new"
hfss_array.component_array["Array_new"].name = "A1"

omodel = hfss_array.get_oo_object(hfss_array.odesign, "Model")
oarray = hfss_array.get_oo_object(omodel, "A1")

assert array.visible
array.visible = False
assert not oarray.GetPropValue("Visible")
array.visible = True
assert oarray.GetPropValue("Visible")

assert array.show_cell_number
array.show_cell_number = False
assert not oarray.GetPropValue("Show Cell Number")
array.show_cell_number = True
assert oarray.GetPropValue("Show Cell Number")

assert array.render == "Shaded"
array.render = "Wireframe"
assert oarray.GetPropValue("Render") == "Wireframe"
array.render = "Shaded"
assert oarray.GetPropValue("Render") == "Shaded"
array.render = "Shaded1"
assert not array.render == "Shaded1"

a_choices = array.a_vector_choices
assert array.a_vector_name in a_choices
array.a_vector_name = a_choices[0]
assert oarray.GetPropValue("A Vector") == a_choices[0]
array.a_vector_name = "Test"
assert not array.a_vector_name == "Test"

b_choices = array.b_vector_choices
assert array.b_vector_name in b_choices
array.b_vector_name = b_choices[1]
assert oarray.GetPropValue("B Vector") == b_choices[1]
array.b_vector_name = "Test"
assert not array.b_vector_name == "Test"

assert array.a_size == 8

assert array.b_size == 8

assert array.padding_cells == 0
array.padding_cells = 2
assert oarray.GetPropValue("Padding") == "2"
array.padding_cells = 0

assert array.coordinate_system == "Global"
array.coordinate_system = "Corner"
array.coordinate_system = "Global"

array_csv = os.path.join(local_path, "../_unittest/example_models", test_subfolder, "array_info.csv")
array_info = array.parse_array_info_from_csv(array_csv)
assert len(array_info) == 4
assert array_info["component"][1] == "02_Patch1"

# Delete 3D Component
hfss_array.modeler.user_defined_components["03_Radome_Side1"].delete()
array.update_properties()
assert len(array.component_names) == 3
assert len(array.post_processing_cells) == 3

array.delete()
assert not hfss_array.component_array
Loading
Loading