A repository to model line-of-site power from one or more transmitters to receivers, includes antenna directivity. Based on the friis equation. This repo is meant to calculate a 2D line of site power, it has tools for visualizing different scenarios.
pip install git+https://github.com/usnistgov/los_simulation.git
- Use your favorite way to clone the repo or download the zip file and extract it.
- pip install to that location (note pip expects a unix style string 'C:/los_simulation/')
pip install <path to top folder>
If you are using conda and get an error like:
ERROR: Error cannot find command 'git' ...
Try installing git from conda
conda install git
If you are using a fresh environment to install the code remember you need to install pip
conda install pip
from los_simulation import *
create_scenario_1()
- Create one or more RxNodes with a set location, direction and antenna pattern
- Create one or more TxNodes with a set location, direction, antenna pattern and power
- Use node_to_node_power to calculate the friis equation for each node of interest.
from los_simulation import *
frequency =3e9
rx = RxNode(location=[0,0],direction=[0,1],antenna_pattern=simple_directional_gain)
txs = []
number_transmitters =11
tx_distance = 1000
tx_angles = np.linspace(-np.pi,np.pi-2*np.pi/number_transmitters,number_transmitters)
for i,angle in enumerate(tx_angles):
location = [tx_distance*np.cos(angle),tx_distance*np.sin(angle)]
new_tx = TxNode(location=location,direction = [0,1],antenna_pattern = omni, power = -10, id=f"tx_{i}")
txs.append(new_tx)
power_list_rx = np.array(list(map(lambda x: node_to_node_power(rx,x,wavelength=C/frequency),txs)))
total_power_rx = 10*np.log10(np.sum(10**(power_list_rx/10)))
print(f"All powers are {power_list_rx}")
print(f"The total power reaching the Rx is {total_power_rx}")
An example that demonstrates the basic functioning of the repository and illustrates creating scenarios with different distribution of transmitters and receivers with different antenna patterns.
API Documentation, the landing page is the __init__.py
file and the submodule simulations.py
is the primary code module.
This repository relies on simulations.py for its functionality, for API style documentation see documentation.
Aric Sanders [email protected]
Certain commercial equipment, instruments, or materials (or suppliers, or software, ...) are identified in this repository to foster understanding. Such identification does not imply recommendation or endorsement by the National Institute of Standards and Technology, nor does it imply that the materials or equipment identified are necessarily the best available for the purpose.