LibreVNA/Software/PC_Application/Calibration/calkit.h

67 lines
1.7 KiB
C
Raw Normal View History

#ifndef CALKIT_H
#define CALKIT_H
#include "touchstone.h"
2020-11-08 21:30:19 +08:00
#include "Util/qpointervariant.h"
#include "calstandard.h"
#include "savable.h"
2021-10-21 19:00:34 +08:00
2022-09-10 06:06:54 +08:00
#include "LibreCAL/caldevice.h"
2021-10-21 19:00:34 +08:00
#include <string>
#include <complex>
2020-11-08 21:30:19 +08:00
#include <QDir>
class Calkit : public Savable
{
friend class CalkitDialog;
public:
Calkit();
2022-03-17 19:53:13 +08:00
Calkit(const Calkit&) = default;
2020-11-08 21:30:19 +08:00
Calkit& operator=(const Calkit& other)
{
this->manufacturer = other.manufacturer;
this->serialnumber = other.serialnumber;
this->description = other.description;
this->standards = other.standards;
2020-11-08 21:30:19 +08:00
return *this;
}
class SOLT {
public:
std::complex<double> Open;
std::complex<double> Short;
std::complex<double> Load;
std::complex<double> ThroughS11, ThroughS12, ThroughS21, ThroughS22;
};
class TRL {
public:
bool reflectionIsNegative;
std::complex<double> ThroughS11, ThroughS12, ThroughS21, ThroughS22;
};
void toFile(QString filename);
static Calkit fromFile(QString filename);
2022-09-10 06:06:54 +08:00
static Calkit fromLibreCAL(CalDevice *device, CalDevice::CoefficientSet s);
void edit(std::function<void(void)> updateCal = nullptr);
2022-08-27 21:28:45 +08:00
std::vector<CalStandard::Virtual *> getStandards() const;
virtual nlohmann::json toJSON() override;
virtual void fromJSON(nlohmann::json j) override;
private:
2022-08-27 01:25:24 +08:00
void clearStandards();
QString manufacturer, serialnumber, description;
std::vector<CalStandard::Virtual*> standards;
2022-01-16 00:00:57 +08:00
const std::vector<Savable::SettingDescription> descr = {{
{&manufacturer, "Manufacturer", ""},
{&serialnumber, "Serialnumber", ""},
{&description, "Description", ""},
2020-11-08 21:30:19 +08:00
}};
};
#endif // CALKIT_H