Skip to content

Commit fd7c98c

Browse files
committed
assignment kwarg
1 parent 4348e5e commit fd7c98c

File tree

10 files changed

+278
-280
lines changed

10 files changed

+278
-280
lines changed

_unittest/test_27_Maxwell2D.py

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -49,34 +49,34 @@ def test_03_assign_initial_mesh_from_slider(self):
4949
assert self.aedtapp.mesh.assign_initial_mesh_from_slider(4)
5050

5151
def test_04_create_winding(self):
52-
bounds = self.aedtapp.assign_winding(faces=["Coil"], current=20e-3)
52+
bounds = self.aedtapp.assign_winding(assignment=["Coil"], current=20e-3)
5353
assert bounds
5454
o = self.aedtapp.modeler.create_rectangle([0, 0, 0], [3, 1], name="Rectangle2", matname="copper")
55-
bounds = self.aedtapp.assign_winding(faces=o.id, current=20e-3)
55+
bounds = self.aedtapp.assign_winding(assignment=o.id, current=20e-3)
5656
assert bounds
57-
bounds = self.aedtapp.assign_winding(faces=["Coil"], current="20e-3A")
57+
bounds = self.aedtapp.assign_winding(assignment=["Coil"], current="20e-3A")
5858
assert bounds
59-
bounds = self.aedtapp.assign_winding(faces=["Coil"], resistance="1ohm")
59+
bounds = self.aedtapp.assign_winding(assignment=["Coil"], resistance="1ohm")
6060
assert bounds
61-
bounds = self.aedtapp.assign_winding(faces=["Coil"], inductance="1H")
61+
bounds = self.aedtapp.assign_winding(assignment=["Coil"], inductance="1H")
6262
assert bounds
63-
bounds = self.aedtapp.assign_winding(faces=["Coil"], voltage="10V")
63+
bounds = self.aedtapp.assign_winding(assignment=["Coil"], voltage="10V")
6464
assert bounds
6565
bounds_name = generate_unique_name("Coil")
66-
bounds = self.aedtapp.assign_winding(faces=["Coil"], name=bounds_name)
66+
bounds = self.aedtapp.assign_winding(assignment=["Coil"], name=bounds_name)
6767
assert bounds_name == bounds.name
6868

6969
def test_04a_assign_coil(self):
70-
bound = self.aedtapp.assign_coil(objects=["Coil"])
70+
bound = self.aedtapp.assign_coil(assignment=["Coil"])
7171
assert bound
7272
polarity = "Positive"
73-
bound = self.aedtapp.assign_coil(objects=["Coil"], polarity=polarity)
73+
bound = self.aedtapp.assign_coil(assignment=["Coil"], polarity=polarity)
7474
assert bound.props["PolarityType"] == polarity.lower()
7575
polarity = "Negative"
76-
bound = self.aedtapp.assign_coil(objects=["Coil"], polarity=polarity)
76+
bound = self.aedtapp.assign_coil(assignment=["Coil"], polarity=polarity)
7777
assert bound.props["PolarityType"] == polarity.lower()
7878
bound_name = generate_unique_name("Coil")
79-
bound = self.aedtapp.assign_coil(objects=["Coil"], name=bound_name)
79+
bound = self.aedtapp.assign_coil(assignment=["Coil"], name=bound_name)
8080
assert bound_name == bound.name
8181

8282
def test_05_create_vector_potential(self):
@@ -114,7 +114,7 @@ def test_10_assign_torque(self):
114114
assert T.props["Objects"][0] == "Rotor_Section1"
115115
assert T.props["Is Positive"]
116116
assert T.delete()
117-
T = self.aedtapp.assign_torque(objects="Rotor_Section1", is_positive=False, torque_name="Torque_Test")
117+
T = self.aedtapp.assign_torque(assignment="Rotor_Section1", is_positive=False, torque_name="Torque_Test")
118118
assert T.name == "Torque_Test"
119119
assert not T.props["Is Positive"]
120120
assert T.props["Objects"][0] == "Rotor_Section1"
@@ -125,7 +125,7 @@ def test_11_assign_force(self):
125125
assert F.props["Objects"][0] == "Magnet2_Section1"
126126
assert F.props["Reference CS"] == "Global"
127127
assert F.delete()
128-
F = self.aedtapp.assign_force(objects="Magnet2_Section1", force_name="Force_Test")
128+
F = self.aedtapp.assign_force(assignment="Magnet2_Section1", force_name="Force_Test")
129129
assert F.name == "Force_Test"
130130

