gainlineup
Gain Lineups for RF Engineering
Example
Here is an example program to use (copy/paste) in main.rs of a new cargo new example-lineup project.
use cascade_vector_return_vector;
use Block;
use Input;
use SignalNode;
The output is similar to the following:
-Node 0: Cable Run from Signal Generator to DUT Output
Input Level 4.00 dBm
Node 1: Line Amp at X GHz Output
Input Power 4.00 dBm
Block Gain: 22.00 dB (Cumulative Gain: 16.00 dB)
Noise Figure: 6.02 dB
Output Power 26.00 dBm
Node 2: Cable Run from DUT to Spectrum Analyzer Output
Input Power 26.00 dBm
Block Gain: -6.00 dB (Cumulative Gain: 10.00 dB)
Noise Figure: 6.10 dB
Output Power 20.00 dBm
Final Cascade Summary:
----------------------
Number of Blocks: 2
Pin: 4.00 dBm
Pout: 20.00 dBm
Gain: 10.00 dB
Noise Figure: 6.10 dB
----------------------------
The command line interface is more interactive, and allows for the user to use toml files to define the Input, the Blocks, and run the cascade, turning the output into a html file.
The contents of that file are:
= -80.0
= 6.0e9
= 1.0e6
[[]]
= "explicit"
= "Low Noise Amplifier"
= 20.0
= 3.0
[[]]
= "explicit"
= "Mixer"
= 10.0
= 6.0
[[]]
= "explicit"
= "IF Amplifier"
= 15.0
= 5.0
The output will be a html file in the same directory as the toml file.
You can view an example of the html output at files/wideband.toml.html
You can view the HTML source file itself here directly: files/wideband.toml.html.
Configuration Field Aliases
You can use the following field names with or without unit suffixes. The suffixes are the default, but the aliases are supported for brevity:
| Original Field | Alias (Optional) |
|---|---|
gain_db |
gain |
noise_figure_db |
noise_figure, nf (Noise Figure is NF, Noise Factor is F) |
output_p1db_dbm |
output_p1db, op1db |
output_ip3_dbm |
output_ip3, oip3 |
input_power_dbm |
input_power, pin |
frequency_hz |
frequency, f |
bandwidth_hz |
bandwidth, bw |
noise_temperature_k |
noise_temperature |
You could define the same configuration as above with the following toml:
= -60.0
= 6.0e9
= 1.0e6
[[]]
= "explicit"
= "Low Noise Amplifier"
= 20.0
= 3.0
[[]]
= "explicit"
= "Mixer"
= 10.0
= 6.0
[[]]
= "explicit"
= "IF Amplifier"
= 15.0
= 5.0
However, the unit suffixes are still supported, and are recommended for clarity. Be careful as aliases hide the unit suffixes and might cause unexpected behavior, if you are assuming a different unit suffix than the code... For example, if you assume
pinis in dBW, but the code assumespinis in dBm, you will get unexpected results. Similarly, if you assumefis in GHz, but the code assumesfis in Hz, you will get unexpected results. Also note that nf is the lower case shorthand for noise figure, since NF is used for Noise Figure, while F is used for Noise Factor, see Wikipedia for more information.
Cascade Analysis
The cascade calculates the following cumulative parameters at each node:
| Parameter | Description |
|---|---|
| Signal Power (dBm) | Cumulative signal level through the chain |
| Gain (dB) | Cumulative gain |
| Noise Figure (dB) | Cascaded noise figure (Friis equation) |
| OIP3 (dBm) | Cascaded output third-order intercept point |
| SFDR (dB) | Spur-free dynamic range: 2/3 × (OIP3 − noise floor) |
OIP3 and SFDR are computed when blocks have output_ip3_dbm set. SFDR requires bandwidth > 0 to calculate the noise floor.
Features
Debug Output
To enable debug printing, you can enable the debug-print feature.
[]
= { = "0.18.0", = ["debug-print"] }
