Исправление
This commit is contained in:
@@ -34,13 +34,14 @@ offset_bottom = 183.0
|
||||
fname = "Блок ФС-1"
|
||||
rname = "A4"
|
||||
|
||||
[node name="ref_A3" parent="." groups=["default_reset"] instance=ExtResource("3_kqnvt")]
|
||||
[node name="ref_A3" parent="." groups=["default_reset", "fs_group"] instance=ExtResource("3_kqnvt")]
|
||||
offset_left = 55.0
|
||||
offset_top = 33.0
|
||||
offset_right = 105.0
|
||||
offset_bottom = 183.0
|
||||
fname = "Модуль ФС"
|
||||
rname = "A1"
|
||||
metadata/fs = "fs_1"
|
||||
|
||||
[node name="ref_A4" parent="." groups=["default_reset"] instance=ExtResource("3_kqnvt")]
|
||||
offset_left = 105.0
|
||||
@@ -50,21 +51,23 @@ offset_bottom = 183.0
|
||||
fname = "Блок ФС-2"
|
||||
rname = "A2"
|
||||
|
||||
[node name="ref_A6" parent="." groups=["default_reset"] instance=ExtResource("3_kqnvt")]
|
||||
[node name="ref_A6" parent="." groups=["default_reset", "fs_group"] instance=ExtResource("3_kqnvt")]
|
||||
offset_left = 155.0
|
||||
offset_top = 33.0
|
||||
offset_right = 205.0
|
||||
offset_bottom = 183.0
|
||||
fname = "Модуль ФС"
|
||||
rname = "A5"
|
||||
metadata/fs = "fs_6"
|
||||
|
||||
[node name="ref_A5" parent="." groups=["default_reset"] instance=ExtResource("3_kqnvt")]
|
||||
[node name="ref_A5" parent="." groups=["default_reset", "fs_group"] instance=ExtResource("3_kqnvt")]
|
||||
offset_left = 205.0
|
||||
offset_top = 33.0
|
||||
offset_right = 255.0
|
||||
offset_bottom = 183.0
|
||||
fname = "Модуль ФС"
|
||||
rname = "A3"
|
||||
metadata/fs = "fs_7"
|
||||
|
||||
[node name="ref_A7" parent="." groups=["default_reset"] instance=ExtResource("3_kqnvt")]
|
||||
offset_left = 255.0
|
||||
|
||||
@@ -27,7 +27,7 @@ const Constants: Dictionary = {
|
||||
'TEMP_THRESHOLD': 40,
|
||||
'POWER_THRESHOLD': 40,
|
||||
'TIMER_DELAY': 5.0,
|
||||
'dou_ray_nuber': 0x6,
|
||||
'dou_ray_nuber': 0x3,
|
||||
'attenutor_um_1': 0x7,
|
||||
'attenutor_um_2': 0x7,
|
||||
'attenutor_um_3': 0x0,
|
||||
@@ -67,20 +67,7 @@ var block_config_k := {
|
||||
'ip9_50_3': [5, false],
|
||||
'ip12_50_2': [6, false],
|
||||
}
|
||||
var fs_mapping_k = {
|
||||
0: { 'node': 'kasseta_fs_kd/ref_A3', 'condition': pribor == '1к' },
|
||||
1: { 'node': 'kasseta_fs_kd/ref_A3', 'condition': pribor == '4к' },
|
||||
2: { 'node': 'kasseta_fs_kd/ref_A3', 'condition': pribor == '3к' },
|
||||
3: { 'node': 'kasseta_fs_kd/ref_A3', 'condition': pribor == '2к' },
|
||||
20: { 'node': 'kasseta_fs_kd/ref_A6', 'condition': pribor == '1к' },
|
||||
21: { 'node': 'kasseta_fs_kd/ref_A6', 'condition': pribor == '4к' },
|
||||
22: { 'node': 'kasseta_fs_kd/ref_A6', 'condition': pribor == '3к' },
|
||||
23: { 'node': 'kasseta_fs_kd/ref_A6', 'condition': pribor == '2к' },
|
||||
24: { 'node': 'kasseta_fs_kd/ref_A5', 'condition': pribor == '1к' },
|
||||
25: { 'node': 'kasseta_fs_kd/ref_A5', 'condition': pribor == '4к' },
|
||||
26: { 'node': 'kasseta_fs_kd/ref_A5', 'condition': pribor == '3к' },
|
||||
27: { 'node': 'kasseta_fs_kd/ref_A5', 'condition': pribor == '2к' },
|
||||
}
|
||||
var fs_mapping_k: Dictionary = {}
|
||||
# Основные переменные
|
||||
var current_fs: int = 1
|
||||
var state: int = STATE_MASHINE.INIT
|
||||
@@ -172,14 +159,28 @@ func on_state_mashine() -> void:
|
||||
|
||||
|
||||
func initialize_connections() -> void:
|
||||
signaller.conn(signaller.fs_update_state, Callable(self, 'on_fs_update_state'))
|
||||
var unit_name = get_meta('unit_name')[0]
|
||||
var unit_prd = network.get_unit_instance(unit_name)
|
||||
var current_unit = unit_prd.name
|
||||
var parts = current_unit.split('-')
|
||||
pribor = parts[-1]
|
||||
fs_mapping_k = {
|
||||
0: { 'node': 'kasseta_fs_kd/ref_A3', 'condition': pribor == '1к' },
|
||||
1: { 'node': 'kasseta_fs_kd/ref_A3', 'condition': pribor == '4к' },
|
||||
2: { 'node': 'kasseta_fs_kd/ref_A3', 'condition': pribor == '3к' },
|
||||
3: { 'node': 'kasseta_fs_kd/ref_A3', 'condition': pribor == '2к' },
|
||||
20: { 'node': 'kasseta_fs_kd/ref_A6', 'condition': pribor == '1к' },
|
||||
21: { 'node': 'kasseta_fs_kd/ref_A6', 'condition': pribor == '4к' },
|
||||
22: { 'node': 'kasseta_fs_kd/ref_A6', 'condition': pribor == '3к' },
|
||||
23: { 'node': 'kasseta_fs_kd/ref_A6', 'condition': pribor == '2к' },
|
||||
24: { 'node': 'kasseta_fs_kd/ref_A5', 'condition': pribor == '1к' },
|
||||
25: { 'node': 'kasseta_fs_kd/ref_A5', 'condition': pribor == '4к' },
|
||||
26: { 'node': 'kasseta_fs_kd/ref_A5', 'condition': pribor == '3к' },
|
||||
27: { 'node': 'kasseta_fs_kd/ref_A5', 'condition': pribor == '2к' },
|
||||
}
|
||||
unit_prd.connect('data_received', Callable(self, 'on_data_received'))
|
||||
unit_prd.connect('line_changed', Callable(self, 'on_line_changed'))
|
||||
signaller.conn(signaller.fs_update_state, Callable(self, 'on_fs_update_state').bind(fs_mapping_k))
|
||||
|
||||
|
||||
func setup_timer() -> void:
|
||||
@@ -230,10 +231,11 @@ func on_data_received(unit_prd: Object) -> void:
|
||||
# 1. Обновляем статусы блоков
|
||||
block_config_k = node_common_func.check_block_ip(status, block_config_k)
|
||||
# 2. Обновляем ноды power_supply
|
||||
for power_supply in get_tree().get_nodes_in_group('power_supply'):
|
||||
var node_power_arr = get_tree().get_nodes_in_group('power_supply')
|
||||
for power_supply in node_power_arr:
|
||||
var meta_ip = power_supply.get_meta('ip')
|
||||
if block_config_k.has(meta_ip):
|
||||
power_supply.status = block_config_k[meta_ip][1]
|
||||
power_supply.state = STATE_VAL.GOOD if block_config_k[meta_ip][1] else STATE_VAL.ERROR
|
||||
|
||||
node_common_func.check_temperature_um(status, get_tree().get_nodes_in_group('power_amplifier'))
|
||||
# Обработка данных ЭМС
|
||||
@@ -245,7 +247,7 @@ func on_data_received(unit_prd: Object) -> void:
|
||||
flag_check_dkm = check_dkm(status, Constants.DKM_BIT_6)
|
||||
elif current_fs == 7 and _control_results.fs_7:
|
||||
flag_check_dkm = check_dkm(status, Constants.DKM_BIT_7)
|
||||
|
||||
|
||||
if flag_check_dkm:
|
||||
_process_ukp_power(status)
|
||||
|
||||
@@ -366,6 +368,7 @@ func on_stop_control() -> void:
|
||||
|
||||
func on_fs_update_state(packet_type_7: Dictionary, fs_mapping: Dictionary) -> void:
|
||||
# Словарь для маппинга: ключ - номер FS, значение - целевая нода и условие прибора
|
||||
var fs_mapper: Array = get_tree().get_nodes_in_group('fs')
|
||||
|
||||
for fs in packet_type_7:
|
||||
if fs in fs_mapping and fs_mapping[fs]['condition']:
|
||||
|
||||
Reference in New Issue
Block a user