131131
def test_12_assign_current_source(self):
@@ -137,7 +137,8 @@ def test_12_assign_current_source(self):
137137

138138
def test_13_assign_master_slave(self):
139139
mas, slave = self.aedtapp.assign_master_slave(
140-
self.aedtapp.modeler["Rectangle2"].edges[0].id, self.aedtapp.modeler["Rectangle2"].edges[2].id
140+
self.aedtapp.modeler["Rectangle2"].edges[0].id,
141+
self.aedtapp.modeler["Rectangle2"].edges[2].id,
141142
)
142143
assert "Independent" in mas.name
143144
assert "Dependent" in slave.name
@@ -210,24 +211,24 @@ def test_19_matrix(self):
210211
self.aedtapp.assign_current("Coil_2", amplitude=1, swap_direction=True, name="Current2")
211212
self.aedtapp.assign_current("Coil_3", amplitude=1, swap_direction=True, name="Current3")
212213
self.aedtapp.assign_current("Coil_4", amplitude=1, swap_direction=True, name="Current4")
213-
L = self.aedtapp.assign_matrix(sources="Current1")
214+
L = self.aedtapp.assign_matrix(assignment="Current1")
214215
assert L.props["MatrixEntry"]["MatrixEntry"][0]["Source"] == "Current1"
215216
assert L.delete()
216217
L = self.aedtapp.assign_matrix(
217-
sources=["Current1", "Current2"], matrix_name="Test1", turns=2, return_path="Current3"
218+
assignment=["Current1", "Current2"], matrix_name="Test1", turns=2, return_path="Current3"
218219
)
219220
assert len(L.props["MatrixEntry"]["MatrixEntry"]) == 2
220221
L = self.aedtapp.assign_matrix(
221-
sources=["Current1", "Current2"], matrix_name="Test2", turns=[2, 1], return_path=["Current3", "Current4"]
222+
assignment=["Current1", "Current2"], matrix_name="Test2", turns=[2, 1], return_path=["Current3", "Current4"]
222223
)
223224
assert L.props["MatrixEntry"]["MatrixEntry"][1]["ReturnPath"] == "Current4"
224225
L = self.aedtapp.assign_matrix(
225-
sources=["Current1", "Current2"], matrix_name="Test3", turns=[2, 1], return_path=["Current1", "Current1"]
226+
assignment=["Current1", "Current2"], matrix_name="Test3", turns=[2, 1], return_path=["Current1", "Current1"]
226227
)
227228
assert not L
228229
group_sources = {"Group1_Test": ["Current3", "Current2"]}
229230
L = self.aedtapp.assign_matrix(
230-
sources=["Current3", "Current2"],
231+
assignment=["Current3", "Current2"],
231232
matrix_name="Test4",
232233
turns=[2, 1],
233234
return_path=["Current4", "Current1"],
@@ -236,7 +237,7 @@ def test_19_matrix(self):
236237
assert L.name == "Test4"
237238
group_sources = {"Group1_Test": ["Current3", "Current2"], "Group2_Test": ["Current1", "Current2"]}
238239
L = self.aedtapp.assign_matrix(
239-
sources=["Current1", "Current2"],
240+
assignment=["Current1", "Current2"],
240241
matrix_name="Test5",
241242
turns=[2, 1],
242243
return_path="infinite",
@@ -247,7 +248,7 @@ def test_19_matrix(self):
247248
group_sources["Group1_Test"] = ["Current1", "Current3"]
248249
group_sources["Group2_Test"] = ["Current2", "Current4"]
249250
L = self.aedtapp.assign_matrix(
250-
sources=["Current1", "Current2", "Current3", "Current4"],
251+
assignment=["Current1", "Current2", "Current3", "Current4"],
251252
matrix_name="Test6",
252253
turns=2,
253254
group_sources=group_sources,
@@ -256,7 +257,7 @@ def test_19_matrix(self):
256257
assert L.props["MatrixGroup"]["MatrixGroup"][0]["GroupName"] == "Group1_Test"
257258
group_sources = {"Group1_Test": ["Current1", "Current3"], "Group2_Test": ["Current2", "Current4"]}
258259
L = self.aedtapp.assign_matrix(
259-
sources=["Current1", "Current2", "Current3", "Current4"],
260+
assignment=["Current1", "Current2", "Current3", "Current4"],
260261
matrix_name="Test7",
261262
turns=[5, 1],
262263
group_sources=group_sources,
@@ -265,7 +266,7 @@ def test_19_matrix(self):
265266
assert len(L.props["MatrixGroup"]["MatrixGroup"]) == 2
266267
group_sources = {"Group1_Test": ["Current1", "Current3", "Current2"], "Group2_Test": ["Current2", "Current4"]}
267268
L = self.aedtapp.assign_matrix(
268-
sources=["Current1", "Current2", "Current3"],
269+
assignment=["Current1", "Current2", "Current3"],
269270
matrix_name="Test8",
270271
turns=[2, 1, 2, 3],
271272
return_path=["infinite", "infinite", "Current4"],
@@ -277,7 +278,7 @@ def test_19_matrix(self):
277278
assert L.props["MatrixEntry"]["MatrixEntry"][0]["NumberOfTurns"] == 3
278279
group_sources = {"Group1_Test": ["Current1", "Current3"], "Group2_Test": ["Current2", "Current4"]}
279280
L = self.aedtapp.assign_matrix(
280-
sources=["Current1", "Current2", "Current3", "Current4"],
281+
assignment=["Current1", "Current2", "Current3", "Current4"],
281282
matrix_name="Test9",
282283
turns=[5, 1, 2, 3],
283284
group_sources=group_sources,
@@ -334,8 +335,8 @@ def test_25_export_rl_matrix(self):
334335
self.aedtapp.set_active_design("Sinusoidal")
335336
assert not self.aedtapp.export_rl_matrix("Test1", " ")
336337
self.aedtapp.solution_type = SOLUTIONS.Maxwell2d.EddyCurrentXY
337-
self.aedtapp.assign_matrix(sources=["PM_I1_1_I0", "PM_I1_I0"], matrix_name="Test1")
338-
self.aedtapp.assign_matrix(sources=["Phase_A", "Phase_B", "Phase_C"], matrix_name="Test2")
338+
self.aedtapp.assign_matrix(assignment=["PM_I1_1_I0", "PM_I1_I0"], matrix_name="Test1")
339+
self.aedtapp.assign_matrix(assignment=["Phase_A", "Phase_B", "Phase_C"], matrix_name="Test2")
339340
setup_name = "setupTestMatrixRL"
340341
setup = self.aedtapp.create_setup(name=setup_name)
341342
setup.props["MaximumPasses"] = 2

_unittest/test_28_Maxwell3D.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -167,32 +167,32 @@ def test_04_coil_terminal(self):
167167
def test_05_winding(self):
168168
face_id = self.aedtapp.modeler["Coil_Section1"].faces[0].id
169169
assert self.aedtapp.assign_winding(face_id)
170-
bounds = self.aedtapp.assign_winding(faces=face_id, current=20e-3)
170+
bounds = self.aedtapp.assign_winding(assignment=face_id, current=20e-3)
171171
assert bounds
172-
bounds = self.aedtapp.assign_winding(faces=face_id, current="20e-3A")
172+
bounds = self.aedtapp.assign_winding(assignment=face_id, current="20e-3A")
173173
assert bounds
174-
bounds = self.aedtapp.assign_winding(faces=face_id, resistance="1ohm")
174+
bounds = self.aedtapp.assign_winding(assignment=face_id, resistance="1ohm")
175175
assert bounds
176-
bounds = self.aedtapp.assign_winding(faces=face_id, inductance="1H")
176+
bounds = self.aedtapp.assign_winding(assignment=face_id, inductance="1H")
177177
assert bounds
178-
bounds = self.aedtapp.assign_winding(faces=face_id, voltage="10V")
178+
bounds = self.aedtapp.assign_winding(assignment=face_id, voltage="10V")
179179
assert bounds
180180
bounds_name = generate_unique_name("Winding")
181-
bounds = self.aedtapp.assign_winding(faces=face_id, name=bounds_name)
181+
bounds = self.aedtapp.assign_winding(assignment=face_id, name=bounds_name)
182182
assert bounds_name == bounds.name
183183

184184
def test_05a_assign_coil(self):
185185
face_id = self.aedtapp.modeler["Coil_Section1"].faces[0].id
186-
bound = self.aedtapp.assign_coil(objects=face_id)
186+
bound = self.aedtapp.assign_coil(assignment=face_id)
187187
assert bound
188188
polarity = "Positive"
189-
bound = self.aedtapp.assign_coil(objects=face_id, polarity=polarity)
189+
bound = self.aedtapp.assign_coil(assignment=face_id, polarity=polarity)
190190
assert not bound.props["Point out of terminal"]
191191
polarity = "Negative"
192-
bound = self.aedtapp.assign_coil(objects=face_id, polarity=polarity)
192+
bound = self.aedtapp.assign_coil(assignment=face_id, polarity=polarity)
193193
assert bound.props["Point out of terminal"]
194194
bound_name = generate_unique_name("Coil")
195-
bound = self.aedtapp.assign_coil(objects=face_id, name=bound_name)
195+
bound = self.aedtapp.assign_coil(assignment=face_id, name=bound_name)
196196
assert bound_name == bound.name
197197

198198
def test_05_draw_region(self):
@@ -425,7 +425,7 @@ def test_28_assign_torque(self):
425425
assert T.props["Coordinate System"] == "Global"
426426
assert T.props["Axis"] == "Z"
427427
assert T.delete()
428-
T = self.aedtapp.assign_torque(objects="Coil", is_positive=False, torque_name="Torque_Test")
428+
T = self.aedtapp.assign_torque(assignment="Coil", is_positive=False, torque_name="Torque_Test")
429429
assert not T.props["Is Positive"]
430430
assert T.name == "Torque_Test"
431431

@@ -436,7 +436,7 @@ def test_29_assign_force(self):
436436
assert F.props["Reference CS"] == "Global"
437437
assert F.props["Is Virtual"]
438438
assert F.delete()
439-
F = self.aedtapp.assign_force(objects="Coil", is_virtual=False, force_name="Force_Test")
439+
F = self.aedtapp.assign_force(assignment="Coil", is_virtual=False, force_name="Force_Test")
440440
assert F.name == "Force_Test"
441441
assert not F.props["Is Virtual"]
442442

@@ -445,7 +445,7 @@ def test_30_assign_movement(self):
445445
self.aedtapp.solution_type = SOLUTIONS.Maxwell3d.Transient
446446
self.aedtapp.modeler.create_box([0, 0, 0], [10, 10, 10], name="Inner_Box")
447447
self.aedtapp.modeler.create_box([0, 0, 0], [30, 20, 20], name="Outer_Box")
448-
bound = self.aedtapp.assign_translate_motion("Outer_Box", mechanical_transient=True, velocity=1)
448+
bound = self.aedtapp.assign_translate_motion("Outer_Box", velocity=1, mechanical_transient=True)
449449
assert bound
450450
assert bound.props["Velocity"] == "1m_per_sec"
451451

@@ -474,18 +474,18 @@ def test_32_matrix(self, add_app):
474474
m3d.assign_voltage(rectangle3.faces[0], amplitude=1, name="Voltage3")
475475
m3d.assign_voltage(rectangle4.faces[0], amplitude=1, name="Voltage4")
476476

477-
L = m3d.assign_matrix(sources="Voltage1")
477+
L = m3d.assign_matrix(assignment="Voltage1")
478478
assert L.props["MatrixEntry"]["MatrixEntry"][0]["Source"] == "Voltage1"
479479
assert L.delete()
480480
group_sources = "Voltage2"
481-
L = m3d.assign_matrix(sources=["Voltage1", "Voltage3"], matrix_name="Test1", group_sources=group_sources)
481+
L = m3d.assign_matrix(assignment=["Voltage1", "Voltage3"], matrix_name="Test1", group_sources=group_sources)
482482
assert L.props["MatrixEntry"]["MatrixEntry"][1]["Source"] == "Voltage3"
483483
m3d.solution_type = SOLUTIONS.Maxwell3d.Transient
484484
winding1 = m3d.assign_winding("Sheet1", name="Current1")
485485
winding2 = m3d.assign_winding("Sheet2", name="Current2")
486486
winding3 = m3d.assign_winding("Sheet3", name="Current3")
487487
winding4 = m3d.assign_winding("Sheet4", name="Current4")
488-
L = m3d.assign_matrix(sources="Current1")
488+
L = m3d.assign_matrix(assignment="Current1")
489489
assert not L
490490

491491
def test_32B_matrix(self, add_app):
@@ -506,7 +506,7 @@ def test_32B_matrix(self, add_app):
506506
m3d.assign_current(rectangle3.faces[0], amplitude=1, name="Cur3")
507507
m3d.assign_current(rectangle4.faces[0], amplitude=1, name="Cur4")
508508

509-
L = m3d.assign_matrix(sources=["Cur1", "Cur2", "Cur3"])
509+
L = m3d.assign_matrix(assignment=["Cur1", "Cur2", "Cur3"])
510510
out = L.join_series(["Cur1", "Cur2"])
511511
assert isinstance(out[0], str)
512512
assert isinstance(out[1], str)
@@ -518,7 +518,7 @@ def test_32B_matrix(self, add_app):
518518

519519
def test_32a_export_rl_matrix(self):
520520
self.aedtapp.set_active_design("Matrix2")
521-
L = self.aedtapp.assign_matrix(sources=["Cur1", "Cur2", "Cur3"], matrix_name="matrix_export_test")
521+
L = self.aedtapp.assign_matrix(assignment=["Cur1", "Cur2", "Cur3"], matrix_name="matrix_export_test")
522522
L.join_series(["Cur1", "Cur2"], matrix_name="reduced_matrix_export_test")
523523
setup_name = "setupTestMatrixRL"
524524
setup = self.aedtapp.create_setup(name=setup_name)

_unittest/test_35_MaxwellCircuit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ def test_07_export_netlist(self, add_app):
7171
m2d.solution_type = SOLUTIONS.Maxwell2d.TransientZ
7272
m2d.modeler.create_circle([0, 0, 0], 10, name="Circle_inner")
7373
m2d.modeler.create_circle([0, 0, 0], 30, name="Circle_outer")
74-
m2d.assign_coil(objects=["Circle_inner"])
75-
m2d.assign_winding(faces=["Circle_inner"], winding_type="External", name="Ext_Wdg")
74+
m2d.assign_coil(assignment=["Circle_inner"])
75+
m2d.assign_winding(assignment=["Circle_inner"], winding_type="External", name="Ext_Wdg")
7676
assert m2d.edit_external_circuit(netlist_file, self.aedtapp.design_name)

_unittest_solvers/test_00_analyze.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -402,14 +402,9 @@ def test_05d_circuit_push_excitation_time(self, circuit_app):
402402
assert circuit_app.push_time_excitations(instance_name="U1", setup_name=setup_name)
403403

404404
def test_06_m3d_harmonic_forces(self, m3dtransient):
405-
assert m3dtransient.enable_harmonic_force(
406-
["Stator"],
407-
force_type=2,
408-
window_function="Rectangular",
409-
use_number_of_last_cycles=True,
410-
last_cycles_number=3,
411-
calculate_force="Harmonic",
412-
)
405+
assert m3dtransient.enable_harmonic_force(["Stator"], force_type=2, window_function="Rectangular",
406+
use_number_of_last_cycles=True, last_cycles_number=3,
407+
calculate_force="Harmonic")
413408
m3dtransient.save_project()
414409
m3dtransient.analyze(m3dtransient.active_setup, num_cores=2)
415410
assert m3dtransient.export_element_based_harmonic_force(start_frequency=1, stop_frequency=100,

examples/03-Maxwell/Maxwell2D_DCConduction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9393
# 1V is the source, 0V ground
9494

95-
m2d.assign_matrix(sources=['1V'], group_sources=['0V'], matrix_name="Matrix1")
95+
m2d.assign_matrix(assignment=['1V'], matrix_name="Matrix1", group_sources=['0V'])
9696

9797
##################################################################################
9898
# Assign mesh operation

0 commit comments

Comments
 (0)