Доработка. Организация команды постановки помехи в соответствии с изменениями протокола с СТЦ от 08-08-2025.

This commit is contained in:
MaD_CaT
2025-09-02 10:48:12 +03:00
parent c3e66af8b7
commit 8a61e03fa2
4 changed files with 115 additions and 56 deletions

View File

@@ -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