configurable Z0 for short/open + additional comment entries

This commit is contained in:
Jan Käberich 2021-10-10 18:50:14 +02:00
parent 0452d2472c
commit 3f835eea13
4 changed files with 104 additions and 26 deletions

View File

@ -181,8 +181,6 @@ Calkit Calkit::fromFile(QString filename)
// set default values for non-editable items (for now) // set default values for non-editable items (for now)
c.TRL.Through.Z0 = 50.0; c.TRL.Through.Z0 = 50.0;
c.SOLT.Short.Z0 = 50.0;
c.SOLT.Open.Z0 = 50.0;
c.SOLT.Through.Z0 = 50.0; c.SOLT.Through.Z0 = 50.0;
return c; return c;
@ -201,6 +199,26 @@ void Calkit::edit(std::function<void (void)> done)
class Calkit::SOLT Calkit::toSOLT(double frequency) class Calkit::SOLT Calkit::toSOLT(double frequency)
{ {
auto addTransmissionLine = [](complex<double> termination_reflection, double offset_impedance, double offset_delay, double offset_loss, double frequency) -> complex<double> {
// 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<double>(offset_impedance + (offset_loss / (2*w)) * f_sqrt, -(offset_loss / (2*w)) * f_sqrt);
auto gamma_l = complex<double>(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<double>(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(); fillTouchstoneCache();
class SOLT ref; class SOLT ref;
if(SOLT.Load.useMeasurements) { if(SOLT.Load.useMeasurements) {
@ -216,9 +234,7 @@ class Calkit::SOLT Calkit::toSOLT(double frequency)
auto imp_L = complex<double>(0, frequency * 2 * M_PI * SOLT.Load.Lseries); auto imp_L = complex<double>(0, frequency * 2 * M_PI * SOLT.Load.Lseries);
imp_load += imp_L; imp_load += imp_L;
ref.Load = (imp_load - complex<double>(50.0)) / (imp_load + complex<double>(50.0)); ref.Load = (imp_load - complex<double>(50.0)) / (imp_load + complex<double>(50.0));
// apply phaseshift due to delay ref.Load = addTransmissionLine(ref.Load, SOLT.Load.Z0, SOLT.Load.delay*1e-12, 0, frequency);
double load_phaseshift = -2 * M_PI * frequency * 2 * SOLT.Load.delay * 1e-12;
ref.Load *= polar<double>(1.0, load_phaseshift);
} }
if(SOLT.Open.useMeasurements) { if(SOLT.Open.useMeasurements) {
@ -234,12 +250,7 @@ class Calkit::SOLT Calkit::toSOLT(double frequency)
auto imp_open = complex<double>(0, -1.0 / (frequency * 2 * M_PI * Cfringing)); auto imp_open = complex<double>(0, -1.0 / (frequency * 2 * M_PI * Cfringing));
ref.Open = (imp_open - complex<double>(50.0)) / (imp_open + complex<double>(50.0)); ref.Open = (imp_open - complex<double>(50.0)) / (imp_open + complex<double>(50.0));
} }
// transform the delay into a phase shift for the given frequency ref.Open = addTransmissionLine(ref.Open, SOLT.Open.Z0, SOLT.Open.delay*1e-12, SOLT.Open.loss*1e9, 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<double>(open_att, open_phaseshift);
ref.Open *= open_correction;
} }
if(SOLT.Short.useMeasurements) { if(SOLT.Short.useMeasurements) {
@ -250,12 +261,7 @@ class Calkit::SOLT Calkit::toSOLT(double frequency)
// convert to impedance // convert to impedance
auto imp_short = complex<double>(0, frequency * 2 * M_PI * Lseries); auto imp_short = complex<double>(0, frequency * 2 * M_PI * Lseries);
ref.Short = (imp_short - complex<double>(50.0)) / (imp_short + complex<double>(50.0)); ref.Short = (imp_short - complex<double>(50.0)) / (imp_short + complex<double>(50.0));
// transform the delay into a phase shift for the given frequency ref.Short = addTransmissionLine(ref.Short, SOLT.Short.Z0, SOLT.Short.delay*1e-12, SOLT.Short.loss*1e9, 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<double>(short_att, short_phaseshift);
ref.Short *= short_correction;
} }
if(SOLT.Through.useMeasurements) { if(SOLT.Through.useMeasurements) {

View File

@ -14,6 +14,9 @@ public:
Calkit(); Calkit();
Calkit& operator=(const Calkit& other) Calkit& operator=(const Calkit& other)
{ {
this->manufacturer = other.manufacturer;
this->serialnumber = other.serialnumber;
this->description = other.description;
this->SOLT = other.SOLT; this->SOLT = other.SOLT;
this->TRL = other.TRL; this->TRL = other.TRL;
this->startDialogWithSOLT = other.startDialogWithSOLT; this->startDialogWithSOLT = other.startDialogWithSOLT;
@ -46,6 +49,8 @@ public:
private: private:
void TransformPathsToRelative(QFileInfo d); void TransformPathsToRelative(QFileInfo d);
void TransformPathsToAbsolute(QFileInfo d); void TransformPathsToAbsolute(QFileInfo d);
QString manufacturer, serialnumber, description;
// SOLT standard definitions // SOLT standard definitions
struct { struct {
struct { struct {
@ -94,7 +99,11 @@ private:
QString name; QString name;
QVariant def; QVariant def;
}; };
const std::array<JSONDescription, 40> json_descr = {{ const std::array<JSONDescription, 43> json_descr = {{
{&manufacturer, "Manufacturer", ""},
{&serialnumber, "Serialnumber", ""},
{&description, "Description", ""},
{&SOLT.Open.Z0, "SOLT/Open/Param/Z0", 50.0}, {&SOLT.Open.Z0, "SOLT/Open/Param/Z0", 50.0},
{&SOLT.Open.delay, "SOLT/Open/Param/Delay", 0.0}, {&SOLT.Open.delay, "SOLT/Open/Param/Delay", 0.0},
{&SOLT.Open.loss, "SOLT/Open/Param/Loss", 0.0}, {&SOLT.Open.loss, "SOLT/Open/Param/Loss", 0.0},

View File

@ -140,6 +140,10 @@ CalkitDialog::~CalkitDialog()
void CalkitDialog::parseEntries() void CalkitDialog::parseEntries()
{ {
ownKit.manufacturer = ui->manufacturer->text();
ownKit.serialnumber = ui->serialnumber->text();
ownKit.description = ui->description->toPlainText();
// type // type
ownKit.SOLT.Open.useMeasurements = ui->open_measurement->isChecked(); ownKit.SOLT.Open.useMeasurements = ui->open_measurement->isChecked();
ownKit.SOLT.Short.useMeasurements = ui->short_measurement->isChecked(); ownKit.SOLT.Short.useMeasurements = ui->short_measurement->isChecked();
@ -196,6 +200,10 @@ void CalkitDialog::parseEntries()
void CalkitDialog::updateEntries() void CalkitDialog::updateEntries()
{ {
ui->manufacturer->setText(ownKit.manufacturer);
ui->serialnumber->setText(ownKit.serialnumber);
ui->description->setPlainText(ownKit.description);
// Coefficients // Coefficients
ui->open_Z0->setValueQuiet(ownKit.SOLT.Open.Z0); ui->open_Z0->setValueQuiet(ownKit.SOLT.Open.Z0);
ui->open_delay->setValueQuiet(ownKit.SOLT.Open.delay); ui->open_delay->setValueQuiet(ownKit.SOLT.Open.delay);

View File

@ -10,7 +10,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1141</width> <width>1141</width>
<height>394</height> <height>602</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -28,11 +28,66 @@
<property name="sizeGripEnabled"> <property name="sizeGripEnabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<layout class="QFormLayout" name="formLayout_7">
<item row="0" column="0">
<widget class="QLabel" name="label_27">
<property name="text">
<string>Manufacturer:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="manufacturer"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_31">
<property name="text">
<string>Serial number:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="serialnumber"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QLabel" name="label_28">
<property name="text">
<string>Description:</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTextEdit" name="description"/>
</item>
</layout>
</item>
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@ -152,7 +207,7 @@
<item row="0" column="1"> <item row="0" column="1">
<widget class="SIUnitEdit" name="short_Z0"> <widget class="SIUnitEdit" name="short_Z0">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -298,7 +353,7 @@
<item row="0" column="1"> <item row="0" column="1">
<widget class="SIUnitEdit" name="open_Z0"> <widget class="SIUnitEdit" name="open_Z0">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -933,10 +988,10 @@
</connection> </connection>
</connections> </connections>
<buttongroups> <buttongroups>
<buttongroup name="TRL_Rtype"/> <buttongroup name="ThroughType"/>
<buttongroup name="ShortType"/>
<buttongroup name="LoadType"/> <buttongroup name="LoadType"/>
<buttongroup name="OpenType"/> <buttongroup name="OpenType"/>
<buttongroup name="ThroughType"/> <buttongroup name="ShortType"/>
<buttongroup name="TRL_Rtype"/>
</buttongroups> </buttongroups>
</ui> </ui>