Additional SCPI command for reading min/max freq/amplitude

This commit is contained in:
Jan Käberich 2021-04-21 18:27:57 +02:00
parent e098549e3b
commit 3f62ad64ad
3 changed files with 63 additions and 0 deletions

View File

@ -387,6 +387,22 @@ S11,S12,S21,S22
-0.0458452,-0.028729 -0.0458452,-0.028729
\end{example} \end{example}
\subsubsection{VNA:TRACe:MAXFrequency}
\query{Returns the highest frequency contained in the trace}{VNA:TRACe:MAXFrequency?}{<trace>, either by name or by index}{maximum frequency in Hz}
\subsubsection{VNA:TRACe:MINFrequency}
\query{Returns the lowest frequency contained in the trace}{VNA:TRACe:MINFrequency?}{<trace>, either by name or by index}{maximum frequency in Hz}
\subsubsection{VNA:TRACe:MAXAmplitude}
\query{Returns the datapoint with the highest amplitude in the trace}{VNA:TRACe:MAXAmplitude?}{<trace>, either by name or by index}{<frequency>,<real>,<imag> of the highest amplitude point}
\begin{example}
:VNA:TRAC:MAXA? S21
5.66406e+9,-6.21766e-5,-0.000795846
\end{example}
\subsubsection{VNA:TRACe:MINAmplitude}
\query{Returns the datapoint with the lowest amplitude in the trace}{VNA:TRACe:MINAmplitude?}{<trace>, either by name or by index}{<frequency>,<real>,<imag> of the lowest amplitude point}
\subsubsection{VNA:TRACe:NEW} \subsubsection{VNA:TRACe:NEW}
\event{Creates a new trace}{VNA:TRACe:NEW}{<trace name>} \event{Creates a new trace}{VNA:TRACe:NEW}{<trace name>}
@ -564,6 +580,23 @@ Port1,Port2
\end{example} \end{example}
\footnotesize{Note: although the imaginary part is always zero, it is still included in the response}\\ \footnotesize{Note: although the imaginary part is always zero, it is still included in the response}\\
\subsubsection{SA:TRACe:MAXFrequency}
\query{Returns the highest frequency contained in the trace}{SA:TRACe:MAXFrequency?}{<trace>, either by name or by index}{maximum frequency in Hz}
\subsubsection{SA:TRACe:MINFrequency}
\query{Returns the lowest frequency contained in the trace}{SA:TRACe:MINFrequency?}{<trace>, either by name or by index}{maximum frequency in Hz}
\subsubsection{SA:TRACe:MAXAmplitude}
\query{Returns the datapoint with the highest amplitude in the trace}{SA:TRACe:MAXAmplitude?}{<trace>, either by name or by index}{<frequency>,<real>,<imag> of the highest amplitude point}
\begin{example}
:SA:TRAC:MAXA? Port1
9.63e+8,4.05022e-5,0
\end{example}
\footnotesize{Note: although the imaginary part is always zero, it is still included in the response}\\
\subsubsection{SA:TRACe:MINAmplitude}
\query{Returns the datapoint with the lowest amplitude in the trace}{SA:TRACe:MINAmplitude?}{<trace>, either by name or by index}{<frequency>,<real>,<imag> of the lowest amplitude point}
\subsubsection{SA:TRACe:NEW} \subsubsection{SA:TRACe:NEW}
\event{Creates a new trace}{SA:TRACe:NEW}{<trace name>} \event{Creates a new trace}{SA:TRACe:NEW}{<trace name>}

View File

@ -202,6 +202,36 @@ void TraceWidget::SetupSCPI()
} }
} }
})); }));
add(new SCPICommand("MAXFrequency", nullptr, [=](QStringList params) -> QString {
auto t = findTrace(params);
if(!t) {
return "ERROR";
}
return QString::number(t->maxX());
}));
add(new SCPICommand("MINFrequency", nullptr, [=](QStringList params) -> QString {
auto t = findTrace(params);
if(!t) {
return "ERROR";
}
return QString::number(t->minX());
}));
add(new SCPICommand("MAXAmplitude", nullptr, [=](QStringList params) -> QString {
auto t = findTrace(params);
if(!t) {
return "ERROR";
}
auto d = t->interpolatedSample(t->findExtremumFreq(true));
return QString::number(d.x)+","+QString::number(d.y.real())+","+QString::number(d.y.imag());
}));
add(new SCPICommand("MINAmplitude", nullptr, [=](QStringList params) -> QString {
auto t = findTrace(params);
if(!t) {
return "ERROR";
}
auto d = t->interpolatedSample(t->findExtremumFreq(false));
return QString::number(d.x)+","+QString::number(d.y.real())+","+QString::number(d.y.imag());
}));
add(new SCPICommand("NEW", [=](QStringList params) -> QString { add(new SCPICommand("NEW", [=](QStringList params) -> QString {
if(params.size() != 1) { if(params.size() != 1) {
return "ERROR"; return "ERROR";