Доработка контроля с ЭМС-Г

This commit is contained in:
2025-02-24 16:42:32 +03:00
parent 70bca2ce57
commit 1b99f2d974
4 changed files with 106 additions and 39 deletions

View File

@@ -516,7 +516,6 @@ func set_tab_and_buttons(tab_index: int, button_name: String) -> void:
func on_mode_select(intem_from_sector: int) -> void:
Network.send_array = []
var node_select_device: GDTable = $TabContainer/PRD/select_dev
var get_select_device = node_select_device.get_node2(1, 0)
var meta = get_select_device.get_item_metadata(intem_from_sector)

View File

@@ -8,9 +8,11 @@ var node_cell_ind: Array
var count_cell: int
var past_pribor: int
var logger: Node
var flag_control_on: bool = false
var array_pow: Array = []
var count_packet:int = 0
var flag_control_on: bool = false
var flag_fs_1_ready: bool = false
var flag_fs_2_ready: bool = false
class Logger extends Node:
@@ -56,6 +58,7 @@ func _ready() -> void:
self.add_child(timer)
timer.connect('timeout', Callable(self, '_on_timer'))
Network.connect('yau_receive', Callable(self, '_on_yau_received'))
self.get_parent().get_child(2).connect('signal_FS_is_ready', Callable(self, '_on_fs_status'))
# Добавляем таймер как дочерний узел
self.add_child(timer_03)
@@ -94,8 +97,6 @@ func _ready() -> void:
func _status_cell(status):
var status_board: int = status.decode_u8(Constants.DataIndices.STATUS_BOARD)
var dry_contact: int = status.decode_u8(Constants.DataIndices.DRY_CONTACT)
var dkm: int = status.decode_u8(Constants.DataIndices.DKM)
$DKM.text = str(dkm)
# status_board
for i in range(1, 5):
@@ -106,25 +107,6 @@ func _status_cell(status):
node_cell_ind[i].state = Constants.STATE_VAL.ERROR
logger.error("%s : Нет связи ❌" % node_cell_ind[i].get('fname'))
#dkm
if Constants.CURRENT_MODE == Constants.MODE.PRD_H:
$soc_DKM/DKM_2.state = (dkm >> 1) & 0x1
$soc_DKM/DKM_3.state = (dkm >> 2) & 0x1
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
$soc_DKM/DKM_2.state = (dkm >> 3) & 0x1
$soc_DKM/DKM_3.state = (dkm >> 4) & 0x1
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
elif Constants.CURRENT_MODE == Constants.MODE.PRD_K:
$soc_DKM/DKM_1.state = (dkm >> 0) & 0x1
$soc_DKM/DKM_2.state = (dkm >> 5) & 0x1
$soc_DKM/DKM_3.state = (dkm >> 6) & 0x1
$Kasseta_FS/Block_FS_PRD_K.state = $soc_DKM/DKM_1.state
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
#dry_contact
if (node_cell_ind[2].state == Constants.STATE_VAL.GOOD):
for i_node in range(5, 13):
@@ -158,6 +140,7 @@ func _on_yau_received(status_yau):
if arr_power_ukp_1[i] > array_pow[i]:
array_pow[i] = arr_power_ukp_1[i]
count_packet +=1
#print(Network.unit.isa_ports)
func _status_prd():
@@ -303,7 +286,8 @@ func _on_fs_status_2(_name_port, status_fs_2):
func fs_1_setup(freq):
#Network.get_fs_gen_status(true) ## отключен пока что (поменять на false)
Network.get_fs_gen_status(true) ## отключен пока что (поменять на false)
await get_tree().create_timer(0.5).timeout
Network.status_can_macro_1(false)
Network.set_fs_ferq_carrier(freq * 1_000_000)
Network.set_fs_attenuation(float(19))
@@ -313,12 +297,14 @@ func fs_1_setup(freq):
func fs_2_setup(freq):
Network.get_fs_gen_status_2(true)
await get_tree().create_timer(0.5).timeout
Network.status_can_macro_2(false)
Network.set_fs_ferq_carrier_2(freq * 1_000_000)
Network.set_fs_attenuation_2(float(19))
Network.set_can_macro_2(freq)
Network.status_can_macro_2(true)
Network.get_fs_gen_status_2(true) ## отключен пока что (поменять на false)
Network.get_fs_gen_status_2(false) ## отключен пока что (поменять на false)
func yau_07b_setup():
@@ -345,8 +331,11 @@ func _on_data_fs(fs_data:PackedByteArray, fs_name: String):
if GRP == Constants.GROUP.GENERATOR:
if fs_data.decode_u32(0xC) == 0:
logger.info('Состояние генератора %s: Включен ✅' % fs_name)
emit_signal('signal_on_start_timer_03')
else:
if fs_name == 'ФС-1':
flag_fs_1_ready = false
if fs_name == 'ФС-2':
flag_fs_2_ready = false
logger.info('Состояние генератора %s: Отключен ❌' % fs_name)
Constants.CMD.BASE_CAN_MACRO_READ:
if GRP == Constants.GROUP.BASE:
@@ -427,3 +416,39 @@ func _on_timer_03():
logger.info('Количество принятых пакетов от ЯУ-07Б: %s пакета' % count_packet)
logger.info('Максимальные значения по мощности от УКП-1: %s ' % str(array_pow))
_status_prd()
func _on_fs_status(META:int):
if logger:
if META == Constants.META.CI_2_OT_FS or META == Constants.META.CI_4_OT_FS:
flag_fs_1_ready = true
elif META == Constants.META.CI_3_OT_FS or META == Constants.META.CI_5_OT_FS:
flag_fs_2_ready = true
if flag_fs_1_ready and flag_fs_2_ready:
#dkm
var dkm: int = Network.unit.status.decode_u8(Constants.DataIndices.DKM)
$DKM.text = str(dkm)
if Constants.CURRENT_MODE == Constants.MODE.PRD_H:
$soc_DKM/DKM_2.state = (dkm >> 1) & 0x1
$soc_DKM/DKM_3.state = (dkm >> 2) & 0x1
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
logger.info('%s: %s' % [$Kasseta_FS/ref_A3.fname, $soc_DKM/DKM_2.state])
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
$soc_DKM/DKM_2.state = (dkm >> 3) & 0x1
$soc_DKM/DKM_3.state = (dkm >> 4) & 0x1
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
logger.info('%s: %s' % [$Kasseta_FS/ref_A3.fname, $soc_DKM/DKM_2.state])
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
logger.info('%s: %s' % [$Kasseta_FS/ref_A4.fname, $soc_DKM/DKM_3.state])
elif Constants.CURRENT_MODE == Constants.MODE.PRD_K:
$soc_DKM/DKM_1.state = (dkm >> 0) & 0x1
$soc_DKM/DKM_2.state = (dkm >> 5) & 0x1
$soc_DKM/DKM_3.state = (dkm >> 6) & 0x1
$Kasseta_FS/Block_FS_PRD_K.state = $soc_DKM/DKM_1.state
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
emit_signal('signal_on_start_timer_03')
print('Флаг ФС: ', [flag_fs_1_ready, flag_fs_2_ready])

