From b7bc5dc1e2bd1976ebad07ebc3860c8cd2449880 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Tue, 30 Jul 2024 08:54:35 +0700 Subject: [PATCH] Update ground_station.py --- core/aerospace/ground_station.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/aerospace/ground_station.py b/core/aerospace/ground_station.py index d7f53bd..ac21beb 100644 --- a/core/aerospace/ground_station.py +++ b/core/aerospace/ground_station.py @@ -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') @@ -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)