-
Notifications
You must be signed in to change notification settings - Fork 16
Comms expansion #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
timsmitdelft
wants to merge
36
commits into
main
Choose a base branch
from
comms_expansion
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Comms expansion #209
Changes from 22 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
1ed3e59
Added models
abd9fcd
Added additional calculations
8ee579b
Added tests for communication models and calculations
4c376af
Fix typo
0d7298e
Fixed typo
b840d2c
Comments and cleanup
7b31547
Tests refactoring
00da78e
Update
02f710e
Update
c0a1c27
Merge branch 'main' into comms_expansion
ebb0e79
Fixed circular reference errors
09079cb
Added .idea to gitignore
4177086
Bugfix after the refactoring
28ed261
Refactoring
f6e1de5
Applied black formatting
c31c38c
Black format attempt 2
68296cf
Flake8 attempt 1
c9077b5
Flake8 attempt 2
5526e95
Black formatting attempt 3
b9dc375
Add pylintrc to gitignore
9e31d2e
Delete pylintrc
timsmitdelft 6a5352c
Merge branch 'comms_expansion' of https://github.com/aidotse/PASEOS i…
8481664
Docstrings
76c7a47
Updated readme with comms link budget example
c6311f3
Removed one layer of abstraction
16c82c9
Updated example notebooks
ca5ac42
Added constants
ef5dbb7
Moved comms utils to comms folder
9bff5eb
Moved comm links to actor instead of paseos
0583471
Updated comms tests
1b5d536
Moved tests
2082b42
Formatting
51a2dc3
Black formatting with line length 100
991968d
Improved docstrings
90af927
Added comments to tests
44a2ead
Allow radio receiver on satellite
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
82 changes: 82 additions & 0 deletions
82
examples/Communication_example/communication_example_utils.py
This file contains hidden or 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,82 @@ | ||
| import numpy as np | ||
| import pandas as pd | ||
|
|
||
|
|
||
| def get_known_actor_comms_status(values): | ||
| """Helper function to track comms status""" | ||
| conv_values = [] | ||
| for val in values: | ||
| status = ["No signal", "Ground only", "CommSat only", "Ground + Sat"] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. status shall be implemented as enum, not as string. |
||
| idx = ("comms_1" in val) * 2 + 1 * ("gs_1" in val) | ||
| conv_values.append(status[idx]) | ||
| return conv_values | ||
|
|
||
|
|
||
| def get_bitrate_status(link): | ||
| """Helper function to get bitrate status history""" | ||
| return link.bitrate_history | ||
|
|
||
|
|
||
| def get_line_of_sight_status(link): | ||
| """Helper function to get line of sight status history""" | ||
| return link.line_of_sight_history | ||
|
|
||
|
|
||
| def get_distance_status(link): | ||
| """Helper function to distance status history""" | ||
| return link.distance_history | ||
|
|
||
|
|
||
| def get_elevation_angle_status(link): | ||
| """Helper function to get elevation angle status history""" | ||
| return link.elevation_angle_history | ||
|
|
||
|
|
||
| def get_closest_entry(df, t, id): | ||
|
timsmitdelft marked this conversation as resolved.
|
||
| df_id = df[df.ID == id] | ||
| return df_id.iloc[(df_id["Time"] - t).abs().argsort().iloc[:1]] | ||
|
|
||
|
|
||
| def get_analysis_df(df, timestep=60, orbital_period=1): | ||
|
timsmitdelft marked this conversation as resolved.
|
||
| t = np.round(np.linspace(0, df.Time.max(), int(df.Time.max() // timestep))) | ||
| sats = df.ID.unique() | ||
| df["known_actors"] = pd.Categorical(df.known_actors) | ||
| df["comm_cat"] = df.known_actors.cat.codes | ||
| standby = [] | ||
| processing = [] | ||
| is_in_eclipse = [] | ||
| comm_stat = [[], [], [], []] | ||
|
|
||
| for idx, t_cur in enumerate(t): | ||
| n_c = 0 | ||
| n_ec = 0 | ||
| for c in comm_stat: | ||
| c.append(0) | ||
| for sat in sats: | ||
| vals = get_closest_entry(df, t_cur, sat) | ||
| n_c += vals.current_activity.values[0] == "Standby" | ||
| n_ec += vals.is_in_eclipse.values[0] | ||
| c_idx = vals.comm_cat.values[0] | ||
| comm_stat[c_idx][idx] += 1 | ||
| standby.append(n_c) | ||
| processing.append(len(sats) - n_c) | ||
| is_in_eclipse.append(n_ec) | ||
|
|
||
| ana_df = pd.DataFrame( | ||
| { | ||
| "Time[s]": t, | ||
| "# of Standby": standby, | ||
| "# of Processing": processing, | ||
| "# in Eclipse": is_in_eclipse, | ||
| "# of " + df.known_actors.cat.categories[0]: comm_stat[0], | ||
| "# of " + df.known_actors.cat.categories[1]: comm_stat[1], | ||
| "# of " + df.known_actors.cat.categories[2]: comm_stat[2], | ||
| # "# of " + df.known_actors.cat.categories[3]: comm_stat[3], | ||
| } | ||
| ) | ||
| ana_df["Completed orbits"] = ana_df["Time[s]"] / orbital_period | ||
| ana_df = ana_df.round({"Completed orbits": 2}) | ||
| ana_df["Share Processing"] = ana_df["# of Processing"] / len(sats) | ||
| ana_df["Share in Eclipse"] = ana_df["# in Eclipse"] / len(sats) | ||
|
|
||
| return ana_df | ||
721 changes: 721 additions & 0 deletions
721
examples/Communication_example/communication_simple_ground.ipynb
|
timsmitdelft marked this conversation as resolved.
|
Large diffs are not rendered by default.
Oops, something went wrong.
649 changes: 649 additions & 0 deletions
649
examples/Communication_example/communication_simple_satellite.ipynb
|
timsmitdelft marked this conversation as resolved.
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.