diff --git a/Software/PC_Application/Traces/tracexyplot.cpp b/Software/PC_Application/Traces/tracexyplot.cpp index d774e6a..572f1aa 100644 --- a/Software/PC_Application/Traces/tracexyplot.cpp +++ b/Software/PC_Application/Traces/tracexyplot.cpp @@ -885,7 +885,8 @@ QString TraceXYPlot::AxisTypeToName(TraceXYPlot::YAxisType type) { switch(type) { 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::Phase: return "Phase"; case YAxisType::UnwrappedPhase: return "Unwrapped Phase"; @@ -999,6 +1000,9 @@ QPointF TraceXYPlot::traceToCoordinate(Trace *t, unsigned int sample, TraceXYPlo case YAxisType::Magnitude: ret.setY(Util::SparamTodB(data.y)); break; + case YAxisType::MagnitudedBuV: + ret.setY(Util::dBmTodBuV(Util::SparamTodB(data.y))); + break; case YAxisType::MagnitudeLinear: ret.setY(abs(data.y)); break; @@ -1263,6 +1267,7 @@ QString TraceXYPlot::AxisUnit(TraceXYPlot::YAxisType type) } else if(source == TraceModel::DataSource::SA) { switch(type) { case TraceXYPlot::YAxisType::Magnitude: return "dBm"; + case TraceXYPlot::YAxisType::MagnitudedBuV: return "dBuV"; default: return ""; } } @@ -1297,6 +1302,7 @@ QString TraceXYPlot::AxisPrefixes(TraceXYPlot::YAxisType type) } else if(source == TraceModel::DataSource::SA) { switch(type) { case TraceXYPlot::YAxisType::Magnitude: return " "; + case TraceXYPlot::YAxisType::MagnitudedBuV: return " "; default: return " "; } } diff --git a/Software/PC_Application/Traces/tracexyplot.h b/Software/PC_Application/Traces/tracexyplot.h index 6fdbe65..86ce3c6 100644 --- a/Software/PC_Application/Traces/tracexyplot.h +++ b/Software/PC_Application/Traces/tracexyplot.h @@ -16,6 +16,7 @@ public: Disabled, // S parameter options Magnitude, + MagnitudedBuV, MagnitudeLinear, Phase, UnwrappedPhase, diff --git a/Software/PC_Application/Traces/xyplotaxisdialog.cpp b/Software/PC_Application/Traces/xyplotaxisdialog.cpp index f98356b..a6c8b71 100644 --- a/Software/PC_Application/Traces/xyplotaxisdialog.cpp +++ b/Software/PC_Application/Traces/xyplotaxisdialog.cpp @@ -257,6 +257,7 @@ std::set XYplotAxisDialog::supportedYAxis(TraceXYPlot::X switch(type) { case TraceXYPlot::XAxisType::Frequency: ret.insert(TraceXYPlot::YAxisType::Magnitude); + ret.insert(TraceXYPlot::YAxisType::MagnitudedBuV); break; default: break; diff --git a/Software/PC_Application/Util/util.cpp b/Software/PC_Application/Util/util.cpp index 5bbf24d..627f2de 100644 --- a/Software/PC_Application/Util/util.cpp +++ b/Software/PC_Application/Util/util.cpp @@ -65,3 +65,10 @@ double Util::distanceToLine(QPointF point, QPointF l1, QPointF l2, QPointF *clos std::complex Util::SparamToImpedance(std::complex 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; +} diff --git a/Software/PC_Application/Util/util.h b/Software/PC_Application/Util/util.h index 190b396..ab47357 100644 --- a/Software/PC_Application/Util/util.h +++ b/Software/PC_Application/Util/util.h @@ -31,6 +31,7 @@ namespace Util { static inline double SparamTodB(std::complex d) { return SparamTodB(abs(d)); } + double dBmTodBuV(double dBm); static inline double SparamToDegree(std::complex d) { return (arg(d) * 180.0 / M_PI); }