From 3f835eea13a7fdee240f85046704a2562187313a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=A4berich?= Date: Sun, 10 Oct 2021 18:50:14 +0200 Subject: [PATCH] configurable Z0 for short/open + additional comment entries --- .../PC_Application/Calibration/calkit.cpp | 40 ++++++----- Software/PC_Application/Calibration/calkit.h | 11 ++- .../Calibration/calkitdialog.cpp | 8 +++ .../Calibration/calkitdialog.ui | 71 ++++++++++++++++--- 4 files changed, 104 insertions(+), 26 deletions(-) diff --git a/Software/PC_Application/Calibration/calkit.cpp b/Software/PC_Application/Calibration/calkit.cpp index ffbde66..a180058 100644 --- a/Software/PC_Application/Calibration/calkit.cpp +++ b/Software/PC_Application/Calibration/calkit.cpp @@ -181,8 +181,6 @@ Calkit Calkit::fromFile(QString filename) // set default values for non-editable items (for now) c.TRL.Through.Z0 = 50.0; - c.SOLT.Short.Z0 = 50.0; - c.SOLT.Open.Z0 = 50.0; c.SOLT.Through.Z0 = 50.0; return c; @@ -201,6 +199,26 @@ void Calkit::edit(std::function done) class Calkit::SOLT Calkit::toSOLT(double frequency) { + auto addTransmissionLine = [](complex termination_reflection, double offset_impedance, double offset_delay, double offset_loss, double frequency) -> complex { + // nomenclature and formulas from https://loco.lab.asu.edu/loco-memos/edges_reports/report_20130807.pdf + auto Gamma_T = termination_reflection; + auto f = frequency; + auto w = 2.0 * M_PI * frequency; + auto f_sqrt = sqrt(f / 1e9); + + auto Z_c = complex(offset_impedance + (offset_loss / (2*w)) * f_sqrt, -(offset_loss / (2*w)) * f_sqrt); + auto gamma_l = complex(offset_loss*offset_delay/(2*offset_impedance)*f_sqrt, w*offset_delay+offset_loss*offset_delay/(2*offset_impedance)*f_sqrt); + + auto Z_r = complex(50.0); + + auto Gamma_1 = (Z_c - Z_r) / (Z_c + Z_r); + + auto Gamma_i = (Gamma_1*(1.0-exp(-2.0*gamma_l)-Gamma_1*Gamma_T)+exp(-2.0*gamma_l)*Gamma_T) + / (1.0-Gamma_1*(exp(-2.0*gamma_l)*Gamma_1+Gamma_T*(1.0-exp(-2.0*gamma_l)))); + + return Gamma_i; + }; + fillTouchstoneCache(); class SOLT ref; if(SOLT.Load.useMeasurements) { @@ -216,9 +234,7 @@ class Calkit::SOLT Calkit::toSOLT(double frequency) auto imp_L = complex(0, frequency * 2 * M_PI * SOLT.Load.Lseries); imp_load += imp_L; ref.Load = (imp_load - complex(50.0)) / (imp_load + complex(50.0)); - // apply phaseshift due to delay - double load_phaseshift = -2 * M_PI * frequency * 2 * SOLT.Load.delay * 1e-12; - ref.Load *= polar(1.0, load_phaseshift); + ref.Load = addTransmissionLine(ref.Load, SOLT.Load.Z0, SOLT.Load.delay*1e-12, 0, frequency); } if(SOLT.Open.useMeasurements) { @@ -234,12 +250,7 @@ class Calkit::SOLT Calkit::toSOLT(double frequency) auto imp_open = complex(0, -1.0 / (frequency * 2 * M_PI * Cfringing)); ref.Open = (imp_open - complex(50.0)) / (imp_open + complex(50.0)); } - // transform the delay into a phase shift for the given frequency - double open_phaseshift = -2 * M_PI * frequency * 2 * SOLT.Open.delay * 1e-12; - double open_att_db = SOLT.Open.loss * 1e9 * 4.3429 * 2 * SOLT.Open.delay * 1e-12 / SOLT.Open.Z0 * sqrt(frequency / 1e9); - double open_att = pow(10.0, -open_att_db / 10.0); - auto open_correction = polar(open_att, open_phaseshift); - ref.Open *= open_correction; + ref.Open = addTransmissionLine(ref.Open, SOLT.Open.Z0, SOLT.Open.delay*1e-12, SOLT.Open.loss*1e9, frequency); } if(SOLT.Short.useMeasurements) { @@ -250,12 +261,7 @@ class Calkit::SOLT Calkit::toSOLT(double frequency) // convert to impedance auto imp_short = complex(0, frequency * 2 * M_PI * Lseries); ref.Short = (imp_short - complex(50.0)) / (imp_short + complex(50.0)); - // transform the delay into a phase shift for the given frequency - double short_phaseshift = -2 * M_PI * frequency * 2 * SOLT.Short.delay * 1e-12; - double short_att_db = SOLT.Short.loss * 1e9 * 4.3429 * 2 * SOLT.Short.delay * 1e-12 / SOLT.Short.Z0 * sqrt(frequency / 1e9);; - double short_att = pow(10.0, -short_att_db / 10.0); - auto short_correction = polar(short_att, short_phaseshift); - ref.Short *= short_correction; + ref.Short = addTransmissionLine(ref.Short, SOLT.Short.Z0, SOLT.Short.delay*1e-12, SOLT.Short.loss*1e9, frequency); } if(SOLT.Through.useMeasurements) { diff --git a/Software/PC_Application/Calibration/calkit.h b/Software/PC_Application/Calibration/calkit.h index 3c25a0d..a33b49e 100644 --- a/Software/PC_Application/Calibration/calkit.h +++ b/Software/PC_Application/Calibration/calkit.h @@ -14,6 +14,9 @@ public: Calkit(); Calkit& operator=(const Calkit& other) { + this->manufacturer = other.manufacturer; + this->serialnumber = other.serialnumber; + this->description = other.description; this->SOLT = other.SOLT; this->TRL = other.TRL; this->startDialogWithSOLT = other.startDialogWithSOLT; @@ -46,6 +49,8 @@ public: private: void TransformPathsToRelative(QFileInfo d); void TransformPathsToAbsolute(QFileInfo d); + + QString manufacturer, serialnumber, description; // SOLT standard definitions struct { struct { @@ -94,7 +99,11 @@ private: QString name; QVariant def; }; - const std::array json_descr = {{ + const std::array json_descr = {{ + {&manufacturer, "Manufacturer", ""}, + {&serialnumber, "Serialnumber", ""}, + {&description, "Description", ""}, + {&SOLT.Open.Z0, "SOLT/Open/Param/Z0", 50.0}, {&SOLT.Open.delay, "SOLT/Open/Param/Delay", 0.0}, {&SOLT.Open.loss, "SOLT/Open/Param/Loss", 0.0}, diff --git a/Software/PC_Application/Calibration/calkitdialog.cpp b/Software/PC_Application/Calibration/calkitdialog.cpp index 7b2cf92..3298ce1 100644 --- a/Software/PC_Application/Calibration/calkitdialog.cpp +++ b/Software/PC_Application/Calibration/calkitdialog.cpp @@ -140,6 +140,10 @@ CalkitDialog::~CalkitDialog() void CalkitDialog::parseEntries() { + ownKit.manufacturer = ui->manufacturer->text(); + ownKit.serialnumber = ui->serialnumber->text(); + ownKit.description = ui->description->toPlainText(); + // type ownKit.SOLT.Open.useMeasurements = ui->open_measurement->isChecked(); ownKit.SOLT.Short.useMeasurements = ui->short_measurement->isChecked(); @@ -196,6 +200,10 @@ void CalkitDialog::parseEntries() void CalkitDialog::updateEntries() { + ui->manufacturer->setText(ownKit.manufacturer); + ui->serialnumber->setText(ownKit.serialnumber); + ui->description->setPlainText(ownKit.description); + // Coefficients ui->open_Z0->setValueQuiet(ownKit.SOLT.Open.Z0); ui->open_delay->setValueQuiet(ownKit.SOLT.Open.delay); diff --git a/Software/PC_Application/Calibration/calkitdialog.ui b/Software/PC_Application/Calibration/calkitdialog.ui index faacd00..b904fea 100644 --- a/Software/PC_Application/Calibration/calkitdialog.ui +++ b/Software/PC_Application/Calibration/calkitdialog.ui @@ -10,7 +10,7 @@ 0 0 1141 - 394 + 602 @@ -28,11 +28,66 @@ false - + + + + + + + Manufacturer: + + + + + + + + + + Serial number: + + + + + + + + + + + + + + + + Description: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + - 1 + 0 @@ -152,7 +207,7 @@ - false + true @@ -298,7 +353,7 @@ - false + true @@ -933,10 +988,10 @@ - - + - + +