diff --git a/Software/PC_Application/Traces/Math/expression.cpp b/Software/PC_Application/Traces/Math/expression.cpp index f4a3754..a15e448 100644 --- a/Software/PC_Application/Traces/Math/expression.cpp +++ b/Software/PC_Application/Traces/Math/expression.cpp @@ -41,11 +41,13 @@ void Math::Expression::edit() exp = ui->expEdit->text(); expressionChanged(); }); - // TODO add power domain - if(dataType == DataType::Time) { - // select the label explaining the time domain variables (frequency label is the default) - ui->stackedWidget->setCurrentIndex(1); + switch(dataType) { + case DataType::Frequency: ui->stackedWidget->setCurrentIndex(0); break; + case DataType::Time: ui->stackedWidget->setCurrentIndex(1); break; + case DataType::Power: ui->stackedWidget->setCurrentIndex(2); break; + default: break; } + d->show(); } @@ -78,6 +80,7 @@ void Math::Expression::inputSamplesChanged(unsigned int begin, unsigned int end) for(unsigned int i=begin;itimeToDistance(t); x = in[i].y; @@ -103,6 +106,7 @@ void Math::Expression::expressionChanged() parser->RemoveVar("d"); parser->RemoveVar("f"); parser->RemoveVar("w"); + parser->RemoveVar("P"); switch(dataType) { case DataType::Time: parser->DefineVar("t", Variable(&t)); @@ -112,6 +116,9 @@ void Math::Expression::expressionChanged() parser->DefineVar("f", Variable(&f)); parser->DefineVar("w", Variable(&w)); break; + case DataType::Power: + parser->DefineVar("P", Variable(&P)); + break; default: break; } diff --git a/Software/PC_Application/Traces/Math/expression.h b/Software/PC_Application/Traces/Math/expression.h index bf5b02d..39e8b2e 100644 --- a/Software/PC_Application/Traces/Math/expression.h +++ b/Software/PC_Application/Traces/Math/expression.h @@ -30,7 +30,7 @@ private slots: private: QString exp; mup::ParserX *parser; - mup::Value t, d, f, w, x; + mup::Value t, d, f, w, x, P; }; } diff --git a/Software/PC_Application/Traces/Math/expressiondialog.ui b/Software/PC_Application/Traces/Math/expressiondialog.ui index 5380d30..9210faf 100644 --- a/Software/PC_Application/Traces/Math/expressiondialog.ui +++ b/Software/PC_Application/Traces/Math/expressiondialog.ui @@ -44,7 +44,7 @@ - <html><head/><body><p>Available variables:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x: the S parameter as a (complex) voltage vector. </li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">f: measurement frequency in Hz</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">w: angular measurement frequency (w = 2πf)</li></ul><p>Examples:<br/>Add 10db to the trace (10db = exp10(10/20) = sqrt(10)):</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x * sqrt(10)</li></ul><p>Clip trace at 0db (0db = exp10(0/20) = 1) while preserving phase:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">abs(x) &lt; 1 ? x : exp(i*arg(x))</li></ul></body></html> + <html><head/><body><p>Available variables:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x: the S parameter as a (complex) voltage vector. </li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">f: measurement frequency in Hz</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">w: angular measurement frequency (w = 2πf)</li></ul><p>Examples:<br/>Add 10db to the trace (10db = exp10(10/20) = sqrt(10)):</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x * sqrt(10)</li></ul><p>Clip trace at 0db (0db = exp10(0/20) = 1) while preserving phase:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">abs(x) &lt; 1 ? x : exp(i*arg(x))</li></ul></body></html> @@ -61,6 +61,20 @@ + + + + + + <html><head/><body><p>Available variables:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x: the S parameter as a (complex) voltage vector. </li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">P: power of the stimulus signal in dBm</li></ul><p>Examples:<br/>Add 10db to the trace (10db = exp10(10/20) = sqrt(10)):</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x * sqrt(10)</li></ul><p>Clip trace at 0db (0db = exp10(0/20) = 1) while preserving phase:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">abs(x) &lt; 1 ? x : exp(i*arg(x))</li></ul></body></html> + + + true + + + + +