Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from ctarver/devleop
Devleop
- Loading branch information
Showing
21 changed files
with
223 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
* phypy version: | ||
* PhyPy version: | ||
* Python version: | ||
* Operating System: | ||
|
||
|
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 |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
Usage | ||
===== | ||
|
||
To use phypy in a project:: | ||
To use PhyPy in a project:: | ||
|
||
import phypy |
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,18 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
"""Console script for phypy.""" | ||
import sys | ||
import click | ||
|
||
|
||
@click.command() | ||
def main(args=None): | ||
"""Console script for phypy.""" | ||
click.echo("Replace this message by putting your code into " | ||
"phypy.cli.main") | ||
click.echo("See click documentation at https://click.palletsprojects.com/") | ||
return 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) # pragma: no cover |
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,6 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
"""MIMO Module for PhyPy""" | ||
|
||
__author__ = """Chance Tarver""" | ||
__email__ = 'tarver.chance@gmail.com' |
Empty file.
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,95 @@ | ||
import numpy as np | ||
import simpy | ||
|
||
|
||
class MimoTransmitter: | ||
""" Class that represents an entire MIMO Transmitter Array. Includes channel and precoder.""" | ||
|
||
def __init__(self, | ||
n_antennas: int = 64, | ||
n_users: int = 4, | ||
precoder: str = 'zero_forcing', | ||
update_precoder_frequency: int = 7): | ||
self.n_antennas = n_antennas | ||
self.n_users = n_users | ||
self.channel_matrix = None # Will store the channel matrix when we get it. | ||
self.precoder = ZeroForcing(self.channel_matrix, update_precoder_frequency) | ||
|
||
def update_channel(self, channel): | ||
""" The channel object exists in its own object. Periodically, our transmitter will get new CSI/channel. | ||
This method updates the classes copy of the channel""" | ||
|
||
def transmit(self, symbols): | ||
pass | ||
|
||
|
||
class LinearPrecoder: | ||
def __init__(self): | ||
pass | ||
|
||
def precode(self, symbols): | ||
out = np.dot(self.precoding_matrix, symbols) | ||
return out | ||
|
||
def precode_update_process(self, env): | ||
env.timeout( | ||
0.001 | ||
) # Small delay so that we always update based on a new channel | ||
while True: | ||
print(f'Current Symbol = {env.now}. Updating precoder') | ||
self.create_precoder_matrix(self.precoding_matrix) | ||
yield env.timeout(self.update_rate) | ||
|
||
|
||
class ZeroForcing(LinearPrecoder): | ||
def __init__(self, channel_matrix, update_rate): | ||
self.precoding_matrix = None # Will be set by create_precoder_matrix method | ||
self.create_precoder_matrix(channel_matrix) | ||
self.update_rate = update_rate | ||
|
||
def create_precoder_matrix(self, channel_matrix): | ||
self.precoding_matrix = channel_matrix | ||
|
||
|
||
class MIMO_Channel: | ||
def channel_update_process(self, env): | ||
while True: | ||
print(f'Current Symbol = {env.now}. Updating channel') | ||
self.update_channel() | ||
yield env.timeout(self.update_rate) | ||
|
||
|
||
class MimoAwgn(MIMO_Channel): | ||
def __init__(self, n_users: int = 8, n_antennas: int = 64, n_subcarriers=1200, update_rate: int = 7): | ||
self.n_users = n_users | ||
self.n_antennas = n_antennas | ||
self.n_subcarriers = n_subcarriers | ||
self.update_rate = update_rate | ||
self.matrix = 1 | ||
|
||
def update_channel(self): | ||
new_channel = 0.9*old_channel + guassian | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
env = simpy.Environment() | ||
update_channel_frequency = 1 # Every 2 symbols, make new MIMO channel | ||
update_precoder_frequency = 7 | ||
n_users = 4 | ||
n_antennas = 64 | ||
n_subcarriers = 1200 | ||
n_symbols = 64 | ||
|
||
channel = MimoAwgn(n_users=n_users, n_antennas=n_antennas, n_subcarriers=n_subcarriers) | ||
tx = MimoTransmitter(n_users=n_users, n_antennas=n_antennas, | ||
update_precoder_frequency=update_precoder_frequency) | ||
env.process(channel.channel_update_process(env)) | ||
env.process(tx.precoder.precode_update_process(env)) | ||
env.run(until=n_symbols) | ||
|
||
print(tx.n_antennas) | ||
print(tx.n_users) | ||
print(tx.precoder) | ||
|
||
|
Empty file.
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 |
---|---|---|
@@ -1,16 +1,14 @@ | ||
pip==18.1 | ||
bumpversion==0.5.3 | ||
wheel==0.32.1 | ||
pip==19.2.3 | ||
bump2version==0.5.11 | ||
wheel==0.33.6 | ||
watchdog==0.9.0 | ||
flake8==3.5.0 | ||
tox==3.5.2 | ||
coverage==4.5.1 | ||
Sphinx==1.8.1 | ||
twine==1.12.1 | ||
|
||
pytest==3.8.2 | ||
pytest-runner==4.2 | ||
mypy | ||
|
||
flake8==3.7.8 | ||
tox==3.14.0 | ||
coverage==4.5.4 | ||
Sphinx==1.8.5 | ||
twine==1.14.0 | ||
Click==7.0 | ||
pytest==4.6.5 | ||
pytest-runner==5.1 | ||
numpy | ||
matplotlib | ||
simpy |
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.