|
|
|
|
@@ -62,7 +62,7 @@ class TestPRD extends Node:
|
|
|
|
|
var control_results: Dictionary
|
|
|
|
|
var self_name: String
|
|
|
|
|
var state: int = STATE_MASHINE.INIT
|
|
|
|
|
var current_fs: int
|
|
|
|
|
var current_litera: int
|
|
|
|
|
var flag_timer_started: bool = false
|
|
|
|
|
var unit_prd: Object
|
|
|
|
|
var module_prd: Object
|
|
|
|
|
@@ -87,7 +87,7 @@ class TestPRD extends Node:
|
|
|
|
|
block_fs_config = init_data['block_fs_prd_config']
|
|
|
|
|
block_kasseta_y5_config = init_data['block_kasseta_y5_prd_config']
|
|
|
|
|
control_results = init_data['control_results']
|
|
|
|
|
current_fs = init_data['current_fs']
|
|
|
|
|
current_litera = init_data['current_litera']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
|
@@ -109,17 +109,17 @@ class TestPRD extends Node:
|
|
|
|
|
block_ip_config = check_block_ip(status, block_ip_config)
|
|
|
|
|
check_temperature_um(status, power_amplify)
|
|
|
|
|
_process_dkm_status(status)
|
|
|
|
|
if current_fs != 0:
|
|
|
|
|
var tek_litera: Dictionary = power_result[current_fs]
|
|
|
|
|
if current_litera != 0:
|
|
|
|
|
var tek_litera: Dictionary = power_result[current_litera]
|
|
|
|
|
var interes = _get_ray_key(state)
|
|
|
|
|
if interes != '':
|
|
|
|
|
tek_litera[_get_ray_key(state)] = power_um_ukp(status, current_fs, tek_litera[_get_ray_key(state)])
|
|
|
|
|
power_result[current_fs] = tek_litera
|
|
|
|
|
tek_litera[_get_ray_key(state)] = power_um_ukp(status, current_litera, tek_litera[_get_ray_key(state)])
|
|
|
|
|
power_result[current_litera] = tek_litera
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Пакеты от MP550Service
|
|
|
|
|
func on_fs_update_state(packet_type_7: Dictionary, fs_mapping: Dictionary) -> void:
|
|
|
|
|
var fs_key: String = FS_KEYS.get(current_fs, '')
|
|
|
|
|
var fs_key: String = FS_KEYS.get(current_litera, '')
|
|
|
|
|
if fs_key.is_empty():
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
@@ -156,7 +156,7 @@ class TestPRD extends Node:
|
|
|
|
|
state = STATE_MASHINE.UG_SET_RAY
|
|
|
|
|
STATE_MASHINE.UG_SET_RAY:
|
|
|
|
|
var addr: int = constants.ADDR_UG_LITERA_1
|
|
|
|
|
if current_fs == 3 or current_fs == 5 or current_fs == 7:
|
|
|
|
|
if current_litera == 3 or current_litera == 5 or current_litera == 7:
|
|
|
|
|
addr = constants.ADDR_UG_LITERA_2
|
|
|
|
|
if unit_prd.isa_ports.has(addr) and (unit_prd.cmd_state == unit_prd.CmdState.DONE):
|
|
|
|
|
control_timer.stop()
|
|
|
|
|
@@ -171,8 +171,8 @@ class TestPRD extends Node:
|
|
|
|
|
elif unit_prd.isa_ports[addr] & 0x07 == 4:
|
|
|
|
|
state = STATE_MASHINE.UG_SET_RAY_5
|
|
|
|
|
elif unit_prd.isa_ports[addr] & 0x07 == 5:
|
|
|
|
|
if not current_fs == 1:
|
|
|
|
|
control_results = check_dou_result(control_results, power_result, self_name, current_fs, constants)
|
|
|
|
|
if not current_litera == 1:
|
|
|
|
|
control_results = check_dou_result(control_results, power_result, self_name, current_litera, constants)
|
|
|
|
|
state = STATE_MASHINE.IN_EMS_STOP
|
|
|
|
|
elif unit_prd.isa_ports[addr] & 0x07 == 6:
|
|
|
|
|
state = STATE_MASHINE.UG_SET_RAY_0
|
|
|
|
|
@@ -206,8 +206,8 @@ class TestPRD extends Node:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _handle_init_state() -> void:
|
|
|
|
|
control_label.text = 'Выполняется инициализация ФС-%s' % current_fs
|
|
|
|
|
if current_fs in [1, 2, 3, 4, 5, 6, 7]:
|
|
|
|
|
control_label.text = 'Выполняется инициализация ФС-%s' % current_litera
|
|
|
|
|
if current_litera in [1, 2, 3, 4, 5, 6, 7]:
|
|
|
|
|
state = STATE_MASHINE.FS_TURN_ON
|
|
|
|
|
#state = STATE_MASHINE.STOP_CONTROL
|
|
|
|
|
else:
|
|
|
|
|
@@ -217,23 +217,23 @@ class TestPRD extends Node:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _handle_fs_turn_on_state() -> void:
|
|
|
|
|
control_label.text = 'Выполняется включение ФС-%s' % current_fs
|
|
|
|
|
manage_fs(true, self_name, pribor_config, fs_parameters, current_fs, constants.POWER_UM)
|
|
|
|
|
control_label.text = 'Выполняется включение ФС-%s' % current_litera
|
|
|
|
|
manage_fs(true, self_name, pribor_config, fs_parameters, current_litera, constants.POWER_UM)
|
|
|
|
|
control_timer.wait_time = constants.TIMER_DELAY
|
|
|
|
|
control_timer.start()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _handle_fs_work_state() -> void:
|
|
|
|
|
control_label.text = 'Выполняется проверка ФС-%s' % current_fs
|
|
|
|
|
control_label.text = 'Выполняется проверка ФС-%s' % current_litera
|
|
|
|
|
if not module_prd.unit_yau07.online:
|
|
|
|
|
return
|
|
|
|
|
if (current_fs == 2 and block_fs_config.fs_2) or \
|
|
|
|
|
(current_fs == 3 and block_fs_config.fs_3) or \
|
|
|
|
|
(current_fs == 4 and block_fs_config.fs_4) or \
|
|
|
|
|
(current_fs == 5 and block_fs_config.fs_5) or \
|
|
|
|
|
(current_fs == 6 and block_fs_config.fs_6) or \
|
|
|
|
|
(current_fs == 7 and block_fs_config.fs_7) or \
|
|
|
|
|
(current_fs == 1 and block_fs_config.fs_1):
|
|
|
|
|
if (current_litera == 2 and block_fs_config.fs_2) or \
|
|
|
|
|
(current_litera == 3 and block_fs_config.fs_3) or \
|
|
|
|
|
(current_litera == 4 and block_fs_config.fs_4) or \
|
|
|
|
|
(current_litera == 5 and block_fs_config.fs_5) or \
|
|
|
|
|
(current_litera == 6 and block_fs_config.fs_6) or \
|
|
|
|
|
(current_litera == 7 and block_fs_config.fs_7) or \
|
|
|
|
|
(current_litera == 1 and block_fs_config.fs_1):
|
|
|
|
|
state = STATE_MASHINE.CHEK_KASSETA_Y5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -271,27 +271,27 @@ class TestPRD extends Node:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _handle_fs_turn_off_state() -> void:
|
|
|
|
|
control_label.text = 'Выполняется отключение ФС-%s' % current_fs
|
|
|
|
|
manage_fs(false, self_name, pribor_config, fs_parameters, current_fs, constants.POWER_UM)
|
|
|
|
|
control_label.text = 'Выполняется отключение ФС-%s' % current_litera
|
|
|
|
|
manage_fs(false, self_name, pribor_config, fs_parameters, current_litera, constants.POWER_UM)
|
|
|
|
|
state = STATE_MASHINE.STOP_CONTROL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _handle_stop_control_state() -> void:
|
|
|
|
|
control_label.text = 'Выполняется завершение проверки ФС-%s' % current_fs
|
|
|
|
|
control_label.text = 'Выполняется завершение проверки ФС-%s' % current_litera
|
|
|
|
|
flag_timer_started = false
|
|
|
|
|
_advance_to_next_fs()
|
|
|
|
|
state = STATE_MASHINE.INIT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _advance_to_next_fs() -> void:
|
|
|
|
|
match current_fs:
|
|
|
|
|
1: current_fs = 6
|
|
|
|
|
2: current_fs = 3
|
|
|
|
|
3: current_fs = 0
|
|
|
|
|
4: current_fs = 5
|
|
|
|
|
5: current_fs = 0
|
|
|
|
|
6: current_fs = 7
|
|
|
|
|
7: current_fs = 0
|
|
|
|
|
match current_litera:
|
|
|
|
|
1: current_litera = 6
|
|
|
|
|
2: current_litera = 3
|
|
|
|
|
3: current_litera = 0
|
|
|
|
|
4: current_litera = 5
|
|
|
|
|
5: current_litera = 0
|
|
|
|
|
6: current_litera = 7
|
|
|
|
|
7: current_litera = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######################################
|
|
|
|
|
@@ -323,23 +323,23 @@ class TestPRD extends Node:
|
|
|
|
|
func _process_dkm_status(status: PackedByteArray) -> void:
|
|
|
|
|
if not block_fs_config.has(_get_current_fs_key()):
|
|
|
|
|
return
|
|
|
|
|
var dkm_bit = _get_dkm_bit_for_current_fs()
|
|
|
|
|
var dkm_bit = _get_dkm_bit_for_current_fs(current_litera, constants)
|
|
|
|
|
block_dkm_config = check_dkm(status, dkm_bit, block_dkm_config)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _get_current_fs_key() -> String:
|
|
|
|
|
return FS_KEYS.get(current_fs, '')
|
|
|
|
|
return FS_KEYS.get(current_litera, '')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _get_dkm_bit_for_current_fs() -> int:
|
|
|
|
|
match current_fs:
|
|
|
|
|
1: return constants.DKM_BIT_1
|
|
|
|
|
2: return constants.DKM_BIT_2
|
|
|
|
|
3: return constants.DKM_BIT_3
|
|
|
|
|
4: return constants.DKM_BIT_4
|
|
|
|
|
5: return constants.DKM_BIT_5
|
|
|
|
|
6: return constants.DKM_BIT_6
|
|
|
|
|
7: return constants.DKM_BIT_7
|
|
|
|
|
static func _get_dkm_bit_for_current_fs(litera: int, constants_dic: Dictionary) -> int:
|
|
|
|
|
match litera:
|
|
|
|
|
1: return constants_dic.DKM_BIT_1
|
|
|
|
|
2: return constants_dic.DKM_BIT_2
|
|
|
|
|
3: return constants_dic.DKM_BIT_3
|
|
|
|
|
4: return constants_dic.DKM_BIT_4
|
|
|
|
|
5: return constants_dic.DKM_BIT_5
|
|
|
|
|
6: return constants_dic.DKM_BIT_6
|
|
|
|
|
7: return constants_dic.DKM_BIT_7
|
|
|
|
|
_: return -1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -398,7 +398,7 @@ class TestPRD extends Node:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Управаление модулем фс (включить/отключить излучение)
|
|
|
|
|
static func manage_fs(mode: bool, pribor: String, p_conf: Dictionary, fs_params: Dictionary, cur_fs: int, power_um: int) -> void:
|
|
|
|
|
static func manage_fs(mode: bool, pribor: String, p_conf: Dictionary, fs_params: Dictionary, litera: int, power_um: int) -> void:
|
|
|
|
|
# Получаем конфигурацию для текущего прибора
|
|
|
|
|
var config: Dictionary = p_conf[pribor]
|
|
|
|
|
var angle: float = config.angle
|
|
|
|
|
@@ -408,13 +408,13 @@ class TestPRD extends Node:
|
|
|
|
|
var interfer_name: String = 'k1' if mode else 'off'
|
|
|
|
|
var fs_arr: Array = []
|
|
|
|
|
|
|
|
|
|
if cur_fs in fs_params:
|
|
|
|
|
var params = fs_params[cur_fs]
|
|
|
|
|
if litera in fs_params:
|
|
|
|
|
var params = fs_params[litera]
|
|
|
|
|
fs_arr.append([
|
|
|
|
|
angle,
|
|
|
|
|
params.freq,
|
|
|
|
|
params.width,
|
|
|
|
|
sectors[cur_fs - 1] if cur_fs == 1 else sectors[cur_fs - 5] if cur_fs > 5 else sectors[cur_fs - 4] if cur_fs > 3 else sectors[cur_fs - 2]
|
|
|
|
|
sectors[litera - 1] if litera == 1 else sectors[litera - 5] if litera > 5 else sectors[litera - 4] if litera > 3 else sectors[litera - 2]
|
|
|
|
|
])
|
|
|
|
|
signaller.emit_signal('interfer_init', interfer_name, fs_arr, power_um)
|
|
|
|
|
|
|
|
|
|
@@ -548,14 +548,14 @@ class TestPRD extends Node:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
|
static func power_um_ukp(status: PackedByteArray, crnt_fs: int, pwr_result: Array) -> Array:
|
|
|
|
|
static func power_um_ukp(status: PackedByteArray, litera: int, pwr_result: Array) -> Array:
|
|
|
|
|
const Constants: Dictionary = {'POWER_UKP_1' : 31, 'POWER_UKP_2': 63}
|
|
|
|
|
var power_values: Array = []
|
|
|
|
|
var base_offset = 0
|
|
|
|
|
var iteration: int = 6
|
|
|
|
|
var ug_valid: bool = (status[0] >> 2) & 1
|
|
|
|
|
|
|
|
|
|
match crnt_fs:
|
|
|
|
|
match litera:
|
|
|
|
|
1:
|
|
|
|
|
# Обработка для current_fs = 1 (одно значение)
|
|
|
|
|
var value = status.decode_u16(Constants.POWER_UKP_1 + 2 * 7)
|
|
|
|
|
@@ -621,15 +621,15 @@ class TestPRD extends Node:
|
|
|
|
|
return max_power_values.duplicate()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func check_dou_result(control_dic: Dictionary, power_dic: Dictionary, pribor: String, cur_prd: int, cnst: Dictionary) -> Dictionary:
|
|
|
|
|
static func check_dou_result(control_dic: Dictionary, power_dic: Dictionary, pribor: String, litera: int, cnst: Dictionary) -> Dictionary:
|
|
|
|
|
var all_dou_ok = true
|
|
|
|
|
var dou: String = 'dou_2' if cur_prd == 2 else 'dou_3'
|
|
|
|
|
var dou: String = 'dou_2' if litera == 2 else 'dou_3'
|
|
|
|
|
if pribor == '1к' or pribor == '2к' or pribor == '3к' or pribor == '4к':
|
|
|
|
|
dou = 'dou_6' if cur_prd == 6 else 'dou_7'
|
|
|
|
|
dou = 'dou_6' if litera == 6 else 'dou_7'
|
|
|
|
|
elif pribor == '1в' or pribor == '2в' or pribor == '3в' or pribor == '4в':
|
|
|
|
|
dou = 'dou_4' if cur_prd == 5 else 'dou_5'
|
|
|
|
|
dou = 'dou_4' if litera == 5 else 'dou_5'
|
|
|
|
|
|
|
|
|
|
var ray_dic: Dictionary = power_dic[cur_prd]
|
|
|
|
|
var ray_dic: Dictionary = power_dic[litera]
|
|
|
|
|
if ray_dic[RAY_m5].size() == 0 or \
|
|
|
|
|
ray_dic[RAY_5 ].size() == 0 or \
|
|
|
|
|
ray_dic[RAY_15].size() == 0 or \
|
|
|
|
|
@@ -642,10 +642,16 @@ class TestPRD extends Node:
|
|
|
|
|
for i_pow_arr in ray_dic.values():
|
|
|
|
|
for i_pow in i_pow_arr.size():
|
|
|
|
|
if i_pow_arr[i_pow] < cnst.POWER_THRESHOLD:
|
|
|
|
|
print_debug('dou_%s: false' % cur_prd)
|
|
|
|
|
print_debug('dou_%s: false' % litera)
|
|
|
|
|
all_dou_ok = false
|
|
|
|
|
|
|
|
|
|
print([cur_prd, ray_dic])
|
|
|
|
|
print([litera, ray_dic])
|
|
|
|
|
control_dic[dou] = all_dou_ok
|
|
|
|
|
|
|
|
|
|
return control_dic
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func get_minimum_pow(pow_dic: Dictionary, cur_litera: int)-> Dictionary:
|
|
|
|
|
var minimum_value_dic: Dictionary
|
|
|
|
|
|
|
|
|
|
return minimum_value_dic
|
|
|
|
|
|