selectable calkit load model
This commit is contained in:
parent
55421d60aa
commit
855d67d028
@ -80,6 +80,13 @@ Calkit Calkit::fromFile(QString filename)
|
||||
qDebug() << "JSON format detected";
|
||||
// calkit file uses json format, parse
|
||||
Savable::parseJSON(j, c.descr);
|
||||
auto jSOLT = j["SOLT"];
|
||||
if (!jSOLT.contains("loadModelCFirst")) {
|
||||
// older version which did not allow the user to choose the load model. CFirst seems to be the more
|
||||
// used standard so it is the default for newer calkits. However, old calkits used LFirst so we need
|
||||
// to keep that to not mess with older calkit files
|
||||
c.SOLT.loadModelCFirst = false;
|
||||
}
|
||||
// adjust Z0/resistance in case of older calkit file version with missing resistance entries
|
||||
if(isnan(c.SOLT.load_f.resistance)) {
|
||||
c.SOLT.load_f.resistance = c.SOLT.load_f.Z0;
|
||||
@ -207,14 +214,20 @@ class Calkit::SOLT Calkit::toSOLT(double frequency, bool male_standards)
|
||||
ref.Load = ts_load->interpolate(frequency).S[0];
|
||||
} else {
|
||||
auto imp_load = complex<double>(Load.resistance, 0);
|
||||
if (SOLT.loadModelCFirst) {
|
||||
// C is the first parameter starting from the VNA port. But the load is modeled here starting from
|
||||
// the other end, so we need to start with the inductor
|
||||
imp_load += complex<double>(0, frequency * 2 * M_PI * Load.Lseries);
|
||||
}
|
||||
// Add parallel capacitor to impedance
|
||||
if(Load.Cparallel > 0) {
|
||||
auto imp_C = complex<double>(0, -1.0 / (frequency * 2 * M_PI * Load.Cparallel));
|
||||
imp_load = (imp_load * imp_C) / (imp_load + imp_C);
|
||||
}
|
||||
// add series inductor to impedance
|
||||
auto imp_L = complex<double>(0, frequency * 2 * M_PI * Load.Lseries);
|
||||
imp_load += imp_L;
|
||||
if (!SOLT.loadModelCFirst) {
|
||||
// inductor not added yet, do so now
|
||||
imp_load += complex<double>(0, frequency * 2 * M_PI * Load.Lseries);
|
||||
}
|
||||
ref.Load = (imp_load - complex<double>(50.0)) / (imp_load + complex<double>(50.0));
|
||||
ref.Load = addTransmissionLine(ref.Load, Load.Z0, Load.delay*1e-12, 0, frequency);
|
||||
}
|
||||
|
@ -79,6 +79,7 @@ private:
|
||||
int Sparam;
|
||||
};
|
||||
Load load_m, load_f;
|
||||
bool loadModelCFirst;
|
||||
struct {
|
||||
double Z0, delay, loss;
|
||||
QString file;
|
||||
@ -152,6 +153,7 @@ private:
|
||||
{&SOLT.short_f.file, "SOLT.Short.Measurements.File_Female", ""},
|
||||
{&SOLT.short_f.Sparam, "SOLT.Short.Measurements.Port_Female", 0},
|
||||
|
||||
{&SOLT.loadModelCFirst, "SOLT.loadModelCFirst", true},
|
||||
{&SOLT.load_m.resistance, "SOLT.Load.Param.Resistance", 50.0},
|
||||
{&SOLT.load_m.Z0, "SOLT.Load.Param.Z0", 50.0},
|
||||
{&SOLT.load_m.delay, "SOLT.Load.Param.Delay", 0.0},
|
||||
|
@ -249,6 +249,7 @@ void CalkitDialog::parseEntries()
|
||||
ownKit.SOLT.short_m.L2 = ui->short_L2->value();
|
||||
ownKit.SOLT.short_m.L3 = ui->short_L3->value();
|
||||
|
||||
ownKit.SOLT.loadModelCFirst = ui->load_C_first->isChecked();
|
||||
ownKit.SOLT.load_m.resistance = ui->load_resistance->value();
|
||||
ownKit.SOLT.load_m.Z0 = ui->load_Z0->value();
|
||||
ownKit.SOLT.load_m.delay = ui->load_delay->value();
|
||||
@ -336,6 +337,8 @@ void CalkitDialog::updateEntries()
|
||||
ui->short_L2->setValueQuiet(ownKit.SOLT.short_m.L2);
|
||||
ui->short_L3->setValueQuiet(ownKit.SOLT.short_m.L3);
|
||||
|
||||
ui->load_C_first->setChecked(ownKit.SOLT.loadModelCFirst);
|
||||
ui->load_L_first->setChecked(!ownKit.SOLT.loadModelCFirst);
|
||||
ui->load_resistance->setValueQuiet(ownKit.SOLT.load_m.resistance);
|
||||
ui->load_Z0->setValueQuiet(ownKit.SOLT.load_m.Z0);
|
||||
ui->load_delay->setValueQuiet(ownKit.SOLT.load_m.delay);
|
||||
|
@ -722,7 +722,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="mf_load">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_7">
|
||||
<attribute name="title">
|
||||
@ -940,6 +940,35 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Load Parameter Model</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="load_L_first">
|
||||
<property name="text">
|
||||
<string>Series L first</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">LoadModel</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="load_C_first">
|
||||
<property name="text">
|
||||
<string>Shunt C first</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">LoadModel</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@ -1477,12 +1506,13 @@
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="LoadType_f"/>
|
||||
<buttongroup name="OpenType"/>
|
||||
<buttongroup name="LoadType"/>
|
||||
<buttongroup name="ShortType"/>
|
||||
<buttongroup name="ThroughType"/>
|
||||
<buttongroup name="OpenType_f"/>
|
||||
<buttongroup name="TRL_Rtype"/>
|
||||
<buttongroup name="LoadType"/>
|
||||
<buttongroup name="ShortType_f"/>
|
||||
<buttongroup name="OpenType"/>
|
||||
<buttongroup name="ThroughType"/>
|
||||
<buttongroup name="LoadModel"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user