Skip to content

Commit

Permalink
Merge branch '223-simulation-trajectories' into 'master'
Browse files Browse the repository at this point in the history
Simulation Trajectories

Closes #223

See merge request barkhauseninstitut/wicon/hermespy!192
  • Loading branch information
adlerjan committed Jun 4, 2024
2 parents 30d63e3 + db6222b commit de87b4f
Show file tree
Hide file tree
Showing 331 changed files with 1,120 additions and 631 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ image: python:3.11
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
GIT_SUBMODULE_STRATEGY: recursive
HERMES_VERSION: "1.2.0"
HERMES_VERSION: "1.3.0"
HERMES_WHEEL_11: "hermespy-$HERMES_VERSION-cp311-cp311-linux_x86_64.whl"
HERMES_WHEEL_10: "hermespy-$HERMES_VERSION-cp310-cp310-linux_x86_64.whl"
HERMES_WHEEL_09: "hermespy-$HERMES_VERSION-cp39-cp39-linux_x86_64.whl"
Expand Down
15 changes: 0 additions & 15 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ adjacent-channel interference among different communication systems.

## Features

The current release version 1.1.0 serves as a platform for joint development.
The current release version 1.3.0 serves as a platform for joint development.
Its main focus is to provide a software architecture that can be easily extended.
Detailed core features as well as a release plan can be found in the
[features](https://hermespy.org/features.html) list.
Expand Down
58 changes: 58 additions & 0 deletions _examples/library/getting_started_mobility.py
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()
2 changes: 1 addition & 1 deletion _examples/paper/fec.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from hermespy.modem import TransmittingModem, ReceivingModem, OFDMWaveform, GridResource, GridElement, SymbolSection, BitErrorEvaluator, BlockErrorEvaluator, FrameErrorEvaluator, ThroughputEvaluator

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/hardware_effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from hermespy.core import ConsoleMode

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/interference_alamouti.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from hermespy.precoding import SpaceTimeBlockCoding

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/interference_no.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from hermespy.core import ConsoleMode

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/interference_zf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from hermespy.core import ConsoleMode

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/multinode_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from hermespy.modem import TransmittingModem, ReceivingModem, RRCWaveform, SCCorrelationSynchronization, SCLeastSquaresChannelEstimation, SCZeroForcingChannelEqualization, BitErrorEvaluator

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/multinode_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from hermespy.modem import TransmittingModem, ReceivingModem, RRCWaveform, SCCorrelationSynchronization, SCLeastSquaresChannelEstimation, SCZeroForcingChannelEqualization, BitErrorEvaluator

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/pa_characteristics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
ClippingPowerAmplifier

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/radar_sensing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from hermespy.tools import db2lin

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/stopping.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from hermespy.core import ConsoleMode

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/sweeping.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from hermespy.core import ConsoleMode

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/theory.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from hermespy.core import ConsoleMode

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/theory_awgn.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from hermespy.core import ConsoleMode

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/theory_rayleigh.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from hermespy.core import ConsoleMode

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion _examples/paper/theory_theory.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from hermespy.core import Executable

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.3.0"
Expand Down
18 changes: 16 additions & 2 deletions bumpver.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[bumpver]

current_version = "1.1.0"
current_version = "1.3.0"
version_pattern = "MAJOR.MINOR.PATCH"
commit_message = "Bump to version {new_version}"
commit = false
Expand All @@ -19,20 +19,29 @@ push = false
"hermespy/beamforming/*.py" = [ '__version__ = "{version}"' ]
"hermespy/bin/*.py" = [ '__version__ = "{version}"' ]
"hermespy/channel/*.py" = [ '__version__ = "{version}"' ]
"hermespy/channel/cdl/*.py" = [ '__version__ = "{version}"' ]
"hermespy/channel/delay/*.py" = [ '__version__ = "{version}"' ]
"hermespy/channel/fading/*.py" = [ '__version__ = "{version}"' ]
"hermespy/channel/quadriga/*.py" = [ '__version__ = "{version}"' ]
"hermespy/channel/radar/*.py" = [ '__version__ = "{version}"' ]
"hermespy/core/*.py" = [ '__version__ = "{version}"' ]
"hermespy/fec/*.py" = [ '__version__ = "{version}"' ]
"hermespy/hardware_loop/*.py" = [ '__version__ = "{version}"' ]
"hermespy/hardware_loop/audio/*.py" = [ '__version__ = "{version}"' ]
"hermespy/hardware_loop/calibration/*.py" = [ '__version__ = "{version}"' ]
"hermespy/hardware_loop/uhd/*.py" = [ '__version__ = "{version}"' ]
"hermespy/jcas/*.py" = [ '__version__ = "{version}"' ]
"hermespy/modem/*.py" = [ '__version__ = "{version}"' ]
"hermespy/modem/precoding/*.py" = [ '__version__ = "{version}"' ]
"hermespy/modem/tools/*.py" = [ '__version__ = "{version}"' ]
"hermespy/modem/waveforms/*.py" = [ '__version__ = "{version}"' ]
"hermespy/modem/waveforms/orthogonal/*.py" = [ '__version__ = "{version}"' ]
"hermespy/precoding/*.py" = [ '__version__ = "{version}"' ]
"hermespy/radar/*.py" = [ '__version__ = "{version}"' ]
"hermespy/simulation/*.py" = [ '__version__ = "{version}"' ]
"hermespy/simulation/coupling/*.py" = [ '__version__ = "{version}"' ]
"hermespy/simulation/isolation/*.py" = [ '__version__ = "{version}"' ]
"hermespy/simulation/modem/*.py" = [ '__version__ = "{version}"' ]
"hermespy/simulation/noise/*.py" = [ '__version__ = "{version}"' ]
"hermespy/simulation/rf_chain/*.py" = [ '__version__ = "{version}"' ]
"hermespy/tools/*.py" = [ '__version__ = "{version}"' ]
Expand All @@ -48,16 +57,21 @@ push = false
"tests/unit_tests/fec/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/hardware_loop/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/hardware_loop/audio/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/hardware_loop/calibration/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/hardware_loop/uhd/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/jcas/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/modem/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/modem/precoding/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/modem/tools/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/modem/waveforms/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/modem/waveforms/orthogonal/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/precoding/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/radar/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/simulation/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/simulation/coupling/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/simulation/isolation/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/simulation/modem/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/simulation/noise/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/simulation/rf_chain/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/tools/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/tools/*.py" = [ '__version__ = "{version}"' ]
"tests/unit_tests/*.py" = [ '__version__ = "{version}"' ]
35 changes: 35 additions & 0 deletions docssource/api/simulation.animation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,41 @@
Animation
==========

.. inheritance-diagram:: hermespy.simulation.animation.Trajectory hermespy.simulation.animation.StaticTrajectory hermespy.simulation.animation.LinearTrajectory
:parts: 1

Movements of devices and other objects within simulations may be described by :class:`Trajectories<hermespy.simulation.animation.Trajectory>`,
which model the veloctiy, position and orientation of the object as a function of time.
Generally, objects that may be animated within a simulation should inherit from the :class:`Moveable<hermespy.simulation.animation.Moveable>` class,
which exposes the :meth:`trajectory<hermespy.simulation.animation.Moveable.trajectory>` property.
The currently available trajectory types are:

.. list-table:: Trajectory Types
:header-rows: 1

* - Type
- Description
* - :class:`StaticTrajectory<hermespy.simulation.animation.StaticTrajectory>`
- A trajectory that does not change over time.
* - :class:`LinearTrajectory<hermespy.simulation.animation.LinearTrajectory>`
- A trajectory that moves in a straight line at a constant velocity.

The following example demonstrates how to assign a linear trajectory to a device
within a simulation and plot the scenario:

.. literalinclude:: ../scripts/examples/simulation_animation.py
:language: python
:linenos:
:lines: 10-29

.. autoclass:: hermespy.simulation.animation.Trajectory

.. autoclass:: hermespy.simulation.animation.StaticTrajectory

.. autoclass:: hermespy.simulation.animation.LinearTrajectory

.. autoclass:: hermespy.simulation.animation.Moveable

.. autoclass:: hermespy.simulation.animation.TrajectorySample

.. footbibliography::
2 changes: 1 addition & 1 deletion docssource/scripts/examples/channel_radar_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from hermespy.simulation import Simulation

# Initialize a single device operating at 78.5 GHz
simulation = Simulation()
simulation = Simulation(seed=42)
device = simulation.new_device(carrier_frequency=78.5e9)

# Create a radar channel modeling a single target at 10m distance
Expand Down
29 changes: 29 additions & 0 deletions docssource/scripts/examples/simulation_animation.py
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()
2 changes: 1 addition & 1 deletion docssource/scripts/plot_antenna_gains.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from hermespy.simulation.antenna import Antenna, IdealAntenna, PatchAntenna, Dipole

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.2.7"
Expand Down
2 changes: 1 addition & 1 deletion docssource/scripts/plot_pa_characteristics.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ClippingPowerAmplifier

__author__ = "Jan Adler"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.2.7"
Expand Down
2 changes: 1 addition & 1 deletion docssource/scripts/plot_quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from hermespy.simulation import AnalogDigitalConverter, QuantizerType

__author__ = "Andre Noll Barreto"
__copyright__ = "Copyright 2023, Barkhausen Institut gGmbH"
__copyright__ = "Copyright 2024, Barkhausen Institut gGmbH"
__credits__ = ["Andre Noll Barreto", "Jan Adler"]
__license__ = "AGPLv3"
__version__ = "0.2.7"
Expand Down
Loading

0 comments on commit de87b4f

Please sign in to comment.