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
97 changes: 83 additions & 14 deletions examples/high_frequency/emc/busbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,66 @@
print(q3d.net_sources("Bar2"))
print(q3d.net_sources("Bar3"))


# ## Create Matrix Reduction Operations
#
# Series of Bar1 and Bar2

mr_series = q3d.insert_reduced_matrix(
operation_name="JoinSeries",
assignment=["Sink1", "Source2"],
reduced_matrix="MR_1_Series",
new_net_name="Series1",
)

# Add Parallel with Bar3

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",
)

# Add Series with Bar3

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

# Create the solution setup and define the frequency range for the solution.

setup1 = q3d.create_setup(props={"AdaptiveFreq": "100MHz"})
sweep = setup1.add_sweep()
sweep.props["RangeStart"] = "1MHz"
sweep.props["RangeEnd"] = "100MHz"
freq_sweep_name = "my_sweep"
setup1 = q3d.create_setup(props={"AdaptiveFreq": "1000MHz"})
sweep = setup1.add_sweep(name=freq_sweep_name)
sweep.props["RangeStart"] = "0Hz"
sweep.props["RangeEnd"] = "20GHz"
sweep.props["RangeStep"] = "5MHz"
sweep.update()
sweep.update()

# ## Analyze
#
# Solve the setup.

q3d.analyze(cores=NUM_CORES)
q3d.save_project()

# ### Set up for postprocessing
#
# Specify the traces to display after solving the model.
# Specify the traces to display after solving the model. Capacitances - Original Matrix

data_plot_self = q3d.matrices[0].get_sources_for_plot(
get_self_terms=True, get_mutual_terms=False
Expand All @@ -137,19 +185,40 @@
get_self_terms=False, get_mutual_terms=True, category="C"
)

# Define a plot and a data table in AEDT for visualizing results.
# Specify the traces to display after solving the model. ACL - Reduced Matrix MR_1_Series

q3d.post.create_report(expressions=data_plot_self)
q3d.post.create_report(
expressions=data_plot_mutual, context="Original", plot_type="Data Table"
data_red_m1_plot_self = q3d.matrices[1].get_sources_for_plot(
get_self_terms=True, get_mutual_terms=False, category="ACL"
)

# ## Analyze
#
# Solve the setup.
# Specify the traces to display after solving the model. ACL - Reduced Matrix MR_2_Series

q3d.analyze(cores=NUM_CORES)
q3d.save_project()
data_red_m2_plot_self = q3d.matrices[2].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.

rep_original_self_c = q3d.post.create_report(
expressions=data_plot_self, plot_name="Original, Self Capacitances"
)
rep_original_mutual_c = q3d.post.create_report(
expressions=data_plot_mutual,
context="Original",
plot_type="Data Table",
plot_name="Original, Mutual Capacitances",
)
rep_red_m1_self_acl = q3d.post.create_report(
expressions=data_red_m1_plot_self,
context="MR_1_Series",
plot_name="MR_1_Series, Self Inductances",
)
rep_red_m2_self_acl = q3d.post.create_report(
expressions=data_red_m2_plot_self,
context="MR_2_Series",
plot_name="MR_2_Series, Self Inductances",
)
rep_red_m2_self_acl.edit_x_axis_scaling(linear_scaling=False)

# Retrieve solution data for processing in Python.

Expand Down
Loading