Add loss to load standard

This commit is contained in:
Jan Käberich 2022-10-01 02:31:53 +02:00
parent d2f1ca8f95
commit 858e945373
7 changed files with 34 additions and 13 deletions

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>349</width>
<height>355</height>
<width>344</width>
<height>386</height>
</rect>
</property>
<property name="windowTitle">
@ -99,23 +99,33 @@
<widget class="SIUnitEdit" name="delay"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Offset loss [GΩ/s]: </string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="SIUnitEdit" name="loss"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Parallel C:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="SIUnitEdit" name="parC"/>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
<string>Series L:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="SIUnitEdit" name="serL"/>
</item>
</layout>
@ -238,7 +248,7 @@
</connection>
</connections>
<buttongroups>
<buttongroup name="buttonGroup"/>
<buttongroup name="buttonGroup_2"/>
<buttongroup name="buttonGroup"/>
</buttongroups>
</ui>

View File

@ -58,7 +58,7 @@
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="page">
<layout class="QFormLayout" name="formLayout">

View File

@ -1014,6 +1014,11 @@ QString Calibration::descriptiveCalName()
return tmp;
}
bool Calibration::hasUnsavedChanges() const
{
return unsavedChanges;
}
Calkit &Calibration::getKit()
{
return kit;

View File

@ -88,7 +88,9 @@ public:
QString getCurrentCalibrationFile();
double getMinFreq();
double getMaxFreq();
int getNumPoints();
bool hasUnsavedChanges() const;
public slots:
// Call once all datapoints of the current span have been added

View File

@ -293,7 +293,7 @@ Calkit Calkit::fromFile(QString filename)
c.standards.push_back(short_f);
}
auto load_m = new CalStandard::Load(SOLT.separate_male_female ? "Default male standard" : "Default standard", SOLT.load_m.Z0, SOLT.load_m.delay, SOLT.load_m.resistance, SOLT.load_m.Cparallel, SOLT.load_m.Lseries, SOLT.loadModelCFirst);
auto load_m = new CalStandard::Load(SOLT.separate_male_female ? "Default male standard" : "Default standard", SOLT.load_m.Z0, SOLT.load_m.delay, 0.0, SOLT.load_m.resistance, SOLT.load_m.Cparallel, SOLT.load_m.Lseries, SOLT.loadModelCFirst);
if(SOLT.load_m.useMeasurements) {
auto ts = Touchstone(1);
ts.fromFile(SOLT.load_m.file.toStdString());
@ -301,7 +301,7 @@ Calkit Calkit::fromFile(QString filename)
}
c.standards.push_back(load_m);
if(SOLT.separate_male_female) {
auto load_f = new CalStandard::Load("Default female standard", SOLT.load_m.Z0, SOLT.load_f.delay, SOLT.load_f.resistance, SOLT.load_f.Cparallel, SOLT.load_f.Lseries, SOLT.loadModelCFirst);
auto load_f = new CalStandard::Load("Default female standard", SOLT.load_m.Z0, SOLT.load_f.delay, 0.0, SOLT.load_f.resistance, SOLT.load_f.Cparallel, SOLT.load_f.Lseries, SOLT.loadModelCFirst);
if(SOLT.load_f.useMeasurements) {
auto ts = Touchstone(1);
ts.fromFile(SOLT.load_f.file.toStdString());

View File

@ -423,7 +423,7 @@ std::complex<double> Load::toS11(double freq)
imp_load += complex<double>(0, freq * 2 * M_PI * Lseries);
}
complex<double> load = (imp_load - complex<double>(50.0)) / (imp_load + complex<double>(50.0));
return addTransmissionLine(load, Z0, delay*1e-12, 0, freq);
return addTransmissionLine(load, Z0, delay*1e-12, loss*1e9, freq);
}
}
@ -441,6 +441,7 @@ void Load::edit(std::function<void(void)> finishedCallback)
ui->Z0->setPrecision(2);
ui->Z0->setValue(Z0);
ui->delay->setValue(delay);
ui->loss->setValue(loss);
ui->parC->setUnit("F");
ui->parC->setPrefixes("pnum ");
ui->parC->setPrecision(3);
@ -497,6 +498,7 @@ void Load::edit(std::function<void(void)> finishedCallback)
resistance = ui->resistance->value();
Z0 = ui->Z0->value();
delay = ui->delay->value();
loss = ui->loss->value();
Cparallel = ui->parC->value();
Lseries = ui->serL->value();
Cfirst = ui->C_first->isChecked();
@ -513,6 +515,7 @@ nlohmann::json Load::toJSON()
auto j = OnePort::toJSON();
j["Z0"] = Z0;
j["delay"] = delay;
j["loss"] = loss;
j["resistance"] = resistance;
j["Cparallel"] = Cparallel;
j["Lseries"] = Lseries;
@ -525,6 +528,7 @@ void Load::fromJSON(nlohmann::json j)
OnePort::fromJSON(j);
Z0 = j.value("Z0", 50.0);
delay = j.value("delay", 0.0);
loss = j.value("loss", 0.0);
resistance = j.value("resistance", 0.0);
Cparallel = j.value("Cparallel", 0.0);
Lseries = j.value("Lseries", 0.0);

View File

@ -113,8 +113,8 @@ class Load : public OnePort
{
public:
Load();
Load(QString name, double Z0, double delay, double resistance, double Cparallel, double Lseries, bool Cfirst = true)
: OnePort(name), Z0(Z0), delay(delay), resistance(resistance), Cparallel(Cparallel), Lseries(Lseries), Cfirst(Cfirst){}
Load(QString name, double Z0, double delay, double loss, double resistance, double Cparallel, double Lseries, bool Cfirst = true)
: OnePort(name), Z0(Z0), delay(delay), loss(loss), resistance(resistance), Cparallel(Cparallel), Lseries(Lseries), Cfirst(Cfirst){}
virtual std::complex<double> toS11(double freq) override;
virtual void edit(std::function<void(void)> finishedCallback = nullptr) override;
@ -122,7 +122,7 @@ public:
virtual nlohmann::json toJSON() override;
virtual void fromJSON(nlohmann::json j) override;
private:
double Z0, delay, resistance, Cparallel, Lseries;
double Z0, delay, loss, resistance, Cparallel, Lseries;
bool Cfirst;
};