закончен контроль
This commit is contained in:
@@ -264,11 +264,12 @@ theme_override_styles/tab_selected = SubResource("StyleBoxTexture_k08q3")
|
||||
theme_override_styles/tab_hovered = SubResource("StyleBoxTexture_dklg6")
|
||||
theme_override_styles/tab_unselected = SubResource("StyleBoxTexture_17le6")
|
||||
tab_alignment = 2
|
||||
current_tab = 0
|
||||
current_tab = 2
|
||||
tab_focus_mode = 0
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="PRD" type="Panel" parent="TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_7u7p7")
|
||||
metadata/_tab_index = 0
|
||||
@@ -420,13 +421,14 @@ metadata/_tab_index = 1
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="lbl_control" type="Label" parent="TabContainer/ControlPanel"]
|
||||
modulate = Color(1, 0, 0, 1)
|
||||
layout_mode = 0
|
||||
offset_left = 45.0
|
||||
offset_top = -37.0
|
||||
offset_right = 665.0
|
||||
offset_bottom = -6.0
|
||||
theme_override_font_sizes/font_size = 22
|
||||
text = "Контроль исправности прибора ПРД-Н"
|
||||
text = "Прибор не исправен"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
@@ -714,7 +716,6 @@ offset_right = 1616.0
|
||||
offset_bottom = 847.0
|
||||
|
||||
[node name="EMS_G" type="Panel" parent="TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_ooo4i")
|
||||
script = ExtResource("9_g1wia")
|
||||
|
||||
153
scripts/PRD.gd
153
scripts/PRD.gd
@@ -34,14 +34,14 @@ func _ready() -> void:
|
||||
node_select1.set_columns_min_size([120, 120])
|
||||
node_select1.set_node_text(0, 0, 'Мощность')
|
||||
node_select1.set_node_text(1, 0, 'Температура')
|
||||
|
||||
|
||||
# Таблица УКП_2
|
||||
node_select2 = $TabContainer/PRD/body_grid/litera_3_5_7/table_ukp_2
|
||||
draw_tabl(node_select2, Constants.ROWS_REGS_DATA, Constants.ROWS_REGS_DATA.size())
|
||||
node_select2.set_columns_min_size([120, 120])
|
||||
node_select2.set_node_text(0, 0, 'Мощность')
|
||||
node_select2.set_node_text(1, 0, 'Температура')
|
||||
|
||||
|
||||
# Таблица ЯУ-07б
|
||||
var node_select_yau_07b = $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control
|
||||
draw_tabl(node_select_yau_07b, Constants.ROWS_YAU_07B_1, Constants.ROWS_YAU_07B_1.size())
|
||||
@@ -53,7 +53,7 @@ func _ready() -> void:
|
||||
node_select_yau_07b.set_node_text(0, 3, 'Положение луча')
|
||||
node_select_yau_07b.set_node_text(0, 4, 'Аттенюатор')
|
||||
node_select_yau_07b.set_node_text(0, 6, 'СИ 2 в УФ')
|
||||
|
||||
|
||||
var node_select_yau_07b_2 = $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control
|
||||
draw_tabl(node_select_yau_07b_2, Constants.ROWS_YAU_07B_2, Constants.ROWS_YAU_07B_2.size())
|
||||
node_select_yau_07b_2.set_columns_min_size([160, 120])
|
||||
@@ -65,7 +65,7 @@ func _ready() -> void:
|
||||
node_select_yau_07b_2.set_node_text(0, 4, 'Аттенюатор')
|
||||
node_select_yau_07b_2.set_node_text(0, 5, 'ФГОЗ 3')
|
||||
node_select_yau_07b_2.set_node_text(0, 6, 'СИ 3 в УФ')
|
||||
|
||||
|
||||
#Таблица ФС
|
||||
var node_select_fs_1 = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control
|
||||
draw_tabl(node_select_fs_1, Constants.ROWS_FS, Constants.ROWS_FS.size())
|
||||
@@ -82,7 +82,7 @@ func _ready() -> void:
|
||||
node_select_fs_1.set_node_text(0, 4, 'Генератор')
|
||||
node_select_fs_1.set_node_text(0, 5, 'fpga')
|
||||
node_select_fs_1.set_node_text(0, 6, 'СИ 2 от ФС')
|
||||
|
||||
|
||||
var node_select_fs_2 = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control
|
||||
draw_tabl(node_select_fs_2, Constants.ROWS_FS, Constants.ROWS_FS.size())
|
||||
node_select_fs_2.set_columns_min_size([120, 120, 150])
|
||||
@@ -98,12 +98,13 @@ func _ready() -> void:
|
||||
node_select_fs_2.set_node_text(0, 4, 'Генератор')
|
||||
node_select_fs_2.set_node_text(0, 5, 'fpga')
|
||||
node_select_fs_2.set_node_text(0, 6, 'СИ 3 от ФС')
|
||||
|
||||
|
||||
# Выбор прибора для подключения
|
||||
var node_select_device = $TabContainer/PRD/select_dev
|
||||
draw_tabl(node_select_device, Constants.SELECT_DEVICE, Constants.SELECT_DEVICE.size())
|
||||
var get_select_device = node_select_device.get_node2(1, 0)
|
||||
|
||||
get_select_device.connect('item_selected', Callable(self, 'on_device_selected'))
|
||||
|
||||
# Заполнение адресов
|
||||
for i_addr in Constants.ADDRESSES.size():
|
||||
get_select_device.add_item(Constants.ADDRESSES[i_addr][0])
|
||||
@@ -111,28 +112,27 @@ func _ready() -> void:
|
||||
get_select_device.connect('item_selected', Callable(self, 'on_btn_select'))
|
||||
node_select_device.get_node2(0,0).text = 'ПРИБОР'
|
||||
node_select_device.set_columns_min_size([100, 100])
|
||||
|
||||
|
||||
# Получаем имя выбранного прибора
|
||||
if Constants.ADDRESSES.size() > 0:
|
||||
get_select_device.select(0)
|
||||
status_pribor = get_select_device.get_item_text(0).strip_edges().substr(4)
|
||||
|
||||
|
||||
## Заполненение списка модуляции УМ
|
||||
for key in Constants.OUT_x128:
|
||||
node_select_yau_07b.get_node2(1, 2).add_item(key)
|
||||
node_select_yau_07b_2.get_node2(1, 2).add_item(key)
|
||||
|
||||
|
||||
## Заполненение списка направления луча
|
||||
for key in Constants.RAY_DICT:
|
||||
node_select_yau_07b.get_node2(1, 3).add_item(key)
|
||||
node_select_yau_07b_2.get_node2(1, 3).add_item(key)
|
||||
|
||||
|
||||
## Заполненение списка аттенюатора
|
||||
for key in Constants.ATT_DICT:
|
||||
node_select_yau_07b.get_node2(1, 4).add_item(key)
|
||||
node_select_yau_07b_2.get_node2(1, 4).add_item(key)
|
||||
|
||||
draw_control_panel_prd(Constants.ADDRESSES[0][3])
|
||||
|
||||
|
||||
Network.connect('yau_status_line', Callable(self, '_on_yau_status'))
|
||||
Network.connect('yau_receive', Callable(self, '_on_data_received'))
|
||||
@@ -143,18 +143,18 @@ func _ready() -> void:
|
||||
Network.connect('port_fs_closed_2', _on_port_changed_fs_2.bind(Color.CRIMSON))
|
||||
Network.connect('data_from_fs_1', _on_data_fs_1)
|
||||
Network.connect('data_from_fs_2', _on_data_fs_2)
|
||||
|
||||
|
||||
node_select_yau_07b.get_node2(1, 1).get_child(1, false).connect('toggled', Callable(self, '_on_zapret1'))
|
||||
node_select_yau_07b.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um_1'))
|
||||
node_select_yau_07b.get_node2(1, 3).connect('item_selected', Callable(self, '_on_btn_ray_1'))
|
||||
node_select_yau_07b.get_node2(1, 4).connect('item_selected', Callable(self, '_on_attenuator_1'))
|
||||
|
||||
|
||||
node_select_yau_07b_2.get_node2(1, 1).get_child(1, false).connect('toggled', Callable(self, '_on_zapret2'))
|
||||
node_select_yau_07b_2.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um_2'))
|
||||
node_select_yau_07b_2.get_node2(1, 3).connect('item_selected', Callable(self, '_on_btn_ray_2'))
|
||||
node_select_yau_07b_2.get_node2(1, 4).connect('item_selected', Callable(self, '_on_attenuator_2'))
|
||||
node_select_yau_07b_2.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_fgos_2'))
|
||||
|
||||
|
||||
node_select_fs_1.get_node2(1, 4).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_1'))
|
||||
node_select_fs_1.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att_1'))
|
||||
node_select_fs_1.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq_1'))
|
||||
@@ -164,97 +164,9 @@ func _ready() -> void:
|
||||
node_select_fs_2.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq_2'))
|
||||
|
||||
|
||||
func draw_control_panel_prd(pribor) -> void:
|
||||
if pribor == Constants.MODE.PRD_H:
|
||||
# Кассета У5
|
||||
$TabContainer/ControlPanel/soc_y5/IP5_25.rname = 'А24'
|
||||
$TabContainer/ControlPanel/soc_y5/ay07.rname = 'А30'
|
||||
$TabContainer/ControlPanel/soc_y5/ems_g.rname = 'А26'
|
||||
$TabContainer/ControlPanel/soc_y5/ug.rname = 'А27'
|
||||
$TabContainer/ControlPanel/soc_y5/ukp_1.rname = 'А28'
|
||||
$TabContainer/ControlPanel/soc_y5/ukp_2.rname = 'А29'
|
||||
# Кассета ФС
|
||||
$TabContainer/ControlPanel/Kasseta_FS/Kasseta.text = 'Кассета ФС-НД'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/Block_FS_PRD_K.visible = false
|
||||
$TabContainer/ControlPanel/Kasseta_FS/FS_PRD_K.visible = false
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A1.rname = 'А1'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A1.fname = 'Модуль ФС'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A3.rname = 'А3'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A3.fname = 'БЛОК ФС-2'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A2.rname = 'А2'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A2.fname = 'Модуль ФС'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A4.rname = 'А4'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A4.fname = 'БЛОК ФС-3'
|
||||
# Кассета П-1
|
||||
$TabContainer/ControlPanel/soc_P1/IP12_50.rname = 'А21'
|
||||
$TabContainer/ControlPanel/soc_P1/IP9_50_1.rname = 'А20'
|
||||
$TabContainer/ControlPanel/soc_P1/IP9_50_2.rname = 'А19'
|
||||
$TabContainer/ControlPanel/soc_P1/MAA_1.rname = 'А22'
|
||||
$TabContainer/ControlPanel/soc_P1/MAA_2.rname = 'А23'
|
||||
# Кассета П-2
|
||||
$TabContainer/ControlPanel/soc_P2.visible = false
|
||||
|
||||
elif pribor == Constants.MODE.PRD_B:
|
||||
# Кассета У5
|
||||
$TabContainer/ControlPanel/soc_y5/IP5_25.rname = 'А24'
|
||||
$TabContainer/ControlPanel/soc_y5/ay07.rname = 'А30'
|
||||
$TabContainer/ControlPanel/soc_y5/ems_g.rname = 'А26'
|
||||
$TabContainer/ControlPanel/soc_y5/ug.rname = 'А27'
|
||||
$TabContainer/ControlPanel/soc_y5/ukp_1.rname = 'А28'
|
||||
$TabContainer/ControlPanel/soc_y5/ukp_2.rname = 'А29'
|
||||
# Кассета ФС
|
||||
$TabContainer/ControlPanel/Kasseta_FS/Kasseta.text = 'Кассета ФС-ВД'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/Block_FS_PRD_K.visible = false
|
||||
$TabContainer/ControlPanel/Kasseta_FS/FS_PRD_K.visible = false
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A1.rname = 'А1'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A1.fname = 'Модуль ФС'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A3.rname = 'А3'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A3.fname = 'БЛОК ФС-4'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A2.rname = 'А2'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A2.fname = 'Модуль ФС'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A4.rname = 'А4'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A4.fname = 'БЛОК ФС-5'
|
||||
# Кассета П-1
|
||||
$TabContainer/ControlPanel/soc_P1/IP12_50.rname = 'А21'
|
||||
$TabContainer/ControlPanel/soc_P1/IP9_50_1.rname = 'А20'
|
||||
$TabContainer/ControlPanel/soc_P1/IP9_50_2.rname = 'А19'
|
||||
$TabContainer/ControlPanel/soc_P1/MAA_1.rname = 'А22'
|
||||
$TabContainer/ControlPanel/soc_P1/MAA_2.rname = 'А23'
|
||||
# Кассета П-2
|
||||
$TabContainer/ControlPanel/soc_P2.visible = false
|
||||
|
||||
elif pribor == Constants.MODE.PRD_K:
|
||||
# Кассета У5
|
||||
$TabContainer/ControlPanel/soc_y5/IP5_25.rname = 'А31'
|
||||
$TabContainer/ControlPanel/soc_y5/ay07.rname = 'А37'
|
||||
$TabContainer/ControlPanel/soc_y5/ems_g.rname = 'А33'
|
||||
$TabContainer/ControlPanel/soc_y5/ug.rname = 'А34'
|
||||
$TabContainer/ControlPanel/soc_y5/ukp_1.rname = 'А35'
|
||||
$TabContainer/ControlPanel/soc_y5/ukp_2.rname = 'А36'
|
||||
# Кассета ФС
|
||||
$TabContainer/ControlPanel/Kasseta_FS/Kasseta.text = 'Кассета ФС-КД'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/Block_FS_PRD_K.visible = true
|
||||
$TabContainer/ControlPanel/Kasseta_FS/FS_PRD_K.visible = true
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A1.rname = 'А3'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A1.fname = 'Модуль ФС'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A3.rname = 'А6'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A3.fname = 'БЛОК ФС-6'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A2.rname = 'А2'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A2.fname = 'Модуль ФС'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A4.rname = 'А5'
|
||||
$TabContainer/ControlPanel/Kasseta_FS/ref_A4.fname = 'БЛОК ФС-7'
|
||||
# Кассета П-1
|
||||
$TabContainer/ControlPanel/soc_P1/IP12_50.rname = 'А23'
|
||||
$TabContainer/ControlPanel/soc_P1/IP12_50.fname = 'ИП9-50'
|
||||
$TabContainer/ControlPanel/soc_P1/IP9_50_1.rname = 'А24'
|
||||
$TabContainer/ControlPanel/soc_P1/IP9_50_1.fname = 'ИП9-50'
|
||||
$TabContainer/ControlPanel/soc_P1/IP9_50_2.rname = 'А26'
|
||||
$TabContainer/ControlPanel/soc_P1/IP9_50_2.fname = 'ИП12-50'
|
||||
|
||||
$TabContainer/ControlPanel/soc_P1/MAA_1.rname = 'А27'
|
||||
$TabContainer/ControlPanel/soc_P1/MAA_2.rname = 'А28'
|
||||
# Кассета П-2
|
||||
$TabContainer/ControlPanel/soc_P2.visible = true
|
||||
func on_device_selected(selected_index: int) -> void:
|
||||
var get_select_device = $TabContainer/PRD/select_dev.get_node2(1, 0)
|
||||
status_pribor = get_select_device.get_item_text(selected_index).strip_edges().substr(4)
|
||||
|
||||
|
||||
## From Network status about yau-07
|
||||
@@ -267,7 +179,7 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
|
||||
var isa_data: Dictionary = {}
|
||||
for key in unit_isa_ports.keys():
|
||||
isa_data[key] = unit_isa_ports[key]
|
||||
|
||||
|
||||
if isa_data.has(Constants.BASE_PORTS.EMS_G+2):
|
||||
var tmp = isa_data[Constants.BASE_PORTS.EMS_G+2]
|
||||
isa_data.erase(Constants.BASE_PORTS.EMS_G+2)
|
||||
@@ -283,7 +195,7 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
|
||||
if len(Constants.EMS_G_PORT_DATA_HOLDER) == 32:
|
||||
emit_signal('read_ems_g_finish')
|
||||
$ISA.text = 'ISA: ' + str(len(Constants.EMS_G_PORT_DATA_HOLDER))
|
||||
|
||||
|
||||
if isa_data.has(Constants.BASE_PORTS.UG+6):
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 3).select(isa_data[0x106] & 0x7)
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 4).select((isa_data[0x106] & 0x38)>> 3)
|
||||
@@ -364,23 +276,23 @@ func _on_data_received(data_from_yau_07):
|
||||
var _DKM: int = data_from_yau_07.decode_u16(Constants.DataIndices.DKM) # ДКМ от УГ
|
||||
#node_select1.set_node_text(2, 0, '%d' % dry_contact)
|
||||
#node_select1.set_node_text(3, 0, '%d' % DKM)
|
||||
|
||||
|
||||
|
||||
|
||||
## УКП
|
||||
for i in range(6): ## Мощность от УКП_1
|
||||
var power_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_1 + 2 * i)
|
||||
node_select1.set_node_text(0, i+1, '%d' % power_ukp_1)
|
||||
|
||||
|
||||
for i in range(6): ## Температура от УКП_1
|
||||
var temperature_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * i)
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * Constants.TEMP
|
||||
node_select1.set_node_text(1, i+1, '%d °С' % TMP)
|
||||
|
||||
|
||||
for i_pow in range(6): ## Мощность от УКП_2
|
||||
if len(data_from_yau_07) > Constants.DataIndices.POWER_UKP_2 + 2 * i_pow:
|
||||
var power_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_2 + 2 * i_pow)
|
||||
node_select2.set_node_text(0, i_pow+1, '%d' % power_ukp_2)
|
||||
|
||||
|
||||
for row in range(6): ## Температура от УКП_2
|
||||
if len(data_from_yau_07) > Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * row:
|
||||
var temperature_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * row)
|
||||
@@ -495,7 +407,7 @@ func _on_load_config():
|
||||
func set_tab_and_buttons(tab_index: int, button_name: String) -> void:
|
||||
$TabContainer.current_tab = tab_index
|
||||
var side_panel = $Background/side_panel
|
||||
|
||||
|
||||
for button in side_panel.get_children():
|
||||
if button is Button:
|
||||
button.button_pressed = (button.name == button_name)
|
||||
@@ -506,8 +418,7 @@ func on_btn_select(intem_from_sector: int) -> void:
|
||||
var get_select_device = node_select_device.get_node2(1, 0)
|
||||
var meta = get_select_device.get_item_metadata(intem_from_sector)
|
||||
Network.on_command_change_device(meta)
|
||||
flag_mode = meta[2]
|
||||
draw_control_panel_prd(flag_mode)
|
||||
Constants.CURRENT_MODE = meta[2]
|
||||
_on_start_fs_1()
|
||||
_on_start_fs_2()
|
||||
|
||||
@@ -534,7 +445,7 @@ func _on_modul_um_1(item_from_ray_1: int):
|
||||
2: 0x4000,
|
||||
3: 0x8000
|
||||
}
|
||||
|
||||
|
||||
var modul_um = modul_um_values.get(item_from_ray_1, 0)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um)
|
||||
|
||||
@@ -551,7 +462,7 @@ func _on_modul_um_2(item_from_ray_1: int):
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um)
|
||||
|
||||
|
||||
## Включение/отключение сигнала ФГОЗ
|
||||
## Включение/отключение сигнала ФГОЗ
|
||||
func _on_fgos_2(toggled_on: bool):
|
||||
var meta = 56
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
|
||||
@@ -567,8 +478,8 @@ func _on_btn_ray_1(item_from_ray_1: int) -> void:
|
||||
Network.read_port_isa([Constants.BASE_PORTS.UG+6])
|
||||
else:
|
||||
print_debug('В ISA отсутствует данные в \"%x\" порту' % (Constants.BASE_PORTS.UG+0x6))
|
||||
|
||||
|
||||
|
||||
|
||||
## Регулировка положением луча 2
|
||||
func _on_btn_ray_2(item_from_ray_2: int) -> void:
|
||||
if isa_from_yau07b.has(Constants.BASE_PORTS.UG+8):
|
||||
|
||||
@@ -1,37 +1,182 @@
|
||||
extends Panel
|
||||
|
||||
var unit_yau07 = Yau07.YaU07.new('ЯУ07')
|
||||
|
||||
var timer = Timer.new()
|
||||
var node_cell_ind: Array
|
||||
var count_cell: int
|
||||
var past_pribor: int
|
||||
|
||||
func _ready() -> void:
|
||||
Network.connect('yau_receive', Callable(self, '_on_data_received'))
|
||||
Network.connect('yau_status_line', Callable(self, '_control_pribor'))
|
||||
self.add_child(timer)
|
||||
timer.connect('timeout', Callable(self, '_on_timer').bind(Network.unit))
|
||||
timer.start(1)
|
||||
|
||||
'''sockets_ind = [
|
||||
$soc_y5/ems_g/light_ind,
|
||||
$soc_y5/ug/light_ind,
|
||||
$soc_y5/ukp_1/light_ind,
|
||||
$soc_y5/ukp_2/light_ind]
|
||||
node_cell_ind = [
|
||||
$soc_y5/ay07,
|
||||
$soc_y5/ems_g,
|
||||
$soc_y5/ug,
|
||||
$soc_y5/ukp_1,
|
||||
$soc_y5/ukp_2,
|
||||
|
||||
node_power_ind = [
|
||||
$soc_P1/MAA_1/light_ind,
|
||||
$soc_P1/MAA_2/light_ind,
|
||||
$soc_P1/IP9_50_2/light_ind,
|
||||
$soc_P1/IP9_50_1/light_ind,
|
||||
$soc_P1/IP12_50/light_ind,
|
||||
$soc_P2/IP9_50/light_ind,
|
||||
$soc_P2/IP12_50/light_ind,
|
||||
$soc_y5/IP5_25/light_ind]'''
|
||||
$soc_P1/MAA_1,
|
||||
$soc_P1/MAA_2,
|
||||
$soc_P1/IP9_50_1,
|
||||
$soc_P1/IP9_50_2,
|
||||
$soc_P1/IP12_50,
|
||||
|
||||
func on_timer(unit):
|
||||
print(unit)
|
||||
$soc_P2/IP9_50,
|
||||
$soc_P2/IP12_50,
|
||||
|
||||
func _on_data_received(data_from_yau_07):
|
||||
var _status_board = data_from_yau_07.decode_u8(Constants.DataIndices.STATUS_BOARD)
|
||||
var _dry_contact: int = data_from_yau_07.decode_u16(Constants.DataIndices.DRY_CONTACT) # Контроль сухих контактов (УГ)
|
||||
$soc_y5/IP5_25]
|
||||
count_cell = len(node_cell_ind)
|
||||
|
||||
|
||||
## From Network status about yau-07
|
||||
func _control_pribor(_yau_status:bool) -> void:
|
||||
#$device.text = str(Constants.CURRENT_MODE)
|
||||
$soc_y5/ay07.state = Constants.STATE_VAL.GOOD
|
||||
func _on_timer(pribor_prd):
|
||||
if (past_pribor != Constants.CURRENT_MODE):
|
||||
_draw_control_panel_prd(Constants.CURRENT_MODE)
|
||||
if (pribor_prd.online):
|
||||
$soc_y5/ay07.state = Constants.STATE_VAL.GOOD
|
||||
_status_cell(pribor_prd.status)
|
||||
else:
|
||||
$soc_y5/ay07.state = Constants.STATE_VAL.ERROR
|
||||
for i in range(1,count_cell):
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.NONE
|
||||
_status_prd()
|
||||
past_pribor = Constants.CURRENT_MODE
|
||||
|
||||
|
||||
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+1)
|
||||
|
||||
# status_board
|
||||
for i in range(1, count_cell-8):
|
||||
if ((status_board >> (i-1)) & 0x1) == 1:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.GOOD
|
||||
else:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.ERROR
|
||||
|
||||
#dry_contact
|
||||
if (node_cell_ind[2].state == Constants.STATE_VAL.GOOD):
|
||||
for i in range(5, count_cell):
|
||||
if ((dry_contact >> (i-5)) & 0x1) == 0:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.GOOD
|
||||
else:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.ERROR
|
||||
else:
|
||||
for i in range(5, count_cell):
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.NONE
|
||||
|
||||
func _status_prd():
|
||||
var status: int
|
||||
for i in range(count_cell-3):
|
||||
status += 1 if (node_cell_ind[i].state == Constants.STATE_VAL.GOOD) else 0
|
||||
status += 1 if (node_cell_ind[count_cell-1].state == Constants.STATE_VAL.GOOD) else 0
|
||||
|
||||
if (Constants.CURRENT_MODE == Constants.MODE.PRD_K):
|
||||
status += 1 if (node_cell_ind[count_cell-3].state == Constants.STATE_VAL.GOOD) else 0
|
||||
status += 1 if (node_cell_ind[count_cell-2].state == Constants.STATE_VAL.GOOD) else 0
|
||||
if (status == count_cell):
|
||||
$lbl_control.text = 'Прибор исправен'
|
||||
$lbl_control.modulate = Color(0,1,0,1)
|
||||
else:
|
||||
$lbl_control.text = 'Прибор не исправен'
|
||||
$lbl_control.modulate = Color(1,0,0,1)
|
||||
else:
|
||||
if (status == count_cell-2):
|
||||
$lbl_control.text = 'Прибор исправен'
|
||||
$lbl_control.modulate = Color(0,1,0,1)
|
||||
else:
|
||||
$lbl_control.text = 'Прибор не исправен'
|
||||
$lbl_control.modulate = Color(1,0,0,1)
|
||||
|
||||
func _draw_control_panel_prd(pribor):
|
||||
if pribor == Constants.MODE.PRD_H:
|
||||
# Кассета У5
|
||||
$soc_y5/IP5_25.rname = 'А24'
|
||||
$soc_y5/ay07.rname = 'А30'
|
||||
$soc_y5/ems_g.rname = 'А26'
|
||||
$soc_y5/ug.rname = 'А27'
|
||||
$soc_y5/ukp_1.rname = 'А28'
|
||||
$soc_y5/ukp_2.rname = 'А29'
|
||||
# Кассета ФС
|
||||
$Kasseta_FS/Kasseta.text = 'Кассета ФС-НД'
|
||||
$Kasseta_FS/Block_FS_PRD_K.visible = false
|
||||
$Kasseta_FS/FS_PRD_K.visible = false
|
||||
$Kasseta_FS/ref_A1.rname = 'А1'
|
||||
$Kasseta_FS/ref_A1.fname = 'Модуль ФС'
|
||||
$Kasseta_FS/ref_A3.rname = 'А3'
|
||||
$Kasseta_FS/ref_A3.fname = 'БЛОК ФС-2'
|
||||
$Kasseta_FS/ref_A2.rname = 'А2'
|
||||
$Kasseta_FS/ref_A2.fname = 'Модуль ФС'
|
||||
$Kasseta_FS/ref_A4.rname = 'А4'
|
||||
$Kasseta_FS/ref_A4.fname = 'БЛОК ФС-3'
|
||||
# Кассета П-1
|
||||
$soc_P1/IP12_50.rname = 'А21'
|
||||
$soc_P1/IP9_50_1.rname = 'А20'
|
||||
$soc_P1/IP9_50_2.rname = 'А19'
|
||||
$soc_P1/MAA_1.rname = 'А22'
|
||||
$soc_P1/MAA_2.rname = 'А23'
|
||||
# Кассета П-2
|
||||
$soc_P2.visible = false
|
||||
|
||||
elif pribor == Constants.MODE.PRD_B:
|
||||
# Кассета У5
|
||||
$soc_y5/IP5_25.rname = 'А24'
|
||||
$soc_y5/ay07.rname = 'А30'
|
||||
$soc_y5/ems_g.rname = 'А26'
|
||||
$soc_y5/ug.rname = 'А27'
|
||||
$soc_y5/ukp_1.rname = 'А28'
|
||||
$soc_y5/ukp_2.rname = 'А29'
|
||||
# Кассета ФС
|
||||
$Kasseta_FS/Kasseta.text = 'Кассета ФС-ВД'
|
||||
$Kasseta_FS/Block_FS_PRD_K.visible = false
|
||||
$Kasseta_FS/FS_PRD_K.visible = false
|
||||
$Kasseta_FS/ref_A1.rname = 'А1'
|
||||
$Kasseta_FS/ref_A1.fname = 'Модуль ФС'
|
||||
$Kasseta_FS/ref_A3.rname = 'А3'
|
||||
$Kasseta_FS/ref_A3.fname = 'БЛОК ФС-4'
|
||||
$Kasseta_FS/ref_A2.rname = 'А2'
|
||||
$Kasseta_FS/ref_A2.fname = 'Модуль ФС'
|
||||
$Kasseta_FS/ref_A4.rname = 'А4'
|
||||
$Kasseta_FS/ref_A4.fname = 'БЛОК ФС-5'
|
||||
# Кассета П-1
|
||||
$soc_P1/IP12_50.rname = 'А21'
|
||||
$soc_P1/IP9_50_1.rname = 'А20'
|
||||
$soc_P1/IP9_50_2.rname = 'А19'
|
||||
$soc_P1/MAA_1.rname = 'А22'
|
||||
$soc_P1/MAA_2.rname = 'А23'
|
||||
# Кассета П-2
|
||||
$soc_P2.visible = false
|
||||
|
||||
elif pribor == Constants.MODE.PRD_K:
|
||||
# Кассета У5
|
||||
$soc_y5/IP5_25.rname = 'А31'
|
||||
$soc_y5/ay07.rname = 'А37'
|
||||
$soc_y5/ems_g.rname = 'А33'
|
||||
$soc_y5/ug.rname = 'А34'
|
||||
$soc_y5/ukp_1.rname = 'А35'
|
||||
$soc_y5/ukp_2.rname = 'А36'
|
||||
# Кассета ФС
|
||||
$Kasseta_FS/Kasseta.text = 'Кассета ФС-КД'
|
||||
$Kasseta_FS/Block_FS_PRD_K.visible = true
|
||||
$Kasseta_FS/FS_PRD_K.visible = true
|
||||
$Kasseta_FS/ref_A1.rname = 'А3'
|
||||
$Kasseta_FS/ref_A1.fname = 'Модуль ФС'
|
||||
$Kasseta_FS/ref_A3.rname = 'А6'
|
||||
$Kasseta_FS/ref_A3.fname = 'БЛОК ФС-6'
|
||||
$Kasseta_FS/ref_A2.rname = 'А2'
|
||||
$Kasseta_FS/ref_A2.fname = 'Модуль ФС'
|
||||
$Kasseta_FS/ref_A4.rname = 'А5'
|
||||
$Kasseta_FS/ref_A4.fname = 'БЛОК ФС-7'
|
||||
# Кассета П-1
|
||||
$soc_P1/IP12_50.rname = 'А23'
|
||||
$soc_P1/IP12_50.fname = 'ИП9-50'
|
||||
$soc_P1/IP9_50_1.rname = 'А24'
|
||||
$soc_P1/IP9_50_1.fname = 'ИП9-50'
|
||||
$soc_P1/IP9_50_2.rname = 'А26'
|
||||
$soc_P1/IP9_50_2.fname = 'ИП12-50'
|
||||
|
||||
$soc_P1/MAA_1.rname = 'А27'
|
||||
$soc_P1/MAA_2.rname = 'А28'
|
||||
# Кассета П-2
|
||||
$soc_P2.visible = true
|
||||
|
||||
@@ -58,7 +58,7 @@ func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
|
||||
broadcast_packet = sock.get_packet()
|
||||
var addr_receive = sock.get_packet_ip()
|
||||
var port_receive = sock.get_packet_port()
|
||||
|
||||
|
||||
if (ip_address_yau == addr_receive) and (ip_port_yau == port_receive):
|
||||
last_update_time_yau07 = 0.0
|
||||
unit.parse(broadcast_packet)
|
||||
@@ -84,7 +84,7 @@ func poll_receive_fs(client: StreamPeerTCP, peerstream: PacketPeer, ip_fs: Strin
|
||||
elif client == client_fs_2:
|
||||
emit_signal("port_fs_closed_2", ip_fs)
|
||||
return
|
||||
|
||||
|
||||
if peer.get_available_bytes() > 0:
|
||||
var rx_data: PackedByteArray
|
||||
rx_data.append_array(peer.get_data(peer.get_available_bytes())[1])
|
||||
@@ -106,11 +106,11 @@ func _ready() -> void:
|
||||
var rc = soc_brodcast.bind(Constants.BROADCAST_PORT, '*')
|
||||
if rc != OK:
|
||||
print_debug('Ошибка: Неудачная привязка широковещательного адреса')
|
||||
|
||||
|
||||
soc_unicast = Socket.new()
|
||||
rc = soc_unicast.bind(Constants.UNICAST_PORT, Constants.UNICAST_ADDRESS)
|
||||
if rc != OK:
|
||||
print_debug('Ошибка: неудачная привязка адреса: ', ip_address_yau)
|
||||
print_debug('Ошибка: неудачная привязка адреса: ', ip_address_yau)
|
||||
|
||||
unit.connect('line_changed', Callable(self, 'on_line_changed'))
|
||||
unit.connect('command_fail', Callable(self, 'on_command_fail'))
|
||||
@@ -123,17 +123,17 @@ func _process(delta: float) -> void:
|
||||
|
||||
last_update_time_yau07 += delta
|
||||
last_update_time_fs += delta
|
||||
|
||||
|
||||
if client_fs_1:
|
||||
poll_receive_fs(client_fs_1, peerstream_fs_1, ip_fs_1)
|
||||
state_machine_fs(client_fs_1)
|
||||
if client_fs_2:
|
||||
poll_receive_fs(client_fs_2, peerstream_fs_2, ip_fs_2)
|
||||
state_machine_fs(client_fs_2)
|
||||
|
||||
|
||||
poll_receive_yau07(soc_brodcast)
|
||||
poll_receive_yau07(soc_unicast)
|
||||
|
||||
|
||||
state_machine_yau07()
|
||||
|
||||
match unit.process(delta):
|
||||
@@ -167,12 +167,12 @@ func state_machine_yau07():
|
||||
state = Constants.STATE.WAIT
|
||||
|
||||
|
||||
# Записать команду в ИСА
|
||||
# Записать команду в ИСА
|
||||
func read_port_isa(read_ports: Array) -> void:
|
||||
send_array.append(['rd', read_ports])
|
||||
|
||||
|
||||
# Прочитать данные из порта от ИСА
|
||||
# Прочитать данные из порта от ИСА
|
||||
func write_port_isa(port_isa: int, data_isa: int) -> void:
|
||||
var write_data: Dictionary = {port_isa: data_isa}
|
||||
send_array.append(['wr', write_data])
|
||||
@@ -217,7 +217,7 @@ func state_machine_fs(client_fs):
|
||||
func connect_fs_1():
|
||||
if client_fs_1:
|
||||
disconnect_fs(client_fs_1)
|
||||
|
||||
|
||||
client_fs_1 = StreamPeerTCP.new()
|
||||
peerstream_fs_1 = PacketPeerStream.new()
|
||||
var rc = client_fs_1.connect_to_host(ip_fs_1, Constants.PORT_FS)
|
||||
|
||||
@@ -37,7 +37,7 @@ class YaU07:
|
||||
signal command_done(unit: YaU07) ## Вызывается после выполнения команды
|
||||
signal command_fail(unit: YaU07) ## Вызывается если возникла ошибка при выполнении команды и команда не выполнена
|
||||
signal parse_failed(unit: YaU07)
|
||||
signal data_received(unit: YaU07) ## Вызывается, когда получены данные
|
||||
signal data_received(unit: YaU07) ## Вызывается, когда получены данные
|
||||
|
||||
var name: = String()
|
||||
var cmd_num_rx: = 0 ## Номер команды принятый
|
||||
@@ -262,7 +262,6 @@ class YaU07:
|
||||
status[i] = rx_data[byte_i] # Массив байтовый "состояние прибора"
|
||||
i += 1
|
||||
emit_signal('data_received', self)
|
||||
|
||||
if rx_data_len == (status_len + 6):
|
||||
return true # Нет поля "ответ на команду", разбор пакета завершить
|
||||
|
||||
|
||||
Reference in New Issue
Block a user