View File

@@ -1,7 +1,11 @@
extends Panel
signal signal_FS_is_ready()
var node_select1: Node
var shift: int = 2
var button_link_meta: Dictionary = {}
var status_fs_1
var status_fs_2
func _on_read_ems_g():
@@ -139,19 +143,49 @@ func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_nod
set_frame(socket_status, frame_type)
if i == 1: # СЗИ_2_от_УФ
# $TabContainer /PRD /body_grid/litera_2_4_6/yau07b_control
var CZI_2_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(2).get_node2(1, 7).get_child(1)
set_frame(CZI_2_FS, frame_type)
if i == 2: # СЗИ_3_от_УФ
var CZI_3_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(2).get_node2(1, 7).get_child(1)
set_frame(CZI_3_FS, frame_type)
if i == 9: # СИ_2_от_ФС
var CI_2_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(0).get_node2(1, 6).get_child(1)
set_frame(CI_2_FS, frame_type)
if i == 10: # СИ_3_от_ФС
var CI_3_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(0).get_node2(1, 6).get_child(1)
set_frame(CI_3_FS, frame_type)
if Constants.CURRENT_MODE == Constants.MODE.PRD_H:
if i == 1: # СЗИ_2_от_УФ
# $TabContainer /PRD /body_grid/litera_2_4_6/yau07b_control
var CZI_2_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(2).get_node2(1, 7).get_child(1)
set_frame(CZI_2_FS, frame_type)
if i == 2: # СЗИ_3_от_УФ
var CZI_3_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(2).get_node2(1, 7).get_child(1)
set_frame(CZI_3_FS, frame_type)
elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
if i == 3: # СЗИ_4_от_УФ
# $TabContainer /PRD /body_grid/litera_2_4_6/yau07b_control
var CZI_2_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(2).get_node2(1, 7).get_child(1)
set_frame(CZI_2_FS, frame_type)
if i == 4: # СЗИ_5_от_УФ
var CZI_3_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(2).get_node2(1, 7).get_child(1)
set_frame(CZI_3_FS, frame_type)
if Constants.CURRENT_MODE == Constants.MODE.PRD_H:
if i == 9: # СИ_2_от_ФС
var CI_2_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(0).get_node2(1, 6).get_child(1)
set_frame(CI_2_FS, frame_type)
if frame_type == Constants.Frame.CONSTANT and status_fs_1 != Constants.Frame.CONSTANT:
emit_signal('signal_FS_is_ready', Constants.META.CI_2_OT_FS)
status_fs_1 = frame_type
if i == 10: # СИ_3_от_ФС
var CI_3_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(0).get_node2(1, 6).get_child(1)
set_frame(CI_3_FS, frame_type)
if frame_type == Constants.Frame.CONSTANT and status_fs_2 != Constants.Frame.CONSTANT:
emit_signal('signal_FS_is_ready', Constants.META.CI_3_OT_FS)
status_fs_2 = frame_type
elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
if i == 11: # СИ_4_от_ФС
var CI_4_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(0).get_node2(1, 6).get_child(1)
set_frame(CI_4_FS, frame_type)
if frame_type == Constants.Frame.CONSTANT and status_fs_1 != Constants.Frame.CONSTANT:
emit_signal('signal_FS_is_ready', Constants.META.CI_4_OT_FS)
status_fs_1 = frame_type
if i == 12: # СИ_5_от_ФС
var CI_5_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(0).get_node2(1, 6).get_child(1)
set_frame(CI_5_FS, frame_type)
if frame_type == Constants.Frame.CONSTANT and status_fs_2 != Constants.Frame.CONSTANT:
emit_signal('signal_FS_is_ready', Constants.META.CI_5_OT_FS)
status_fs_2 = frame_type
func set_frame(node: Node, val: int): node.set_frame(val)

