mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-04-17 12:23:40 +00:00
Impedance renormalization moved to de-embedding
This commit is contained in:
parent
d08388f903
commit
4307a392fb
42 changed files with 584 additions and 330 deletions
|
|
@ -0,0 +1,57 @@
|
|||
#include "impedancerenormalization.h"
|
||||
|
||||
#include "ui_impedancenormalizationdialog.h"
|
||||
#include "Tools/parameters.h"
|
||||
#include "appwindow.h"
|
||||
|
||||
#include <complex>
|
||||
|
||||
using namespace std;
|
||||
|
||||
ImpedanceRenormalization::ImpedanceRenormalization()
|
||||
: DeembeddingOption(),
|
||||
impedance(50.0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ImpedanceRenormalization::transformDatapoint(VNAData &p)
|
||||
{
|
||||
p.S = Sparam(ABCDparam(p.S, p.reference_impedance), impedance);
|
||||
p.reference_impedance = impedance;
|
||||
}
|
||||
|
||||
nlohmann::json ImpedanceRenormalization::toJSON()
|
||||
{
|
||||
nlohmann::json j;
|
||||
j["impedance"] = impedance;
|
||||
return j;
|
||||
}
|
||||
|
||||
void ImpedanceRenormalization::fromJSON(nlohmann::json j)
|
||||
{
|
||||
impedance = j.value("impedance", impedance);
|
||||
}
|
||||
|
||||
void ImpedanceRenormalization::edit()
|
||||
{
|
||||
auto dialog = new QDialog();
|
||||
ui = new Ui::ImpedanceRenormalizationDialog();
|
||||
ui->setupUi(dialog);
|
||||
connect(dialog, &QDialog::finished, [=](){
|
||||
delete ui;
|
||||
});
|
||||
|
||||
// set initial values
|
||||
ui->impedance->setUnit("Ω");
|
||||
ui->impedance->setPrecision(3);
|
||||
ui->impedance->setValue(impedance);
|
||||
|
||||
connect(ui->impedance, &SIUnitEdit::valueChanged, [&](double newval){
|
||||
impedance = newval;
|
||||
});
|
||||
|
||||
if(AppWindow::showGUI()) {
|
||||
dialog->show();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue