Skip to content

Commit

Permalink
Update ground_station.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Jul 30, 2024
1 parent 2fa3640 commit b7bc5dc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/aerospace/ground_station.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def __init__(self, frequency, bandwidth):
self.bandwidth = bandwidth

def receive_signal(self, signal):
# Simulate the reception of a signal
# Simulate the reception of the signal
nyq = 0.5 * self.frequency
normal_cutoff = self.bandwidth / nyq
b, a = butter(5, normal_cutoff, btype='low')
Expand All @@ -26,9 +26,15 @@ def decode_signal(self, signal):
decoded_signal = np.where(signal > 0.5, 1, 0)
return decoded_signal

def store_data(self, data):
# Store the decoded data in a file
with open("data.txt", "w") as f:
f.write(str(data))

# Example usage:
ground_station = GroundStation(frequency=1000, bandwidth=100)
signal = np.random.rand(1000)
received_signal = ground_station.receive_signal(signal)
demodulated_signal = ground_station.demodulate_signal(received_signal)
decoded_signal = ground_station.decode_signal(demodulated_signal)
ground_station.store_data(decoded_signal)

0 comments on commit b7bc5dc

Please sign in to comment.