Model Comparison to Qucs-S#
This notebook compares the S-parameter models from qpdk (using sax) against reference results from Qucs-S simulations. Each test suite validates a different component model.
The comparisons include:
Polar plots showing S-parameters in the complex plane
Magnitude and phase plots versus frequency
Visual validation of model accuracy against reference data
Discover Test Suites#
Dynamically discover all test suite classes that compare qpdk models to Qucs-S results. We find all classes that:
Are subclasses of
BaseCompareToQucsAre not the base class itself
Are concrete classes (not abstract)
# Discover all available test suites
test_suites = discover_test_suites()
print(f"Found {len(test_suites)} test suite(s):")
for suite in test_suites:
print(f"\t· {suite.__name__}")
Found 5 test suite(s):
· TestCPWCompareToQucs
· TestCapacitorCompareToQucs
· TestCouplerStraightCompareToQucs
· TestInductorCompareToQucs
· TestLCResonatorCompareToQucs
Model Comparison#
Compare the S-parameter models against Qucs-S reference data.
# Find and plot all test suites
for suite in test_suites:
test_instance = suite()
display(Markdown(f"### {test_instance.component_name}"))
display(Markdown(f"**Test Suite:** `{suite.__name__}`"))
param_strs = [
f"{p.name} = {p.value / p.unit:.2f} × 10^{int(np.log10(p.unit))}"
for p in sorted(test_instance.parameters, key=lambda x: x.name)
]
param_text = "**Parameters:**\n" + "\n".join(f"- {p}" for p in param_strs)
display(Markdown(param_text))
display(Markdown(f"**CSV:** `{test_instance.csv_filename}`"))
test_instance.plot_comparison()
Coplanar waveguide
Test Suite: TestCPWCompareToQucs
Parameters:
length = 10000000000.00 × 10^-6
CSV: cpw_w10_s_6_l10mm.csv
Capacitor
Test Suite: TestCapacitorCompareToQucs
Parameters:
capacitance = 60.00 × 10^-15
CSV: capacitor_qucs.csv
Coupler Straight
Test Suite: TestCouplerStraightCompareToQucs
Parameters:
gap = 1520000.00 × 10^-6
length = 500000000.00 × 10^-6
CSV: coupler_straight_qucs.csv
Inductor
Test Suite: TestInductorCompareToQucs
Parameters:
inductance = 10.00 × 10^-9
CSV: inductor_qucs.csv
LC Resonator
Test Suite: TestLCResonatorCompareToQucs
Parameters:
capacitance = 10.00 × 10^-15
inductance = 10.00 × 10^-9
CSV: lc_resonator_qucs.csv
Summary#
The plots above show comparisons between qpdk models (dashed lines) and Qucs-S reference simulations (solid lines) for various passive components:
Left plot: Polar representation showing S-parameters in the complex plane
Right plot: Magnitude (in dB) and phase (in radians) versus frequency
Good agreement between the models validates the accuracy of the qpdk implementations for use in circuit simulations and design optimization.