wuxiang 1 week ago
parent
commit
876ed47c1b
3 changed files with 22 additions and 21 deletions
  1. BIN
      model/__pycache__/surveillance_radar.cpython-39.pyc
  2. 2 1
      model/surveillance_radar.py
  3. 20 20
      test.py

BIN
model/__pycache__/surveillance_radar.cpython-39.pyc


+ 2 - 1
model/surveillance_radar.py

@@ -13,7 +13,7 @@ import time
 import uhd
 # ==================== 侦查雷达类 ====================
 class SurveillanceRadar:
-    SAMPLING_RATE = 10e6
+    SAMPLING_RATE = 8e6
     CENTER_FREQ = 6e9
     GAIN = 50
 
@@ -124,6 +124,7 @@ class SurveillanceRadar:
                     continue
                 # 将100个信号依次队列
                 if num_rx > 0:
+                    print("已接收大小数:"+str(num_rx))
                     #如果队列已满,则去对头元素
                     if self.rx_buffer.full():
                         self.rx_buffer.get()

+ 20 - 20
test.py

@@ -12,24 +12,24 @@ else:
     print("设备初始化失败"+str(response.json()))
     exit()
 
-# # 笛卡尔积测试数据获取接口
-# data_url = f"{server_url}/api/sdk/data"
-# jamming_policies = [policy.value for policy in JammingPolicy]  # 获取所有干扰策略
-# anti_jamming_policies = [policy.value for policy in AntiJammingPolicy]  # 获取所有抗干扰策略
+# 笛卡尔积测试数据获取接口
+data_url = f"{server_url}/api/sdk/data"
+jamming_policies = [policy.value for policy in JammingPolicy]  # 获取所有干扰策略
+anti_jamming_policies = [policy.value for policy in AntiJammingPolicy]  # 获取所有抗干扰策略
 
-# # 生成笛卡尔积测试数据
-# test_data = []
-# for jamming_policy in jamming_policies:
-#     for anti_jamming_policy in anti_jamming_policies:
-#         test_data.append({"jamming_policy": jamming_policy, "anti_jamming_policy": anti_jamming_policy})
-# print("笛卡尔积测试数据:", test_data)
-# print("------------------------")
-# # 发送测试数据并获取结果
-# for data in test_data:
-#     response = requests.post(data_url, json=data)
-#     if response.status_code == 200 and response.json()["code"] == 200:
-#         print(f"测试数据: {data}")
-#         print(f"结果: {response.json()['data']}")
-#         print("------------------------")
-#     else:
-#         print("失败:", response.json())
+# 生成笛卡尔积测试数据
+test_data = []
+for jamming_policy in jamming_policies:
+    for anti_jamming_policy in anti_jamming_policies:
+        test_data.append({"jamming_policy": jamming_policy, "anti_jamming_policy": anti_jamming_policy})
+print("笛卡尔积测试数据:", test_data)
+print("------------------------")
+# 发送测试数据并获取结果
+for data in test_data:
+    response = requests.post(data_url, json=data)
+    if response.status_code == 200 and response.json()["code"] == 200:
+        print(f"测试数据: {data}")
+        print(f"结果: {response.json()['data']}")
+        print("------------------------")
+    else:
+        print("失败:", response.json())