LibreVNA/Software/PC_Application/LibreVNA-GUI/VNA/Deembedding/twothru.h

51 lines
1.5 KiB
C
Raw Normal View History

2022-10-01 23:10:44 +08:00
#ifndef TWOTHRU_H
#define TWOTHRU_H
#include "deembeddingoption.h"
#include "Tools/parameters.h"
#include <complex>
#include <QMessageBox>
namespace Ui {
class TwoThruDialog;
}
class TwoThru : public DeembeddingOption
{
public:
TwoThru();
2022-10-14 06:27:22 +08:00
std::set<unsigned int> getAffectedPorts() override;
2023-01-16 07:25:29 +08:00
virtual void transformDatapoint(DeviceDriver::VNAMeasurement& p) override;
2022-10-01 23:10:44 +08:00
virtual void edit() override;
virtual Type getType() override {return DeembeddingOption::Type::TwoThru;}
nlohmann::json toJSON() override;
void fromJSON(nlohmann::json j) override;
private slots:
void startMeasurement();
void updateGUI();
2023-01-16 07:25:29 +08:00
void measurementCompleted(std::vector<DeviceDriver::VNAMeasurement> m) override;
2022-10-01 23:10:44 +08:00
private:
using Point = struct {
double freq;
Tparam inverseP1, inverseP2;
};
2023-01-16 07:25:29 +08:00
static std::vector<DeviceDriver::VNAMeasurement> interpolateEvenFrequencySteps(std::vector<DeviceDriver::VNAMeasurement> input);
std::vector<Point> calculateErrorBoxes(std::vector<DeviceDriver::VNAMeasurement> data_2xthru);
std::vector<Point> calculateErrorBoxes(std::vector<DeviceDriver::VNAMeasurement> data_2xthru, std::vector<DeviceDriver::VNAMeasurement> data_fix_dut_fix, double z0);
2022-10-01 23:10:44 +08:00
2023-01-16 07:25:29 +08:00
std::vector<DeviceDriver::VNAMeasurement> measurements2xthru;
std::vector<DeviceDriver::VNAMeasurement> measurementsDUT;
2022-10-01 23:10:44 +08:00
double Z0;
2022-10-14 06:27:22 +08:00
unsigned int port1, port2;
2022-10-01 23:10:44 +08:00
std::vector<Point> points;
bool measuring2xthru;
bool measuringDUT;
Ui::TwoThruDialog *ui;
};
#endif // TWOTHRU_H