-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '223-simulation-trajectories' into 'master'
Simulation Trajectories Closes #223 See merge request barkhauseninstitut/wicon/hermespy!192
- Loading branch information
Showing
331 changed files
with
1,120 additions
and
631 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
# Import required HermesPy modules | ||
from hermespy.core import dB, Transformation | ||
from hermespy.channel import IndoorOffice, LOSState | ||
from hermespy.simulation import LinearTrajectory, Simulation, StaticTrajectory, SNR | ||
from hermespy.modem import BitErrorEvaluator, RootRaisedCosineWaveform, SingleCarrierLeastSquaresChannelEstimation, SingleCarrierZeroForcingChannelEqualization, SimplexLink | ||
|
||
# Create a new HermesPy simulation scenario | ||
simulation = Simulation(seed=42) | ||
|
||
# Create two devices representing base station and terminal | ||
# in a downlink scenario | ||
cf = 2.4e9 | ||
base_station = simulation.scenario.new_device(carrier_frequency=cf) | ||
terminal = simulation.scenario.new_device(carrier_frequency=cf) | ||
|
||
# Assign a positions / trajectories to the terminal and base station | ||
base_station.trajectory = StaticTrajectory( | ||
Transformation.From_Translation(np.array([0, 0, 2])) | ||
) | ||
terminal.trajectory = LinearTrajectory( | ||
Transformation.From_Translation(np.array([10, 0, 0])), | ||
Transformation.From_Translation(np.array([0, 10, 0])), | ||
10, | ||
) | ||
|
||
# Configure a downlink communicating between base station and terminal | ||
# via a single-carrier waveform | ||
link = SimplexLink(base_station, terminal) | ||
link.waveform = RootRaisedCosineWaveform(symbol_rate=1e6, oversampling_factor=8, | ||
num_preamble_symbols=10, num_data_symbols=100, | ||
roll_off=.9) | ||
link.waveform.channel_estimation = SingleCarrierLeastSquaresChannelEstimation() | ||
link.waveform.channel_equalization = SingleCarrierZeroForcingChannelEqualization() | ||
|
||
# Specify the channel model between base station and terminal | ||
channel = IndoorOffice(expected_state=LOSState.LOS) | ||
simulation.set_channel(base_station, terminal, channel) | ||
|
||
# Specify the hardware noise model | ||
base_station.noise_level = SNR(dB(100), base_station, channel) | ||
terminal.noise_level = SNR(dB(100), base_station, channel) | ||
|
||
# Evaluate the bit error rate | ||
ber = BitErrorEvaluator(link, link) | ||
simulation.add_evaluator(ber) | ||
|
||
# Run a simulation generating drops every 1 second | ||
simulation.drop_interval = 1 | ||
simulation.num_drops = 1000 | ||
|
||
# Sweep over the receive SNR | ||
simulation.new_dimension('noise_level', dB(100, 20, 16, 12, 8, 4, 0), terminal) | ||
result = simulation.run() | ||
result.plot() | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
from hermespy.core import Transformation | ||
from hermespy.simulation import Simulation, LinearTrajectory | ||
|
||
|
||
# Create a new simulation featuring two devices | ||
simulation = Simulation() | ||
device_alpha = simulation.new_device() | ||
device_beta = simulation.new_device() | ||
|
||
# Assign each device a linear trajectory | ||
device_alpha.trajectory = LinearTrajectory( | ||
initial_pose=Transformation.From_Translation(np.array([0, 0, 20])), | ||
final_pose=Transformation.From_Translation(np.array([0, 100, 5])), | ||
duration=60, | ||
) | ||
device_beta.trajectory = LinearTrajectory( | ||
initial_pose=Transformation.From_Translation(np.array([100, 100, 0])), | ||
final_pose=Transformation.From_Translation(np.array([0, 0, 0])), | ||
duration=60, | ||
) | ||
|
||
# Visualize the trajectories | ||
simulation.scenario.visualize() | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.