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
58 changes: 55 additions & 3 deletions examples/high_frequency/emc/busbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,56 @@
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 = [b for b in q3d.matrices if b.name == 'MR_1_Series'] [0]
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"
sweep.props["RangeStart"] = "0MHz"
sweep.props["RangeEnd"] = "1000MHz"
sweep.props["RangeStep"] = "5MHz"
sweep.update()

# ### 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,9 +175,23 @@
get_self_terms=False, get_mutual_terms=True, category="C"
)

# Specify the traces to display after solving the model.ACL - Reduced Matrix MR_1_Series

data_reducedm1_plot_self = q3d.matrices[1].get_sources_for_plot(
get_self_terms=True, get_mutual_terms=False, category="ACL"
)

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

data_reducedm2_plot_self = q3d.matrices[2].get_sources_for_plot(
get_self_terms=True, get_mutual_terms=False, category="ACL"
)

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

q3d.post.create_report(expressions=data_plot_self)
q3d.post.create_report(expressions=data_reducedm1_plot_self)
q3d.post.create_report(expressions=data_reducedm2_plot_self)
q3d.post.create_report(
expressions=data_plot_mutual, context="Original", plot_type="Data Table"
)
Expand Down
Loading