|
Qucs-S S-parameter Viewer & RF Synthesis Tools
|
Utility functions needed across the whole project. More...
#include "general.h"
Functions | |
| QString | RoundVariablePrecision (double val) |
| Rounds double to minimum decimal places needed. | |
| QString | num2str (std::complex< double > Z, Units CompType) |
| Converts complex number to string with units. | |
| QString | num2str (double Num, Units CompType) |
| Converts double to string with engineering notation and units. | |
| QString | num2str (double Num) |
| Converts double to string with engineering notation. | |
| std::complex< double > | Str2Complex (QString num) |
| Parses string to complex number. | |
| QString | ConvertLengthFromM (QString units, double len) |
| Converts length in meters to appropriate unit with auto-scaling. | |
| void | convert_MA_RI_to_dB (double &S_1, double &S_2, double &S_3, double &S_4, QString format) |
| Converts S-parameter from MA/RI/DB format to dB, angle, real, and imaginary. | |
| double | getFreqScale (QString frequency_unit) |
| Gets frequency scale factor from unit string. | |
| int | findClosestIndex (const QList< double > &list, double value) |
| Finds index of closest value in list. | |
| double | getFreqFromText (QString freq) |
| Parses frequency string to Hz. | |
| QPointF | findClosestPoint (const QList< double > &xValues, const QList< double > &yValues, double targetX) |
| Finds closest point in x-y data series. | |
| double | getScaleFactor (QString scale) |
| Gets scale factor from SI prefix. | |
| double | parseValueWithUnit (const QString &str) |
| Parse string containing magnitude and scale factor (e.g 5mm, 500u, etc) | |
Utility functions needed across the whole project.
| void convert_MA_RI_to_dB | ( | double & | S_1, |
| double & | S_2, | ||
| double & | S_3, | ||
| double & | S_4, | ||
| QString | format | ||
| ) |
Converts S-parameter from MA/RI/DB format to dB, angle, real, and imaginary.
| [in,out] | S_1 | Magnitude (MA), Real (RI), or dB (DB) → dB output |
| [in,out] | S_2 | Angle (MA/DB) or Imaginary (RI) → angle output |
| [out] | S_3 | Real part output |
| [out] | S_4 | Imaginary part output |
| format | Input format: "MA", "RI", or "DB" (case insensitive) |
| QString ConvertLengthFromM | ( | QString | units, |
| double | len | ||
| ) |
Converts length in meters to appropriate unit with auto-scaling.
| units | Current unit (mm, mil, um, nm, inch, ft, m) |
| len | Length in meters |
| int findClosestIndex | ( | const QList< double > & | list, |
| double | value | ||
| ) |
Finds index of closest value in list.
| list | List to search |
| value | Target value |
| QPointF findClosestPoint | ( | const QList< double > & | xValues, |
| const QList< double > & | yValues, | ||
| double | targetX | ||
| ) |
Finds closest point in x-y data series.
| xValues | X-axis values |
| yValues | Y-axis values |
| targetX | Target x value |
| double getFreqFromText | ( | QString | freq | ) |
Parses frequency string to Hz.
| freq | Frequency string (e.g., "2.4 GHz", "100MHz") |
| double getFreqScale | ( | QString | frequency_unit | ) |
Gets frequency scale factor from unit string.
| frequency_unit | Unit string (Hz, kHz, MHz, GHz) |
| double getScaleFactor | ( | QString | scale | ) |
Gets scale factor from SI prefix.
| scale | Prefix string (Y, Z, E, P, T, G, M, k, m, u, n, p, f, a, z, y) |
| QString num2str | ( | double | Num | ) |
Converts double to string with engineering notation.
| Num | Value to convert |
| QString num2str | ( | double | Num, |
| Units | CompType | ||
| ) |
Converts double to string with engineering notation and units.
| Num | Value to convert |
| CompType | Unit type |
| QString num2str | ( | std::complex< double > | Z, |
| Units | CompType | ||
| ) |
Converts complex number to string with units.
| Z | Complex value |
| CompType | Unit type |
| double parseValueWithUnit | ( | const QString & | str | ) |
Parse string containing magnitude and scale factor (e.g 5mm, 500u, etc)
| input | string (500 um) |
| output | double (5e-4) |
| QString RoundVariablePrecision | ( | double | val | ) |
Rounds double to minimum decimal places needed.
| val | Value to round |
| std::complex< double > Str2Complex | ( | QString | num | ) |
Parses string to complex number.
| num | String representation (e.g., "50+j25", "j50", "50") |