View File

@@ -199,6 +199,7 @@ func on_command_fail(_unit) -> void:
func on_command_change_device(meta_device):
send_array = []
ip_address_yau = meta_device[0]
ip_port_yau = meta_device[1]
ip_fs_1 = meta_device[3]
@@ -244,6 +245,10 @@ func start_work_fs():
counter_fs_1 = 0
unit_fs.start_session(counter_fs_1, client_fs_1)
counter_fs_1 += 1
unit_fs.set_gen_state(false, counter_fs_1, client_fs_1)
counter_fs_1 += 1
unit_fs.set_gen_state(true, counter_fs_1, client_fs_1)
counter_fs_1 += 1
unit_fs.get_gen_state(counter_fs_1, client_fs_1)
counter_fs_1 += 1
unit_fs.get_att_batch(counter_fs_1, client_fs_1)
@@ -329,6 +334,10 @@ func start_work_fs_2():
counter_fs_2 = 0
unit_fs.start_session(counter_fs_2, client_fs_2)
counter_fs_2 += 1
unit_fs.set_gen_state(false, counter_fs_2, client_fs_2)
counter_fs_2 += 1
unit_fs.set_gen_state(true, counter_fs_2, client_fs_2)
counter_fs_2 += 1
unit_fs.set_att_batch(19.0, counter_fs_2, client_fs_2)
counter_fs_2 += 1
unit_fs.get_gen_state(counter_fs_2, client_fs_2)