dBuV axis option for spectrum analyzer
This commit is contained in:
parent
cece0080ed
commit
754ded1d08
@ -885,7 +885,8 @@ QString TraceXYPlot::AxisTypeToName(TraceXYPlot::YAxisType type)
|
|||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case YAxisType::Disabled: return "Disabled";
|
case YAxisType::Disabled: return "Disabled";
|
||||||
case YAxisType::Magnitude: return "Magnitude";
|
case YAxisType::Magnitude: return "Magnitude (dB/dBm)";
|
||||||
|
case YAxisType::MagnitudedBuV: return "Magnitude (dBuV)";
|
||||||
case YAxisType::MagnitudeLinear: return "Magnitude (linear)";
|
case YAxisType::MagnitudeLinear: return "Magnitude (linear)";
|
||||||
case YAxisType::Phase: return "Phase";
|
case YAxisType::Phase: return "Phase";
|
||||||
case YAxisType::UnwrappedPhase: return "Unwrapped Phase";
|
case YAxisType::UnwrappedPhase: return "Unwrapped Phase";
|
||||||
@ -999,6 +1000,9 @@ QPointF TraceXYPlot::traceToCoordinate(Trace *t, unsigned int sample, TraceXYPlo
|
|||||||
case YAxisType::Magnitude:
|
case YAxisType::Magnitude:
|
||||||
ret.setY(Util::SparamTodB(data.y));
|
ret.setY(Util::SparamTodB(data.y));
|
||||||
break;
|
break;
|
||||||
|
case YAxisType::MagnitudedBuV:
|
||||||
|
ret.setY(Util::dBmTodBuV(Util::SparamTodB(data.y)));
|
||||||
|
break;
|
||||||
case YAxisType::MagnitudeLinear:
|
case YAxisType::MagnitudeLinear:
|
||||||
ret.setY(abs(data.y));
|
ret.setY(abs(data.y));
|
||||||
break;
|
break;
|
||||||
@ -1263,6 +1267,7 @@ QString TraceXYPlot::AxisUnit(TraceXYPlot::YAxisType type)
|
|||||||
} else if(source == TraceModel::DataSource::SA) {
|
} else if(source == TraceModel::DataSource::SA) {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case TraceXYPlot::YAxisType::Magnitude: return "dBm";
|
case TraceXYPlot::YAxisType::Magnitude: return "dBm";
|
||||||
|
case TraceXYPlot::YAxisType::MagnitudedBuV: return "dBuV";
|
||||||
default: return "";
|
default: return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1297,6 +1302,7 @@ QString TraceXYPlot::AxisPrefixes(TraceXYPlot::YAxisType type)
|
|||||||
} else if(source == TraceModel::DataSource::SA) {
|
} else if(source == TraceModel::DataSource::SA) {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case TraceXYPlot::YAxisType::Magnitude: return " ";
|
case TraceXYPlot::YAxisType::Magnitude: return " ";
|
||||||
|
case TraceXYPlot::YAxisType::MagnitudedBuV: return " ";
|
||||||
default: return " ";
|
default: return " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ public:
|
|||||||
Disabled,
|
Disabled,
|
||||||
// S parameter options
|
// S parameter options
|
||||||
Magnitude,
|
Magnitude,
|
||||||
|
MagnitudedBuV,
|
||||||
MagnitudeLinear,
|
MagnitudeLinear,
|
||||||
Phase,
|
Phase,
|
||||||
UnwrappedPhase,
|
UnwrappedPhase,
|
||||||
|
@ -257,6 +257,7 @@ std::set<TraceXYPlot::YAxisType> XYplotAxisDialog::supportedYAxis(TraceXYPlot::X
|
|||||||
switch(type) {
|
switch(type) {
|
||||||
case TraceXYPlot::XAxisType::Frequency:
|
case TraceXYPlot::XAxisType::Frequency:
|
||||||
ret.insert(TraceXYPlot::YAxisType::Magnitude);
|
ret.insert(TraceXYPlot::YAxisType::Magnitude);
|
||||||
|
ret.insert(TraceXYPlot::YAxisType::MagnitudedBuV);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -65,3 +65,10 @@ double Util::distanceToLine(QPointF point, QPointF l1, QPointF l2, QPointF *clos
|
|||||||
std::complex<double> Util::SparamToImpedance(std::complex<double> d) {
|
std::complex<double> Util::SparamToImpedance(std::complex<double> d) {
|
||||||
return Preferences::getInstance().Acquisition.refImp * (1.0 + d) / (1.0 - d);
|
return Preferences::getInstance().Acquisition.refImp * (1.0 + d) / (1.0 - d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double Util::dBmTodBuV(double dBm)
|
||||||
|
{
|
||||||
|
double uVpower = 0.000001*0.000001/Preferences::getInstance().Acquisition.refImp;
|
||||||
|
double dBdiff = 10*log10(uVpower*1000);
|
||||||
|
return dBm - dBdiff;
|
||||||
|
}
|
||||||
|
@ -31,6 +31,7 @@ namespace Util {
|
|||||||
static inline double SparamTodB(std::complex<double> d) {
|
static inline double SparamTodB(std::complex<double> d) {
|
||||||
return SparamTodB(abs(d));
|
return SparamTodB(abs(d));
|
||||||
}
|
}
|
||||||
|
double dBmTodBuV(double dBm);
|
||||||
static inline double SparamToDegree(std::complex<double> d) {
|
static inline double SparamToDegree(std::complex<double> d) {
|
||||||
return (arg(d) * 180.0 / M_PI);
|
return (arg(d) * 180.0 / M_PI);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user