### Install development version from GitHub Source: https://github.com/barkhausen-institut/hermespy/blob/master/README.md Clones the current development version from GitHub and installs it as an editable package. The clone uses the --recursive flag to include submodules. ```bash git clone --recursive git@github.com:Barkhausen-Institut/hermespy.git cd hermespy python -m pip install -v -e . ``` -------------------------------- ### Install HermesPy with optional features Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/installation.rst Installs HermesPy with additional optional features by appending feature identifiers to the pip install command. Replace 'feature,feature,feature' with the desired identifiers from the list (e.g., quadriga, uhd, audio, sionna, documentation, develop). ```bash pip install "hermespy[feature,feature,feature]" ``` -------------------------------- ### Build and install HermesPy from source using Windows vEnv Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/installation.rst Creates a new virtual environment with Python's venv, activates it, and installs the package from the current directory. Replace with your environment name. Omit the first step if using an existing environment. ```batch python -m venv \Scripts\activate pip install . ``` -------------------------------- ### Install HermesPy from PyPI with pip Source: https://github.com/barkhausen-institut/hermespy/blob/master/README.md Recommended installation for end-users. Requires a Python environment of version 3.10 to 3.12. Pulls the pre-built wheels from PyPI. ```bash python -m pip install hermespy ``` -------------------------------- ### Build and install HermesPy from source using Linux vEnv Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/installation.rst Creates a new virtual environment with Python's venv, activates it, and installs the package from the current directory. Replace with your environment name. Omit the first step if using an existing environment. ```bash python -m venv env source env/bin/activate pip install . ``` -------------------------------- ### Install documentation dependencies Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/developer_hints.rst Installs additional dependencies required for building the documentation from PyPi. ```bash pip install -e ".[documentation]" ``` -------------------------------- ### Install HermesPy from PyPi using Linux vEnv Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/installation.rst Creates a new virtual environment with Python's venv, activates it, and installs the HermesPy wheel from PyPi. Replace with your environment name. Omit the first step if using an existing environment. ```bash python -m venv env source env/bin/activate pip install hermespy ``` -------------------------------- ### Deploy DSP algorithms to hardware loop testbed Source: https://github.com/barkhausen-institut/hermespy/blob/master/README.md Creates a HardwareLoop with a PhysicalScenarioDummy, assigns the DSP algorithms to devices, adds the BitErrorEvaluator, sweeps over power, and adds a ReceivedConstellationPlot for visualization. Runs 10 drops and plots results. Requires matplotlib and hermespy.hardware_loop. ```python import matplotlib.pyplot as plt from hermespy.hardware_loop import HardwareLoop, PhysicalScenarioDummy, ReceivedConstellationPlot # Initialize a hardware loop running each DSP algorithm on a dedicated device loop = HardwareLoop(PhysicalScenarioDummy(seed=42)) loop.new_device(carrier_frequency=1e9).add_dsp(sense) loop.new_device(carrier_frequency=1e9).add_dsp(com) loop.new_device(carrier_frequency=1e9).add_dsp(joint) # Configure the hardware loop to run the KPI evaluation routine loop.add_evaluator(ber) # Configure the hardware loop to sweep over a parameter dimension loop.new_dimension('power', dB(-30, -20, -10, 0, 10), loop.scenario.devices[0], title="Interference Power") # Configure the hardware loop to visualize a received signal loop.add_plot(ReceivedConstellationPlot(com, 'Rx Constellation')) # Run the hardware loop and plot the results loop.num_drops = 10 loop.run().plot() plt.show() ``` -------------------------------- ### Create Windows virtual environment and install HermesPy in develop mode Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/installation.rst Use these commands to create a Python virtual environment on Windows, activate it, and install HermesPy in editable mode with development dependencies. ```batch python -m venv \Scripts\activate pip install -e ".[develop]" ``` -------------------------------- ### Create Linux virtual environment and install HermesPy in develop mode Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/installation.rst Use these commands to create a Python virtual environment on Linux, activate it, and install HermesPy in editable mode with development dependencies. ```bash python -m venv env source env/bin/activate pip install -e ".[develop]" ``` -------------------------------- ### Install HermesPy from PyPi using Windows vEnv Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/installation.rst Creates a new virtual environment with Python's venv, activates it, and installs the HermesPy wheel from PyPi. Replace with your environment name. Omit the first step if using an existing environment. ```batch python -m venv \Scripts\activate pip install hermespy ``` -------------------------------- ### Initialize DSP algorithms from modem, radar, and jcas modules Source: https://github.com/barkhausen-institut/hermespy/blob/master/README.md Creates a ReceivingModem with RRCWaveform, a Radar with FMCW waveform, and a MatchedFilterJcas joint waveform. Also initializes a BitErrorEvaluator for KPI evaluation. Requires the hermespy.modem, hermespy.radar, and hermespy.jcas modules. ```python from hermespy.modem import ReceivingModem, RRCWaveform, BitErrorEvaluator from hermespy.radar import Radar, FMCW from hermespy.jcas import MatchedFilterJcas # Initialize a DSP algorithm from each module com = ReceivingModem(waveform=RRCWaveform()) sense = Radar(waveform=FMCW(num_chirps=100, pulse_rep_interval=3e-6)) joint = MatchedFilterJcas(10.0, waveform=RRCWaveform()) # Initialize an exemplary KPI evaluation routine ber = BitErrorEvaluator(joint, com, plot_surface=False) ``` -------------------------------- ### Build and install HermesPy from source using Windows Conda Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/installation.rst Creates a new Conda environment with Python 3.11, activates it, installs pip, and installs the package from the current directory. Replace with your environment name. Omit the first step if using an existing environment. ```batch conda create -n python=3.11 conda activate conda install pip pip install . ``` -------------------------------- ### Deploy DSP algorithms to simulation campaign with parameter sweeps Source: https://github.com/barkhausen-institut/hermespy/blob/master/README.md Sets up a Simulation with three devices, each running one DSP algorithm. Adds the BitErrorEvaluator and configures sweeps over noise_level and carrier_frequency using the new dimension interface. Runs 200 samples and plots results. Requires matplotlib and hermespy.simulation. ```python import matplotlib.pyplot as plt from hermespy.core import dB from hermespy.simulation import Simulation # Initialize a simulation running each DSP algorithm on a dedicated device sim = Simulation(seed=42) sim.new_device(carrier_frequency=1e9).add_dsp(com) sim.new_device(carrier_frequency=26e9).add_dsp(sense) sim.new_device(carrier_frequency=1e9).add_dsp(joint) # Configure the simulation to run the KPI evaluation routine sim.add_evaluator(ber) # Configure the simulation to sweep over two parameter dimensions sim.new_dimension('noise_level', dB(-20, -10, 0, 10, 20, 30), *sim.devices) sim.new_dimension('carrier_frequency', [1e9, 13e9, 26e9], sim.devices[0], title="CF") # Run the simulation and plot the results sim.num_samples = 200 sim.run().plot() plt.show() ``` -------------------------------- ### Install HermesPy from PyPi using Windows Conda Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/installation.rst Creates a new Conda environment with Python 3.11, activates it, installs pip, and installs the HermesPy wheel from PyPi. Replace with your environment name. Omit the first step if using an existing environment. ```batch conda create -n python=3.11 conda activate conda install pip pip install hermespy ``` -------------------------------- ### Install flake8 and black Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/developer_hints.rst Manually installs both tools in your environment before first execution. ```bash pip install --upgrade flake8 black ``` -------------------------------- ### Create Conda environment and install HermesPy in develop mode Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/installation.rst Use these commands to create a new Conda environment with Python 3.11, activate it, install pip, and then install HermesPy in editable mode with development dependencies. ```bash conda create -n python=3.11 conda activate conda install pip pip install -e ".[develop]" ``` -------------------------------- ### Configure SpatialDelayChannel in a Simulation Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/channel/delay/spatial.rst Sets up two devices with specified positions and a SpatialDelayChannel between them within a Simulation. Requires both devices to have assumed positions; the channel's impulse response depends on their distance and relative orientation. The example also configures a SimplexLink with RRCWaveform, SCLeastSquaresChannelEstimation, SCZeroForcingChannelEqualization, and SCCorrelationSynchronization. ```python # Initialize two devices to be linked by a channel simulation = Simulation() alpha_device = simulation.new_device( carrier_frequency=1e8, pose=Transformation.From_Translation(np.array([0, 0, 0])), ) beta_device = simulation.new_device( carrier_frequency=1e8, pose=Transformation.From_Translation(np.array([1, 0, 0])), ) # Create a channel between the two devices channel = SpatialDelayChannel() simulation.set_channel(alpha_device, beta_device, channel) # Configure communication link between the two devices link = SimplexLink() alpha_device.transmitters.add(link) beta_device.receivers.add(link) # Specify the waveform and postprocessing to be used by the link link.waveform = RRCWaveform( num_data_symbols=1000, num_preamble_symbols=10, pilot_rate=10, ) link.waveform.channel_estimation = SCLeastSquaresChannelEstimation() link.waveform.channel_equalization = SCZeroForcingChannelEqualization() link.waveform.synchronization = SCCorrelationSynchronization() ``` -------------------------------- ### Configure Cost259 channel in a Simulation Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/channel/fading/cost259.rst Minimal example for setting up a Cost259 channel between two devices within a Simulation. It creates devices, assigns a Cost259 channel with URBAN model type, configures a SimplexLink with RRCWaveform, adds BER evaluation, and sweeps over noise levels. The final simulation run and SNR curve plotting are not shown. ```python # Initialize two devices to be linked by a channel simulation = Simulation() alpha_device = simulation.new_device(carrier_frequency=1e8) beta_device = simulation.new_device(carrier_frequency=1e8) # Create a channel between the two devices channel = Cost259(model_type=Cost259Type.URBAN) simulation.set_channel(alpha_device, beta_device, channel) # Configure communication link between the two devices link = SimplexLink() alpha_device.transmitters.add(link) beta_device.receivers.add(link) # Specify the waveform and postprocessing to be used by the link link.waveform = RRCWaveform( num_data_symbols=1000, num_preamble_symbols=10, pilot_rate=10, ) link.waveform.channel_estimation = SCLeastSquaresChannelEstimation() link.waveform.channel_equalization = SCZeroForcingChannelEqualization() # Configure a simulation to evaluate the link's BER and sweep over the receive SNR simulation.add_evaluator(BitErrorEvaluator(link, link)) simulation.new_dimension('noise_level', dB(0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20), beta_device) # Run simulation and plot resulting SNR curve ``` -------------------------------- ### Clone HermesPy source code from GitHub Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/installation.rst Clones the HermesPy repository recursively (including submodules) and changes into the hermespy directory. Requires Git with LFS extension installed. The --recursive flag is required to clone submodules. ```bash git clone --recursive cd hermespy/ ``` -------------------------------- ### Alias IdealChannel as Channel Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/simulation/index.rst Use this snippet to configure the simulation with an ideal channel by aliasing IdealChannel as Channel. This is the only code example provided in the source. ```python # Alias the ideal channel as Channel Channel = IdealChannel ``` -------------------------------- ### Configure BitErrorEvaluator in a simulation campaign Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/modem/evaluators.ber.rst Sets up a simulation with two devices and modems, configures their waveforms, adds a BitErrorEvaluator, defines a noise dimension, and runs the simulation. The example uses a RootRaisedCosineWaveform with 10 preamble and 100 data symbols, and evaluates BER over noise levels from 0 to 20 dB. ```python # Create a new simulation featuring two devices simulation = Simulation() device_alpha = simulation.new_device(bandwidth=1e8, oversampling_factor=8) device_beta = simulation.new_device(bandwidth=1e8, oversampling_factor=8) # Create a transmitting and receiving modem for each device, respectively modem_alpha = TransmittingModem() device_alpha.transmitters.add(modem_alpha) modem_beta = ReceivingModem() device_beta.receivers.add(modem_beta) # Configure the modem's waveform waveform_configuration = { 'num_preamble_symbols': 10, 'num_data_symbols': 100, } modem_alpha.waveform = RootRaisedCosineWaveform(**waveform_configuration) modem_beta.waveform = RootRaisedCosineWaveform(**waveform_configuration) simulation.add_evaluator(BitErrorEvaluator(modem_alpha, modem_beta)) simulation.new_dimension('noise_level', dB(0, 2, 4, 8, 10, 12, 14, 16, 18, 20), device_beta) simulation.num_samples = 1000 result = simulation.run() ``` -------------------------------- ### Configure UrbanMacrocells channel in a Simulation Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/channel/cdl/urban_macrocells.rst Minimal example showing how to set up an urban macrocell channel model within a Simulation. It initializes two devices, creates a channel between them, configures a communication link with an RRC waveform and SCLeastSquaresChannelEstimation, and sets the channel in the simulation. ```python # Initialize two devices to be linked by a channel simulation = Simulation() alpha_device = simulation.new_device( carrier_frequency=1e8, bandwidth=1e6, oversampling_factor=4, pose=Transformation.From_Translation(np.array([0., 0., 2.])), ) beta_device = simulation.new_device( carrier_frequency=1e8, bandwidth=1e6, oversampling_factor=4, pose=Transformation.From_Translation(np.array([40., 40., 2.])), ) # Create a channel between the two devices channel = UrbanMacrocells() simulation.set_channel(alpha_device, beta_device, channel) # Configure communication link between the two devices link = SimplexLink() alpha_device.transmitters.add(link) beta_device.receivers.add(link) # Specify the waveform and postprocessing to be used by the link link.waveform = RRCWaveform( num_data_symbols=1000, num_preamble_symbols=10, pilot_rate=10, ) link.waveform.channel_estimation = SCLeastSquaresChannelEstimation() ``` -------------------------------- ### Configure StaticTrigger for Multiple Simulated Devices Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/simulation/synchronization.StaticTrigger.rst Assign the same StaticTrigger instance to the trigger_model property of multiple simulated devices to synchronize them at the start of the SimulatedDrop. The example creates a simulation with two sets of linked devices and assigns trigger models to each set. ```python # Create a new simulation featuring two sets of two linked, synchronized devices simulation = Simulation() # Create devices device_A_Tx = simulation.new_device(carrier_frequency=3.7e9, bandwidth=400e6, oversampling_factor=4) device_A_Rx = simulation.new_device(carrier_frequency=3.7e9, bandwidth=400e6, oversampling_factor=4) device_B_Tx = simulation.new_device(carrier_frequency=3.9e9, bandwidth=400e6, oversampling_factor=4) device_B_Rx = simulation.new_device(carrier_frequency=3.9e9, bandwidth=400e6, oversampling_factor=4) device_A_Tx.trigger_model = trigger_model_A device_A_Rx.trigger_model = trigger_model_A trigger_model_B = StaticTrigger() device_B_Tx.trigger_model = trigger_model_B device_B_Rx.trigger_model = trigger_model_B # Configure BER evaluators for each link ``` -------------------------------- ### Install HermesPy audio dependencies Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/notebooks/audio.ipynb Installs the hermespy[audio] package in the current Python kernel. A runtime restart is required after installation when running on Colab. ```python %%capture # Install HermesPy and its dependencies in the current kernel # When running on Colabs, a restart of the runtime is required afterwards import sys !{sys.executable} -m pip install --quiet hermespy[audio] ``` -------------------------------- ### Configure User Equipment as Transmitting Modems Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/beamforming/nullsteeringbeamformer.rst Creates three transmitting modems and adds them to the respective user equipment devices. This configures the UEs for transmission in the receiving beamformer example. ```python user_equipment_transmitter_1 = TransmittingModem(waveform=deepcopy(waveform)) user_equipment_transmitter_2 = TransmittingModem(waveform=deepcopy(waveform)) user_equipment_transmitter_3 = TransmittingModem(waveform=deepcopy(waveform)) user_equipment_device_1.add_dsp(user_equipment_transmitter_1) user_equipment_device_2.add_dsp(user_equipment_transmitter_2) user_equipment_device_3.add_dsp(user_equipment_transmitter_3) ``` -------------------------------- ### SampleOffsetTrigger Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/simulation/synchronization.SampleOffsetTrigger.rst The SampleOffsetTrigger class introduces an offset of a fixed number of samples to the start of the SimulatedDrop. It can be configured by assigning the same instance to the trigger_model property of multiple simulated devices. ```APIDOC ## SampleOffsetTrigger ### Description The SampleOffsetTrigger introduces an offset of a fixed number of samples to the start of the SimulatedDrop. It can be configured by assigning the same instance to the trigger_model property of multiple simulated devices. ### Constructor `SampleOffsetTrigger(offset: int)` ### Parameters - **offset** (int) - Required - The number of samples to offset the start of the SimulatedDrop. ### Usage Example ```python # Create a new simulation featuring two sets of two linked, synchronized devices simulation = Simulation() # Create devices device_A_Tx = simulation.new_device(carrier_frequency=3.7e9, bandwidth=400e6, oversampling_factor=4) device_A_Rx = simulation.new_device(carrier_frequency=3.7e9, bandwidth=400e6, oversampling_factor=4) device_B_Tx = simulation.new_device(carrier_frequency=3.9e9, bandwidth=400e6, oversampling_factor=4) device_B_Rx = simulation.new_device(carrier_frequency=3.9e9, bandwidth=400e6, oversampling_factor=4) device_A_Tx.trigger_model = trigger_model_A device_A_Rx.trigger_model = trigger_model_A trigger_model_B = SampleOffsetTrigger(2048) device_B_Tx.trigger_model = trigger_model_B device_B_Rx.trigger_model = trigger_model_B # Configure BER evaluators for each link ``` ``` -------------------------------- ### Configure ThroughputEvaluator in a Simulation Campaign Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/modem/evaluators.throughput.rst Minimal example showing how to set up a simulation with two devices, add transmitting and receiving modems, configure their waveforms, and add a ThroughputEvaluator. The simulation runs with a noise level dimension and 1000 samples. ```python # Create a new simulation featuring two devices simulation = Simulation() device_alpha = simulation.new_device(bandwidth=1e8, oversampling_factor=8) device_beta = simulation.new_device(bandwidth=1e8, oversampling_factor=8) # Create a transmitting and receiving modem for each device, respectively modem_alpha = TransmittingModem() device_alpha.transmitters.add(modem_alpha) modem_beta = ReceivingModem() device_beta.receivers.add(modem_beta) # Configure the modem's waveform waveform_configuration = { 'num_preamble_symbols': 10, 'num_data_symbols': 100, } modem_alpha.waveform = RootRaisedCosineWaveform(**waveform_configuration) modem_beta.waveform = RootRaisedCosineWaveform(**waveform_configuration) simulation.add_evaluator(ThroughputEvaluator(modem_alpha, modem_beta)) simulation.new_dimension('noise_level', dB(0, 2, 4, 8, 10, 12, 14, 16, 18, 20), device_beta) simulation.num_samples = 1000 result = simulation.run() ``` -------------------------------- ### Configure user equipment transmitters with probing waveform Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/beamforming/capon.rst Creates TransmittingModem instances for both user equipment devices using deep copies of the configured waveform and adds them as DSP components. ```python user_equipment_transmitter_1 = TransmittingModem(waveform=deepcopy(waveform)) user_equipment_transmitter_2 = TransmittingModem(waveform=deepcopy(waveform)) user_equipment_device_1.add_dsp(user_equipment_transmitter_1) user_equipment_device_2.add_dsp(user_equipment_transmitter_2) ``` -------------------------------- ### SpatialDelayChannelRealization Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/channel/delay/spatial.rst The SpatialDelayChannelRealization class represents a specific realization of the spatial delay channel, providing the channel's impulse response for a given configuration. ```APIDOC ## SpatialDelayChannelRealization ### Description The SpatialDelayChannelRealization class represents a specific realization of the spatial delay channel, providing the channel's impulse response for a given configuration. ### Usage This class is typically instantiated internally by the SpatialDelayChannel during simulation. ### Notes - It is part of the hermespy.channel.delay.spatial module. - It inherits from the base realization class and provides the realized channel response. ``` -------------------------------- ### Configure RandomDelayChannel in a Simulation Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/channel/delay/random.rst Sets up a simulation with two devices linked by a RandomDelayChannel, configures a SimplexLink with RRCWaveform and channel estimation/equalization/synchronization, adds a BitErrorEvaluator, sweeps over noise levels, and runs the simulation. The delay is drawn uniformly between 1e-8 and 10e-8 seconds. ```python # Initialize two devices to be linked by a channel simulation = Simulation() alpha_device = simulation.new_device(carrier_frequency=1e8) beta_device = simulation.new_device(carrier_frequency=1e8) # Create a channel between the two devices channel = RandomDelayChannel((1e-8, 10e-8)) simulation.set_channel(alpha_device, beta_device, channel) # Configure communication link between the two devices link = SimplexLink() alpha_device.transmitters.add(link) beta_device.receivers.add(link) # Specify the waveform and postprocessing to be used by the link link.waveform = RRCWaveform( num_data_symbols=1000, num_preamble_symbols=10, pilot_rate=10, ) link.waveform.channel_estimation = SCLeastSquaresChannelEstimation() link.waveform.channel_equalization = SCZeroForcingChannelEqualization() link.waveform.synchronization = SCCorrelationSynchronization() # Configure a simulation to evaluate the link's BER and sweep over the receive SNR simulation.add_evaluator(BitErrorEvaluator(link, link)) simulation.new_dimension('noise_level', dB(20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40), beta_device) # Run simulation and plot resulting SNR curve simulation.num_samples = 1000 ``` -------------------------------- ### Initialize Simulation and Add Device Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/matlab.rst Load the hermespy.simulation module, create a Simulation object, and add a new virtual device. This minimal example shows how to control Hermes from Matlab after environment activation. ```matlab simulation_module = py.importlib.import_module('hermespy.simulation'); simulation = simulation_module.Simulation(); device = simulation.new_device(); ``` -------------------------------- ### Initialize base station device with uniform antenna array Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/beamforming/capon.rst Creates a new device representing a base station with a simulated uniform array of ideal isotropic antennas spaced at half-wavelength intervals. The device is positioned at the origin with the specified carrier frequency. ```python base_station_device = simulation.new_device( antennas=SimulatedUniformArray(SimulatedIdealAntenna, .5 * wavelength, (8, 8, 1)), carrier_frequency=carrier_frequency, pose=Transformation.From_Translation(np.array([0, 0, 0])), ) ``` -------------------------------- ### Initialize Devices and Create Channel Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/channel/index.rst Sets up two SimulatedDevice instances and a Channel object as the foundation for a channel simulation. This is the prerequisite step before any transmission or propagation. ```python # Initialize two devices to be linked by a channel alpha_device = SimulatedDevice() beta_device = SimulatedDevice() # Create a channel between the two devices channel = Channel() ``` -------------------------------- ### Initialize Simulation and Configure Channels Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/simulation/index.rst Sets up a simulation with a limited number of actors and adds two devices, then configures three unique channels between them. The num_actors property is usually not required as Ray scales automatically, but may be needed for memory constraints. ```python # Initialize a new simulation simulation = Simulation() # Limit the number of actors, i.e. parallel physical layers, to 3 simulation.num_actors = 3 # Add two devices to the simulation device_alpha = simulation.new_device() device_beta = simulation.new_device() # Configure the three unique channels alpha_alpha_channel = Channel() beta_beta_channel = Channel() alpha_beta_channel = Channel() simulation.set_channel(device_alpha, device_alpha, alpha_alpha_channel) simulation.set_channel(device_beta, device_beta, beta_beta_channel) simulation.set_channel(device_alpha, device_beta, alpha_beta_channel) ``` -------------------------------- ### Configure SampleOffsetTrigger for multiple devices Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/simulation/synchronization.SampleOffsetTrigger.rst Assigns the same SampleOffsetTrigger instance to the trigger_model property of multiple simulated devices to introduce a fixed sample offset. The example creates two sets of linked devices and sets trigger_model_A and trigger_model_B, but note that trigger_model_A is referenced before it is defined in the displayed code. ```python # Create a new simulation featuring two sets of two linked, synchronized devices simulation = Simulation() # Create devices device_A_Tx = simulation.new_device(carrier_frequency=3.7e9, bandwidth=400e6, oversampling_factor=4) device_A_Rx = simulation.new_device(carrier_frequency=3.7e9, bandwidth=400e6, oversampling_factor=4) device_B_Tx = simulation.new_device(carrier_frequency=3.9e9, bandwidth=400e6, oversampling_factor=4) device_B_Rx = simulation.new_device(carrier_frequency=3.9e9, bandwidth=400e6, oversampling_factor=4) device_A_Tx.trigger_model = trigger_model_A device_A_Rx.trigger_model = trigger_model_A trigger_model_B = SampleOffsetTrigger(2048) device_B_Tx.trigger_model = trigger_model_B device_B_Rx.trigger_model = trigger_model_B # Configure BER evaluators for each link ``` -------------------------------- ### Create Simulation and Add Devices Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/getting_started.rst Initializes a Simulation and adds two dedicated devices with an oversampling factor of 4. The simulation automatically initializes IdealChannel instances for new devices. ```python # Create a new simulation simulation = Simulation() # Add two dedicated devices to the simulation tx_device = simulation.new_device(oversampling_factor=4) rx_device = simulation.new_device(oversampling_factor=4) ``` -------------------------------- ### Create simulation and add devices Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/channel/index.rst Instantiates a Simulation and adds the two existing devices (alpha_device and beta_device) to it. This is required before running the simulation with the configured channel. ```python # Create a new simulation and add the two existing devices simulation = Simulation() simulation.add_device(alpha_device) simulation.add_device(beta_device) ``` -------------------------------- ### Create Hardware Loop with PhysicalScenarioDummy and Devices Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/getting_started.rst Initializes a hardware loop with a dummy physical scenario and two dedicated devices, e.g., USRPs. The dummy scenario does not require real hardware and behaves like simulated devices. ```python # Create a new hardware loop hardware_scenario = PhysicalScenarioDummy(seed=42) hardware_loop = HardwareLoop[PhysicalScenarioDummy, PhysicalDeviceDummy](hardware_scenario) # Add two dedicated devices to the hardware loop, this could be, for example, two USRPs tx_device = hardware_loop.new_device(carrier_frequency=1e9, oversampling_factor=8) rx_device = hardware_loop.new_device(carrier_frequency=1e9, oversampling_factor=8) ``` -------------------------------- ### Configure MultipathFadingChannel in a Simulation Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/channel/fading/fading.MultipathFadingChannel.rst Minimal example showing how to configure the MultipathFadingChannel within a Simulation. It initializes two devices, creates a channel with specified delays, powers, and Rice factors, sets up a SimplexLink with RRCWaveform and channel estimation/equalization, and adds a BitErrorEvaluator with a noise level sweep. ```python # Initialize two devices to be linked by a channel simulation = Simulation() alpha_device = simulation.new_device(carrier_frequency=1e8) beta_device = simulation.new_device(carrier_frequency=1e8) # Create a channel between the two devices delays = 1e-9 * np.array([0, 0.3819, 0.4025, 0.5868, 0.4610, 0.5375, 0.6708, 0.5750, 0.7618, 1.5375, 1.8978, 2.2242, 2.1717, 2.4942, 2.5119, 3.0582, 4.0810, 4.4579, 4.5695, 4.7966, 5.0066, 5.3043, 9.6586]) powers = 10 ** (np.array([-13.4, 0, -2.2, -4, -6, -8.2, -9.9, -10.5, -7.5, -15.9, -6.6, -16.7, -12.4, -15.2, -10.8, -11.3, -12.7, -16.2, -18.3, -18.9, -16.6, -19.9, -29.7]) / 10) rice_factors = np.zeros_like(delays) channel = MultipathFadingChannel(delays, powers, rice_factors) simulation.set_channel(alpha_device, beta_device, channel) # Configure communication link between the two devices link = SimplexLink() alpha_device.transmitters.add(link) beta_device.receivers.add(link) # Specify the waveform and postprocessing to be used by the link link.waveform = RRCWaveform( num_data_symbols=1000, num_preamble_symbols=10, pilot_rate=10, ) link.waveform.channel_estimation = SCLeastSquaresChannelEstimation() link.waveform.channel_equalization = SCZeroForcingChannelEqualization() # Configure a simulation to evaluate the link's BER and sweep over the receive SNR simulation.add_evaluator(BitErrorEvaluator(link, link)) simulation.new_dimension('noise_level', dB(0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20), beta_device) # Run simulation and plot resulting SNR curve ``` -------------------------------- ### Create base station device with uniform array Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/beamforming/nullsteeringbeamformer.rst Initializes a simulation environment and creates a base station device with a 5x5 uniform array of ideal isotropic antennas spaced at half wavelength intervals. Requires an existing simulation object and definitions for wavelength, carrier_frequency, and Transformation. ```python base_station_device = simulation.new_device( antennas=SimulatedUniformArray(SimulatedIdealAntenna, .5 * wavelength, (5, 5, 1)), carrier_frequency=carrier_frequency, pose=Transformation.From_Translation(np.array([0, 0, 0])), ) ``` -------------------------------- ### Configure OFDM Radar and Simulate Target Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/jcas/ofdm_radar.rst Creates an OFDMRadar with an OFDMWaveform, attaches a MaxDetector to a SimulatedDevice, simulates a single target via SingleTargetRadarChannel, and plots the resulting range-Doppler cube. Requires a SimulatedDevice with carrier_frequency, bandwidth, and oversampling_factor set as shown. ```python # Configure a OFDM radar device = SimulatedDevice( carrier_frequency=24e9, bandwidth=1024*90.909e3, oversampling_factor=4, ) radar = OFDMRadar(OFDMWaveform( grid_resources=[ GridResource(16, PrefixType.CYCLIC, .1, [GridElement(ElementType.DATA, 7), GridElement(ElementType.REFERENCE, 1)]), GridResource(128, PrefixType.CYCLIC, .1, [GridElement(ElementType.DATA, 1)]), ], grid_structure=[ SymbolSection(64, [0, 1]) ], num_subcarriers=1024, )) radar.detector = MaxDetector() device.add_dsp(radar) # Generate a single target radar_channel = SingleTargetRadarChannel(.75 * radar.max_range(device.bandwidth), 1., velocity=10, attenuate=False) transmission = device.transmit() propagation = radar_channel.propagate(transmission, device, device) reception = device.receive(propagation) # Visualize radar image reception.operator_receptions[0].cube.plot_range() ``` -------------------------------- ### Initialize ReceivingModem with Simulation and Waveform Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/modem/modem.ReceivingModem.rst Sets up a simulation with a single device, adds a ReceivingModem to the device's receivers, and configures a RootRaisedCosineWaveform with 16 preamble symbols, 32 data symbols, and 64-QAM modulation. ```python # Initialize a new simulation considering a single device simulation = Simulation() device = simulation.new_device(carrier_frequency=1e10, oversampling_factor=4, bandwidth=1e6) # Configure the modem modeling the device's transmit DSP rx_modem = ReceivingModem() device.receivers.add(rx_modem) # Configure the modem's waveform waveform = RootRaisedCosineWaveform( num_preamble_symbols=16, num_data_symbols=32, modulation_order=64, ) rx_modem.waveform = waveform ``` -------------------------------- ### Create two user equipment devices Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/beamforming/capon.rst Adds two devices representing user equipments to be illuminated by the base station. The first is positioned at (200, 200, 100) and the second at (200, -200, 100), both using the same carrier frequency. ```python user_equipment_device_1 = simulation.new_device( carrier_frequency=carrier_frequency, pose=Transformation.From_Translation(np.array([200., 200., 100.])), ) user_equipment_device_2 = simulation.new_device( carrier_frequency=carrier_frequency, pose=Transformation.From_Translation(np.array([200., -200., 100.])), ) ``` -------------------------------- ### Configure BlockErrorEvaluator in a simulation campaign Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/modem/evaluators.bler.rst Minimal example showing how to set up a simulation with two devices, add transmitting and receiving modems, configure their waveforms, and add a BlockErrorEvaluator. The simulation runs with a noise level dimension and 1000 samples. ```python # Create a new simulation featuring two devices simulation = Simulation() device_alpha = simulation.new_device(bandwidth=1e8, oversampling_factor=8) device_beta = simulation.new_device(bandwidth=1e8, oversampling_factor=8) # Create a transmitting and receiving modem for each device, respectively modem_alpha = TransmittingModem() device_alpha.transmitters.add(modem_alpha) modem_beta = ReceivingModem() device_beta.receivers.add(modem_beta) # Configure the modem's waveform waveform_configuration = { 'num_preamble_symbols': 10, 'num_data_symbols': 100, } modem_alpha.waveform = RootRaisedCosineWaveform(**waveform_configuration) modem_beta.waveform = RootRaisedCosineWaveform(**waveform_configuration) simulation.add_evaluator(BlockErrorEvaluator(modem_alpha, modem_beta)) simulation.new_dimension('noise_level', dB(0, 2, 4, 8, 10, 12, 14, 16, 18, 20), device_beta) simulation.num_samples = 1000 result = simulation.run() ``` -------------------------------- ### Configure transmitters and receivers for both devices Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/simulation/index.rst Sets up both devices to transmit and receive 100 samples of a random complex signal with amplitude 1 and 100 MHz bandwidth. Creates SignalTransmitter and SignalReceiver instances and adds them to the respective devices. The receivers are configured with expected_power=1.0. ```python # Make both devices transmit 100 samples at 100 MHz ns, fs = 100, 1e8 transmitted_signal = Signal.Create(np.exp(2j * np.random.uniform(0, np.pi, (1, ns))), fs) alpha_transmitter = SignalTransmitter(transmitted_signal) beta_transmitter = SignalTransmitter(transmitted_signal) alpha_receiver = SignalReceiver(ns, expected_power=1.0) beta_receiver = SignalReceiver(ns, expected_power=1.0) device_alpha.transmitters.add(alpha_transmitter) device_beta.transmitters.add(beta_transmitter) device_alpha.receivers.add(alpha_receiver) device_beta.receivers.add(beta_receiver) ``` -------------------------------- ### Configure IndoorOffice channel in Simulation Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/channel/cdl/indoor_office.rst Minimal example for setting up an IndoorOffice channel model within a Simulation. Initializes two devices with specified carrier frequency, bandwidth, and pose, creates the channel with OfficeType.OPEN and seed 42, sets it between devices, configures a SimplexLink with RRCWaveform and channel estimation/equalization. ```python # Initialize two devices to be linked by a channel simulation = Simulation() alpha_device = simulation.new_device( carrier_frequency=1e8, bandwidth=1e7, pose=Transformation.From_Translation(np.array([0., 0., 2.])), ) beta_device = simulation.new_device( carrier_frequency=1e8, bandwidth=1e7, pose=Transformation.From_Translation(np.array([40., 40., 2.])) ) # Create a channel between the two devices channel = IndoorOffice(office_type=OfficeType.OPEN, seed=42) simulation.set_channel(alpha_device, beta_device, channel) # Configure communication link between the two devices link = SimplexLink() alpha_device.transmitters.add(link) beta_device.receivers.add(link) # Specify the waveform and postprocessing to be used by the link link.waveform = RRCWaveform( num_data_symbols=1000, num_preamble_symbols=10, pilot_rate=10, ) link.waveform.channel_estimation = SCLeastSquaresChannelEstimation() link.waveform.channel_equalization = SCZeroForcingChannelEqualization() ``` -------------------------------- ### ChannelRealization.sample() Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/channel/index.rst Abstract method to generate a new ChannelSample object. Calling this method results in a new sample representing a single one-directional propagation channel in space and time. ```APIDOC ## ChannelRealization.sample() ### Description Abstract method to generate a new ChannelSample object. Calling this method results in a new sample representing a single one-directional propagation channel in space and time. ### Method sample() ### Returns ChannelSample - A new channel sample object. ``` -------------------------------- ### Set PATH for Octave CLI on Windows Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/installation.rst Run this command in a Windows command prompt to append the path to the Octave command-line interface to the system PATH variable, which may be required for oct2py to locate Octave. ```bash setx PATH "%PATH%;" ``` -------------------------------- ### Set SpatialDelayChannel between base station and second UE Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/beamforming/capon.rst Configures the simulation channel between the base station device and the second user equipment using SpatialDelayChannel with model_propagation_loss disabled. This is part of the Capon beamforming simulation setup. ```python simulation.set_channel( base_station_device, user_equipment_device_2, SpatialDelayChannel(model_propagation_loss=False), ) ``` -------------------------------- ### Initialize Simulation and Configure TransmittingModem Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/modem/modem.TransmittingModem.rst Sets up a simulation with a single device and configures a TransmittingModem with a RootRaisedCosineWaveform. The waveform uses 16 preamble symbols, 32 data symbols, and 64-QAM modulation. ```python # Initialize a new simulation considering a single device simulation = Simulation() device = simulation.new_device(carrier_frequency=1e10, oversampling_factor=4, bandwidth=1e6) # Configure the modem modeling the device's transmit DSP tx_modem = TransmittingModem() device.transmitters.add(tx_modem) # Configure the modem's waveform waveform = RootRaisedCosineWaveform( num_preamble_symbols=16, num_data_symbols=32, modulation_order=64, ) tx_modem.waveform = waveform ``` -------------------------------- ### Create three user equipment devices Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/beamforming/nullsteeringbeamformer.rst Adds three UE devices to the simulation at specified positions, each with the same carrier frequency. Requires an existing simulation object and definitions for carrier_frequency and Transformation. ```python user_equipment_device_1 = simulation.new_device( carrier_frequency=carrier_frequency, pose=Transformation.From_Translation(np.array([200., 200., 100.])), ) user_equipment_device_2 = simulation.new_device( carrier_frequency=carrier_frequency, pose=Transformation.From_Translation(np.array([200., -200., 100.])), ) user_equipment_device_3 = simulation.new_device( carrier_frequency=carrier_frequency, pose=Transformation.From_Translation(np.array([-400., 200., 100.])), ) ``` -------------------------------- ### Configure TimeOffsetTrigger for multiple devices Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/simulation/synchronization.TimeOffsetTrigger.rst Assign the same TimeOffsetTrigger instance to the trigger_model property of multiple simulated devices to introduce a fixed time offset to the start of SimulatedDrop. The example creates a simulation with two sets of linked devices and configures trigger models for each set. ```python # Create a new simulation featuring two sets of two linked, synchronized devices simulation = Simulation() # Create devices device_A_Tx = simulation.new_device(carrier_frequency=3.7e9, bandwidth=400e6, oversampling_factor=4) device_A_Rx = simulation.new_device(carrier_frequency=3.7e9, bandwidth=400e6, oversampling_factor=4) device_B_Tx = simulation.new_device(carrier_frequency=3.9e9, bandwidth=400e6, oversampling_factor=4) device_B_Rx = simulation.new_device(carrier_frequency=3.9e9, bandwidth=400e6, oversampling_factor=4) device_A_Tx.trigger_model = trigger_model_A device_A_Rx.trigger_model = trigger_model_A trigger_model_B = TimeOffsetTrigger(.5 * device_B_Tx.max_frame_duration) device_B_Tx.trigger_model = trigger_model_B device_B_Rx.trigger_model = trigger_model_B # Configure BER evaluators for each link ``` -------------------------------- ### Set results directory and run hardware loop Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/getting_started.rst Sets the results directory to the default location and runs the hardware loop. This consolidates all drop data and evaluations into a single drops.h5 file within the directory. ```python hardware_loop.results_dir = hardware_loop.default_results_dir() hardware_loop.run() ``` -------------------------------- ### Install HermesPy and dependencies Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/notebooks/channel.ipynb Installs HermesPy and its dependencies in the current kernel using pip. A runtime restart is required after installation when running on Colab. ```python %%capture # Install HermesPy and its dependencies in the current kernel # When running on Colabs, a restart of the runtime is required afterwards import sys !{sys.executable} -m pip install --quiet hermespy ``` -------------------------------- ### Configure IndoorFactory channel in Simulation Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/channel/cdl/indoor_factory.rst Minimal example for setting up an IndoorFactory channel between two devices in a Simulation. It initializes devices with specified bandwidth, oversampling factor, carrier frequency, and poses, then creates the channel with parameters 10000, 3000, FactoryType.HH, and seed 42. Finally, it configures a SimplexLink with RRCWaveform and SCLeastSquaresChannelEstimation. ```python # Initialize two devices to be linked by a channel simulation = Simulation() alpha_device = simulation.new_device( bandwidth=1e5, oversampling_factor=8, carrier_frequency=1e8, pose=Transformation.From_Translation(np.array([0., 0., 3.])), ) beta_device = simulation.new_device( bandwidth=1e5, oversampling_factor=8, carrier_frequency=1e8, pose=Transformation.From_Translation(np.array([40., 40., 3.])), ) # Create a channel between the two devices channel = IndoorFactory(10000, 3000, FactoryType.HH, seed=42) simulation.set_channel(alpha_device, beta_device, channel) # Configure communication link between the two devices link = SimplexLink() alpha_device.transmitters.add(link) beta_device.receivers.add(link) # Specify the waveform and postprocessing to be used by the link link.waveform = RRCWaveform( num_data_symbols=1000, num_preamble_symbols=10, pilot_rate=10, ) link.waveform.channel_estimation = SCLeastSquaresChannelEstimation() ``` -------------------------------- ### Build documentation with Sphinx Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/developer_hints.rst Builds the HTML documentation from docssource/ into documentation/ from the project's root directory. ```bash sphinx-build ./docssource/ ./documentation/ ``` -------------------------------- ### Configure transmit focus of beamformer Source: https://github.com/barkhausen-institut/hermespy/blob/master/docssource/api/beamforming/conventional.rst This code block is incomplete and appears to be a fragment of a configuration for the beamformer's transmit focus. It is not usable as a standalone example. ```python ] ```