diff --git a/scenes/контроль/контроль.tscn b/scenes/контроль/контроль.tscn index 8c15112..461f07c 100644 --- a/scenes/контроль/контроль.tscn +++ b/scenes/контроль/контроль.tscn @@ -111,6 +111,7 @@ metadata/unit_name = ["уарэп-эмс"] metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_uf"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 15.0 offset_top = -34.0 @@ -177,6 +178,7 @@ patch_margin_right = 16 patch_margin_bottom = 16 [node name="label" type="Label" parent="pribor_rtr"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 12.0 offset_top = -54.0 @@ -230,6 +232,7 @@ patch_margin_right = 16 patch_margin_bottom = 16 [node name="label" type="Label" parent="pribor_afsp_1"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 165.0 offset_top = -245.0 @@ -244,7 +247,7 @@ vertical_alignment = 1 modulate = Color(0.498039, 0.498039, 0.498039, 1) light_mask = 3 position = Vector2(415, -40) -scale = Vector2(3.0, 3.0) +scale = Vector2(3, 3) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") @@ -285,6 +288,7 @@ patch_margin_right = 16 patch_margin_bottom = 16 [node name="label" type="Label" parent="pribor_afsp_2"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 200.0 offset_top = -240.0 @@ -299,7 +303,7 @@ vertical_alignment = 1 modulate = Color(0.498039, 0.498039, 0.498039, 1) light_mask = 3 position = Vector2(425, -40) -scale = Vector2(3.0, 3.0) +scale = Vector2(3, 3) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") @@ -323,6 +327,7 @@ metadata/unit_name = ["уарэп-щ3", "уарэп-спт25-1", "уарэп-с metadata/online_proc = "online_change_arr" [node name="label" type="Label" parent="pribor_uyep"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 26.8566 offset_top = -38.3276 @@ -376,6 +381,7 @@ metadata/unit_name = ["уарэп-яу07-2в"] metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_v_2"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 14.0 offset_top = -38.0 @@ -429,6 +435,7 @@ metadata/unit_name = ["уарэп-яу07-2н"] metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_n_2"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 15.0 offset_top = -38.0 @@ -484,6 +491,7 @@ metadata/unit_name = ["уарэп-яу07-2к"] metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_k_2"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 17.0 offset_top = -38.0 @@ -537,6 +545,7 @@ metadata/unit_name = ["уарэп-яу07-3в"] metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_v_3"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 9.0 offset_top = -38.0 @@ -590,6 +599,7 @@ metadata/unit_name = ["уарэп-яу07-3н"] metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_n_3"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 8.0 offset_top = -38.0 @@ -643,6 +653,7 @@ metadata/unit_name = ["уарэп-яу07-3к"] metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_k_3"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 9.0 offset_top = -38.0 @@ -696,6 +707,7 @@ metadata/unit_name = ["уарэп-яу07-1в"] metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_v_1"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 8.0 offset_top = -38.0 @@ -749,6 +761,7 @@ metadata/online_proc = "on_line_changed" metadata/unit_name = ["уарэп-яу07-1н"] [node name="label" type="Label" parent="pribor_prd_n_1"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 8.0 offset_top = -38.0 @@ -802,6 +815,7 @@ metadata/unit_name = ["уарэп-яу07-1к"] metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_k_1"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 9.0 offset_top = -38.0 @@ -854,6 +868,7 @@ metadata/unit_name = ["уарэп-яу07-4в"] metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_v_4"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 17.0 offset_top = -38.0 @@ -906,6 +921,7 @@ metadata/unit_name = ["уарэп-яу07-4н"] metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_n_4"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 14.0 offset_top = -38.0 @@ -958,6 +974,7 @@ metadata/unit_name = ["уарэп-яу07-4к"] metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_k_4"] +self_modulate = Color(0, 0, 0, 0) layout_mode = 0 offset_left = 17.0 offset_top = -38.0 diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index 31db96c..242edf4 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -425,14 +425,10 @@ func sel_fs_sector(event): func set_fs_color(ecm): - var fs_index_arr: Array = [] - prd.get_fs_index(ecm, fs_index_arr) if ecm.krp != interfer.INTERFER_OFF: - for item in fs_index_arr: - fs_active[item] = null + fs_active[prd.fs_caps_id[ecm.nmfs]] = null else: - for item in fs_index_arr: - fs_active.erase(item) + fs_active.erase(prd.fs_caps_id[ecm.nmfs]) update_fs_colors() diff --git a/scenes/работа/работа.tscn b/scenes/работа/работа.tscn index 64b1bbd..6d64518 100644 --- a/scenes/работа/работа.tscn +++ b/scenes/работа/работа.tscn @@ -305,6 +305,6 @@ text = "Масштаб:" [connection signal="drag_continue" from="." to="." method="_on_drag_continue"] [connection signal="toggled" from="btn_view" to="." method="on_button_view_toggled"] [connection signal="toggled" from="chk_auto" to="." method="on_value_changed"] -[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate_toggled"] [connection signal="toggled" from="btn_activate" to="." method="on_btn_activate"] +[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate_toggled"] [connection signal="toggled" from="btn_center" to="." method="on_btn_center_toggled"] diff --git a/scripts/interfer.gd b/scripts/interfer.gd index f3c38ef..b981e50 100644 --- a/scripts/interfer.gd +++ b/scripts/interfer.gd @@ -4,42 +4,60 @@ class_name Iterfer extends Node ## Режимы помехи. const ITERFER_MODE = { - 'off': ['Откл', {}, 0], - 'srni1': ['СРН-И1', {}, 1], - 'srnm2': ['СРН-М2', {}, 2], - 'srngps': ['СРН-GPS', {}, 3], - 'lchm1': ['ЛЧМ-1', {}, 10], - 'lchm2': ['ЛЧМ-2', {}, 16], - 'mchm1': ['МЧМ-1', {}, 11], - 'pdm2': ['ПД-М2', {}, 12], - 'pdm4': ['ПД-М4', {}, 13], - 'pdm4s': ['ПД-М4С', {}, 14], - 'pdchm': ['ПД-ЧМ', {}, 15], - 'svi1': ['СВ-И1', SVI1_PARAMS, 20], - 'svm2': ['СВ-М2', SVM2_PARAMS, 21], - 'k1': ['K1', K1_PARAMS, 50], - 'ozp1': ['ОЗП-1', OZP1_PARAMS, 51] } + INTERFER_OFF: ['Откл', {}, 0], + 'srni1': ['ПСП + ФМ-2', SRNI1_PARAMS, 1], + 'srnm2': ['Линейная ЧМ', SRNM2_PARAMS, 2], + 'srngps': [INTERFER_IQFILE, SRNGPS_PARAMS, 3], + 'lchm1': ['Линейная ЧМ', LCHM1_PARAMS, 10], + 'lchm2': ['Линейная ЧМ', LCHM2_PARAMS, 16], + 'mchm1': [INTERFER_IQFILE, MCHM1_PARAMS, 11], + 'pdm2': [INTERFER_IQFILE, PDM2_PARAMS, 12], + 'pdm4': [INTERFER_IQFILE, PDM4_PARAMS, 13], + 'pdm4s': [INTERFER_IQFILE, PDM4S_PARAMS, 14], + 'pdchm': [INTERFER_IQFILE, PDCHM_PARAMS, 15], + 'svi1': [INTERFER_IQFILE, SVI1_PARAMS, 20], + 'svm2': [INTERFER_IQFILE, SVM2_PARAMS, 21], + 'k1': [INTERFER_IQFILE, K1_PARAMS, 50], + 'ozp1': [INTERFER_IQFILE, OZP1_PARAMS, 51] } -const K1_PARAMS = {'files': ['K1'], - 'call_proc': 'call_all_diap'} -const OZP1_PARAMS = {'files': ['OZP1'], - 'call_proc': 'call_all_diap'} +const SRNI1_PARAMS = {'par_names' : ['freq', 'width']} +const SRNM2_PARAMS = {'par_names' : ['freq', 'width', 'period']} +const SRNGPS_PARAMS = {'par_names' : ['freq', 'filename']} +const LCHM1_PARAMS = {'par_names' : ['freq', 'width', 'period']} +const LCHM2_PARAMS = {'par_names' : ['freq', 'width', 'period']} +const MCHM1_PARAMS = {'par_names' : ['freq', 'filename']} +const PDM2_PARAMS = {'par_names' : ['freq', 'filename']} +const PDM4_PARAMS = {'par_names' : ['freq', 'filename']} +const PDM4S_PARAMS = {'par_names' : ['freq', 'filename']} +const PDCHM_PARAMS = {'par_names' : ['freq', 'filename']} +const K1_PARAMS = {'files' : 'K1', + 'call_proc' : 'call_all_diap', + 'par_names' : ['freq', 'filename']} +const OZP1_PARAMS = {'files': 'OZP1', + 'call_proc': 'call_all_diap', + 'par_names' : ['freq', 'filename']} # Файл : Диапазон: ['имя файла', частота] const SVI1_PARAMS = {'files': {1: ['SVI1_LIT2', 1017], 2: ['SVI1_LIT3', 1156]}, - 'call_proc': 'call_diap'} + 'call_proc': 'call_diap', + 'par_names' : ['freq', 'filename']} const SVM2_PARAMS = {'files': {1: ['SVM2_LIT2', 1017], 2: ['SVM2_LIT3', 1156]}, - 'call_proc': 'call_diap'} + 'call_proc': 'call_diap', + 'par_names' : ['freq', 'filename']} +# Файл : Ключ: ['имя файла', ширина, использовать 2 ЛЧМ] const PD_CHM = {'files': { - - }, + 5 : ['1 FM 5', 5, false], + 11: ['1 FM 10', 10, false], + 12: ['2 FM 20', 10, true], + 20: ['2 FM 40', 20, false] }, 'call_proc': 'call_pd_chm'} const SOURCE_INTERFER = ['th','fs','cu'] const ID_INTERFERS_LEN = 63 ## Размер пула номеров целей. const INTERFER_OFF = 'off' +const INTERFER_IQFILE = 'IQ-файл' const POW_DEFAULT: float = 100.0 var msg6_num: int = 0 ## Счётчик сообщений "тип 6" var msg8_num: int = 0 ## Счётчик сообщений "тип 8" @@ -75,12 +93,15 @@ class Interfer: data_to_json['ts'] = 6 data_to_json['ss'] = msg_num data_to_json['ispp'] = ispp - data_to_json['krp'] = krp + data_to_json['krp'] = ITERFER_MODE[krp][0] data_to_json['nmfs'] = nmfs if krp != INTERFER_OFF: data_to_json['kni'] = kni data_to_json['powp'] = powp - data_to_json['params'] = params + data_to_json['params'] = {} + for key in ITERFER_MODE[krp][1]['par_names']: + if params.has(key): + data_to_json['params'][key] = params[key] data_to_json['get'] = get_params var pac = JSON.stringify(data_to_json).to_utf8_buffer() return pac @@ -148,7 +169,7 @@ func _ready() -> void: var unit_nav = network.get_unit_instance('навигация') unit_nav.connect('data_received', on_nav_data_received.bind(unit_caps)) threats.connect('threats_resized', Callable(self, 'on_threats_resized')) - threats.connect('threat_update', Callable(self, 'on_threats_update').bind(ecms)) + threats.connect('threat_update', Callable(self, 'on_threats_update').bind(ecms, unit_caps)) func on_nav_data_received(coords: Dictionary, unit_caps): @@ -401,38 +422,63 @@ func on_threats_resized(th_dic): thrs_dict = th_dic -func on_threats_update(threat, ecms): - if threat.tmod != 'fm': return +func on_threats_update(threat, ecms, unit_caps): + var th_id = threat.id + var ecm = null + for ecm_i in thrs.keys(): + if thrs[ecm_i] == th_id: + ecm = ecms[ecm_i] + ecm.params['freq'] = threat.freq + ecm.kni = threat.aoa + if threat.tmod != 'fm': + if ecm != null: + send_ecm(ecm, unit_caps) + return var th_fm_dict: Dictionary + var fs_index_arr: Array + prd.find_fs_index(threat.aoa, threat.freq, fs_index_arr) + if fs_index_arr.size() == 0: + if ecm != null: + send_ecm(ecm, unit_caps) + return + var fs_index = fs_index_arr[0] + var nmfs = prd.FS_PRD[fs_index][1] + if ecm == null: + for ecm_i in ecms.values(): + if nmfs != ecm_i.nmfs: continue + if ecm_i.svk != 1: continue + ecm = ecm_i + if ecm == null: return + for th_index in thrs_dict: if thrs_dict[th_index].tmod != 'fm': continue - var fs_index_arr: Array + fs_index_arr = [] prd.find_fs_index(thrs_dict[th_index].aoa, thrs_dict[th_index].freq, fs_index_arr) if fs_index_arr.size() == 0: continue - if th_fm_dict.has(fs_index_arr[0]): - th_fm_dict[fs_index_arr[0]][th_index] = thrs_dict[th_index] - else: - var th_dict: Dictionary - th_fm_dict[fs_index_arr[0]] = th_dict - th_fm_dict[fs_index_arr[0]][th_index] = thrs_dict[th_index] - for key in th_fm_dict: - if len(th_fm_dict[key]) < 2: continue - var nmfs = prd.FS_PRD[key][1] - for ecm in ecms.values(): - if nmfs != ecm.nmfs: continue - if ecm.krp != 'pdchm': continue + if fs_index_arr[0] != fs_index: continue + th_fm_dict[th_index] = thrs_dict[th_index] + if len(th_fm_dict) > 1: + pass + + send_ecm(ecm, unit_caps) func get_freq_range(freq_range_dict: Dictionary, th_dict: Dictionary): var min_range_abs: int = 6000 - var max_range_abs: int = 0 for key_i in th_dict: var min_range: int = 6000 - var max_range: int = 0 + var key_min = null for key_j in th_dict: if key_i == key_j: continue - var freq_range = abs(th_dict[key_i].freq - th_dict[key_j].freq) - if freq_range < min_range: min_range = freq_range - if freq_range > max_range: max_range = freq_range + var width = (th_dict[key_i].width / 2) + (th_dict[key_j].width / 2) + var freq_range = abs(th_dict[key_i].freq - th_dict[key_j].freq) + width + if freq_range < min_range: + key_min = key_j + min_range = freq_range + if min_range > PD_CHM['files'][20][1]: + th_dict.erase(key_i) + continue + else: + if key_min == null: continue + freq_range_dict[key_i] = [th_dict[key_i], th_dict[key_min], min_range] if min_range < min_range_abs: min_range_abs = min_range - if max_range > max_range_abs: max_range_abs = max_range