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

chore: update Q3D busbar example with Matrix Reduction Operation #272

Merged
merged 11 commits into from
Dec 19, 2024
108 changes: 88 additions & 20 deletions examples/high_frequency/emc/busbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,31 +117,54 @@
print(q3d.net_sources("Bar2"))
print(q3d.net_sources("Bar3"))

# Create the solution setup and define the frequency range for the solution.
# ## Create Matrix Reduction Operations
#
# Series of Bar1 and Bar2

setup1 = q3d.create_setup(props={"AdaptiveFreq": "100MHz"})
sweep = setup1.add_sweep()
sweep.props["RangeStart"] = "1MHz"
sweep.props["RangeEnd"] = "100MHz"
sweep.props["RangeStep"] = "5MHz"
sweep.update()
mr_series = q3d.insert_reduced_matrix(
operation_name="JoinSeries",
assignment=["Sink1", "Source2"],
reduced_matrix="MR_1_Series",
new_net_name="Series1",
)

# ### Set up for postprocessing
#
# Specify the traces to display after solving the model.
# Add Parallel with Bar3

data_plot_self = q3d.matrices[0].get_sources_for_plot(
get_self_terms=True, get_mutual_terms=False
mr_series.add_operation(
operation_type="JoinParallel",
source_names=["Source1", "Source3"],
new_net_name="SeriesPar",
new_source_name="src_par",
new_sink_name="snk_par",
)

# Series of Bar1 and Bar2

mr_series2 = q3d.insert_reduced_matrix(
operation_name="JoinSeries",
assignment=["Sink1", "Source2"],
reduced_matrix="MR_2_Series",
new_net_name="Series2",
)
data_plot_mutual = q3d.get_traces_for_plot(
get_self_terms=False, get_mutual_terms=True, category="C"

# Add Series with Bar3

mr_series2.add_operation(
operation_type="JoinSeries",
source_names=["Sink3", "Source1"],
new_net_name="MR_2_Series1",
)

# Define a plot and a data table in AEDT for visualizing results.
# ## Add a solution Setup and an interpolating frequency sweep

q3d.post.create_report(expressions=data_plot_self)
q3d.post.create_report(
expressions=data_plot_mutual, context="Original", plot_type="Data Table"
freq_sweep_name = "my_sweep"
setup1 = q3d.create_setup(props={"AdaptiveFreq": "1000MHz"})
sweep = setup1.create_linear_step_sweep(
freqstart=0,
freqstop=10,
step_size=0.05,
sweepname=freq_sweep_name,
sweep_type="Interpolating",
)

# ## Analyze
Expand All @@ -151,10 +174,55 @@
q3d.analyze(cores=NUM_CORES)
q3d.save_project()

# ## Specify the traces to display and create the Reports.
#
# Capacitances - Original Matrix.

original_matrix_self = q3d.matrices[0].get_sources_for_plot(
get_self_terms=True, get_mutual_terms=False
)
original_matrix_mutual = q3d.matrices[0].get_sources_for_plot(
get_self_terms=False, get_mutual_terms=True
)

# ACL - Reduced Matrix MR_1_Series

reduced_matrix_1_self = mr_series.get_sources_for_plot(
get_self_terms=True, get_mutual_terms=False, category="ACL"
)

# ACL - Reduced Matrix MR_2_Series

reduced_matrix_2_self = mr_series2.get_sources_for_plot(
get_self_terms=True, get_mutual_terms=False, category="ACL"
)

# Define plots and a data table in AEDT for visualizing results.

original_matrix_self_report = q3d.post.create_report(
expressions=original_matrix_self, plot_name="Original, Self Capacitances"
)
original_matrix_mutual_report = q3d.post.create_report(
expressions=original_matrix_mutual,
context="Original",
plot_type="Data Table",
plot_name="Original, Mutual Capacitances",
)
reduced_matrix_1_self_report = q3d.post.create_report(
expressions=reduced_matrix_1_self,
context="MR_1_Series",
plot_name="MR_1_Series, Self Inductances",
)
reduced_matrix_2_self_report = q3d.post.create_report(
expressions=reduced_matrix_2_self,
context="MR_2_Series",
plot_name="MR_2_Series, Self Inductances",
)
reduced_matrix_2_self_report.edit_x_axis_scaling(linear_scaling=False)

# Retrieve solution data for processing in Python.

data = q3d.post.get_solution_data(expressions=data_plot_self, context="Original")
data.data_magnitude()
data = q3d.post.get_solution_data(expressions=original_matrix_self, context="Original")
data.plot()

# ## Release AEDT
Expand Down
42 changes: 24 additions & 18 deletions examples/low_frequency/motor/aedt_motor/rmxpert.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,26 @@
rmxprt.stator["Inner Diameter"] = "75mm"
rmxprt.stator["Length"] = "65mm"
rmxprt.stator["Stacking Factor"] = 0.95
rmxprt.stator["Steel Type"] = "steel_1008"
rmxprt.stator.properties.properties["Steel Type"] = [
"Material:=",
"steel_1008",
]
rmxprt.stator["Number of Slots"] = 24
rmxprt.stator["Slot Type"] = 2

rmxprt.stator.properties.children["Slot"].props["Auto Design"] = False
rmxprt.stator.properties.children["Slot"].props["Hs0"] = "0.5mm"
rmxprt.stator.properties.children["Slot"].props["Hs1"] = "1.2mm"
rmxprt.stator.properties.children["Slot"].props["Hs2"] = "8.2mm"
rmxprt.stator.properties.children["Slot"].props["Bs0"] = "2.5mm"
rmxprt.stator.properties.children["Slot"].props["Bs1"] = "5.6mm"
rmxprt.stator.properties.children["Slot"].props["Bs2"] = "7.6mm"
rmxprt.stator.properties.children["Slot"].properties["Auto Design"] = False
rmxprt.stator.properties.children["Slot"].properties["Hs0"] = "0.5mm"
rmxprt.stator.properties.children["Slot"].properties["Hs1"] = "1.2mm"
rmxprt.stator.properties.children["Slot"].properties["Hs2"] = "8.2mm"
rmxprt.stator.properties.children["Slot"].properties["Bs0"] = "2.5mm"
rmxprt.stator.properties.children["Slot"].properties["Bs1"] = "5.6mm"
rmxprt.stator.properties.children["Slot"].properties["Bs2"] = "7.6mm"

rmxprt.stator.properties.children["Winding"].props["Winding Layers"] = 2
rmxprt.stator.properties.children["Winding"].props["Parallel Branches"] = 1
rmxprt.stator.properties.children["Winding"].props["Conductors per Slot"] = 52
rmxprt.stator.properties.children["Winding"].props["Coil Pitch"] = 5
rmxprt.stator.properties.children["Winding"].props["Number of Strands"] = 1
rmxprt.stator.properties.children["Winding"].properties["Winding Layers"] = 2
rmxprt.stator.properties.children["Winding"].properties["Parallel Branches"] = 1
rmxprt.stator.properties.children["Winding"].properties["Conductors per Slot"] = 52
rmxprt.stator.properties.children["Winding"].properties["Coil Pitch"] = 5
rmxprt.stator.properties.children["Winding"].properties["Number of Strands"] = 1

# ## Define rotor
#
Expand All @@ -98,16 +101,19 @@
rmxprt.rotor["Inner Diameter"] = "26mm"
rmxprt.rotor["Length"] = "65mm"
rmxprt.rotor["Stacking Factor"] = 0.95
rmxprt.rotor["Steel Type"] = "steel_1008"
rmxprt.rotor["Steel Type"] = [
"Material:=",
"steel_1008",
]
rmxprt.rotor["Pole Type"] = 1

rmxprt.rotor.properties.children["Pole"].props["Embrace"] = 0.7
rmxprt.rotor.properties.children["Pole"].props["Offset"] = "0mm"
rmxprt.rotor.properties.children["Pole"].props["Magnet Type"] = [
rmxprt.rotor.properties.children["Pole"].properties["Embrace"] = 0.7
rmxprt.rotor.properties.children["Pole"].properties["Offset"] = "0mm"
rmxprt.rotor.properties.children["Pole"].properties["Magnet Type"] = [
"Material:=",
"Alnico9",
]
rmxprt.rotor.properties.children["Pole"].props["Magnet Thickness"] = "3.5mm"
rmxprt.rotor.properties.children["Pole"].properties["Magnet Thickness"] = "3.5mm"

# ## Create setup
#
Expand Down
Loading