Scope: added magnitude squared (linear power) display overlays

pull/197/head
f4exb 2018-06-26 01:06:45 +02:00
rodzic 80b7829bf7
commit fd915613e4
5 zmienionych plików z 35 dodań i 3 usunięć

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 2.1 KiB

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -269,6 +269,10 @@ The signal is synchronized with the PLL in 4 phase mode (locker icon is green).
![Channel Analyzer NG plugin scope1 controls](../../../doc/img/ChAnalyzerNG_plugin_overlay_dB.png)
**Note3**: in the MagSq mode when the trace is selected (1) the display overlay on the top right of the trace shows 2 figures in scientific notation. From left to right: peak power and average power.
![Channel Analyzer NG plugin scope2 controls](../../../doc/img/ChAnalyzerNG_plugin_overlay_lin.png)
<h3>5. Source select</h3>
This is for future use when more than one incoming complex signals can be applied. The signal index appears on the right of the button

Wyświetl plik

@ -465,8 +465,36 @@ int ScopeVisNG::processTraces(const SampleVector::const_iterator& cbegin, const
}
else if (projectionType == Projector::ProjectionMagSq)
{
v = ((*itCtl)->m_projector.run(*begin) - itData->m_ofs)*itData->m_amp - 1.0f;
// TODO: power display overlay for squared magnitude
Real magsq = (*itCtl)->m_projector.run(*begin);
v = (magsq - itData->m_ofs)*itData->m_amp - 1.0f;
if ((traceCount >= shift) && (traceCount < shift+length)) // power display overlay values construction
{
if (traceCount == shift)
{
(*itCtl)->m_maxPow = 0.0f;
(*itCtl)->m_sumPow = 0.0f;
(*itCtl)->m_nbPow = 1;
}
if (magsq > 0.0f)
{
if (magsq > (*itCtl)->m_maxPow)
{
(*itCtl)->m_maxPow = magsq;
}
(*itCtl)->m_sumPow += magsq;
(*itCtl)->m_nbPow++;
}
}
if ((m_nbSamples == 1) && ((*itCtl)->m_nbPow > 0)) // on last sample create power display overlay
{
double avgPow = (*itCtl)->m_sumPow / (*itCtl)->m_nbPow;
itData->m_textOverlay = QString("%1 %2").arg((*itCtl)->m_maxPow, 0, 'e', 2).arg(avgPow, 0, 'e', 2);
(*itCtl)->m_nbPow = 0;
}
}
else if (projectionType == Projector::ProjectionMagDB)
{

Wyświetl plik

@ -1217,7 +1217,7 @@ void GLScopeNGGUI::disableLiveMode(bool disable)
void GLScopeNGGUI::fillTraceData(ScopeVisNG::TraceData& traceData)
{
traceData.m_projectionType = (Projector::ProjectionType) ui->traceMode->currentIndex();
traceData.m_hasTextOverlay = (traceData.m_projectionType == Projector::ProjectionMagDB);
traceData.m_hasTextOverlay = (traceData.m_projectionType == Projector::ProjectionMagDB) || (traceData.m_projectionType == Projector::ProjectionMagSq);
traceData.m_textOverlay.clear();
traceData.m_inputIndex = 0;
traceData.m_amp = 0.2 / amps[ui->amp->value()];