Removed warnings
This commit is contained in:
parent
3f7fb99f58
commit
532702f7fb
21
Software/PC_Application/LibreVNA-GUI/.qmake.stash
Normal file
21
Software/PC_Application/LibreVNA-GUI/.qmake.stash
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
|
||||||
|
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 8
|
||||||
|
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 1
|
||||||
|
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
|
||||||
|
QMAKE_CXX.COMPILER_MACROS = \
|
||||||
|
QT_COMPILER_STDCXX \
|
||||||
|
QMAKE_GCC_MAJOR_VERSION \
|
||||||
|
QMAKE_GCC_MINOR_VERSION \
|
||||||
|
QMAKE_GCC_PATCH_VERSION
|
||||||
|
QMAKE_CXX.INCDIRS = \
|
||||||
|
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++ \
|
||||||
|
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32 \
|
||||||
|
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward \
|
||||||
|
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include \
|
||||||
|
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed \
|
||||||
|
C:/Qt/Tools/mingw810_64/x86_64-w64-mingw32/include
|
||||||
|
QMAKE_CXX.LIBDIRS = \
|
||||||
|
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0 \
|
||||||
|
C:/Qt/Tools/mingw810_64/lib/gcc \
|
||||||
|
C:/Qt/Tools/mingw810_64/x86_64-w64-mingw32/lib \
|
||||||
|
C:/Qt/Tools/mingw810_64/lib
|
@ -39,6 +39,7 @@ QString CalDevice::StandardToString(CalDevice::Standard s)
|
|||||||
case Standard::Through: return "THROUGH";
|
case Standard::Through: return "THROUGH";
|
||||||
case Standard::None: return "NONE";
|
case Standard::None: return "NONE";
|
||||||
}
|
}
|
||||||
|
return "Invalid";
|
||||||
}
|
}
|
||||||
|
|
||||||
CalDevice::Standard CalDevice::StandardFromString(QString s)
|
CalDevice::Standard CalDevice::StandardFromString(QString s)
|
||||||
@ -107,7 +108,7 @@ QString CalDevice::getFirmware() const
|
|||||||
return firmware;
|
return firmware;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CalDevice::getNumPorts() const
|
unsigned int CalDevice::getNumPorts() const
|
||||||
{
|
{
|
||||||
return numPorts;
|
return numPorts;
|
||||||
}
|
}
|
||||||
@ -255,7 +256,7 @@ void CalDevice::saveCoefficientSetsThread()
|
|||||||
if(!usb->Cmd(":COEFF:CREATE "+setName+" "+paramName)) {
|
if(!usb->Cmd(":COEFF:CREATE "+setName+" "+paramName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for(unsigned int i=0;i<points;i++) {
|
for(int i=0;i<points;i++) {
|
||||||
auto point = t.point(i);
|
auto point = t.point(i);
|
||||||
if(point.S.size() == 4) {
|
if(point.S.size() == 4) {
|
||||||
// S parameters in point are in S11 S12 S21 S22 order but the LibreCAL expects
|
// S parameters in point are in S11 S12 S21 S22 order but the LibreCAL expects
|
||||||
@ -338,6 +339,7 @@ bool CalDevice::hasModifiedCoefficients()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CalDevice::CoefficientSet::Coefficient *CalDevice::CoefficientSet::getThrough(int port1, int port2) const
|
CalDevice::CoefficientSet::Coefficient *CalDevice::CoefficientSet::getThrough(int port1, int port2) const
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
|
|
||||||
QString serial();
|
QString serial();
|
||||||
QString getFirmware() const;
|
QString getFirmware() const;
|
||||||
int getNumPorts() const;
|
unsigned int getNumPorts() const;
|
||||||
|
|
||||||
class CoefficientSet {
|
class CoefficientSet {
|
||||||
public:
|
public:
|
||||||
|
@ -233,7 +233,7 @@ void LibreCALDialog::startCalibration()
|
|||||||
std::vector<CalStandard::Virtual*> shortStandards;
|
std::vector<CalStandard::Virtual*> shortStandards;
|
||||||
std::vector<CalStandard::Virtual*> loadStandards;
|
std::vector<CalStandard::Virtual*> loadStandards;
|
||||||
std::vector<CalStandard::Virtual*> throughStandards;
|
std::vector<CalStandard::Virtual*> throughStandards;
|
||||||
for(int i=1;i<=device->getNumPorts();i++) {
|
for(unsigned int i=1;i<=device->getNumPorts();i++) {
|
||||||
if(coeffSet.opens[i-1]->t.points() > 0) {
|
if(coeffSet.opens[i-1]->t.points() > 0) {
|
||||||
auto o = new CalStandard::Open();
|
auto o = new CalStandard::Open();
|
||||||
o->setName("Port "+QString::number(i));
|
o->setName("Port "+QString::number(i));
|
||||||
@ -255,7 +255,7 @@ void LibreCALDialog::startCalibration()
|
|||||||
loadStandards.push_back(o);
|
loadStandards.push_back(o);
|
||||||
kit.standards.push_back(o);
|
kit.standards.push_back(o);
|
||||||
}
|
}
|
||||||
for(int j=i+1;j<=device->getNumPorts();j++) {
|
for(unsigned int j=i+1;j<=device->getNumPorts();j++) {
|
||||||
auto c = coeffSet.getThrough(i,j);
|
auto c = coeffSet.getThrough(i,j);
|
||||||
if(!c) {
|
if(!c) {
|
||||||
continue;
|
continue;
|
||||||
@ -276,7 +276,7 @@ void LibreCALDialog::startCalibration()
|
|||||||
set<CalibrationMeasurement::Base*> shortMeasurements;
|
set<CalibrationMeasurement::Base*> shortMeasurements;
|
||||||
set<CalibrationMeasurement::Base*> loadMeasurements;
|
set<CalibrationMeasurement::Base*> loadMeasurements;
|
||||||
vector<CalibrationMeasurement::TwoPort*> throughMeasurements;
|
vector<CalibrationMeasurement::TwoPort*> throughMeasurements;
|
||||||
for(int p=0;p<vnaPorts;p++) {
|
for(unsigned int p=0;p<vnaPorts;p++) {
|
||||||
if(portAssignment[p] == 0) {
|
if(portAssignment[p] == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@ void LibreCALDialog::startCalibration()
|
|||||||
load->setStandard(loadStandards[portAssignment[p]-1]);
|
load->setStandard(loadStandards[portAssignment[p]-1]);
|
||||||
loadMeasurements.insert(load);
|
loadMeasurements.insert(load);
|
||||||
cal->measurements.push_back(load);
|
cal->measurements.push_back(load);
|
||||||
for(int p2=p+1;p2<vnaPorts;p2++) {
|
for(unsigned int p2=p+1;p2<vnaPorts;p2++) {
|
||||||
if(portAssignment[p2] == 0) {
|
if(portAssignment[p2] == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -355,13 +355,13 @@ void LibreCALDialog::startCalibration()
|
|||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
// into through measurements now
|
// into through measurements now
|
||||||
int throughIndex = measurementsTaken - 3;
|
unsigned int throughIndex = measurementsTaken - 3;
|
||||||
if(throughIndex >= throughMeasurements.size()) {
|
if(throughIndex >= throughMeasurements.size()) {
|
||||||
// this was the last measurement
|
// this was the last measurement
|
||||||
// Try to apply the calibration
|
// Try to apply the calibration
|
||||||
Calibration::CalType type;
|
Calibration::CalType type;
|
||||||
type.type = Calibration::Type::SOLT;
|
type.type = Calibration::Type::SOLT;
|
||||||
for(int i=0;i<vnaPorts;i++) {
|
for(unsigned int i=0;i<vnaPorts;i++) {
|
||||||
if(portAssignment[i] > 0) {
|
if(portAssignment[i] > 0) {
|
||||||
// this VNA port was used in the calibration
|
// this VNA port was used in the calibration
|
||||||
type.usedPorts.push_back(i+1);
|
type.usedPorts.push_back(i+1);
|
||||||
@ -436,7 +436,7 @@ void LibreCALDialog::createPortAssignmentUI()
|
|||||||
for(int i=1;i<=calPorts;i++) {
|
for(int i=1;i<=calPorts;i++) {
|
||||||
choices.push_back("Port "+QString::number(i));
|
choices.push_back("Port "+QString::number(i));
|
||||||
}
|
}
|
||||||
for(int p = 1;p<=vnaPorts;p++) {
|
for(unsigned int p = 1;p<=vnaPorts;p++) {
|
||||||
auto label = new QLabel("Port "+QString::number(p)+":");
|
auto label = new QLabel("Port "+QString::number(p)+":");
|
||||||
auto comboBox = new QComboBox();
|
auto comboBox = new QComboBox();
|
||||||
comboBox->addItems(choices);
|
comboBox->addItems(choices);
|
||||||
@ -445,7 +445,7 @@ void LibreCALDialog::createPortAssignmentUI()
|
|||||||
emit portAssignmentChanged();
|
emit portAssignmentChanged();
|
||||||
});
|
});
|
||||||
// try to set the default
|
// try to set the default
|
||||||
if(comboBox->count() > p) {
|
if(comboBox->count() > (int) p) {
|
||||||
comboBox->setCurrentIndex(p);
|
comboBox->setCurrentIndex(p);
|
||||||
} else {
|
} else {
|
||||||
// port not available, set to unused
|
// port not available, set to unused
|
||||||
|
@ -240,13 +240,6 @@ bool USBDevice::receive(QString *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool USBDevice::flushRX()
|
|
||||||
{
|
|
||||||
char data[512];
|
|
||||||
// libusb_bulk_transfer(m_handle, LIBUSB_ENDPOINT_IN | 0x03, (unsigned char*) data, sizeof(data), &actual, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString USBDevice::serial() const
|
QString USBDevice::serial() const
|
||||||
{
|
{
|
||||||
return m_serial;
|
return m_serial;
|
||||||
|
@ -24,7 +24,6 @@ private:
|
|||||||
static void SearchDevices(std::function<bool (libusb_device_handle *, QString)> foundCallback, libusb_context *context, bool ignoreOpenError);
|
static void SearchDevices(std::function<bool (libusb_device_handle *, QString)> foundCallback, libusb_context *context, bool ignoreOpenError);
|
||||||
bool send(const QString &s);
|
bool send(const QString &s);
|
||||||
bool receive(QString *s);
|
bool receive(QString *s);
|
||||||
bool flushRX();
|
|
||||||
libusb_device_handle *m_handle;
|
libusb_device_handle *m_handle;
|
||||||
libusb_context *m_context;
|
libusb_context *m_context;
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ Calibration::Calibration()
|
|||||||
return SCPI::getResultName(SCPI::Result::Error);
|
return SCPI::getResultName(SCPI::Result::Error);
|
||||||
}
|
}
|
||||||
bool okay;
|
bool okay;
|
||||||
int number = params[1].toInt(&okay);
|
unsigned int number = params[1].toInt(&okay);
|
||||||
if(!okay || number < 1 || number > VirtualDevice::getInfo(VirtualDevice::getConnected()).ports) {
|
if(!okay || number < 1 || number > VirtualDevice::getInfo(VirtualDevice::getConnected()).ports) {
|
||||||
// invalid port specified
|
// invalid port specified
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
return SCPI::getResultName(SCPI::Result::Error);
|
||||||
@ -161,9 +161,9 @@ Calibration::Calibration()
|
|||||||
return SCPI::getResultName(SCPI::Result::Error);
|
return SCPI::getResultName(SCPI::Result::Error);
|
||||||
}
|
}
|
||||||
bool okay1;
|
bool okay1;
|
||||||
int port1 = params[1].toInt(&okay1);
|
unsigned int port1 = params[1].toInt(&okay1);
|
||||||
bool okay2;
|
bool okay2;
|
||||||
int port2 = params[2].toInt(&okay2);
|
unsigned int port2 = params[2].toInt(&okay2);
|
||||||
if(!okay1 || !okay2 || port1 < 1 || port2 > VirtualDevice::getInfo(VirtualDevice::getConnected()).ports
|
if(!okay1 || !okay2 || port1 < 1 || port2 > VirtualDevice::getInfo(VirtualDevice::getConnected()).ports
|
||||||
|| port2 < 1 || port2 > VirtualDevice::getInfo(VirtualDevice::getConnected()).ports) {
|
|| port2 < 1 || port2 > VirtualDevice::getInfo(VirtualDevice::getConnected()).ports) {
|
||||||
// invalid port specified
|
// invalid port specified
|
||||||
@ -233,7 +233,7 @@ Calibration::Calibration()
|
|||||||
}
|
}
|
||||||
auto s = measurements[number]->getStandard();
|
auto s = measurements[number]->getStandard();
|
||||||
if(s) {
|
if(s) {
|
||||||
s->getName();
|
return s->getName();
|
||||||
} else {
|
} else {
|
||||||
// no standard set
|
// no standard set
|
||||||
return "None";
|
return "None";
|
||||||
@ -300,6 +300,7 @@ QString Calibration::TypeToString(Calibration::Type type)
|
|||||||
case Type::TRL: return "TRL";
|
case Type::TRL: return "TRL";
|
||||||
case Type::Last: return "Invalid";
|
case Type::Last: return "Invalid";
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
Calibration::Type Calibration::TypeFromString(QString s)
|
Calibration::Type Calibration::TypeFromString(QString s)
|
||||||
@ -450,7 +451,7 @@ void Calibration::edit()
|
|||||||
|
|
||||||
auto updateCalibrationList = [=](){
|
auto updateCalibrationList = [=](){
|
||||||
auto style = QApplication::style();
|
auto style = QApplication::style();
|
||||||
for(int i=0;i<availableCals.size();i++) {
|
for(unsigned int i=0;i<availableCals.size();i++) {
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
if(canCompute(availableCals[i])) {
|
if(canCompute(availableCals[i])) {
|
||||||
icon = style->standardIcon(QStyle::SP_DialogApplyButton);
|
icon = style->standardIcon(QStyle::SP_DialogApplyButton);
|
||||||
@ -466,7 +467,7 @@ void Calibration::edit()
|
|||||||
updateCalStatistics();
|
updateCalStatistics();
|
||||||
updateCalButtons();
|
updateCalButtons();
|
||||||
|
|
||||||
connect(ui->calibrationList, &QListWidget::doubleClicked, [=](const QModelIndex &index) {
|
connect(ui->calibrationList, &QListWidget::doubleClicked, [=](const QModelIndex&) {
|
||||||
ui->activate->clicked();
|
ui->activate->clicked();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -648,7 +649,7 @@ void Calibration::edit()
|
|||||||
QObject::connect(action, &QAction::triggered, [=](){
|
QObject::connect(action, &QAction::triggered, [=](){
|
||||||
auto newMeas = newMeasurement(t);
|
auto newMeas = newMeasurement(t);
|
||||||
if(newMeas) {
|
if(newMeas) {
|
||||||
// measurements.push_back(newMeas);
|
measurements.push_back(newMeas);
|
||||||
updateMeasurementTable();
|
updateMeasurementTable();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -674,6 +675,7 @@ CalibrationMeasurement::Base *Calibration::newMeasurement(CalibrationMeasurement
|
|||||||
case CalibrationMeasurement::Base::Type::Through: m = new CalibrationMeasurement::Through(this); break;
|
case CalibrationMeasurement::Base::Type::Through: m = new CalibrationMeasurement::Through(this); break;
|
||||||
case CalibrationMeasurement::Base::Type::Isolation: m = new CalibrationMeasurement::Isolation(this); break;
|
case CalibrationMeasurement::Base::Type::Isolation: m = new CalibrationMeasurement::Isolation(this); break;
|
||||||
case CalibrationMeasurement::Base::Type::Line: m = new CalibrationMeasurement::Line(this); break;
|
case CalibrationMeasurement::Base::Type::Line: m = new CalibrationMeasurement::Line(this); break;
|
||||||
|
case CalibrationMeasurement::Base::Type::Last: break;
|
||||||
}
|
}
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
@ -800,7 +802,7 @@ Calibration::Point Calibration::computeThroughNormalization(double f)
|
|||||||
// grab measurement and calkit through definitions
|
// grab measurement and calkit through definitions
|
||||||
auto throughForward = static_cast<CalibrationMeasurement::Through*>(findMeasurement(CalibrationMeasurement::Base::Type::Through, p1, p2));
|
auto throughForward = static_cast<CalibrationMeasurement::Through*>(findMeasurement(CalibrationMeasurement::Base::Type::Through, p1, p2));
|
||||||
auto throughReverse = static_cast<CalibrationMeasurement::Through*>(findMeasurement(CalibrationMeasurement::Base::Type::Through, p2, p1));
|
auto throughReverse = static_cast<CalibrationMeasurement::Through*>(findMeasurement(CalibrationMeasurement::Base::Type::Through, p2, p1));
|
||||||
complex<double> S11, S21;
|
complex<double> S21;
|
||||||
Sparam Sideal;
|
Sparam Sideal;
|
||||||
if(throughForward) {
|
if(throughForward) {
|
||||||
S21 = throughForward->getMeasured(f).m21;
|
S21 = throughForward->getMeasured(f).m21;
|
||||||
@ -1091,7 +1093,9 @@ std::vector<Trace *> Calibration::getMeasurementTraces()
|
|||||||
switch(m->getType()) {
|
switch(m->getType()) {
|
||||||
case CalibrationMeasurement::Base::Type::Open:
|
case CalibrationMeasurement::Base::Type::Open:
|
||||||
case CalibrationMeasurement::Base::Type::Short:
|
case CalibrationMeasurement::Base::Type::Short:
|
||||||
case CalibrationMeasurement::Base::Type::Load: {
|
case CalibrationMeasurement::Base::Type::Load:
|
||||||
|
case CalibrationMeasurement::Base::Type::SlidingLoad:
|
||||||
|
case CalibrationMeasurement::Base::Type::Reflect: {
|
||||||
auto onePort = static_cast<CalibrationMeasurement::OnePort*>(m);
|
auto onePort = static_cast<CalibrationMeasurement::OnePort*>(m);
|
||||||
auto t = new Trace(CalibrationMeasurement::Base::TypeToString(onePort->getType())+"_Port"+QString::number(onePort->getPort()));
|
auto t = new Trace(CalibrationMeasurement::Base::TypeToString(onePort->getType())+"_Port"+QString::number(onePort->getPort()));
|
||||||
t->setCalibration();
|
t->setCalibration();
|
||||||
@ -1105,7 +1109,8 @@ std::vector<Trace *> Calibration::getMeasurementTraces()
|
|||||||
ret.push_back(t);
|
ret.push_back(t);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CalibrationMeasurement::Base::Type::Through: {
|
case CalibrationMeasurement::Base::Type::Through:
|
||||||
|
case CalibrationMeasurement::Base::Type::Line: {
|
||||||
auto twoPort = static_cast<CalibrationMeasurement::TwoPort*>(m);
|
auto twoPort = static_cast<CalibrationMeasurement::TwoPort*>(m);
|
||||||
auto ts11 = new Trace(CalibrationMeasurement::Base::TypeToString(twoPort->getType())+"_Port"+QString::number(twoPort->getPort1())+QString::number(twoPort->getPort2())+"_S11");
|
auto ts11 = new Trace(CalibrationMeasurement::Base::TypeToString(twoPort->getType())+"_Port"+QString::number(twoPort->getPort1())+QString::number(twoPort->getPort2())+"_S11");
|
||||||
auto ts12 = new Trace(CalibrationMeasurement::Base::TypeToString(twoPort->getType())+"_Port"+QString::number(twoPort->getPort1())+QString::number(twoPort->getPort2())+"_S12");
|
auto ts12 = new Trace(CalibrationMeasurement::Base::TypeToString(twoPort->getType())+"_Port"+QString::number(twoPort->getPort1())+QString::number(twoPort->getPort2())+"_S12");
|
||||||
@ -1157,8 +1162,8 @@ std::vector<Trace *> Calibration::getMeasurementTraces()
|
|||||||
for(auto p : iso->getPoints()) {
|
for(auto p : iso->getPoints()) {
|
||||||
Trace::Data td;
|
Trace::Data td;
|
||||||
td.x = p.frequency;
|
td.x = p.frequency;
|
||||||
for(int i=0;i<p.S.size();i++) {
|
for(unsigned int i=0;i<p.S.size();i++) {
|
||||||
for(int j=0;j<p.S[i].size();j++) {
|
for(unsigned int j=0;j<p.S[i].size();j++) {
|
||||||
td.y = p.S[i][j];
|
td.y = p.S[i][j];
|
||||||
traces[i][j]->addData(td, Trace::DataType::Frequency);
|
traces[i][j]->addData(td, Trace::DataType::Frequency);
|
||||||
}
|
}
|
||||||
@ -1166,6 +1171,8 @@ std::vector<Trace *> Calibration::getMeasurementTraces()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CalibrationMeasurement::Base::Type::Last:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -1361,7 +1368,7 @@ bool Calibration::fromFile(QString filename)
|
|||||||
|
|
||||||
std::vector<Calibration::CalType> Calibration::getAvailableCalibrations()
|
std::vector<Calibration::CalType> Calibration::getAvailableCalibrations()
|
||||||
{
|
{
|
||||||
int ports = 2;
|
unsigned int ports = 2;
|
||||||
if(VirtualDevice::getConnected()) {
|
if(VirtualDevice::getConnected()) {
|
||||||
ports = VirtualDevice::getConnected()->getInfo().ports;
|
ports = VirtualDevice::getConnected()->getInfo().ports;
|
||||||
}
|
}
|
||||||
@ -1370,13 +1377,13 @@ std::vector<Calibration::CalType> Calibration::getAvailableCalibrations()
|
|||||||
CalType cal;
|
CalType cal;
|
||||||
cal.type = t;
|
cal.type = t;
|
||||||
auto minPorts = minimumPorts(t);
|
auto minPorts = minimumPorts(t);
|
||||||
for(int pnum = minPorts;pnum <= ports;pnum++) {
|
for(unsigned int pnum = minPorts;pnum <= ports;pnum++) {
|
||||||
std::string bitmask(pnum, 1);
|
std::string bitmask(pnum, 1);
|
||||||
bitmask.resize(ports, 0);
|
bitmask.resize(ports, 0);
|
||||||
// assemble selected ports and permute bitmask
|
// assemble selected ports and permute bitmask
|
||||||
do {
|
do {
|
||||||
vector<int> usedPorts;
|
vector<unsigned int> usedPorts;
|
||||||
for (int i = 0; i < ports; ++i) {
|
for (unsigned int i = 0; i < ports; ++i) {
|
||||||
if (bitmask[i]) {
|
if (bitmask[i]) {
|
||||||
usedPorts.push_back(i+1);
|
usedPorts.push_back(i+1);
|
||||||
}
|
}
|
||||||
@ -1403,7 +1410,7 @@ bool Calibration::canCompute(Calibration::CalType type, double *startFreq, doubl
|
|||||||
{
|
{
|
||||||
using RequiredMeasurements = struct {
|
using RequiredMeasurements = struct {
|
||||||
CalibrationMeasurement::Base::Type type;
|
CalibrationMeasurement::Base::Type type;
|
||||||
int port1, port2;
|
unsigned int port1, port2;
|
||||||
};
|
};
|
||||||
vector<RequiredMeasurements> required;
|
vector<RequiredMeasurements> required;
|
||||||
switch(type.type) {
|
switch(type.type) {
|
||||||
@ -1412,27 +1419,27 @@ bool Calibration::canCompute(Calibration::CalType type, double *startFreq, doubl
|
|||||||
case Type::SOLT:
|
case Type::SOLT:
|
||||||
// SOL measurements for every port
|
// SOL measurements for every port
|
||||||
for(auto p : type.usedPorts) {
|
for(auto p : type.usedPorts) {
|
||||||
required.push_back({.type = CalibrationMeasurement::Base::Type::Short, .port1 = p});
|
required.push_back({.type = CalibrationMeasurement::Base::Type::Short, .port1 = p, .port2 = 0});
|
||||||
required.push_back({.type = CalibrationMeasurement::Base::Type::Open, .port1 = p});
|
required.push_back({.type = CalibrationMeasurement::Base::Type::Open, .port1 = p, .port2 = 0});
|
||||||
if(findMeasurements(CalibrationMeasurement::Base::Type::SlidingLoad, p).size() >= 3) {
|
if(findMeasurements(CalibrationMeasurement::Base::Type::SlidingLoad, p).size() >= 3) {
|
||||||
// got enough sliding load measurements, use these
|
// got enough sliding load measurements, use these
|
||||||
required.push_back({.type = CalibrationMeasurement::Base::Type::SlidingLoad, .port1 = p});
|
required.push_back({.type = CalibrationMeasurement::Base::Type::SlidingLoad, .port1 = p, .port2 = 0});
|
||||||
} else {
|
} else {
|
||||||
// not enough sliding load measurement, use normal load
|
// not enough sliding load measurement, use normal load
|
||||||
required.push_back({.type = CalibrationMeasurement::Base::Type::Load, .port1 = p});
|
required.push_back({.type = CalibrationMeasurement::Base::Type::Load, .port1 = p, .port2 = 0});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// through measurements between all ports
|
// through measurements between all ports
|
||||||
for(int i=1;i<=type.usedPorts.size();i++) {
|
for(unsigned int i=1;i<=type.usedPorts.size();i++) {
|
||||||
for(int j=i+1;j<=type.usedPorts.size();j++) {
|
for(unsigned int j=i+1;j<=type.usedPorts.size();j++) {
|
||||||
required.push_back({.type = CalibrationMeasurement::Base::Type::Through, .port1 = i, .port2 = j});
|
required.push_back({.type = CalibrationMeasurement::Base::Type::Through, .port1 = i, .port2 = j});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Type::ThroughNormalization:
|
case Type::ThroughNormalization:
|
||||||
// through measurements between all ports
|
// through measurements between all ports
|
||||||
for(int i=1;i<=type.usedPorts.size();i++) {
|
for(unsigned int i=1;i<=type.usedPorts.size();i++) {
|
||||||
for(int j=i+1;j<=type.usedPorts.size();j++) {
|
for(unsigned int j=i+1;j<=type.usedPorts.size();j++) {
|
||||||
required.push_back({.type = CalibrationMeasurement::Base::Type::Through, .port1 = i, .port2 = j});
|
required.push_back({.type = CalibrationMeasurement::Base::Type::Through, .port1 = i, .port2 = j});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1440,16 +1447,20 @@ bool Calibration::canCompute(Calibration::CalType type, double *startFreq, doubl
|
|||||||
case Type::TRL:
|
case Type::TRL:
|
||||||
// Reflect measurement for every port
|
// Reflect measurement for every port
|
||||||
for(auto p : type.usedPorts) {
|
for(auto p : type.usedPorts) {
|
||||||
required.push_back({.type = CalibrationMeasurement::Base::Type::Reflect, .port1 = p});
|
required.push_back({.type = CalibrationMeasurement::Base::Type::Reflect, .port1 = p, .port2 = 0});
|
||||||
}
|
}
|
||||||
// through and line measurements between all ports
|
// through and line measurements between all ports
|
||||||
for(int i=1;i<=type.usedPorts.size();i++) {
|
for(unsigned int i=1;i<=type.usedPorts.size();i++) {
|
||||||
for(int j=i+1;j<=type.usedPorts.size();j++) {
|
for(unsigned int j=i+1;j<=type.usedPorts.size();j++) {
|
||||||
required.push_back({.type = CalibrationMeasurement::Base::Type::Through, .port1 = i, .port2 = j});
|
required.push_back({.type = CalibrationMeasurement::Base::Type::Through, .port1 = i, .port2 = j});
|
||||||
required.push_back({.type = CalibrationMeasurement::Base::Type::Line, .port1 = i, .port2 = j});
|
required.push_back({.type = CalibrationMeasurement::Base::Type::Line, .port1 = i, .port2 = j});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Type::Last:
|
||||||
|
// Invalid selection
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
if(required.size() > 0) {
|
if(required.size() > 0) {
|
||||||
vector<CalibrationMeasurement::Base*> foundMeasurements;
|
vector<CalibrationMeasurement::Base*> foundMeasurements;
|
||||||
@ -1488,6 +1499,10 @@ bool Calibration::compute(Calibration::CalType type)
|
|||||||
case Type::SOLT: p = computeSOLT(f); break;
|
case Type::SOLT: p = computeSOLT(f); break;
|
||||||
case Type::ThroughNormalization: p = computeThroughNormalization(f); break;
|
case Type::ThroughNormalization: p = computeThroughNormalization(f); break;
|
||||||
case Type::TRL: p = computeTRL(f); break;
|
case Type::TRL: p = computeTRL(f); break;
|
||||||
|
case Type::None:
|
||||||
|
case Type::Last:
|
||||||
|
// nothing to do, should never get here
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
points.push_back(p);
|
points.push_back(p);
|
||||||
}
|
}
|
||||||
@ -1512,6 +1527,9 @@ int Calibration::minimumPorts(Calibration::Type type)
|
|||||||
case Type::SOLT: return 1;
|
case Type::SOLT: return 1;
|
||||||
case Type::ThroughNormalization: return 2;
|
case Type::ThroughNormalization: return 2;
|
||||||
case Type::TRL: return 2;
|
case Type::TRL: return 2;
|
||||||
|
case Type::None:
|
||||||
|
case Type::Last:
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1553,7 +1571,9 @@ QString Calibration::DefaultMeasurementsToString(Calibration::DefaultMeasurement
|
|||||||
case DefaultMeasurements::SOLT2Port: return "2 Port SOLT";
|
case DefaultMeasurements::SOLT2Port: return "2 Port SOLT";
|
||||||
case DefaultMeasurements::SOLT3Port: return "3 Port SOLT";
|
case DefaultMeasurements::SOLT3Port: return "3 Port SOLT";
|
||||||
case DefaultMeasurements::SOLT4Port: return "4 Port SOLT";
|
case DefaultMeasurements::SOLT4Port: return "4 Port SOLT";
|
||||||
|
case DefaultMeasurements::Last: return "Invalid";
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Calibration::createDefaultMeasurements(Calibration::DefaultMeasurements dm)
|
void Calibration::createDefaultMeasurements(Calibration::DefaultMeasurements dm)
|
||||||
@ -1604,6 +1624,8 @@ void Calibration::createDefaultMeasurements(Calibration::DefaultMeasurements dm)
|
|||||||
createThrough(2, 4);
|
createThrough(2, 4);
|
||||||
createThrough(3, 4);
|
createThrough(3, 4);
|
||||||
break;
|
break;
|
||||||
|
case DefaultMeasurements::Last:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public:
|
|||||||
class CalType {
|
class CalType {
|
||||||
public:
|
public:
|
||||||
Type type;
|
Type type;
|
||||||
std::vector<int> usedPorts; // port count starts at 1
|
std::vector<unsigned int> usedPorts; // port count starts at 1
|
||||||
QString getReadableDescription();
|
QString getReadableDescription();
|
||||||
QString getShortString();
|
QString getShortString();
|
||||||
|
|
||||||
|
@ -34,7 +34,9 @@ bool CalibrationMeasurement::Base::setFirstSupportedStandard()
|
|||||||
auto supported = supportedStandards();
|
auto supported = supportedStandards();
|
||||||
if(supported.size() > 0) {
|
if(supported.size() > 0) {
|
||||||
setStandard(supported[0]);
|
setStandard(supported[0]);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CalibrationMeasurement::Base::setStandard(CalStandard::Virtual *standard)
|
bool CalibrationMeasurement::Base::setStandard(CalStandard::Virtual *standard)
|
||||||
@ -93,6 +95,7 @@ QString CalibrationMeasurement::Base::TypeToString(CalibrationMeasurement::Base:
|
|||||||
case Type::Line: return "Line";
|
case Type::Line: return "Line";
|
||||||
case Type::Last: return "Invalid";
|
case Type::Last: return "Invalid";
|
||||||
}
|
}
|
||||||
|
return "Invalid";
|
||||||
}
|
}
|
||||||
|
|
||||||
CalibrationMeasurement::Base::Type CalibrationMeasurement::Base::TypeFromString(QString s)
|
CalibrationMeasurement::Base::Type CalibrationMeasurement::Base::TypeFromString(QString s)
|
||||||
@ -164,14 +167,23 @@ bool CalibrationMeasurement::Base::canMeasureSimultaneously(std::set<Calibration
|
|||||||
case Type::Open:
|
case Type::Open:
|
||||||
case Type::Short:
|
case Type::Short:
|
||||||
case Type::Load:
|
case Type::Load:
|
||||||
|
case Type::SlidingLoad:
|
||||||
|
case Type::Reflect:
|
||||||
// Uses one port
|
// Uses one port
|
||||||
ports.push_back(static_cast<OnePort*>(m)->getPort());
|
ports.push_back(static_cast<OnePort*>(m)->getPort());
|
||||||
break;
|
break;
|
||||||
case Type::Through:
|
case Type::Through:
|
||||||
|
case Type::Line:
|
||||||
// Uses two ports
|
// Uses two ports
|
||||||
ports.push_back(static_cast<TwoPort*>(m)->getPort1());
|
ports.push_back(static_cast<TwoPort*>(m)->getPort1());
|
||||||
ports.push_back(static_cast<TwoPort*>(m)->getPort2());
|
ports.push_back(static_cast<TwoPort*>(m)->getPort2());
|
||||||
break;
|
break;
|
||||||
|
case Type::Isolation:
|
||||||
|
// Uses all ports, unable to measure simultaneously
|
||||||
|
return false;
|
||||||
|
case Type::Last:
|
||||||
|
// invalid
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
for(auto p : ports) {
|
for(auto p : ports) {
|
||||||
if(usedPorts.count(p)) {
|
if(usedPorts.count(p)) {
|
||||||
@ -241,7 +253,7 @@ QWidget *CalibrationMeasurement::OnePort::createSettingsWidget()
|
|||||||
if(port == 0) {
|
if(port == 0) {
|
||||||
setPort(1);
|
setPort(1);
|
||||||
}
|
}
|
||||||
for(int i=1;i<=dev->getInfo().ports;i++) {
|
for(unsigned int i=1;i<=dev->getInfo().ports;i++) {
|
||||||
cbPort->addItem(QString::number(i));
|
cbPort->addItem(QString::number(i));
|
||||||
if(port == i) {
|
if(port == i) {
|
||||||
cbPort->setCurrentText(QString::number(i));
|
cbPort->setCurrentText(QString::number(i));
|
||||||
@ -331,7 +343,7 @@ int CalibrationMeasurement::OnePort::getPort() const
|
|||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrationMeasurement::OnePort::setPort(int p)
|
void CalibrationMeasurement::OnePort::setPort(unsigned int p)
|
||||||
{
|
{
|
||||||
if(port != p) {
|
if(port != p) {
|
||||||
port = p;
|
port = p;
|
||||||
@ -393,7 +405,7 @@ QWidget *CalibrationMeasurement::TwoPort::createSettingsWidget()
|
|||||||
if(port2 == 0) {
|
if(port2 == 0) {
|
||||||
setPort2(2);
|
setPort2(2);
|
||||||
}
|
}
|
||||||
for(int i=1;i<=dev->getInfo().ports;i++) {
|
for(unsigned int i=1;i<=dev->getInfo().ports;i++) {
|
||||||
cbPort1->addItem(QString::number(i));
|
cbPort1->addItem(QString::number(i));
|
||||||
cbPort2->addItem(QString::number(i));
|
cbPort2->addItem(QString::number(i));
|
||||||
if(port1 == i) {
|
if(port1 == i) {
|
||||||
@ -527,7 +539,7 @@ int CalibrationMeasurement::TwoPort::getPort2() const
|
|||||||
return port2;
|
return port2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrationMeasurement::TwoPort::setPort1(int p)
|
void CalibrationMeasurement::TwoPort::setPort1(unsigned int p)
|
||||||
{
|
{
|
||||||
if(port1 != p) {
|
if(port1 != p) {
|
||||||
port1 = p;
|
port1 = p;
|
||||||
@ -535,7 +547,7 @@ void CalibrationMeasurement::TwoPort::setPort1(int p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrationMeasurement::TwoPort::setPort2(int p)
|
void CalibrationMeasurement::TwoPort::setPort2(unsigned int p)
|
||||||
{
|
{
|
||||||
if(port2 != p) {
|
if(port2 != p) {
|
||||||
port2 = p;
|
port2 = p;
|
||||||
|
@ -101,12 +101,12 @@ public:
|
|||||||
int getPort() const;
|
int getPort() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPort(int p);
|
void setPort(unsigned int p);
|
||||||
protected:
|
protected:
|
||||||
signals:
|
signals:
|
||||||
void portChanged(int p);
|
void portChanged(int p);
|
||||||
protected:
|
protected:
|
||||||
int port; // starts at 1
|
unsigned int port; // starts at 1
|
||||||
std::vector<Point> points;
|
std::vector<Point> points;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -203,8 +203,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPort1(int p);
|
void setPort1(unsigned int p);
|
||||||
void setPort2(int p);
|
void setPort2(unsigned int p);
|
||||||
void setReverseStandard(bool reverse);
|
void setReverseStandard(bool reverse);
|
||||||
protected:
|
protected:
|
||||||
signals:
|
signals:
|
||||||
@ -212,7 +212,7 @@ signals:
|
|||||||
void port2Changed(int p);
|
void port2Changed(int p);
|
||||||
void reverseStandardChanged(bool r);
|
void reverseStandardChanged(bool r);
|
||||||
protected:
|
protected:
|
||||||
int port1, port2; // starts at 1
|
unsigned int port1, port2; // starts at 1
|
||||||
bool reverseStandard; // Set to true if standard is defined with ports swapped
|
bool reverseStandard; // Set to true if standard is defined with ports swapped
|
||||||
std::vector<Point> points;
|
std::vector<Point> points;
|
||||||
};
|
};
|
||||||
|
@ -54,6 +54,7 @@ QString Virtual::TypeToString(Virtual::Type type)
|
|||||||
case Type::Line: return "Line";
|
case Type::Line: return "Line";
|
||||||
case Type::Last: return "Invalid";
|
case Type::Last: return "Invalid";
|
||||||
}
|
}
|
||||||
|
return "Invalid";
|
||||||
}
|
}
|
||||||
|
|
||||||
Virtual::Type Virtual::TypeFromString(QString s)
|
Virtual::Type Virtual::TypeFromString(QString s)
|
||||||
@ -718,6 +719,7 @@ Line::Line()
|
|||||||
|
|
||||||
Sparam Line::toSparam(double freq)
|
Sparam Line::toSparam(double freq)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(freq)
|
||||||
Sparam ret;
|
Sparam ret;
|
||||||
ret.m11 = numeric_limits<complex<double>>::quiet_NaN();
|
ret.m11 = numeric_limits<complex<double>>::quiet_NaN();
|
||||||
ret.m12 = numeric_limits<complex<double>>::quiet_NaN();
|
ret.m12 = numeric_limits<complex<double>>::quiet_NaN();
|
||||||
|
@ -15,6 +15,7 @@ class Virtual : public Savable
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Virtual(QString name = "");
|
Virtual(QString name = "");
|
||||||
|
virtual ~Virtual(){};
|
||||||
|
|
||||||
enum class Type {
|
enum class Type {
|
||||||
Open,
|
Open,
|
||||||
|
@ -76,7 +76,7 @@ QString CompoundDevice::getDesription()
|
|||||||
return name + ", "+QString::number(deviceSerials.size())+" devices, "+QString::number(portMapping.size())+" ports in total";
|
return name + ", "+QString::number(deviceSerials.size())+" devices, "+QString::number(portMapping.size())+" ports in total";
|
||||||
}
|
}
|
||||||
|
|
||||||
int CompoundDevice::PortMapping::findActiveStage(std::vector<CompoundDevice::PortMapping> map, int device, int port)
|
int CompoundDevice::PortMapping::findActiveStage(std::vector<CompoundDevice::PortMapping> map, unsigned int device, unsigned int port)
|
||||||
{
|
{
|
||||||
for(unsigned int i=0;i<map.size();i++) {
|
for(unsigned int i=0;i<map.size();i++) {
|
||||||
if(map[i].device == device && map[i].port == port) {
|
if(map[i].device == device && map[i].port == port) {
|
||||||
|
@ -13,14 +13,14 @@ class CompoundDevice : public Savable
|
|||||||
public:
|
public:
|
||||||
CompoundDevice();
|
CompoundDevice();
|
||||||
|
|
||||||
virtual nlohmann::json toJSON();
|
nlohmann::json toJSON() override;
|
||||||
virtual void fromJSON(nlohmann::json j);
|
void fromJSON(nlohmann::json j) override;
|
||||||
|
|
||||||
class PortMapping {
|
class PortMapping {
|
||||||
public:
|
public:
|
||||||
unsigned int device;
|
unsigned int device;
|
||||||
unsigned int port;
|
unsigned int port;
|
||||||
static int findActiveStage(std::vector<PortMapping> map, int device, int port);
|
static int findActiveStage(std::vector<PortMapping> map, unsigned int device, unsigned int port);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class Synchronization {
|
enum class Synchronization {
|
||||||
|
@ -98,7 +98,7 @@ void CompoundDeviceEditDialog::checkIfOkay()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check serials
|
// Check serials
|
||||||
for(int i=0;i<ldev.deviceSerials.size();i++) {
|
for(unsigned int i=0;i<ldev.deviceSerials.size();i++) {
|
||||||
ldev.deviceSerials[i] = deviceFrames[i]->getSerial();
|
ldev.deviceSerials[i] = deviceFrames[i]->getSerial();
|
||||||
if(ldev.deviceSerials[i].isEmpty()) {
|
if(ldev.deviceSerials[i].isEmpty()) {
|
||||||
ui->status->setText("Device "+QString::number(i+1)+" has no serial number");
|
ui->status->setText("Device "+QString::number(i+1)+" has no serial number");
|
||||||
@ -106,8 +106,8 @@ void CompoundDeviceEditDialog::checkIfOkay()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check serials for duplicates
|
// Check serials for duplicates
|
||||||
for(int i=0;i<ldev.deviceSerials.size();i++) {
|
for(unsigned int i=0;i<ldev.deviceSerials.size();i++) {
|
||||||
for(int j=i+1;j<ldev.deviceSerials.size();j++) {
|
for(unsigned int j=i+1;j<ldev.deviceSerials.size();j++) {
|
||||||
if(ldev.deviceSerials[i] == ldev.deviceSerials[j]) {
|
if(ldev.deviceSerials[i] == ldev.deviceSerials[j]) {
|
||||||
ui->status->setText("Duplicate serial number ("+ldev.deviceSerials[i]+") in devices "+QString::number(i+1)+" and "+QString::number(j+1));
|
ui->status->setText("Duplicate serial number ("+ldev.deviceSerials[i]+") in devices "+QString::number(i+1)+" and "+QString::number(j+1));
|
||||||
return;
|
return;
|
||||||
@ -117,14 +117,14 @@ void CompoundDeviceEditDialog::checkIfOkay()
|
|||||||
// Check port mapping
|
// Check port mapping
|
||||||
// Looking for duplicate and missing ports
|
// Looking for duplicate and missing ports
|
||||||
bool highestPortFound = false;
|
bool highestPortFound = false;
|
||||||
int highestPort;
|
unsigned int highestPort;
|
||||||
for(int port=0;port<2*ldev.deviceSerials.size();port++) {
|
for(unsigned int port=0;port<2*ldev.deviceSerials.size();port++) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for(int i=0;i<deviceFrames.size();i++) {
|
for(unsigned int i=0;i<deviceFrames.size();i++) {
|
||||||
if(deviceFrames[i]->getPort1() == port) {
|
if(deviceFrames[i]->getPort1() == (int) port) {
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
if(deviceFrames[i]->getPort2() == port) {
|
if(deviceFrames[i]->getPort2() == (int) port) {
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,17 +152,17 @@ void CompoundDeviceEditDialog::checkIfOkay()
|
|||||||
|
|
||||||
// All good, actually create the port mapping
|
// All good, actually create the port mapping
|
||||||
ldev.portMapping.clear();
|
ldev.portMapping.clear();
|
||||||
for(int port=0;port<highestPort;port++) {
|
for(unsigned int port=0;port<highestPort;port++) {
|
||||||
CompoundDevice::PortMapping map;
|
CompoundDevice::PortMapping map;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for(int i=0;i<deviceFrames.size();i++) {
|
for(unsigned int i=0;i<deviceFrames.size();i++) {
|
||||||
if(deviceFrames[i]->getPort1() == port) {
|
if(deviceFrames[i]->getPort1() == (int) port) {
|
||||||
found = true;
|
found = true;
|
||||||
map.device = i;
|
map.device = i;
|
||||||
map.port = 0;
|
map.port = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(deviceFrames[i]->getPort2() == port) {
|
if(deviceFrames[i]->getPort2() == (int) port) {
|
||||||
found = true;
|
found = true;
|
||||||
map.device = i;
|
map.device = i;
|
||||||
map.port = 1;
|
map.port = 1;
|
||||||
@ -203,7 +203,7 @@ void CompoundDeviceEditDialog::setInitialGUI()
|
|||||||
}
|
}
|
||||||
deviceFrames.clear();
|
deviceFrames.clear();
|
||||||
layout->addStretch(1);
|
layout->addStretch(1);
|
||||||
for(int i=0;i<ldev.deviceSerials.size();i++) {
|
for(unsigned int i=0;i<ldev.deviceSerials.size();i++) {
|
||||||
auto frame = new DeviceFrame(&ldev, i);
|
auto frame = new DeviceFrame(&ldev, i);
|
||||||
connect(frame, &DeviceFrame::settingChanged, this, &CompoundDeviceEditDialog::checkIfOkay);
|
connect(frame, &DeviceFrame::settingChanged, this, &CompoundDeviceEditDialog::checkIfOkay);
|
||||||
addFrame(i, frame);
|
addFrame(i, frame);
|
||||||
@ -402,7 +402,7 @@ void CompoundDeviceEditDialog::removeDeviceFrame(DeviceFrame *dev)
|
|||||||
bool mappingFound;
|
bool mappingFound;
|
||||||
do {
|
do {
|
||||||
mappingFound = false;
|
mappingFound = false;
|
||||||
for(int i=0;i<ldev.portMapping.size();i++) {
|
for(unsigned int i=0;i<ldev.portMapping.size();i++) {
|
||||||
if(ldev.portMapping[i].device == pos) {
|
if(ldev.portMapping[i].device == pos) {
|
||||||
mappingFound = true;
|
mappingFound = true;
|
||||||
ldev.portMapping.erase(ldev.portMapping.begin() + i);
|
ldev.portMapping.erase(ldev.portMapping.begin() + i);
|
||||||
@ -421,9 +421,9 @@ void CompoundDeviceEditDialog::updateDeviceFrames()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceFrame::DeviceFrame(CompoundDevice *dev, int position) :
|
DeviceFrame::DeviceFrame(CompoundDevice *dev, unsigned int position) :
|
||||||
dev(dev),
|
position(position),
|
||||||
position(position)
|
dev(dev)
|
||||||
{
|
{
|
||||||
setMinimumSize(frameSize, frameSize);
|
setMinimumSize(frameSize, frameSize);
|
||||||
setMaximumSize(frameSize, frameSize);
|
setMaximumSize(frameSize, frameSize);
|
||||||
@ -459,7 +459,7 @@ DeviceFrame::DeviceFrame(CompoundDevice *dev, int position) :
|
|||||||
// Set initial state
|
// Set initial state
|
||||||
if(position < dev->deviceSerials.size()) {
|
if(position < dev->deviceSerials.size()) {
|
||||||
serial->setCurrentText(dev->deviceSerials[position]);
|
serial->setCurrentText(dev->deviceSerials[position]);
|
||||||
for(int i=0;i<dev->portMapping.size();i++) {
|
for(unsigned int i=0;i<dev->portMapping.size();i++) {
|
||||||
if(dev->portMapping[i].device == position) {
|
if(dev->portMapping[i].device == position) {
|
||||||
if(dev->portMapping[i].port == 0) {
|
if(dev->portMapping[i].port == 0) {
|
||||||
port1->setCurrentIndex(i + 1);
|
port1->setCurrentIndex(i + 1);
|
||||||
@ -493,7 +493,7 @@ void DeviceFrame::update()
|
|||||||
|
|
||||||
port1->addItem("Unused");
|
port1->addItem("Unused");
|
||||||
port2->addItem("Unused");
|
port2->addItem("Unused");
|
||||||
for(int i=0;i<dev->deviceSerials.size();i++) {
|
for(unsigned int i=0;i<dev->deviceSerials.size();i++) {
|
||||||
port1->addItem("Port "+QString::number(i*2+1));
|
port1->addItem("Port "+QString::number(i*2+1));
|
||||||
port2->addItem("Port "+QString::number(i*2+1));
|
port2->addItem("Port "+QString::number(i*2+1));
|
||||||
port1->addItem("Port "+QString::number(i*2+2));
|
port1->addItem("Port "+QString::number(i*2+2));
|
||||||
|
@ -14,7 +14,7 @@ class CompoundDeviceEditDialog;
|
|||||||
class DeviceFrame : public QFrame {
|
class DeviceFrame : public QFrame {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DeviceFrame(CompoundDevice *dev, int position);
|
DeviceFrame(CompoundDevice *dev, unsigned int position);
|
||||||
~DeviceFrame();
|
~DeviceFrame();
|
||||||
void setPosition(int pos);
|
void setPosition(int pos);
|
||||||
void update();
|
void update();
|
||||||
@ -30,7 +30,7 @@ private:
|
|||||||
QComboBox *port1, *port2;
|
QComboBox *port1, *port2;
|
||||||
QLabel *image;
|
QLabel *image;
|
||||||
|
|
||||||
int position;
|
unsigned int position;
|
||||||
CompoundDevice *dev;
|
CompoundDevice *dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ VirtualDevice::VirtualDevice(QString serial)
|
|||||||
}
|
}
|
||||||
if(cdev->sync == CompoundDevice::Synchronization::USB) {
|
if(cdev->sync == CompoundDevice::Synchronization::USB) {
|
||||||
// create trigger connections for USB synchronization
|
// create trigger connections for USB synchronization
|
||||||
for(int i=0;i<devices.size() - 1;i++) {
|
for(unsigned int i=0;i<devices.size() - 1;i++) {
|
||||||
connect(devices[i], &Device::TriggerReceived, devices[i+1], &Device::SetTrigger, Qt::QueuedConnection);
|
connect(devices[i], &Device::TriggerReceived, devices[i+1], &Device::SetTrigger, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
connect(devices.back(), &Device::TriggerReceived, devices.front(), &Device::SetTrigger, Qt::QueuedConnection);
|
connect(devices.back(), &Device::TriggerReceived, devices.front(), &Device::SetTrigger, Qt::QueuedConnection);
|
||||||
@ -234,8 +234,8 @@ VirtualDevice::Status VirtualDevice::getStatus(VirtualDevice *vdev)
|
|||||||
QStringList VirtualDevice::availableVNAMeasurements()
|
QStringList VirtualDevice::availableVNAMeasurements()
|
||||||
{
|
{
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
for(int i=1;i<=info.ports;i++) {
|
for(unsigned int i=1;i<=info.ports;i++) {
|
||||||
for(int j=1;j<=info.ports;j++) {
|
for(unsigned int j=1;j<=info.ports;j++) {
|
||||||
ret.push_back("S"+QString::number(i)+QString::number(j));
|
ret.push_back("S"+QString::number(i)+QString::number(j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -287,6 +287,7 @@ bool VirtualDevice::setVNA(const VirtualDevice::VNASettings &s, std::function<vo
|
|||||||
case CompoundDevice::Synchronization::USB: sd.syncMode = 1; break;
|
case CompoundDevice::Synchronization::USB: sd.syncMode = 1; break;
|
||||||
case CompoundDevice::Synchronization::ExtRef: sd.syncMode = 2; break;
|
case CompoundDevice::Synchronization::ExtRef: sd.syncMode = 2; break;
|
||||||
case CompoundDevice::Synchronization::Trigger: sd.syncMode = 3; break;
|
case CompoundDevice::Synchronization::Trigger: sd.syncMode = 3; break;
|
||||||
|
case CompoundDevice::Synchronization::Last: sd.syncMode = 1; break; // should never get here
|
||||||
}
|
}
|
||||||
// create vector of currently used stimulus ports
|
// create vector of currently used stimulus ports
|
||||||
vector<CompoundDevice::PortMapping> activeMapping;
|
vector<CompoundDevice::PortMapping> activeMapping;
|
||||||
@ -323,7 +324,7 @@ QString VirtualDevice::serial()
|
|||||||
QStringList VirtualDevice::availableSAMeasurements()
|
QStringList VirtualDevice::availableSAMeasurements()
|
||||||
{
|
{
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
for(int i=1;i<=info.ports;i++) {
|
for(unsigned int i=1;i<=info.ports;i++) {
|
||||||
ret.push_back("PORT"+QString::number(i));
|
ret.push_back("PORT"+QString::number(i));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -368,6 +369,7 @@ bool VirtualDevice::setSA(const VirtualDevice::SASettings &s, std::function<void
|
|||||||
case CompoundDevice::Synchronization::USB: sd.syncMode = 1; break;
|
case CompoundDevice::Synchronization::USB: sd.syncMode = 1; break;
|
||||||
case CompoundDevice::Synchronization::ExtRef: sd.syncMode = 2; break;
|
case CompoundDevice::Synchronization::ExtRef: sd.syncMode = 2; break;
|
||||||
case CompoundDevice::Synchronization::Trigger: sd.syncMode = 3; break;
|
case CompoundDevice::Synchronization::Trigger: sd.syncMode = 3; break;
|
||||||
|
case CompoundDevice::Synchronization::Last: sd.syncMode = 1; break; // should never get here
|
||||||
}
|
}
|
||||||
// Configure the devices
|
// Configure the devices
|
||||||
results.clear();
|
results.clear();
|
||||||
@ -399,7 +401,7 @@ bool VirtualDevice::setSA(const VirtualDevice::SASettings &s, std::function<void
|
|||||||
QStringList VirtualDevice::availableSGPorts()
|
QStringList VirtualDevice::availableSGPorts()
|
||||||
{
|
{
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
for(int i=1;i<info.ports;i++) {
|
for(unsigned int i=1;i<info.ports;i++) {
|
||||||
ret.push_back("PORT"+QString::number(i));
|
ret.push_back("PORT"+QString::number(i));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -410,7 +412,6 @@ bool VirtualDevice::setSG(const SGSettings &s)
|
|||||||
if(!info.supportsSGmode) {
|
if(!info.supportsSGmode) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto& pref = Preferences::getInstance();
|
|
||||||
Protocol::PacketInfo packet = {};
|
Protocol::PacketInfo packet = {};
|
||||||
packet.type = Protocol::PacketType::Generator;
|
packet.type = Protocol::PacketType::Generator;
|
||||||
Protocol::GeneratorSettings &sd = packet.generator;
|
Protocol::GeneratorSettings &sd = packet.generator;
|
||||||
@ -704,7 +705,7 @@ void VirtualDevice::compoundInfoUpdated(Device *dev)
|
|||||||
if(compoundInfoBuffer.size() == devices.size()) {
|
if(compoundInfoBuffer.size() == devices.size()) {
|
||||||
// got information of all devices
|
// got information of all devices
|
||||||
info = Info(devices[0]);
|
info = Info(devices[0]);
|
||||||
for(int i=1;i<devices.size();i++) {
|
for(unsigned int i=1;i<devices.size();i++) {
|
||||||
try {
|
try {
|
||||||
info.subset(Info(devices[i]));
|
info.subset(Info(devices[i]));
|
||||||
} catch (exception &e) {
|
} catch (exception &e) {
|
||||||
@ -728,7 +729,7 @@ void VirtualDevice::compoundStatusUpdated(Device *dev)
|
|||||||
if(compoundStatusBuffer.size() == devices.size()) {
|
if(compoundStatusBuffer.size() == devices.size()) {
|
||||||
// got status of all devices
|
// got status of all devices
|
||||||
status = Status(devices[0]);
|
status = Status(devices[0]);
|
||||||
for(int i=1;i<devices.size();i++) {
|
for(unsigned int i=1;i<devices.size();i++) {
|
||||||
status.merge(Status(devices[i]));
|
status.merge(Status(devices[i]));
|
||||||
}
|
}
|
||||||
emit StatusUpdated(status);
|
emit StatusUpdated(status);
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
uint8_t FW_patch;
|
uint8_t FW_patch;
|
||||||
uint8_t hardware_version;
|
uint8_t hardware_version;
|
||||||
char HW_Revision;
|
char HW_Revision;
|
||||||
int ports;
|
unsigned int ports;
|
||||||
bool supportsVNAmode;
|
bool supportsVNAmode;
|
||||||
bool supportsSAmode;
|
bool supportsSAmode;
|
||||||
bool supportsSGmode;
|
bool supportsSGmode;
|
||||||
|
@ -225,9 +225,9 @@ void SignalgeneratorWidget::setFrequency(double frequency)
|
|||||||
ui->frequency->setValue(frequency);
|
ui->frequency->setValue(frequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalgeneratorWidget::setPort(int port)
|
void SignalgeneratorWidget::setPort(unsigned int port)
|
||||||
{
|
{
|
||||||
if(port < 0 || port > portCheckboxes.size()) {
|
if(port > portCheckboxes.size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(port == 0) {
|
if(port == 0) {
|
||||||
|
@ -29,7 +29,7 @@ signals:
|
|||||||
public slots:
|
public slots:
|
||||||
void setLevel(double level);
|
void setLevel(double level);
|
||||||
void setFrequency(double frequency);
|
void setFrequency(double frequency);
|
||||||
void setPort(int port);
|
void setPort(unsigned int port);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *) override;
|
void timerEvent(QTimerEvent *) override;
|
||||||
|
@ -343,6 +343,8 @@ RESOURCES += \
|
|||||||
icons.qrc \
|
icons.qrc \
|
||||||
resources/librevna.qrc
|
resources/librevna.qrc
|
||||||
|
|
||||||
|
QMAKE_CXXFLAGS += -Wno-deprecated -Wno-deprecated-declarations
|
||||||
|
|
||||||
CONFIG += c++17
|
CONFIG += c++17
|
||||||
REVISION = $$system(git rev-parse HEAD)
|
REVISION = $$system(git rev-parse HEAD)
|
||||||
DEFINES += GITHASH=\\"\"$$REVISION\\"\"
|
DEFINES += GITHASH=\\"\"$$REVISION\\"\"
|
||||||
|
@ -1020,7 +1020,7 @@ void SpectrumAnalyzer::SetupSCPI()
|
|||||||
unsigned long long newval;
|
unsigned long long newval;
|
||||||
if(!SCPI::paramToULongLong(params, 0, newval)) {
|
if(!SCPI::paramToULongLong(params, 0, newval)) {
|
||||||
return SCPI::getResultName(SCPI::Result::Error);
|
return SCPI::getResultName(SCPI::Result::Error);
|
||||||
} else if(newval >= 0 && newval <= VirtualDevice::getInfo(window->getDevice()).ports){
|
} else if(newval <= VirtualDevice::getInfo(window->getDevice()).ports){
|
||||||
SetTGPort(newval);
|
SetTGPort(newval);
|
||||||
return SCPI::getResultName(SCPI::Result::Empty);
|
return SCPI::getResultName(SCPI::Result::Empty);
|
||||||
} else {
|
} else {
|
||||||
|
@ -660,6 +660,7 @@ QString Marker::domainToUnit(Trace::DataType domain)
|
|||||||
case Trace::DataType::Power: return "dBm";
|
case Trace::DataType::Power: return "dBm";
|
||||||
case Trace::DataType::Time: return "s";
|
case Trace::DataType::Time: return "s";
|
||||||
case Trace::DataType::TimeZeroSpan: return "s";
|
case Trace::DataType::TimeZeroSpan: return "s";
|
||||||
|
case Trace::DataType::Invalid: return "";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -528,12 +528,12 @@ void MarkerTypeDelegate::setModelData(QWidget *editor, QAbstractItemModel *, con
|
|||||||
marker->updateTypeFromEditor(editor);
|
marker->updateTypeFromEditor(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize MarkerRestrictDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
QSize MarkerRestrictDelegate::sizeHint(const QStyleOptionViewItem &, const QModelIndex &) const
|
||||||
{
|
{
|
||||||
return QSize(0, rowHeight);
|
return QSize(0, rowHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *MarkerRestrictDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
QWidget *MarkerRestrictDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
auto marker = static_cast<const MarkerModel*>(index.model())->markerFromIndex(index);
|
auto marker = static_cast<const MarkerModel*>(index.model())->markerFromIndex(index);
|
||||||
auto editor = marker->getRestrictEditor();
|
auto editor = marker->getRestrictEditor();
|
||||||
@ -541,8 +541,3 @@ QWidget *MarkerRestrictDelegate::createEditor(QWidget *parent, const QStyleOptio
|
|||||||
editor->setParent(parent);
|
editor->setParent(parent);
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkerRestrictDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
|
||||||
{
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
@ -50,7 +50,6 @@ class MarkerRestrictDelegate : public QStyledItemDelegate
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const override;
|
QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const override;
|
||||||
QWidget *createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const override;
|
QWidget *createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const override;
|
||||||
void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MarkerModel : public QAbstractItemModel, public Savable
|
class MarkerModel : public QAbstractItemModel, public Savable
|
||||||
|
@ -5,16 +5,16 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
SparamTraceSelector::SparamTraceSelector(const TraceModel &model, std::vector<int> used_ports, bool empty_allowed)
|
SparamTraceSelector::SparamTraceSelector(const TraceModel &model, std::vector<unsigned int> used_ports, bool empty_allowed)
|
||||||
: model(model),
|
: model(model),
|
||||||
used_ports(used_ports),
|
empty_allowed(empty_allowed),
|
||||||
empty_allowed(empty_allowed)
|
used_ports(used_ports)
|
||||||
{
|
{
|
||||||
createGUI();
|
createGUI();
|
||||||
setInitialChoices();
|
setInitialChoices();
|
||||||
}
|
}
|
||||||
|
|
||||||
SparamTraceSelector::SparamTraceSelector(const TraceModel &model, std::set<int> used_ports, bool empty_allowed)
|
SparamTraceSelector::SparamTraceSelector(const TraceModel &model, std::set<unsigned int> used_ports, bool empty_allowed)
|
||||||
: model(model),
|
: model(model),
|
||||||
empty_allowed(empty_allowed)
|
empty_allowed(empty_allowed)
|
||||||
{
|
{
|
||||||
|
@ -13,8 +13,8 @@ class SparamTraceSelector : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SparamTraceSelector(const TraceModel &model, std::vector<int> used_ports, bool empty_allowed = false);
|
SparamTraceSelector(const TraceModel &model, std::vector<unsigned int> used_ports, bool empty_allowed = false);
|
||||||
SparamTraceSelector(const TraceModel &model, std::set<int> used_ports, bool empty_allowed = false);
|
SparamTraceSelector(const TraceModel &model, std::set<unsigned int> used_ports, bool empty_allowed = false);
|
||||||
|
|
||||||
bool isValid();
|
bool isValid();
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ private:
|
|||||||
std::vector<QComboBox*> boxes;
|
std::vector<QComboBox*> boxes;
|
||||||
bool empty_allowed;
|
bool empty_allowed;
|
||||||
|
|
||||||
std::vector<int> used_ports;
|
std::vector<unsigned int> used_ports;
|
||||||
unsigned int points;
|
unsigned int points;
|
||||||
double minFreq, maxFreq;
|
double minFreq, maxFreq;
|
||||||
bool valid;
|
bool valid;
|
||||||
|
@ -269,7 +269,6 @@ void Trace::fillFromDatapoints(std::map<QString, Trace *> traceSet, const std::v
|
|||||||
// add new points to traces
|
// add new points to traces
|
||||||
for(auto d : data) {
|
for(auto d : data) {
|
||||||
Trace::Data td;
|
Trace::Data td;
|
||||||
auto S = d.toSparam(1, 2);
|
|
||||||
td.x = d.frequency;
|
td.x = d.frequency;
|
||||||
for(auto m : d.measurements) {
|
for(auto m : d.measurements) {
|
||||||
td.y = m.second;
|
td.y = m.second;
|
||||||
|
@ -63,7 +63,7 @@ Trace *TraceModel::trace(unsigned int index)
|
|||||||
|
|
||||||
int TraceModel::findIndex(Trace *t)
|
int TraceModel::findIndex(Trace *t)
|
||||||
{
|
{
|
||||||
for(int i=0;i<traces.size();i++) {
|
for(unsigned int i=0;i<traces.size();i++) {
|
||||||
if(traces[i] == t) {
|
if(traces[i] == t) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -161,9 +161,9 @@ void Deembedding::swapOptions(unsigned int index)
|
|||||||
std::swap(options[index], options[index+1]);
|
std::swap(options[index], options[index+1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<int> Deembedding::getAffectedPorts()
|
std::set<unsigned int> Deembedding::getAffectedPorts()
|
||||||
{
|
{
|
||||||
set<int> ret;
|
set<unsigned int> ret;
|
||||||
for(auto o : options) {
|
for(auto o : options) {
|
||||||
auto affected = o->getAffectedPorts();
|
auto affected = o->getAffectedPorts();
|
||||||
ret.insert(affected.begin(), affected.end());
|
ret.insert(affected.begin(), affected.end());
|
||||||
|
@ -28,7 +28,7 @@ public:
|
|||||||
void addOption(DeembeddingOption* option);
|
void addOption(DeembeddingOption* option);
|
||||||
void swapOptions(unsigned int index);
|
void swapOptions(unsigned int index);
|
||||||
|
|
||||||
std::set<int> getAffectedPorts();
|
std::set<unsigned int> getAffectedPorts();
|
||||||
|
|
||||||
std::vector<DeembeddingOption*>& getOptions() {return options;}
|
std::vector<DeembeddingOption*>& getOptions() {return options;}
|
||||||
nlohmann::json toJSON() override;
|
nlohmann::json toJSON() override;
|
||||||
|
@ -23,7 +23,7 @@ public:
|
|||||||
static DeembeddingOption *create(Type type);
|
static DeembeddingOption *create(Type type);
|
||||||
static QString getName(Type type);
|
static QString getName(Type type);
|
||||||
|
|
||||||
virtual std::set<int> getAffectedPorts() = 0;
|
virtual std::set<unsigned int> getAffectedPorts() = 0;
|
||||||
virtual void transformDatapoint(VirtualDevice::VNAMeasurement &p) = 0;
|
virtual void transformDatapoint(VirtualDevice::VNAMeasurement &p) = 0;
|
||||||
virtual void edit(){}
|
virtual void edit(){}
|
||||||
virtual Type getType() = 0;
|
virtual Type getType() = 0;
|
||||||
|
@ -15,10 +15,10 @@ ImpedanceRenormalization::ImpedanceRenormalization()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<int> ImpedanceRenormalization::getAffectedPorts()
|
std::set<unsigned int> ImpedanceRenormalization::getAffectedPorts()
|
||||||
{
|
{
|
||||||
set<int> ret;
|
set<unsigned int> ret;
|
||||||
for(int i=1;i<=VirtualDevice::getInfo(VirtualDevice::getConnected()).ports;i++) {
|
for(unsigned int i=1;i<=VirtualDevice::getInfo(VirtualDevice::getConnected()).ports;i++) {
|
||||||
ret.insert(i);
|
ret.insert(i);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -13,7 +13,7 @@ class ImpedanceRenormalization : public DeembeddingOption
|
|||||||
public:
|
public:
|
||||||
ImpedanceRenormalization();
|
ImpedanceRenormalization();
|
||||||
|
|
||||||
std::set<int> getAffectedPorts() override;
|
std::set<unsigned int> getAffectedPorts() override;
|
||||||
void transformDatapoint(VirtualDevice::VNAMeasurement &p) override;
|
void transformDatapoint(VirtualDevice::VNAMeasurement &p) override;
|
||||||
Type getType() override { return Type::ImpedanceRenormalization;}
|
Type getType() override { return Type::ImpedanceRenormalization;}
|
||||||
nlohmann::json toJSON() override;
|
nlohmann::json toJSON() override;
|
||||||
|
@ -27,15 +27,13 @@ MatchingNetwork::MatchingNetwork()
|
|||||||
port = 1;
|
port = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<int> MatchingNetwork::getAffectedPorts()
|
std::set<unsigned int> MatchingNetwork::getAffectedPorts()
|
||||||
{
|
{
|
||||||
return {port};
|
return {port};
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchingNetwork::transformDatapoint(VirtualDevice::VNAMeasurement &p)
|
void MatchingNetwork::transformDatapoint(VirtualDevice::VNAMeasurement &p)
|
||||||
{
|
{
|
||||||
auto S = p.toSparam(1, 2);
|
|
||||||
auto measurement = ABCDparam(S, p.Z0);
|
|
||||||
if(matching.count(p.frequency) == 0) {
|
if(matching.count(p.frequency) == 0) {
|
||||||
// this point is not calculated yet
|
// this point is not calculated yet
|
||||||
MatchingPoint m;
|
MatchingPoint m;
|
||||||
@ -61,8 +59,8 @@ void MatchingNetwork::transformDatapoint(VirtualDevice::VNAMeasurement &p)
|
|||||||
p.measurements[name] = corrected.m11;
|
p.measurements[name] = corrected.m11;
|
||||||
}
|
}
|
||||||
// handle the rest of the measurements
|
// handle the rest of the measurements
|
||||||
for(int i=1;i<=VirtualDevice::getInfo(VirtualDevice::getConnected()).ports;i++) {
|
for(unsigned int i=1;i<=VirtualDevice::getInfo(VirtualDevice::getConnected()).ports;i++) {
|
||||||
for(int j=i+1;j<=VirtualDevice::getInfo(VirtualDevice::getConnected()).ports;j++) {
|
for(unsigned int j=i+1;j<=VirtualDevice::getInfo(VirtualDevice::getConnected()).ports;j++) {
|
||||||
if(i == port) {
|
if(i == port) {
|
||||||
auto S = uncorrected.toSparam(i, j);
|
auto S = uncorrected.toSparam(i, j);
|
||||||
auto corrected = Sparam(m.p * ABCDparam(S, p.Z0), p.Z0);
|
auto corrected = Sparam(m.p * ABCDparam(S, p.Z0), p.Z0);
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
|
|
||||||
// DeembeddingOption interface
|
// DeembeddingOption interface
|
||||||
public:
|
public:
|
||||||
std::set<int> getAffectedPorts() override;
|
std::set<unsigned int> getAffectedPorts() override;
|
||||||
void transformDatapoint(VirtualDevice::VNAMeasurement &p) override;
|
void transformDatapoint(VirtualDevice::VNAMeasurement &p) override;
|
||||||
void edit() override;
|
void edit() override;
|
||||||
Type getType() override {return Type::MatchingNetwork;}
|
Type getType() override {return Type::MatchingNetwork;}
|
||||||
@ -84,7 +84,7 @@ private:
|
|||||||
bool eventFilter(QObject *object, QEvent *event) override;
|
bool eventFilter(QObject *object, QEvent *event) override;
|
||||||
|
|
||||||
std::vector<MatchingComponent*> network;
|
std::vector<MatchingComponent*> network;
|
||||||
int port;
|
unsigned int port;
|
||||||
|
|
||||||
QWidget *graph, *insertIndicator;
|
QWidget *graph, *insertIndicator;
|
||||||
QPoint dragStartPosition;
|
QPoint dragStartPosition;
|
||||||
|
@ -26,7 +26,7 @@ PortExtension::PortExtension()
|
|||||||
ui = nullptr;
|
ui = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<int> PortExtension::getAffectedPorts()
|
std::set<unsigned int> PortExtension::getAffectedPorts()
|
||||||
{
|
{
|
||||||
return {port};
|
return {port};
|
||||||
}
|
}
|
||||||
@ -42,11 +42,11 @@ void PortExtension::transformDatapoint(VirtualDevice::VNAMeasurement &d)
|
|||||||
auto att = pow(10.0, -db_attennuation / 20.0);
|
auto att = pow(10.0, -db_attennuation / 20.0);
|
||||||
auto correction = polar<double>(att, phase);
|
auto correction = polar<double>(att, phase);
|
||||||
for(auto &m : d.measurements) {
|
for(auto &m : d.measurements) {
|
||||||
if(m.first.mid(1, 1).toInt() == port) {
|
if(m.first.mid(1, 1).toUInt() == port) {
|
||||||
// selected port is the destination of this S parameter
|
// selected port is the destination of this S parameter
|
||||||
m.second /= correction;
|
m.second /= correction;
|
||||||
}
|
}
|
||||||
if(m.first.mid(2, 1).toInt() == port) {
|
if(m.first.mid(2, 1).toUInt() == port) {
|
||||||
// selected port is the source of this S parameter
|
// selected port is the source of this S parameter
|
||||||
m.second /= correction;
|
m.second /= correction;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ class PortExtension : public DeembeddingOption
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PortExtension();
|
PortExtension();
|
||||||
std::set<int> getAffectedPorts() override;
|
std::set<unsigned int> getAffectedPorts() override;
|
||||||
void transformDatapoint(VirtualDevice::VNAMeasurement& d) override;
|
void transformDatapoint(VirtualDevice::VNAMeasurement& d) override;
|
||||||
void setCalkit(Calkit *kit);
|
void setCalkit(Calkit *kit);
|
||||||
Type getType() override {return Type::PortExtension;}
|
Type getType() override {return Type::PortExtension;}
|
||||||
@ -42,7 +42,7 @@ private:
|
|||||||
|
|
||||||
// status variables for automatic measurements
|
// status variables for automatic measurements
|
||||||
Calkit *kit;
|
Calkit *kit;
|
||||||
int port;
|
unsigned int port;
|
||||||
bool isOpen;
|
bool isOpen;
|
||||||
bool isIdeal;
|
bool isIdeal;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ TwoThru::TwoThru()
|
|||||||
port2 = 2;
|
port2 = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<int> TwoThru::getAffectedPorts()
|
std::set<unsigned int> TwoThru::getAffectedPorts()
|
||||||
{
|
{
|
||||||
return {port1, port2};
|
return {port1, port2};
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ class TwoThru : public DeembeddingOption
|
|||||||
public:
|
public:
|
||||||
TwoThru();
|
TwoThru();
|
||||||
|
|
||||||
std::set<int> getAffectedPorts() override;
|
std::set<unsigned int> getAffectedPorts() override;
|
||||||
virtual void transformDatapoint(VirtualDevice::VNAMeasurement& p) override;
|
virtual void transformDatapoint(VirtualDevice::VNAMeasurement& p) override;
|
||||||
virtual void edit() override;
|
virtual void edit() override;
|
||||||
virtual Type getType() override {return DeembeddingOption::Type::TwoThru;}
|
virtual Type getType() override {return DeembeddingOption::Type::TwoThru;}
|
||||||
@ -40,7 +40,7 @@ private:
|
|||||||
std::vector<VirtualDevice::VNAMeasurement> measurements2xthru;
|
std::vector<VirtualDevice::VNAMeasurement> measurements2xthru;
|
||||||
std::vector<VirtualDevice::VNAMeasurement> measurementsDUT;
|
std::vector<VirtualDevice::VNAMeasurement> measurementsDUT;
|
||||||
double Z0;
|
double Z0;
|
||||||
int port1, port2;
|
unsigned int port1, port2;
|
||||||
std::vector<Point> points;
|
std::vector<Point> points;
|
||||||
bool measuring2xthru;
|
bool measuring2xthru;
|
||||||
bool measuringDUT;
|
bool measuringDUT;
|
||||||
|
@ -882,11 +882,11 @@ void VNA::SettingsChanged(bool resetTraces, std::function<void (bool)> cb)
|
|||||||
VirtualDevice::VNASettings s = {};
|
VirtualDevice::VNASettings s = {};
|
||||||
s.IFBW = settings.bandwidth;
|
s.IFBW = settings.bandwidth;
|
||||||
if(Preferences::getInstance().Acquisition.alwaysExciteAllPorts) {
|
if(Preferences::getInstance().Acquisition.alwaysExciteAllPorts) {
|
||||||
for(int i=0;i<VirtualDevice::getInfo(window->getDevice()).ports;i++) {
|
for(unsigned int i=0;i<VirtualDevice::getInfo(window->getDevice()).ports;i++) {
|
||||||
s.excitedPorts.push_back(i);
|
s.excitedPorts.push_back(i);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(int i=0;i<VirtualDevice::getInfo(window->getDevice()).ports;i++) {
|
for(unsigned int i=0;i<VirtualDevice::getInfo(window->getDevice()).ports;i++) {
|
||||||
if(traceModel.PortExcitationRequired(i))
|
if(traceModel.PortExcitationRequired(i))
|
||||||
s.excitedPorts.push_back(i);
|
s.excitedPorts.push_back(i);
|
||||||
}
|
}
|
||||||
@ -1141,7 +1141,7 @@ void VNA::SetAveraging(unsigned int averages)
|
|||||||
void VNA::ExcitationRequired()
|
void VNA::ExcitationRequired()
|
||||||
{
|
{
|
||||||
if(!Preferences::getInstance().Acquisition.alwaysExciteAllPorts) {
|
if(!Preferences::getInstance().Acquisition.alwaysExciteAllPorts) {
|
||||||
for(int i=1;i<VirtualDevice::getInfo(window->getDevice()).ports;i++) {
|
for(unsigned int i=1;i<VirtualDevice::getInfo(window->getDevice()).ports;i++) {
|
||||||
auto required = traceModel.PortExcitationRequired(i);
|
auto required = traceModel.PortExcitationRequired(i);
|
||||||
auto set = find(settings.excitedPorts.begin(), settings.excitedPorts.end(), i) != settings.excitedPorts.end();
|
auto set = find(settings.excitedPorts.begin(), settings.excitedPorts.end(), i) != settings.excitedPorts.end();
|
||||||
if(required != set) {
|
if(required != set) {
|
||||||
@ -1640,5 +1640,5 @@ void VNA::SetSingleSweep(bool single)
|
|||||||
|
|
||||||
bool VNA::LoadCalibration(QString filename)
|
bool VNA::LoadCalibration(QString filename)
|
||||||
{
|
{
|
||||||
cal.fromFile(filename);
|
return cal.fromFile(filename);
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ PreferencesDialog::PreferencesDialog(Preferences *pref, QWidget *parent) :
|
|||||||
});
|
});
|
||||||
connect(ui->compoundList, &QListWidget::doubleClicked, [=](){
|
connect(ui->compoundList, &QListWidget::doubleClicked, [=](){
|
||||||
auto index = ui->compoundList->currentRow();
|
auto index = ui->compoundList->currentRow();
|
||||||
if(index >= 0 && index < p->compoundDevices.size()) {
|
if(index >= 0 && index < (int) p->compoundDevices.size()) {
|
||||||
auto d = new CompoundDeviceEditDialog(p->compoundDevices[index]);
|
auto d = new CompoundDeviceEditDialog(p->compoundDevices[index]);
|
||||||
connect(d, &QDialog::accepted, [=](){
|
connect(d, &QDialog::accepted, [=](){
|
||||||
ui->compoundList->item(index)->setText(p->compoundDevices[index]->getDesription());
|
ui->compoundList->item(index)->setText(p->compoundDevices[index]->getDesription());
|
||||||
@ -160,7 +160,7 @@ PreferencesDialog::PreferencesDialog(Preferences *pref, QWidget *parent) :
|
|||||||
});
|
});
|
||||||
connect(ui->compoundDelete, &QPushButton::clicked, [=](){
|
connect(ui->compoundDelete, &QPushButton::clicked, [=](){
|
||||||
auto index = ui->compoundList->currentRow();
|
auto index = ui->compoundList->currentRow();
|
||||||
if(index >= 0 && index < p->compoundDevices.size()) {
|
if(index >= 0 && index < (int) p->compoundDevices.size()) {
|
||||||
// delete the actual compound device
|
// delete the actual compound device
|
||||||
if(VirtualDevice::getConnected() && VirtualDevice::getConnected()->getCompoundDevice() == p->compoundDevices[index]) {
|
if(VirtualDevice::getConnected() && VirtualDevice::getConnected()->getCompoundDevice() == p->compoundDevices[index]) {
|
||||||
// can't remove the device we are currently connected to
|
// can't remove the device we are currently connected to
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
class Savable {
|
class Savable {
|
||||||
public:
|
public:
|
||||||
|
virtual ~Savable(){}
|
||||||
|
|
||||||
virtual nlohmann::json toJSON() = 0;
|
virtual nlohmann::json toJSON() = 0;
|
||||||
virtual void fromJSON(nlohmann::json j) = 0;
|
virtual void fromJSON(nlohmann::json j) = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user