mpylab.device.virtual_rf module

Shared transfer model for coupled virtual RF devices.

mpylab.device.virtual_rf.source_power_watt(source_device, *, gain_db, compression_start_dbm=None, compression_slope=1.0)

Return source power after an optional piecewise-linear compression.

compression_start_dbm refers to the source-device input level. Below it, output power in dBm is source + gain_db. Above it, each additional input dB changes the output by compression_slope dB. Omitting the start level preserves the linear transfer exactly.

Parameters:
  • source_device (object) – Virtual source exposing GetLevel() and returning a power quantity.

  • gain_db (float) – Small-signal power gain in decibels.

  • compression_start_dbm (float, optional) – Source input level in dBm at which compression starts.

  • compression_slope (float, optional) – Output-level increase per additional input decibel above compression, from zero to one.

Returns:

Simulated output power in watts.

Return type:

float

Raises:
  • RuntimeError – If the virtual source does not provide a level.

  • ValueError – If source power or model parameters are invalid.