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