Merge remote-tracking branch 'refs/remotes/kotik/prd-control'
# Conflicts: # scenes/pribor-prd-k/pribor-prd-k.tscn # scenes/pribor-prd-n/pribor-prd-n.tscn # scenes/pribor-prd-v/pribor-prd-v.tscn # scenes/контроль/контроль.tscn
This commit is contained in:
@@ -17,20 +17,23 @@ func _ready() -> void:
|
|||||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||||
for temp in power_amplifier:
|
for temp in power_amplifier:
|
||||||
temp.value1 = -70
|
temp.value1 = -70
|
||||||
|
# Подписываемся на сигналы
|
||||||
unit_prd_k.connect('control_is_over', Callable(self, 'on_press_device'))
|
unit_prd_k.connect('control_is_over', Callable(self, 'on_press_device'))
|
||||||
#unit_prd_k.power_amplify = power_amplifier
|
unit_prd_k.connect('status_updated', Callable(self, '_on_status_updated'))
|
||||||
|
# Устанавливаем начальный статус
|
||||||
|
_update_status_text(unit_prd_k.get_current_status())
|
||||||
on_press_device()
|
on_press_device()
|
||||||
|
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
if Engine.is_editor_hint():
|
if Engine.is_editor_hint():
|
||||||
return
|
return
|
||||||
set_frame($input_0, unit_prd_k.ems_input_1)
|
set_frame($input_0, unit_prd_k.ems_g_sock_dic.ems_input_1)
|
||||||
set_frame($input_1, unit_prd_k.ems_input_2)
|
set_frame($input_1, unit_prd_k.ems_g_sock_dic.ems_input_2)
|
||||||
set_frame($input_2, unit_prd_k.ems_input_lit_1)
|
set_frame($input_2, unit_prd_k.ems_g_sock_dic.ems_input_lit_1)
|
||||||
set_frame($output_0, unit_prd_k.ems_output_1)
|
set_frame($output_0, unit_prd_k.ems_g_sock_dic.ems_output_1)
|
||||||
set_frame($output_1, unit_prd_k.ems_output_2)
|
set_frame($output_1, unit_prd_k.ems_g_sock_dic.ems_output_2)
|
||||||
set_frame($output_2, unit_prd_k.ems_output_lit_1)
|
set_frame($output_2, unit_prd_k.ems_g_sock_dic.ems_output_lit_1)
|
||||||
|
|
||||||
|
|
||||||
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
|
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
|
||||||
@@ -52,8 +55,8 @@ static func set_default_state(default_reset_array_node: Array, power_amplifier_a
|
|||||||
func _enter_tree() -> void:
|
func _enter_tree() -> void:
|
||||||
if Engine.is_editor_hint():
|
if Engine.is_editor_hint():
|
||||||
return
|
return
|
||||||
$control_result.text = 'Ожидается запуск контроля ...' # TODO: Необходимо сделать пулл сообщений
|
if unit_prd_k:
|
||||||
$control_result.add_theme_color_override('font_color', Color.ALICE_BLUE)
|
_update_status_text(unit_prd_k.get_current_status())
|
||||||
|
|
||||||
|
|
||||||
func _exit_tree() -> void:
|
func _exit_tree() -> void:
|
||||||
@@ -66,34 +69,31 @@ static func temperature_fill(temperature_arr_node: Array, temperature_dic: Dicti
|
|||||||
for i_node_temperature in temperature_arr_node:
|
for i_node_temperature in temperature_arr_node:
|
||||||
var temperature_meta: String = i_node_temperature.get_meta('um')
|
var temperature_meta: String = i_node_temperature.get_meta('um')
|
||||||
if not temperature_dic.has(temperature_meta): return
|
if not temperature_dic.has(temperature_meta): return
|
||||||
i_node_temperature.value1 = temperature_dic[temperature_meta]
|
i_node_temperature.value1 = temperature_dic[temperature_meta] if temperature_dic[temperature_meta] < 361 else -40
|
||||||
|
|
||||||
|
|
||||||
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier: Array, POWER_THRESHOLD: int) -> void:
|
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier_arr_node: Array, POWER_THRESHOLD: int) -> void:
|
||||||
for i_powapm in power_amplifier:
|
for i_node_temperature in power_amplifier_arr_node:
|
||||||
var powamp_meta: String = i_powapm.get_meta('um')
|
var powamp_meta: String = i_node_temperature.get_meta('um')
|
||||||
var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE
|
var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE
|
||||||
if not pow_dic.has(powamp_meta): return
|
if not pow_dic.has(powamp_meta): return
|
||||||
if pow_dic:
|
# Проверки fs_result
|
||||||
if not pow_dic.has(powamp_meta):
|
if powamp_meta == 'um_8' and not fs_result.fs_1: return
|
||||||
break
|
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_6: return
|
||||||
if pow_dic[powamp_meta].size() < 6:
|
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_7: return
|
||||||
status = STATE_VAL.ERROR
|
|
||||||
else:
|
if powamp_meta == 'um_8':
|
||||||
if powamp_meta == 'um_8' and not fs_result.fs_1: return
|
i_node_temperature.value0 = [pow_dic[powamp_meta][5]]
|
||||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_6: return
|
status = STATE_VAL.ERROR if pow_dic[powamp_meta][5] < POWER_THRESHOLD else STATE_VAL.GOOD
|
||||||
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_7: return
|
else:
|
||||||
|
i_node_temperature.value0 = pow_dic[powamp_meta]
|
||||||
if powamp_meta == 'um_8':
|
# Проверки 3 значения = исправен
|
||||||
i_powapm.value0 = [pow_dic[powamp_meta][5]]
|
var count_above_threshold = 0
|
||||||
if pow_dic[powamp_meta][5] < POWER_THRESHOLD:
|
for i_p in pow_dic[powamp_meta]:
|
||||||
status = STATE_VAL.ERROR
|
if i_p >= POWER_THRESHOLD:
|
||||||
else:
|
count_above_threshold += 1
|
||||||
i_powapm.value0 = pow_dic[powamp_meta]
|
status = STATE_VAL.GOOD if count_above_threshold >= 3 else STATE_VAL.ERROR
|
||||||
for i_p in pow_dic[powamp_meta]:
|
i_node_temperature.state = status
|
||||||
if i_p < POWER_THRESHOLD:
|
|
||||||
status = STATE_VAL.ERROR
|
|
||||||
i_powapm.state = status
|
|
||||||
|
|
||||||
|
|
||||||
func on_press_device() -> void:
|
func on_press_device() -> void:
|
||||||
@@ -107,26 +107,20 @@ func on_press_device() -> void:
|
|||||||
var dou_6: Node = $dou6_A7
|
var dou_6: Node = $dou6_A7
|
||||||
var module_fs_7: Node = $kasseta_fs_kd/ref_A7
|
var module_fs_7: Node = $kasseta_fs_kd/ref_A7
|
||||||
var dou_7: Node = $dou7_A8
|
var dou_7: Node = $dou7_A8
|
||||||
|
var control_data: Dictionary = unit_prd_k.get_control_results()
|
||||||
var for_control_result: Dictionary = {
|
var for_control_result: Dictionary = {
|
||||||
'control_is_over': unit_prd_k.flag_control_is_over,
|
|
||||||
'result_dic': unit_prd_k.control_results,
|
|
||||||
'power_dic': unit_prd_k.power_result,
|
|
||||||
'block_kasseta_y5_config': unit_prd_k.block_kasseta_y5_config,
|
|
||||||
'block_ip_config': unit_prd_k.block_ip_config,
|
|
||||||
'temperature_um' : unit_prd_k.temperature_um,
|
|
||||||
'nodes_y5': nodes_y5,
|
'nodes_y5': nodes_y5,
|
||||||
'node_ip_power_arr': node_ip_power_arr,
|
'node_ip_power_arr': node_ip_power_arr,
|
||||||
'fs_nodes': fs_nodes,
|
'fs_nodes': fs_nodes,
|
||||||
'power_amplifier': power_amplifier,
|
'power_amplifier': power_amplifier,
|
||||||
'default_reset_array_node': default_reset_array_node,
|
'default_reset_array_node': default_reset_array_node,
|
||||||
'POWER_THRESHOLD': unit_prd_k.constants.POWER_THRESHOLD,
|
|
||||||
'name_prd': unit_prd_k.self_name,
|
|
||||||
'module_fs_1': module_fs_1,
|
'module_fs_1': module_fs_1,
|
||||||
'module_fs_6': module_fs_6,
|
'module_fs_6': module_fs_6,
|
||||||
'dou_6': dou_6,
|
'dou_6': dou_6,
|
||||||
'module_fs_7': module_fs_7,
|
'module_fs_7': module_fs_7,
|
||||||
'dou_7': dou_7,
|
'dou_7': dou_7,
|
||||||
}
|
}
|
||||||
|
for_control_result.merge(control_data, true)
|
||||||
on_control_result(for_control_result)
|
on_control_result(for_control_result)
|
||||||
|
|
||||||
|
|
||||||
@@ -140,14 +134,16 @@ static func on_control_result(for_result_dic: Dictionary) -> void:
|
|||||||
if block_kasseta_y5_prd_config_k.has(meta_y5):
|
if block_kasseta_y5_prd_config_k.has(meta_y5):
|
||||||
if not block_kasseta_y5_prd_config_k['yau07']:
|
if not block_kasseta_y5_prd_config_k['yau07']:
|
||||||
node_y5.state = STATE_VAL.ERROR if meta_y5 == 'yau07' else STATE_VAL.NONE
|
node_y5.state = STATE_VAL.ERROR if meta_y5 == 'yau07' else STATE_VAL.NONE
|
||||||
break
|
else:
|
||||||
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_k[meta_y5] else STATE_VAL.ERROR
|
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_k[meta_y5] else STATE_VAL.ERROR
|
||||||
|
|
||||||
var block_ip_config_k: Dictionary = for_result_dic.block_ip_config
|
var block_ip_config_k: Dictionary = for_result_dic.block_ip_config
|
||||||
for power_supply in for_result_dic.node_ip_power_arr:
|
for power_supply in for_result_dic.node_ip_power_arr:
|
||||||
var meta_ip = power_supply.get_meta('ip')
|
var meta_ip = power_supply.get_meta('ip')
|
||||||
if block_ip_config_k.has(meta_ip) and block_kasseta_y5_prd_config_k.ug:
|
if block_ip_config_k.has(meta_ip) and block_kasseta_y5_prd_config_k.ug and block_kasseta_y5_prd_config_k.yau07:
|
||||||
power_supply.state = STATE_VAL.GOOD if block_ip_config_k[meta_ip][1] else STATE_VAL.ERROR
|
power_supply.state = STATE_VAL.GOOD if block_ip_config_k[meta_ip][1] else STATE_VAL.ERROR
|
||||||
|
else:
|
||||||
|
power_supply.state = STATE_VAL.NONE
|
||||||
|
|
||||||
if not for_result_dic.control_is_over:
|
if not for_result_dic.control_is_over:
|
||||||
set_default_state(for_result_dic.default_reset_array_node, for_result_dic.power_amplifier)
|
set_default_state(for_result_dic.default_reset_array_node, for_result_dic.power_amplifier)
|
||||||
@@ -172,12 +168,6 @@ static func on_control_result(for_result_dic: Dictionary) -> void:
|
|||||||
if block_kasseta_y5_prd_config_k['yau07']:
|
if block_kasseta_y5_prd_config_k['yau07']:
|
||||||
power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD)
|
power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD)
|
||||||
|
|
||||||
var result: bool = true
|
|
||||||
for device in result_dic.values():
|
|
||||||
if not device:
|
|
||||||
result = false
|
|
||||||
log.message(Logger.INFO, 'Прибор ПРД-%s %s' % [for_result_dic.name_prd, ['неисправен', 'исправен'][int(result)]])
|
|
||||||
|
|
||||||
|
|
||||||
func find_labels(node1: Node):
|
func find_labels(node1: Node):
|
||||||
if node1 is Label:
|
if node1 is Label:
|
||||||
@@ -193,3 +183,22 @@ func find_labels(node1: Node):
|
|||||||
node1.set_meta("tooltip_set", true)
|
node1.set_meta("tooltip_set", true)
|
||||||
for child in node1.get_children():
|
for child in node1.get_children():
|
||||||
find_labels(child)
|
find_labels(child)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_status_updated(status_text: String) -> void:
|
||||||
|
_update_status_text(status_text)
|
||||||
|
|
||||||
|
|
||||||
|
func _update_status_text(text: String) -> void:
|
||||||
|
$control_result.text = text
|
||||||
|
# Можно добавить смену цвета в зависимости от статуса
|
||||||
|
if "Ошибка" in text or "неисправен" in text:
|
||||||
|
$control_result.add_theme_color_override('font_color', Color.RED)
|
||||||
|
log.message(Logger.INFO, 'Прибор ПРД-%s неисправен' % [unit_prd_k.self_name])
|
||||||
|
elif "Ограничена" in text or "Предупреждение" in text:
|
||||||
|
$control_result.add_theme_color_override('font_color', Color.YELLOW)
|
||||||
|
elif "исправен" in text or "завершён" in text:
|
||||||
|
$control_result.add_theme_color_override('font_color', Color.GREEN)
|
||||||
|
log.message(Logger.INFO, 'Прибор ПРД-%s исправен' % [unit_prd_k.self_name])
|
||||||
|
else:
|
||||||
|
$control_result.add_theme_color_override('font_color', Color.WHITE)
|
||||||
|
|||||||
@@ -338,33 +338,27 @@ offset_right = 524.0
|
|||||||
offset_bottom = 666.0
|
offset_bottom = 666.0
|
||||||
fname = "Кассета П-2"
|
fname = "Кассета П-2"
|
||||||
|
|
||||||
[node name="input_0" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="input_0" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(392, 472)
|
position = Vector2(392, 472)
|
||||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||||
|
|
||||||
[node name="input_1" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="input_1" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(444, 472)
|
position = Vector2(444, 472)
|
||||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||||
|
|
||||||
[node name="input_2" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="input_2" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(294, 473)
|
position = Vector2(294, 473)
|
||||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||||
|
|
||||||
[node name="output_0" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="output_0" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(394, 318)
|
position = Vector2(394, 318)
|
||||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||||
|
|
||||||
[node name="output_1" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="output_1" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(444, 318)
|
position = Vector2(444, 318)
|
||||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||||
|
|
||||||
[node name="output_2" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="output_2" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(294, 318)
|
position = Vector2(294, 318)
|
||||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ func _ready() -> void:
|
|||||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||||
for temp in power_amplifier:
|
for temp in power_amplifier:
|
||||||
temp.value1 = -70
|
temp.value1 = -70
|
||||||
|
# Подписываемся на сигналы
|
||||||
unit_prd_n.connect('control_is_over', Callable(self, 'on_press_device'))
|
unit_prd_n.connect('control_is_over', Callable(self, 'on_press_device'))
|
||||||
|
unit_prd_n.connect('status_updated', Callable(self, '_on_status_updated'))
|
||||||
|
# Устанавливаем начальный статус
|
||||||
|
_update_status_text(unit_prd_n.get_current_status())
|
||||||
start_control()
|
start_control()
|
||||||
on_press_device()
|
on_press_device()
|
||||||
|
|
||||||
@@ -25,10 +29,10 @@ func _ready() -> void:
|
|||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
if Engine.is_editor_hint():
|
if Engine.is_editor_hint():
|
||||||
return
|
return
|
||||||
set_frame($input_0, unit_prd_n.ems_input_1)
|
set_frame($input_0, unit_prd_n.ems_g_sock_dic.ems_input_1)
|
||||||
set_frame($input_1, unit_prd_n.ems_input_2)
|
set_frame($input_1, unit_prd_n.ems_g_sock_dic.ems_input_2)
|
||||||
set_frame($output_0, unit_prd_n.ems_output_1)
|
set_frame($output_0, unit_prd_n.ems_g_sock_dic.ems_output_1)
|
||||||
set_frame($output_1, unit_prd_n.ems_output_2)
|
set_frame($output_1, unit_prd_n.ems_g_sock_dic.ems_output_2)
|
||||||
|
|
||||||
|
|
||||||
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
|
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
|
||||||
@@ -50,8 +54,8 @@ static func set_default_state(default_reset_array_node: Array, power_amplifier_a
|
|||||||
func _enter_tree() -> void:
|
func _enter_tree() -> void:
|
||||||
if Engine.is_editor_hint():
|
if Engine.is_editor_hint():
|
||||||
return
|
return
|
||||||
$control_result.text = 'Ожидается запуск контроля ...' # TODO: Необходимо сделать пулл сообщений
|
if unit_prd_n:
|
||||||
$control_result.add_theme_color_override('font_color', Color.ALICE_BLUE)
|
_update_status_text(unit_prd_n.get_current_status())
|
||||||
|
|
||||||
|
|
||||||
func _exit_tree() -> void:
|
func _exit_tree() -> void:
|
||||||
@@ -64,7 +68,7 @@ static func temperature_fill(temperature_arr_node: Array, temperature_dic: Dicti
|
|||||||
for i_node_temperature in temperature_arr_node:
|
for i_node_temperature in temperature_arr_node:
|
||||||
var temperature_meta: String = i_node_temperature.get_meta('um')
|
var temperature_meta: String = i_node_temperature.get_meta('um')
|
||||||
if not temperature_dic.has(temperature_meta): return
|
if not temperature_dic.has(temperature_meta): return
|
||||||
i_node_temperature.value1 = temperature_dic[temperature_meta]
|
i_node_temperature.value1 = temperature_dic[temperature_meta] if temperature_dic[temperature_meta] < 361 else -40
|
||||||
|
|
||||||
|
|
||||||
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier_arr_node: Array, POWER_THRESHOLD: int) -> void:
|
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier_arr_node: Array, POWER_THRESHOLD: int) -> void:
|
||||||
@@ -75,9 +79,12 @@ static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifi
|
|||||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_2: return
|
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_2: return
|
||||||
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_3: return
|
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_3: return
|
||||||
i_node_powapm.value0 = pow_dic[powamp_meta]
|
i_node_powapm.value0 = pow_dic[powamp_meta]
|
||||||
|
var count_above_threshold = 0
|
||||||
for i_p in pow_dic[powamp_meta]:
|
for i_p in pow_dic[powamp_meta]:
|
||||||
if i_p < POWER_THRESHOLD:
|
if i_p >= POWER_THRESHOLD:
|
||||||
status = STATE_VAL.ERROR
|
count_above_threshold += 1
|
||||||
|
|
||||||
|
status = STATE_VAL.GOOD if count_above_threshold >= 3 else STATE_VAL.ERROR
|
||||||
i_node_powapm.state = status
|
i_node_powapm.state = status
|
||||||
|
|
||||||
|
|
||||||
@@ -91,25 +98,19 @@ func on_press_device() -> void:
|
|||||||
var dou_2: Node = $dou2_A5
|
var dou_2: Node = $dou2_A5
|
||||||
var module_fs_3: Node = $kasseta_FS_ND/ref_A3
|
var module_fs_3: Node = $kasseta_FS_ND/ref_A3
|
||||||
var dou_3: Node = $dou3_A6
|
var dou_3: Node = $dou3_A6
|
||||||
|
var control_data: Dictionary = unit_prd_n.get_control_results()
|
||||||
var for_control_result: Dictionary = {
|
var for_control_result: Dictionary = {
|
||||||
'control_is_over': unit_prd_n.flag_control_is_over,
|
|
||||||
'result_dic': unit_prd_n.control_results,
|
|
||||||
'power_dic': unit_prd_n.power_result,
|
|
||||||
'block_kasseta_y5_config': unit_prd_n.block_kasseta_y5_config,
|
|
||||||
'block_ip_config': unit_prd_n.block_ip_config,
|
|
||||||
'temperature_um' : unit_prd_n.temperature_um,
|
|
||||||
'nodes_y5': nodes_y5,
|
'nodes_y5': nodes_y5,
|
||||||
'node_ip_power_arr': node_ip_power_arr,
|
'node_ip_power_arr': node_ip_power_arr,
|
||||||
'fs_nodes': fs_nodes,
|
'fs_nodes': fs_nodes,
|
||||||
'power_amplifier': power_amplifier_arr_node,
|
'power_amplifier': power_amplifier_arr_node,
|
||||||
'default_reset_array_node': default_reset_array_node,
|
'default_reset_array_node': default_reset_array_node,
|
||||||
'POWER_THRESHOLD': unit_prd_n.constants.POWER_THRESHOLD,
|
|
||||||
'name_prd': unit_prd_n.self_name,
|
|
||||||
'module_fs_2': module_fs_2,
|
'module_fs_2': module_fs_2,
|
||||||
'dou_2': dou_2,
|
'dou_2': dou_2,
|
||||||
'module_fs_3': module_fs_3,
|
'module_fs_3': module_fs_3,
|
||||||
'dou_3': dou_3,
|
'dou_3': dou_3,
|
||||||
}
|
}
|
||||||
|
for_control_result.merge(control_data, true)
|
||||||
on_control_result(for_control_result)
|
on_control_result(for_control_result)
|
||||||
|
|
||||||
|
|
||||||
@@ -121,16 +122,18 @@ static func on_control_result(for_result_dic: Dictionary) -> void:
|
|||||||
for node_y5 in nodes_y5:
|
for node_y5 in nodes_y5:
|
||||||
var meta_y5 = node_y5.get_meta('y5')
|
var meta_y5 = node_y5.get_meta('y5')
|
||||||
if block_kasseta_y5_prd_config_n.has(meta_y5):
|
if block_kasseta_y5_prd_config_n.has(meta_y5):
|
||||||
if not block_kasseta_y5_prd_config_n['yau07']:
|
if not block_kasseta_y5_prd_config_n.yau07:
|
||||||
node_y5.state = STATE_VAL.ERROR if meta_y5 == 'yau07' else STATE_VAL.NONE
|
node_y5.state = STATE_VAL.ERROR if meta_y5 == 'yau07' else STATE_VAL.NONE
|
||||||
break
|
else:
|
||||||
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_n[meta_y5] else STATE_VAL.ERROR
|
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_n[meta_y5] else STATE_VAL.ERROR
|
||||||
|
|
||||||
var block_ip_config_n: Dictionary = for_result_dic.block_ip_config
|
var block_ip_config_n: Dictionary = for_result_dic.block_ip_config
|
||||||
for power_supply in for_result_dic.node_ip_power_arr:
|
for power_supply in for_result_dic.node_ip_power_arr:
|
||||||
var meta_ip = power_supply.get_meta('ip')
|
var meta_ip = power_supply.get_meta('ip')
|
||||||
if block_ip_config_n.has(meta_ip) and block_kasseta_y5_prd_config_n.ug:
|
if block_ip_config_n.has(meta_ip) and block_kasseta_y5_prd_config_n.ug and block_kasseta_y5_prd_config_n.yau07:
|
||||||
power_supply.state = STATE_VAL.GOOD if block_ip_config_n[meta_ip][1] else STATE_VAL.ERROR
|
power_supply.state = STATE_VAL.GOOD if block_ip_config_n[meta_ip][1] else STATE_VAL.ERROR
|
||||||
|
else:
|
||||||
|
power_supply.state = STATE_VAL.NONE
|
||||||
|
|
||||||
if not for_result_dic.control_is_over:
|
if not for_result_dic.control_is_over:
|
||||||
set_default_state(for_result_dic.default_reset_array_node, for_result_dic.power_amplifier)
|
set_default_state(for_result_dic.default_reset_array_node, for_result_dic.power_amplifier)
|
||||||
@@ -151,12 +154,6 @@ static func on_control_result(for_result_dic: Dictionary) -> void:
|
|||||||
|
|
||||||
if block_kasseta_y5_prd_config_n['yau07']:
|
if block_kasseta_y5_prd_config_n['yau07']:
|
||||||
power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD)
|
power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD)
|
||||||
var result: bool = true
|
|
||||||
for device in result_dic.values():
|
|
||||||
if not device:
|
|
||||||
result = false
|
|
||||||
|
|
||||||
log.message(Logger.INFO, 'Прибор ПРД-%s %s' % [for_result_dic.name_prd, ['неисправен', 'исправен'][int(result)]])
|
|
||||||
|
|
||||||
|
|
||||||
func find_labels(node1: Node):
|
func find_labels(node1: Node):
|
||||||
@@ -173,3 +170,22 @@ func find_labels(node1: Node):
|
|||||||
node1.set_meta("tooltip_set", true)
|
node1.set_meta("tooltip_set", true)
|
||||||
for child in node1.get_children():
|
for child in node1.get_children():
|
||||||
find_labels(child)
|
find_labels(child)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_status_updated(status_text: String) -> void:
|
||||||
|
_update_status_text(status_text)
|
||||||
|
|
||||||
|
|
||||||
|
func _update_status_text(text: String) -> void:
|
||||||
|
$control_result.text = text
|
||||||
|
# Можно добавить смену цвета в зависимости от статуса
|
||||||
|
if "Ошибка" in text or "неисправен" in text:
|
||||||
|
$control_result.add_theme_color_override('font_color', Color.RED)
|
||||||
|
log.message(Logger.INFO, 'Прибор ПРД-%s неисправен' % [unit_prd_n.self_name])
|
||||||
|
elif "Ограничена" in text or "Предупреждение" in text:
|
||||||
|
$control_result.add_theme_color_override('font_color', Color.YELLOW)
|
||||||
|
elif "исправен" in text or "завершён" in text:
|
||||||
|
$control_result.add_theme_color_override('font_color', Color.GREEN)
|
||||||
|
log.message(Logger.INFO, 'Прибор ПРД-%s исправен' % [unit_prd_n.self_name])
|
||||||
|
else:
|
||||||
|
$control_result.add_theme_color_override('font_color', Color.WHITE)
|
||||||
|
|||||||
@@ -446,23 +446,19 @@ theme_override_font_sizes/font_size = 22
|
|||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="input_0" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="input_0" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(495, 443)
|
position = Vector2(495, 443)
|
||||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||||
|
|
||||||
[node name="input_1" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="input_1" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(246, 440)
|
position = Vector2(246, 440)
|
||||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||||
|
|
||||||
[node name="output_0" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="output_0" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(497, 330)
|
position = Vector2(497, 330)
|
||||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||||
|
|
||||||
[node name="output_1" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="output_1" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(249, 331)
|
position = Vector2(249, 331)
|
||||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||||
|
|
||||||
|
|||||||
@@ -17,17 +17,21 @@ func _ready() -> void:
|
|||||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||||
for temp in power_amplifier:
|
for temp in power_amplifier:
|
||||||
temp.value1 = -70
|
temp.value1 = -70
|
||||||
|
# Подписываемся на сигналы
|
||||||
unit_prd_v.connect('control_is_over', Callable(self, 'on_press_device'))
|
unit_prd_v.connect('control_is_over', Callable(self, 'on_press_device'))
|
||||||
|
unit_prd_v.connect('status_updated', Callable(self, '_on_status_updated'))
|
||||||
|
# Устанавливаем начальный статус
|
||||||
|
_update_status_text(unit_prd_v.get_current_status())
|
||||||
on_press_device()
|
on_press_device()
|
||||||
|
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
if Engine.is_editor_hint():
|
if Engine.is_editor_hint():
|
||||||
return
|
return
|
||||||
set_frame($input_0, unit_prd_v.ems_input_1)
|
set_frame($input_0, unit_prd_v.ems_g_sock_dic.ems_input_1)
|
||||||
set_frame($input_1, unit_prd_v.ems_input_2)
|
set_frame($input_1, unit_prd_v.ems_g_sock_dic.ems_input_2)
|
||||||
set_frame($output_0, unit_prd_v.ems_output_1)
|
set_frame($output_0, unit_prd_v.ems_g_sock_dic.ems_output_1)
|
||||||
set_frame($output_1, unit_prd_v.ems_output_2)
|
set_frame($output_1, unit_prd_v.ems_g_sock_dic.ems_output_2)
|
||||||
|
|
||||||
|
|
||||||
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
|
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
|
||||||
@@ -49,8 +53,8 @@ static func set_default_state(default_reset_array_node: Array, power_amplifier_a
|
|||||||
func _enter_tree() -> void:
|
func _enter_tree() -> void:
|
||||||
if Engine.is_editor_hint():
|
if Engine.is_editor_hint():
|
||||||
return
|
return
|
||||||
$control_result.text = 'Ожидается запуск контроля ...' # TODO: Необходимо сделать пулл сообщений
|
if unit_prd_v:
|
||||||
$control_result.add_theme_color_override('font_color', Color.ALICE_BLUE)
|
_update_status_text(unit_prd_v.get_current_status())
|
||||||
|
|
||||||
|
|
||||||
func _exit_tree() -> void:
|
func _exit_tree() -> void:
|
||||||
@@ -63,24 +67,24 @@ static func temperature_fill(temperature_arr_node: Array, temperature_dic: Dicti
|
|||||||
for i_node_temperature in temperature_arr_node:
|
for i_node_temperature in temperature_arr_node:
|
||||||
var temperature_meta: String = i_node_temperature.get_meta('um')
|
var temperature_meta: String = i_node_temperature.get_meta('um')
|
||||||
if not temperature_dic.has(temperature_meta): return
|
if not temperature_dic.has(temperature_meta): return
|
||||||
i_node_temperature.value1 = temperature_dic[temperature_meta]
|
i_node_temperature.value1 = temperature_dic[temperature_meta] if temperature_dic[temperature_meta] < 361 else -40
|
||||||
|
|
||||||
|
|
||||||
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier: Array, POWER_THRESHOLD: int) -> void:
|
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier_arr_node: Array, POWER_THRESHOLD: int) -> void:
|
||||||
for i_powapm in power_amplifier:
|
for i_node_powapm in power_amplifier_arr_node:
|
||||||
var powamp_meta: String = i_powapm.get_meta('um')
|
var powamp_meta: String = i_node_powapm.get_meta('um')
|
||||||
var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE
|
var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE
|
||||||
if not pow_dic.has(powamp_meta): return
|
if not pow_dic.has(powamp_meta): return
|
||||||
if pow_dic[powamp_meta].size() < 6:
|
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_4: return
|
||||||
status = STATE_VAL.ERROR
|
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_5: return
|
||||||
else:
|
i_node_powapm.value0 = pow_dic[powamp_meta]
|
||||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_4: return
|
var count_above_threshold = 0
|
||||||
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_5: return
|
for i_p in pow_dic[powamp_meta]:
|
||||||
i_powapm.value0 = pow_dic[powamp_meta]
|
if i_p >= POWER_THRESHOLD:
|
||||||
for i_p in pow_dic[powamp_meta]:
|
count_above_threshold += 1
|
||||||
if i_p < POWER_THRESHOLD:
|
|
||||||
status = STATE_VAL.ERROR
|
status = STATE_VAL.GOOD if count_above_threshold >= 3 else STATE_VAL.ERROR
|
||||||
i_powapm.state = status
|
i_node_powapm.state = status
|
||||||
|
|
||||||
|
|
||||||
func on_press_device() -> void:
|
func on_press_device() -> void:
|
||||||
@@ -93,25 +97,19 @@ func on_press_device() -> void:
|
|||||||
var dou_4: Node = $dou4_A5
|
var dou_4: Node = $dou4_A5
|
||||||
var module_fs_5: Node = $kasseta_FS_VD/ref_A2
|
var module_fs_5: Node = $kasseta_FS_VD/ref_A2
|
||||||
var dou_5: Node = $dou5_A6
|
var dou_5: Node = $dou5_A6
|
||||||
|
var control_data = unit_prd_v.get_control_results()
|
||||||
var for_control_result: Dictionary = {
|
var for_control_result: Dictionary = {
|
||||||
'control_is_over': unit_prd_v.flag_control_is_over,
|
|
||||||
'result_dic': unit_prd_v.control_results,
|
|
||||||
'power_dic': unit_prd_v.power_result,
|
|
||||||
'block_kasseta_y5_config': unit_prd_v.block_kasseta_y5_config,
|
|
||||||
'block_ip_config': unit_prd_v.block_ip_config,
|
|
||||||
'temperature_um' : unit_prd_v.temperature_um,
|
|
||||||
'nodes_y5': nodes_y5,
|
'nodes_y5': nodes_y5,
|
||||||
'node_ip_power_arr': node_ip_power_arr,
|
'node_ip_power_arr': node_ip_power_arr,
|
||||||
'fs_nodes': fs_nodes,
|
'fs_nodes': fs_nodes,
|
||||||
'power_amplifier': power_amplifier,
|
'power_amplifier': power_amplifier,
|
||||||
'default_reset_array_node': default_reset_array_node,
|
'default_reset_array_node': default_reset_array_node,
|
||||||
'POWER_THRESHOLD': unit_prd_v.constants.POWER_THRESHOLD,
|
|
||||||
'name_prd': unit_prd_v.self_name,
|
|
||||||
'module_fs_4': module_fs_4,
|
'module_fs_4': module_fs_4,
|
||||||
'dou_4': dou_4,
|
'dou_4': dou_4,
|
||||||
'module_fs_5': module_fs_5,
|
'module_fs_5': module_fs_5,
|
||||||
'dou_5': dou_5,
|
'dou_5': dou_5,
|
||||||
}
|
}
|
||||||
|
for_control_result.merge(control_data, true)
|
||||||
on_control_result(for_control_result)
|
on_control_result(for_control_result)
|
||||||
|
|
||||||
|
|
||||||
@@ -123,16 +121,18 @@ static func on_control_result(for_result_dic: Dictionary) -> void:
|
|||||||
for node_y5 in nodes_y5:
|
for node_y5 in nodes_y5:
|
||||||
var meta_y5 = node_y5.get_meta('y5')
|
var meta_y5 = node_y5.get_meta('y5')
|
||||||
if block_kasseta_y5_prd_config_v.has(meta_y5):
|
if block_kasseta_y5_prd_config_v.has(meta_y5):
|
||||||
if block_kasseta_y5_prd_config_v['yau07'] == false:
|
if not block_kasseta_y5_prd_config_v.yau07:
|
||||||
node_y5.state = STATE_VAL.ERROR if meta_y5 == 'yau07' else STATE_VAL.NONE
|
node_y5.state = STATE_VAL.ERROR if meta_y5 == 'yau07' else STATE_VAL.NONE
|
||||||
break
|
else:
|
||||||
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_v[meta_y5] else STATE_VAL.ERROR
|
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_v[meta_y5] else STATE_VAL.ERROR
|
||||||
|
|
||||||
var block_ip_config_v: Dictionary = for_result_dic.block_ip_config
|
var block_ip_config_v: Dictionary = for_result_dic.block_ip_config
|
||||||
for power_supply in for_result_dic.node_ip_power_arr:
|
for power_supply in for_result_dic.node_ip_power_arr:
|
||||||
var meta_ip = power_supply.get_meta('ip')
|
var meta_ip = power_supply.get_meta('ip')
|
||||||
if block_ip_config_v.has(meta_ip) and block_kasseta_y5_prd_config_v.ug:
|
if block_ip_config_v.has(meta_ip) and block_kasseta_y5_prd_config_v.ug and block_kasseta_y5_prd_config_v.yau07:
|
||||||
power_supply.state = STATE_VAL.GOOD if block_ip_config_v[meta_ip][1] else STATE_VAL.ERROR
|
power_supply.state = STATE_VAL.GOOD if block_ip_config_v[meta_ip][1] else STATE_VAL.ERROR
|
||||||
|
else:
|
||||||
|
power_supply.state = STATE_VAL.NONE
|
||||||
|
|
||||||
if not for_result_dic.control_is_over:
|
if not for_result_dic.control_is_over:
|
||||||
set_default_state(for_result_dic.default_reset_array_node, for_result_dic.power_amplifier)
|
set_default_state(for_result_dic.default_reset_array_node, for_result_dic.power_amplifier)
|
||||||
@@ -154,13 +154,6 @@ static func on_control_result(for_result_dic: Dictionary) -> void:
|
|||||||
if block_kasseta_y5_prd_config_v['yau07']:
|
if block_kasseta_y5_prd_config_v['yau07']:
|
||||||
power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD)
|
power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD)
|
||||||
|
|
||||||
var result: bool = true
|
|
||||||
for device in result_dic.values():
|
|
||||||
if not device:
|
|
||||||
result = false
|
|
||||||
|
|
||||||
log.message(Logger.INFO, 'Прибор ПРД-%s %s' % [for_result_dic.name_prd, ['неисправен', 'исправен'][int(result)]])
|
|
||||||
|
|
||||||
|
|
||||||
func find_labels(node1: Node):
|
func find_labels(node1: Node):
|
||||||
if node1 is Label:
|
if node1 is Label:
|
||||||
@@ -176,3 +169,22 @@ func find_labels(node1: Node):
|
|||||||
node1.set_meta("tooltip_set", true)
|
node1.set_meta("tooltip_set", true)
|
||||||
for child in node1.get_children():
|
for child in node1.get_children():
|
||||||
find_labels(child)
|
find_labels(child)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_status_updated(status_text: String) -> void:
|
||||||
|
_update_status_text(status_text)
|
||||||
|
|
||||||
|
|
||||||
|
func _update_status_text(text: String) -> void:
|
||||||
|
$control_result.text = text
|
||||||
|
# Можно добавить смену цвета в зависимости от статуса
|
||||||
|
if "Ошибка" in text or "неисправен" in text:
|
||||||
|
$control_result.add_theme_color_override('font_color', Color.RED)
|
||||||
|
log.message(Logger.INFO, 'Прибор ПРД-%s неисправен' % [unit_prd_v.self_name])
|
||||||
|
elif "Ограничена" in text or "Предупреждение" in text:
|
||||||
|
$control_result.add_theme_color_override('font_color', Color.YELLOW)
|
||||||
|
elif "исправен" in text or "завершён" in text:
|
||||||
|
$control_result.add_theme_color_override('font_color', Color.GREEN)
|
||||||
|
log.message(Logger.INFO, 'Прибор ПРД-%s исправен' % [unit_prd_v.self_name])
|
||||||
|
else:
|
||||||
|
$control_result.add_theme_color_override('font_color', Color.WHITE)
|
||||||
|
|||||||
@@ -385,23 +385,19 @@ value0_info = "Мощность"
|
|||||||
value1_info = "Температура,°C"
|
value1_info = "Температура,°C"
|
||||||
metadata/um = "um_14"
|
metadata/um = "um_14"
|
||||||
|
|
||||||
[node name="input_0" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="input_0" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(496, 440)
|
position = Vector2(496, 440)
|
||||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||||
|
|
||||||
[node name="input_1" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="input_1" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(248, 440)
|
position = Vector2(248, 440)
|
||||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||||
|
|
||||||
[node name="output_0" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="output_0" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(496, 336)
|
position = Vector2(496, 336)
|
||||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||||
|
|
||||||
[node name="output_1" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
[node name="output_1" type="AnimatedSprite2D" parent="."]
|
||||||
visible = false
|
|
||||||
position = Vector2(248, 336)
|
position = Vector2(248, 336)
|
||||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ func status_uf() -> void:
|
|||||||
$lbl_header2.text = 'Прибор исправен'
|
$lbl_header2.text = 'Прибор исправен'
|
||||||
$lbl_header2.modulate = Color.GREEN
|
$lbl_header2.modulate = Color.GREEN
|
||||||
else:
|
else:
|
||||||
$lbl_header2.text = 'Прибор не исправен'
|
$lbl_header2.text = 'Прибор неисправен'
|
||||||
$lbl_header2.modulate = Color.RED
|
$lbl_header2.modulate = Color.RED
|
||||||
$lbl_header2.visible = true
|
$lbl_header2.visible = true
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ func _stop_pulse():
|
|||||||
pulsing = false
|
pulsing = false
|
||||||
disabled = false
|
disabled = false
|
||||||
text = original_text
|
text = original_text
|
||||||
|
tooltip_text = ''
|
||||||
|
|
||||||
|
|
||||||
func _on_status_change():
|
func _on_status_change():
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ textures = [ExtResource("1_n1aqt"), ExtResource("2_rim3u"), ExtResource("3_3w8fg
|
|||||||
value0 = [20.0, 30.0, 40.0, 50.0, 60.0, 70.0]
|
value0 = [20.0, 30.0, 40.0, 50.0, 60.0, 70.0]
|
||||||
min_value1 = -40.0
|
min_value1 = -40.0
|
||||||
max_value0 = 1400.0
|
max_value0 = 1400.0
|
||||||
max_value1 = 60.0
|
max_value1 = 55.0
|
||||||
step0 = 1.0
|
step0 = 1.0
|
||||||
step1 = 1.0
|
step1 = 1.0
|
||||||
value_name0 = "P,%"
|
value_name0 = "P,%"
|
||||||
@@ -476,10 +476,10 @@ size_flags_horizontal = 3
|
|||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
tooltip_text = "
|
tooltip_text = "
|
||||||
Текущее: 0.00
|
Текущее: 0.00
|
||||||
Диапазон: -40.00…70.00"
|
Диапазон: -40.00…60.00"
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
min_value = -40.0
|
min_value = -40.0
|
||||||
max_value = 60.0
|
max_value = 55.0
|
||||||
fill_mode = 3
|
fill_mode = 3
|
||||||
nine_patch_stretch = true
|
nine_patch_stretch = true
|
||||||
stretch_margin_left = 8
|
stretch_margin_left = 8
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ signal pressed(control: PanelContainer)
|
|||||||
if not is_inside_tree():
|
if not is_inside_tree():
|
||||||
return
|
return
|
||||||
$margin/vbox/grid1/level7.value = v
|
$margin/vbox/grid1/level7.value = v
|
||||||
$margin/vbox/grid1/level7.tint_progress = Color.RED if v >= 70 else Color.GOLD if v >= 60 else Color.WHITE
|
$margin/vbox/grid1/level7.tint_progress = Color.RED if v >= 50 else Color.GOLD if v >= 40 else Color.WHITE
|
||||||
|
|
||||||
|
|
||||||
@export var min_value0: float:
|
@export var min_value0: float:
|
||||||
@@ -262,7 +262,7 @@ value0 = [20.0, 30.0, 40.0, 50.0, 60.0, 70.0]
|
|||||||
value1 = -40.0
|
value1 = -40.0
|
||||||
min_value1 = -40.0
|
min_value1 = -40.0
|
||||||
max_value0 = 1400.0
|
max_value0 = 1400.0
|
||||||
max_value1 = 60.0
|
max_value1 = 55.0
|
||||||
step0 = 1.0
|
step0 = 1.0
|
||||||
step1 = 1.0
|
step1 = 1.0
|
||||||
value_name0 = "P,%"
|
value_name0 = "P,%"
|
||||||
@@ -366,10 +366,10 @@ size_flags_horizontal = 3
|
|||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
tooltip_text = "
|
tooltip_text = "
|
||||||
Текущее: -40.00
|
Текущее: -40.00
|
||||||
Диапазон: -40.00…70.00"
|
Диапазон: -40.00…60.00"
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
min_value = -40.0
|
min_value = -40.0
|
||||||
max_value = 60.0
|
max_value = 55.0
|
||||||
value = -40.0
|
value = -40.0
|
||||||
fill_mode = 3
|
fill_mode = 3
|
||||||
nine_patch_stretch = true
|
nine_patch_stretch = true
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ var ctl_btn_state := false
|
|||||||
|
|
||||||
func on_line_changed(u, conn_node, _pribor_meta): conn_node.set_val(u.online)
|
func on_line_changed(u, conn_node, _pribor_meta): conn_node.set_val(u.online)
|
||||||
func on_serv_changed(u, pribor_node, _pribor_meta): pribor_node.state = int(u.serviceability)
|
func on_serv_changed(u, pribor_node, _pribor_meta): pribor_node.state = int(u.serviceability)
|
||||||
|
var count_device_control_is_ready: int = 0
|
||||||
|
|
||||||
|
|
||||||
func on_mode_changed():
|
func on_mode_changed():
|
||||||
@@ -90,6 +91,7 @@ func _ready():
|
|||||||
prd_module.connect('update_serviceability', Callable(self, 'on_serviceability_changed').bind(prd_module, pribor_node))
|
prd_module.connect('update_serviceability', Callable(self, 'on_serviceability_changed').bind(prd_module, pribor_node))
|
||||||
prd_module.unit_control.connect('update_progress', Callable(self, 'on_update_progress').bind(pribor_node))
|
prd_module.unit_control.connect('update_progress', Callable(self, 'on_update_progress').bind(pribor_node))
|
||||||
prd_module.unit_control.connect('update_max_value_progress', Callable(self, 'on_update_max_value_progress').bind(pribor_node))
|
prd_module.unit_control.connect('update_max_value_progress', Callable(self, 'on_update_max_value_progress').bind(pribor_node))
|
||||||
|
prd_module.unit_control.connect('control_is_over', Callable(self, 'on_control_is_over').bind(prd_module.unit_control))
|
||||||
if item == 'уарэп-эмс':
|
if item == 'уарэп-эмс':
|
||||||
signaller.connect('update_uf_serviceability', Callable(self, 'on_update_uf_serviceability').bind(pribor_node))
|
signaller.connect('update_uf_serviceability', Callable(self, 'on_update_uf_serviceability').bind(pribor_node))
|
||||||
# Пиктограммы приборов, которые отображают состояние подключения только
|
# Пиктограммы приборов, которые отображают состояние подключения только
|
||||||
@@ -155,6 +157,7 @@ func on_update_uf_serviceability(uf_serviceaability: bool, uf_pribor: Node)-> vo
|
|||||||
|
|
||||||
|
|
||||||
func _on_control_prd_pressed() -> void:
|
func _on_control_prd_pressed() -> void:
|
||||||
|
count_device_control_is_ready = 0
|
||||||
signaller.emit_signal('start_contol_device')
|
signaller.emit_signal('start_contol_device')
|
||||||
|
|
||||||
|
|
||||||
@@ -167,6 +170,20 @@ func on_update_max_value_progress(max_value_progress: int, pribor_node: Node) ->
|
|||||||
pribor_node.progress_max_value = max_value_progress
|
pribor_node.progress_max_value = max_value_progress
|
||||||
|
|
||||||
|
|
||||||
|
func on_control_is_over(pribor_node: Node) -> void:
|
||||||
|
if pribor_node.self_name in ['1н', '2н', '3н', '4н', '1в', '2в', '3в', '4в', '1к', '2к', '3к', '4к',]:
|
||||||
|
count_device_control_is_ready += 1
|
||||||
|
if count_device_control_is_ready == 12:
|
||||||
|
var time_dict = Time.get_datetime_dict_from_system()
|
||||||
|
$control_prd.text = 'Контроль выполнен %02d:%02d/%02d.%02d' % [
|
||||||
|
time_dict.hour,
|
||||||
|
time_dict.minute,
|
||||||
|
time_dict.day,
|
||||||
|
time_dict.month]
|
||||||
|
$control_prd.disabled = false
|
||||||
|
$control_prd.tooltip_text = 'Нажать для повторного контроля '
|
||||||
|
|
||||||
|
|
||||||
func on_control_button_pressed(state: bool) -> void:
|
func on_control_button_pressed(state: bool) -> void:
|
||||||
ctl_btn_state = state
|
ctl_btn_state = state
|
||||||
update_pribor_items_visibility()
|
update_pribor_items_visibility()
|
||||||
@@ -194,9 +211,6 @@ animations = [{
|
|||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_lbx5w"]
|
|
||||||
bg_color = Color(0.6, 0.6, 0.6, 0)
|
|
||||||
|
|
||||||
[node name="Контроль" type="Panel"]
|
[node name="Контроль" type="Panel"]
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@@ -470,10 +484,12 @@ texture_normal = ExtResource("2_0nvm1")
|
|||||||
stretch_mode = 0
|
stretch_mode = 0
|
||||||
script = ExtResource("3_4pt7j")
|
script = ExtResource("3_4pt7j")
|
||||||
state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)]
|
state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)]
|
||||||
|
state = 1
|
||||||
metadata/unit_name = ["уарэп-эмс"]
|
metadata/unit_name = ["уарэп-эмс"]
|
||||||
metadata/online_proc = "on_line_changed"
|
metadata/online_proc = "on_line_changed"
|
||||||
|
|
||||||
[node name="label" type="Label" parent="pribor_uf"]
|
[node name="label" type="Label" parent="pribor_uf"]
|
||||||
|
self_modulate = Color(0, 1, 0, 1)
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 15.0
|
offset_left = 15.0
|
||||||
offset_top = -44.0
|
offset_top = -44.0
|
||||||
@@ -1700,24 +1716,15 @@ default_color = Color(1, 1, 1, 0.352941)
|
|||||||
|
|
||||||
[node name="control_prd" type="Button" parent="."]
|
[node name="control_prd" type="Button" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 1101.0
|
offset_left = 1043.0
|
||||||
offset_top = 64.0
|
offset_top = 64.0
|
||||||
offset_right = 1326.0
|
offset_right = 1390.0
|
||||||
offset_bottom = 104.0
|
offset_bottom = 104.0
|
||||||
focus_mode = 0
|
focus_mode = 0
|
||||||
text = "Запуск контроля"
|
text = "Запуск контроля"
|
||||||
script = ExtResource("18_lbx5w")
|
script = ExtResource("18_lbx5w")
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="check_debag" type="CheckButton" parent="."]
|
|
||||||
layout_mode = 0
|
|
||||||
offset_left = 1440.0
|
|
||||||
offset_top = 1137.0
|
|
||||||
offset_right = 1543.0
|
|
||||||
offset_bottom = 1164.0
|
|
||||||
theme_override_styles/focus = SubResource("StyleBoxFlat_lbx5w")
|
|
||||||
text = "Отладка"
|
|
||||||
|
|
||||||
[connection signal="toggled" from="pribor_prd_n_1" to="pribor_prd_n_1" method="_on_toggled"]
|
[connection signal="toggled" from="pribor_prd_n_1" to="pribor_prd_n_1" method="_on_toggled"]
|
||||||
[connection signal="toggled" from="pribor_uf" to="pribor_uf" method="_on_toggled"]
|
[connection signal="toggled" from="pribor_uf" to="pribor_uf" method="_on_toggled"]
|
||||||
[connection signal="toggled" from="pribor_rtr" to="pribor_rtr" method="_on_toggled"]
|
[connection signal="toggled" from="pribor_rtr" to="pribor_rtr" method="_on_toggled"]
|
||||||
@@ -1736,4 +1743,3 @@ text = "Отладка"
|
|||||||
[connection signal="toggled" from="pribor_prd_n_4" to="pribor_prd_n_4" method="_on_toggled"]
|
[connection signal="toggled" from="pribor_prd_n_4" to="pribor_prd_n_4" method="_on_toggled"]
|
||||||
[connection signal="toggled" from="pribor_prd_k_4" to="pribor_prd_k_4" method="_on_toggled"]
|
[connection signal="toggled" from="pribor_prd_k_4" to="pribor_prd_k_4" method="_on_toggled"]
|
||||||
[connection signal="pressed" from="control_prd" to="." method="_on_control_prd_pressed"]
|
[connection signal="pressed" from="control_prd" to="." method="_on_control_prd_pressed"]
|
||||||
[connection signal="toggled" from="check_debag" to="." method="_on_check_debag_toggled"]
|
|
||||||
|
|||||||
@@ -3,7 +3,18 @@ extends Node
|
|||||||
# Константы
|
# Константы
|
||||||
const CONFIG_PATH = "user://config/setting_prd_control.json"
|
const CONFIG_PATH = "user://config/setting_prd_control.json"
|
||||||
const DEFAULT_CONFIG_PATH = "res://config/setting_prd_control.json"
|
const DEFAULT_CONFIG_PATH = "res://config/setting_prd_control.json"
|
||||||
|
# Добавляем константы для прогресса
|
||||||
|
const PROGRESS_INIT: float = 5.0
|
||||||
|
const PROGRESS_FS_TURN_ON: float = 10.0
|
||||||
|
const PROGRESS_FS_WORK: float = 20.0
|
||||||
|
const PROGRESS_CHECK_KASSETA: float = 25.0
|
||||||
|
const PROGRESS_WRITE_ISA: float = 30.0
|
||||||
|
const PROGRESS_READ_ISA: float = 35.0
|
||||||
|
const PROGRESS_UG_SET_RAY: float = 40.0
|
||||||
|
const PROGRESS_RAY_STATES: float = 50.0
|
||||||
|
const PROGRESS_COMPLETE: float = 100.0
|
||||||
|
|
||||||
|
# Для маппинга (Возможно уберу в будущем, но это не точно)
|
||||||
const RAY_m5: String = "RAY_m5"
|
const RAY_m5: String = "RAY_m5"
|
||||||
const RAY_5: String = "RAY_5"
|
const RAY_5: String = "RAY_5"
|
||||||
const RAY_15: String = "RAY_15"
|
const RAY_15: String = "RAY_15"
|
||||||
@@ -32,6 +43,14 @@ enum STATE_MACHINE {
|
|||||||
STOP_CONTROL,
|
STOP_CONTROL,
|
||||||
AWAIT
|
AWAIT
|
||||||
}
|
}
|
||||||
|
var ems_g_sock_dic: Dictionary = {
|
||||||
|
'ems_input_1': 0,
|
||||||
|
'ems_input_2': 0,
|
||||||
|
'ems_input_lit_1': 0,
|
||||||
|
'ems_output_1': 0,
|
||||||
|
'ems_output_2': 0,
|
||||||
|
'ems_output_lit_1': 0,
|
||||||
|
}
|
||||||
|
|
||||||
# Загруженные конфигурации
|
# Загруженные конфигурации
|
||||||
var config_data: Dictionary
|
var config_data: Dictionary
|
||||||
@@ -54,6 +73,8 @@ var block_kasseta_y5_config: Dictionary
|
|||||||
var temperature_um: Dictionary
|
var temperature_um: Dictionary
|
||||||
var control_results: Dictionary
|
var control_results: Dictionary
|
||||||
var power_result: Dictionary
|
var power_result: Dictionary
|
||||||
|
var ecms: Dictionary
|
||||||
|
var power_for_litera: Dictionary
|
||||||
var self_name: String
|
var self_name: String
|
||||||
var state: int = STATE_MACHINE.INIT
|
var state: int = STATE_MACHINE.INIT
|
||||||
var current_litera: int
|
var current_litera: int
|
||||||
@@ -63,6 +84,8 @@ var flag_si_fs_input: bool = false
|
|||||||
var flag_si_fs_output: bool = false
|
var flag_si_fs_output: bool = false
|
||||||
var flag_in_control: bool = false
|
var flag_in_control: bool = false
|
||||||
var flag_control_is_over: bool = false
|
var flag_control_is_over: bool = false
|
||||||
|
var flag_no_trust_yau07: bool = false
|
||||||
|
var flag_only_fs: bool = false
|
||||||
var unit_prd: Object
|
var unit_prd: Object
|
||||||
var control_timer: Timer = Timer.new()
|
var control_timer: Timer = Timer.new()
|
||||||
var ems_6666_timer: Timer = Timer.new()
|
var ems_6666_timer: Timer = Timer.new()
|
||||||
@@ -70,8 +93,17 @@ var machine_timer: Timer = Timer.new()
|
|||||||
var cc: int = 0
|
var cc: int = 0
|
||||||
var cmd_array: Array
|
var cmd_array: Array
|
||||||
|
|
||||||
signal control_is_over()
|
# Добавляем переменные для отслеживания прогресса
|
||||||
signal update_progress(progress_value: float)
|
var total_fs_to_check: int = 0
|
||||||
|
var completed_fs_count: int = 0
|
||||||
|
var current_fs_progress: float = 0.0
|
||||||
|
# Переменная для текущего статуса
|
||||||
|
var current_status: String = "Ожидание запуска контроля"
|
||||||
|
|
||||||
|
# Сигналы Класса
|
||||||
|
signal control_is_over() # Когда контроль все!
|
||||||
|
signal status_updated(status_text: String) # Сигнал для обновления статуса
|
||||||
|
signal update_progress(progress_value: float)
|
||||||
signal update_max_value_progress(max_progress_value: int)
|
signal update_max_value_progress(max_progress_value: int)
|
||||||
|
|
||||||
var progress_value: float:
|
var progress_value: float:
|
||||||
@@ -80,9 +112,6 @@ var progress_value: float:
|
|||||||
progress_value = v
|
progress_value = v
|
||||||
call_deferred('emit_signal', 'update_progress', v)
|
call_deferred('emit_signal', 'update_progress', v)
|
||||||
|
|
||||||
var ecms: Dictionary
|
|
||||||
var power_for_litera: Dictionary
|
|
||||||
|
|
||||||
|
|
||||||
## Инициализация аргуметнов
|
## Инициализация аргуметнов
|
||||||
func _init(init_data: Dictionary, cmd_array_from_prd: Array) -> void:
|
func _init(init_data: Dictionary, cmd_array_from_prd: Array) -> void:
|
||||||
@@ -140,9 +169,9 @@ func _load_configuration() -> void:
|
|||||||
config_data = json.data
|
config_data = json.data
|
||||||
_parse_config_data()
|
_parse_config_data()
|
||||||
else:
|
else:
|
||||||
push_error("Failed to parse JSON config: " + json.get_error_message())
|
push_error("Ошибка разбора JSON конфигурации: " + json.get_error_message())
|
||||||
else:
|
else:
|
||||||
push_error("Failed to load config file: " + CONFIG_PATH)
|
push_error("Ошибка to load config file: " + CONFIG_PATH)
|
||||||
|
|
||||||
|
|
||||||
func _parse_config_data() -> void:
|
func _parse_config_data() -> void:
|
||||||
@@ -195,8 +224,9 @@ func _process(_delta: float) -> void:
|
|||||||
func on_data_received(unit_pribor: Object) -> void:
|
func on_data_received(unit_pribor: Object) -> void:
|
||||||
if not flag_in_control: return
|
if not flag_in_control: return
|
||||||
var status: PackedByteArray = unit_pribor.status
|
var status: PackedByteArray = unit_pribor.status
|
||||||
|
block_kasseta_y5_config = check_block_kasseta_y5(status, block_kasseta_y5_config, flag_no_trust_yau07)
|
||||||
|
if flag_no_trust_yau07: return
|
||||||
socket_status_ems_g(status)
|
socket_status_ems_g(status)
|
||||||
block_kasseta_y5_config = check_block_kasseta_y5(status, block_kasseta_y5_config)
|
|
||||||
block_ip_config = check_block_ip(status, block_ip_config)
|
block_ip_config = check_block_ip(status, block_ip_config)
|
||||||
temperature_um = check_temperature_um(status)
|
temperature_um = check_temperature_um(status)
|
||||||
if machine_timer.is_stopped():
|
if machine_timer.is_stopped():
|
||||||
@@ -211,33 +241,26 @@ func on_data_received(unit_pribor: Object) -> void:
|
|||||||
power_for_litera[current_litera] = tek_litera
|
power_for_litera[current_litera] = tek_litera
|
||||||
|
|
||||||
|
|
||||||
var ems_input_1: int
|
# Методы для работы с JSON
|
||||||
var ems_input_2: int
|
|
||||||
var ems_input_lit_1: int
|
|
||||||
var ems_output_1: int
|
|
||||||
var ems_output_2: int
|
|
||||||
var ems_output_lit_1: int
|
|
||||||
|
|
||||||
# Методы для работы с DataIndices из JSON
|
|
||||||
func _get_data_index(key: String) -> int:
|
func _get_data_index(key: String) -> int:
|
||||||
return data_indices.get(key, -1)
|
return data_indices.get(key, -1)
|
||||||
|
|
||||||
|
|
||||||
func socket_status_ems_g(packet_form_yau_07: PackedByteArray) -> void:
|
func socket_status_ems_g(packet_form_yau_07: PackedByteArray) -> void:
|
||||||
if self_name in ['1н', '2н', '3н', '4н']:
|
if self_name in ['1н', '2н', '3н', '4н']:
|
||||||
ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 9)) != 0
|
ems_g_sock_dic.ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 9)) != 0
|
||||||
ems_input_2 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 10)) != 0
|
ems_g_sock_dic.ems_input_2 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 10)) != 0
|
||||||
if self_name in ['1в', '2в', '3в', '4в']:
|
if self_name in ['1в', '2в', '3в', '4в']:
|
||||||
ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 11)) != 0
|
ems_g_sock_dic.ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 11)) != 0
|
||||||
ems_input_2 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 12)) != 0
|
ems_g_sock_dic.ems_input_2 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 12)) != 0
|
||||||
if self_name in ['1к', '2к', '3к', '4к']:
|
if self_name in ['1к', '2к', '3к', '4к']:
|
||||||
ems_input_lit_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 8)) != 0
|
ems_g_sock_dic.ems_input_lit_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 8)) != 0
|
||||||
ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 13)) != 0
|
ems_g_sock_dic.ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 13)) != 0
|
||||||
ems_input_2 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 14)) != 0
|
ems_g_sock_dic.ems_input_2 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 14)) != 0
|
||||||
|
|
||||||
ems_output_1 = (packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD')) & (1 << 4)) != 0
|
ems_g_sock_dic.ems_output_1 = (packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD')) & (1 << 4)) != 0
|
||||||
ems_output_2 = (packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD')) & (1 << 5)) != 0
|
ems_g_sock_dic.ems_output_2 = (packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD')) & (1 << 5)) != 0
|
||||||
ems_output_lit_1 = (packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD')) & (1 << 3)) != 0
|
ems_g_sock_dic.ems_output_lit_1 = (packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD')) & (1 << 3)) != 0
|
||||||
|
|
||||||
var number_socket_input: int
|
var number_socket_input: int
|
||||||
if current_litera >= 1 and current_litera <= 7:
|
if current_litera >= 1 and current_litera <= 7:
|
||||||
@@ -264,6 +287,7 @@ func on_fs_update_state(packet_type_7: Dictionary, fs_mapping: Dictionary) -> vo
|
|||||||
control_results[fs_key] = fs_result[fs_key]
|
control_results[fs_key] = fs_result[fs_key]
|
||||||
flag_fs_status_ok = control_results[fs_key] == 1
|
flag_fs_status_ok = control_results[fs_key] == 1
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
func state_control_machine() -> void:
|
func state_control_machine() -> void:
|
||||||
match state:
|
match state:
|
||||||
@@ -286,6 +310,8 @@ func state_control_machine() -> void:
|
|||||||
STATE_MACHINE.CHEK_KASSETA_Y5:
|
STATE_MACHINE.CHEK_KASSETA_Y5:
|
||||||
if block_kasseta_y5_config['yau07']:
|
if block_kasseta_y5_config['yau07']:
|
||||||
state = STATE_MACHINE.WRITE_ISA
|
state = STATE_MACHINE.WRITE_ISA
|
||||||
|
elif flag_only_fs:
|
||||||
|
state = STATE_MACHINE.IN_EMS_STOP
|
||||||
STATE_MACHINE.WRITE_ISA:
|
STATE_MACHINE.WRITE_ISA:
|
||||||
if not flag_write_isa:
|
if not flag_write_isa:
|
||||||
_handle_ug_set_state(0x6)
|
_handle_ug_set_state(0x6)
|
||||||
@@ -355,13 +381,14 @@ func state_control_machine() -> void:
|
|||||||
STATE_MACHINE.STOP_CONTROL:
|
STATE_MACHINE.STOP_CONTROL:
|
||||||
_handle_stop_control_state()
|
_handle_stop_control_state()
|
||||||
## В машине состояний вызов изменения состояния прогресс бара контроля
|
## В машине состояний вызов изменения состояния прогресс бара контроля
|
||||||
if block_kasseta_y5_config['yau07']:
|
if block_kasseta_y5_config['yau07'] or flag_no_trust_yau07:
|
||||||
progressbar_status()
|
progressbar_status()
|
||||||
|
|
||||||
|
|
||||||
## 'Выполняется инициализация ФС-%s' % current_litera
|
## 'Выполняется инициализация ФС-%s' % current_litera
|
||||||
func _handle_init_state() -> void:
|
func _handle_init_state() -> void:
|
||||||
if current_litera in [1, 2, 3, 4, 5, 6, 7]:
|
if current_litera in [1, 2, 3, 4, 5, 6, 7]:
|
||||||
|
_set_status("Инициализация ФС-%s" % current_litera)
|
||||||
var flag_ecm: bool = false
|
var flag_ecm: bool = false
|
||||||
for key in ecms:
|
for key in ecms:
|
||||||
var params = ecms[key].params.freq
|
var params = ecms[key].params.freq
|
||||||
@@ -375,12 +402,18 @@ func _handle_init_state() -> void:
|
|||||||
flag_control_is_over = true
|
flag_control_is_over = true
|
||||||
control_results = on_control_result(block_ip_config, control_results)
|
control_results = on_control_result(block_ip_config, control_results)
|
||||||
power_result = prep_power(power_for_litera, self_name)
|
power_result = prep_power(power_for_litera, self_name)
|
||||||
emit_signal('control_is_over')
|
|
||||||
machine_timer.stop()
|
machine_timer.stop()
|
||||||
|
var result: bool = true
|
||||||
|
for device in control_results.values():
|
||||||
|
if not device:
|
||||||
|
result = false
|
||||||
|
_set_status("Прибор ПРД-%s: %s" % [self_name, ['неисправен', 'исправен'][int(result)]])
|
||||||
|
emit_signal('control_is_over')
|
||||||
|
|
||||||
|
|
||||||
##'Выполняется включение ФС-%s' % current_litera
|
##'Выполняется включение ФС-%s' % current_litera
|
||||||
func _handle_fs_turn_on_state() -> void:
|
func _handle_fs_turn_on_state() -> void:
|
||||||
|
_set_status("Включение ФС-%s" % current_litera)
|
||||||
manage_fs(true, self_name, pribor_config, fs_parameters, current_litera, constants.POWER_UM)
|
manage_fs(true, self_name, pribor_config, fs_parameters, current_litera, constants.POWER_UM)
|
||||||
control_timer.wait_time = constants.TIMER_DELAY
|
control_timer.wait_time = constants.TIMER_DELAY
|
||||||
control_timer.start()
|
control_timer.start()
|
||||||
@@ -388,17 +421,20 @@ func _handle_fs_turn_on_state() -> void:
|
|||||||
|
|
||||||
##'Выполняется проверка ФС-%s' % current_litera
|
##'Выполняется проверка ФС-%s' % current_litera
|
||||||
func _handle_fs_work_state() -> void:
|
func _handle_fs_work_state() -> void:
|
||||||
|
_set_status("Проверка ФС-%s" % current_litera)
|
||||||
if (current_litera == 2 and control_results.fs_2) or \
|
if (current_litera == 2 and control_results.fs_2) or \
|
||||||
(current_litera == 3 and control_results.fs_3) or \
|
(current_litera == 3 and control_results.fs_3) or \
|
||||||
(current_litera == 4 and control_results.fs_4) or \
|
(current_litera == 4 and control_results.fs_4) or \
|
||||||
(current_litera == 5 and control_results.fs_5) or \
|
(current_litera == 5 and control_results.fs_5) or \
|
||||||
(current_litera == 6 and control_results.fs_6) or \
|
(current_litera == 6 and control_results.fs_6) or \
|
||||||
(current_litera == 7 and control_results.fs_7) or \
|
(current_litera == 7 and control_results.fs_7) or \
|
||||||
(current_litera == 1 and control_results.fs_1):
|
(current_litera == 1 and control_results.fs_1):
|
||||||
state = STATE_MACHINE.CHEK_KASSETA_Y5
|
state = STATE_MACHINE.CHEK_KASSETA_Y5
|
||||||
|
|
||||||
|
|
||||||
|
## Подготовка к настройки и записи в УГ
|
||||||
func _handle_ug_set_state(RAY_DOU_NUM: int) -> void:
|
func _handle_ug_set_state(RAY_DOU_NUM: int) -> void:
|
||||||
|
_set_status("Настройка угла %s" % _get_ray_name(RAY_DOU_NUM))
|
||||||
var dic_att := {
|
var dic_att := {
|
||||||
'RAY_DOU_NUM': RAY_DOU_NUM,
|
'RAY_DOU_NUM': RAY_DOU_NUM,
|
||||||
'ADDR_UG_LITERA_1': constants.ADDR_UG_LITERA_1,
|
'ADDR_UG_LITERA_1': constants.ADDR_UG_LITERA_1,
|
||||||
@@ -420,38 +456,84 @@ func _handle_ug_set_state(RAY_DOU_NUM: int) -> void:
|
|||||||
flag_write_isa = on_ug_setting(unit_prd, dic_att, cmd_array)
|
flag_write_isa = on_ug_setting(unit_prd, dic_att, cmd_array)
|
||||||
|
|
||||||
|
|
||||||
## Таймер отправки команды в ЭМС-Г для модуляции
|
|
||||||
func _on_ems_6666_timer() -> void:
|
|
||||||
cmd_array.append([unit_prd.CmdCode.WRITE_ISA, [constants.BASE_ADDR_EMS_G, 6666]])
|
|
||||||
|
|
||||||
|
|
||||||
## Таймер вызова машины состояний
|
|
||||||
func on_state_mashine():
|
|
||||||
state_control_machine()
|
|
||||||
|
|
||||||
|
|
||||||
|
## Функция для продвижения статуса прогресс бара
|
||||||
func progressbar_status() -> void:
|
func progressbar_status() -> void:
|
||||||
|
if current_litera == 0:
|
||||||
|
progress_value = PROGRESS_COMPLETE
|
||||||
|
await get_tree().create_timer(0.5).timeout
|
||||||
|
progress_value = 0
|
||||||
|
return
|
||||||
|
|
||||||
|
# Базовый прогресс в зависимости от состояния
|
||||||
|
var base_progress: float = 0.0
|
||||||
|
|
||||||
match state:
|
match state:
|
||||||
STATE_MACHINE.INIT:
|
STATE_MACHINE.INIT:
|
||||||
cc += 10 if current_litera in [3, 5, 6, 7] else 0
|
base_progress = PROGRESS_INIT
|
||||||
if control_timer.get_time_left() > 0:
|
STATE_MACHINE.FS_TURN_ON:
|
||||||
progress_value = cc + control_timer.get_wait_time() - control_timer.get_time_left()
|
base_progress = PROGRESS_FS_TURN_ON
|
||||||
if current_litera == 0:
|
STATE_MACHINE.FS_WORK:
|
||||||
progress_value = 0
|
base_progress = PROGRESS_FS_WORK
|
||||||
|
STATE_MACHINE.CHEK_KASSETA_Y5:
|
||||||
|
base_progress = PROGRESS_CHECK_KASSETA
|
||||||
|
STATE_MACHINE.WRITE_ISA:
|
||||||
|
base_progress = PROGRESS_WRITE_ISA
|
||||||
|
STATE_MACHINE.READ_ISA:
|
||||||
|
base_progress = PROGRESS_READ_ISA
|
||||||
|
STATE_MACHINE.UG_SET_RAY:
|
||||||
|
base_progress = PROGRESS_UG_SET_RAY
|
||||||
|
STATE_MACHINE.UG_SET_RAY_0, STATE_MACHINE.UG_SET_RAY_1:
|
||||||
|
base_progress = PROGRESS_RAY_STATES
|
||||||
|
STATE_MACHINE.UG_SET_RAY_2:
|
||||||
|
base_progress = PROGRESS_RAY_STATES + 10.0
|
||||||
|
STATE_MACHINE.UG_SET_RAY_3:
|
||||||
|
base_progress = PROGRESS_RAY_STATES + 20.0
|
||||||
|
STATE_MACHINE.UG_SET_RAY_4:
|
||||||
|
base_progress = PROGRESS_RAY_STATES + 30.0
|
||||||
|
STATE_MACHINE.UG_SET_RAY_5:
|
||||||
|
base_progress = PROGRESS_RAY_STATES + 40.0
|
||||||
|
STATE_MACHINE.IN_EMS_STOP, STATE_MACHINE.FS_TURN_OFF, STATE_MACHINE.STOP_CONTROL:
|
||||||
|
base_progress = PROGRESS_COMPLETE
|
||||||
|
|
||||||
|
# Плавное заполнение во время ожидания таймера
|
||||||
|
if control_timer.time_left > 0 and state != STATE_MACHINE.STOP_CONTROL:
|
||||||
|
var timer_progress = (control_timer.wait_time - control_timer.time_left) / control_timer.wait_time
|
||||||
|
base_progress = lerp(base_progress - 5.0, base_progress, timer_progress)
|
||||||
|
|
||||||
|
# Распределяем прогресс по ФС
|
||||||
|
if total_fs_to_check > 0:
|
||||||
|
var progress_per_fs = PROGRESS_COMPLETE / total_fs_to_check
|
||||||
|
current_fs_progress = base_progress
|
||||||
|
progress_value = (completed_fs_count * progress_per_fs) + (current_fs_progress * progress_per_fs / PROGRESS_COMPLETE)
|
||||||
|
else:
|
||||||
|
progress_value = base_progress
|
||||||
|
|
||||||
|
progress_value = clamp(progress_value, 0.0, PROGRESS_COMPLETE)
|
||||||
|
|
||||||
|
|
||||||
##'Выполняется отключение ФС-%s' % current_litera
|
##'Выполняется отключение ФС-%s' % current_litera
|
||||||
func _handle_fs_turn_off_state() -> void:
|
func _handle_fs_turn_off_state() -> void:
|
||||||
|
_set_status("Отключение ФС-%s" % current_litera)
|
||||||
flag_fs_status_ok = false
|
flag_fs_status_ok = false
|
||||||
manage_fs(false, self_name, pribor_config, fs_parameters, current_litera, constants.POWER_UM)
|
manage_fs(false, self_name, pribor_config, fs_parameters, current_litera, constants.POWER_UM)
|
||||||
|
|
||||||
|
|
||||||
##'Выполняется завершение проверки ФС-%s' % current_litera
|
##'Выполняется завершение проверки ФС-%s' % current_litera
|
||||||
func _handle_stop_control_state() -> void:
|
func _handle_stop_control_state() -> void:
|
||||||
|
_set_status("Завершение контроля ФС-%s" % current_litera)
|
||||||
|
# Увеличиваем счетчик завершенных ФС
|
||||||
|
completed_fs_count += 1
|
||||||
|
|
||||||
_advance_to_next_fs()
|
_advance_to_next_fs()
|
||||||
state = STATE_MACHINE.INIT
|
state = STATE_MACHINE.INIT
|
||||||
|
if current_litera == 0: return
|
||||||
|
if flag_no_trust_yau07:
|
||||||
|
state = STATE_MACHINE.STOP_CONTROL
|
||||||
|
|
||||||
|
|
||||||
|
## Переходит на следующую литеру, если 0 то считай закончил выполнения контроля
|
||||||
func _advance_to_next_fs() -> void:
|
func _advance_to_next_fs() -> void:
|
||||||
match current_litera:
|
match current_litera:
|
||||||
1: current_litera = 6
|
1: current_litera = 6
|
||||||
@@ -461,6 +543,9 @@ func _advance_to_next_fs() -> void:
|
|||||||
5: current_litera = 0
|
5: current_litera = 0
|
||||||
6: current_litera = 7
|
6: current_litera = 7
|
||||||
7: current_litera = 0
|
7: current_litera = 0
|
||||||
|
# Сбрасываем прогресс текущей ФС при переходе к следующей
|
||||||
|
if current_litera != 0:
|
||||||
|
current_fs_progress = 0.0
|
||||||
|
|
||||||
|
|
||||||
######################################
|
######################################
|
||||||
@@ -482,12 +567,15 @@ func on_interfer_resized(ecms_dic: Dictionary) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _on_start_contol_device()-> void:
|
func _on_start_contol_device()-> void:
|
||||||
|
_set_status("Подготовка к контролю")
|
||||||
_determine_self_name()
|
_determine_self_name()
|
||||||
machine_timer.wait_time = constants.STATE_MASHINE_TIMER
|
machine_timer.wait_time = constants.STATE_MASHINE_TIMER
|
||||||
machine_timer.start()
|
machine_timer.start()
|
||||||
|
|
||||||
|
|
||||||
func _determine_self_name() -> void:
|
func _determine_self_name() -> void:
|
||||||
|
flag_no_trust_yau07 = false
|
||||||
|
flag_only_fs = false
|
||||||
cc = 0
|
cc = 0
|
||||||
state = STATE_MACHINE.get("INIT", 0)
|
state = STATE_MACHINE.get("INIT", 0)
|
||||||
var current_unit = unit_prd.name
|
var current_unit = unit_prd.name
|
||||||
@@ -517,8 +605,19 @@ func _determine_self_name() -> void:
|
|||||||
control_results = device_data_config.get("control_results", {})
|
control_results = device_data_config.get("control_results", {})
|
||||||
current_litera = device_config.get("start_litera", 0)
|
current_litera = device_config.get("start_litera", 0)
|
||||||
|
|
||||||
|
# Определяем общее количество ФС для контроля
|
||||||
|
match self_name:
|
||||||
|
'1к', '2к', '3к', '4к':
|
||||||
|
total_fs_to_check = 3 # Литеры 1, 6, 7
|
||||||
|
'1н', '2н', '3н', '4н':
|
||||||
|
total_fs_to_check = 2 # Литеры 2, 3
|
||||||
|
'1в', '2в', '3в', '4в':
|
||||||
|
total_fs_to_check = 2 # Литеры 4, 5
|
||||||
|
|
||||||
progress_value = 0
|
progress_value = 0
|
||||||
call_deferred('emit_signal', 'update_max_value_progress', device_config.get("progress_max", 20))
|
completed_fs_count = 0
|
||||||
|
current_fs_progress = 0.0
|
||||||
|
call_deferred('emit_signal', 'update_max_value_progress', 100)
|
||||||
|
|
||||||
|
|
||||||
func _load_block_config(config, config_type: String) -> Dictionary:
|
func _load_block_config(config, config_type: String) -> Dictionary:
|
||||||
@@ -536,6 +635,7 @@ func _get_device_type() -> String:
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
## Настройка таймеров
|
||||||
func setup_timer() -> void:
|
func setup_timer() -> void:
|
||||||
add_child(control_timer)
|
add_child(control_timer)
|
||||||
control_timer.timeout.connect(on_stop_control)
|
control_timer.timeout.connect(on_stop_control)
|
||||||
@@ -550,19 +650,46 @@ func setup_timer() -> void:
|
|||||||
machine_timer.connect('timeout', Callable(self, 'on_state_mashine'))
|
machine_timer.connect('timeout', Callable(self, 'on_state_mashine'))
|
||||||
|
|
||||||
|
|
||||||
|
## Таймер отправки команды в ЭМС-Г для модуляции
|
||||||
|
func _on_ems_6666_timer() -> void:
|
||||||
|
cmd_array.append([unit_prd.CmdCode.WRITE_ISA, [constants.BASE_ADDR_EMS_G, 6666]])
|
||||||
|
|
||||||
|
|
||||||
|
## Таймер вызова машины состояний
|
||||||
|
func on_state_mashine():
|
||||||
|
state_control_machine()
|
||||||
|
|
||||||
|
|
||||||
|
## При таймауте таймера ожидания выполнения команды и перехода на следующий шаг машины состояний
|
||||||
|
func on_stop_control() -> void:
|
||||||
|
_handle_fs_turn_off_state()
|
||||||
|
|
||||||
|
if state == STATE_MACHINE.UG_SET_RAY:
|
||||||
|
flag_no_trust_yau07 = true
|
||||||
|
elif state == STATE_MACHINE.CHEK_KASSETA_Y5:
|
||||||
|
flag_only_fs = true
|
||||||
|
state = STATE_MACHINE.FS_TURN_OFF
|
||||||
|
|
||||||
|
|
||||||
|
## Срабатывает при выходе или входе в режим контроль
|
||||||
func on_mode_changed(in_tree: bool) -> void:
|
func on_mode_changed(in_tree: bool) -> void:
|
||||||
flag_in_control = in_tree
|
flag_in_control = in_tree
|
||||||
if not in_tree: ## TODO: Дополнительная проверка если контроль идет, если нет, то смысла вызывать нет
|
if not in_tree: ## TODO: Дополнительная проверка если контроль идет, если нет, то смысла вызывать нет
|
||||||
|
_set_status("Ожидание запуска контроля")
|
||||||
flag_control_is_over = false
|
flag_control_is_over = false
|
||||||
|
flag_no_trust_yau07 = false
|
||||||
|
flag_only_fs = false
|
||||||
progress_value = 0
|
progress_value = 0
|
||||||
machine_timer.stop()
|
machine_timer.stop()
|
||||||
state = STATE_MACHINE.INIT
|
state = STATE_MACHINE.INIT
|
||||||
_handle_fs_turn_off_state()
|
_handle_fs_turn_off_state()
|
||||||
#prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]])
|
#prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]])
|
||||||
|
else:
|
||||||
|
_set_status("Ожидание запуска контроля")
|
||||||
|
|
||||||
|
|
||||||
func _process_dkm_status(status: PackedByteArray) -> void:
|
func _process_dkm_status(status: PackedByteArray) -> void:
|
||||||
if not control_results.has(_get_current_fs_key()):
|
if not control_results.has(_get_current_fs_key(current_litera, fs_keys)):
|
||||||
return
|
return
|
||||||
var dkm_bit = _get_dkm_bit_for_current_fs(current_litera, constants)
|
var dkm_bit = _get_dkm_bit_for_current_fs(current_litera, constants)
|
||||||
if dkm_bit == 0:
|
if dkm_bit == 0:
|
||||||
@@ -589,10 +716,11 @@ func _process_dkm_status(status: PackedByteArray) -> void:
|
|||||||
control_results['dkm_7'] = check_dkm(status, dkm_bit)
|
control_results['dkm_7'] = check_dkm(status, dkm_bit)
|
||||||
|
|
||||||
|
|
||||||
func _get_current_fs_key() -> String:
|
static func _get_current_fs_key(litera: int, fs_keys_dic: Dictionary) -> String:
|
||||||
return fs_keys.get(str(current_litera), '')
|
return fs_keys_dic.get(str(litera), '')
|
||||||
|
|
||||||
|
|
||||||
|
## Возвращает бит ДКМ для проверки текущей литеры
|
||||||
static func _get_dkm_bit_for_current_fs(litera: int, constants_dic: Dictionary) -> int:
|
static func _get_dkm_bit_for_current_fs(litera: int, constants_dic: Dictionary) -> int:
|
||||||
match litera:
|
match litera:
|
||||||
1: return constants_dic.DKM_BIT_1
|
1: return constants_dic.DKM_BIT_1
|
||||||
@@ -605,14 +733,9 @@ static func _get_dkm_bit_for_current_fs(litera: int, constants_dic: Dictionary)
|
|||||||
_: return -1
|
_: return -1
|
||||||
|
|
||||||
|
|
||||||
func on_stop_control() -> void:
|
## Итоговое заключение по результам контроля всех ИП
|
||||||
_handle_fs_turn_off_state()
|
|
||||||
state = STATE_MACHINE.FS_TURN_OFF
|
|
||||||
|
|
||||||
|
|
||||||
static func on_control_result(ip_config: Dictionary, ctrl_results: Dictionary) -> Dictionary:
|
static func on_control_result(ip_config: Dictionary, ctrl_results: Dictionary) -> Dictionary:
|
||||||
var all_blocks_ip_ok = true
|
var all_blocks_ip_ok = true
|
||||||
|
|
||||||
for block in ip_config:
|
for block in ip_config:
|
||||||
if not ip_config[block][1]:
|
if not ip_config[block][1]:
|
||||||
all_blocks_ip_ok = false
|
all_blocks_ip_ok = false
|
||||||
@@ -624,10 +747,10 @@ static func on_control_result(ip_config: Dictionary, ctrl_results: Dictionary) -
|
|||||||
static func on_ug_setting(prd_unit: Object, settings_ug: Dictionary, prd_cmd_array: Array) -> bool:
|
static func on_ug_setting(prd_unit: Object, settings_ug: Dictionary, prd_cmd_array: Array) -> bool:
|
||||||
var result_1 = ((settings_ug.ATT_UM_1 & 0x07) << 3) | (settings_ug.RAY_DOU_NUM & 0x07)
|
var result_1 = ((settings_ug.ATT_UM_1 & 0x07) << 3) | (settings_ug.RAY_DOU_NUM & 0x07)
|
||||||
var result_2 = ((settings_ug.ATT_UM_2 & 0x07) << 3) | (settings_ug.RAY_DOU_NUM & 0x07)
|
var result_2 = ((settings_ug.ATT_UM_2 & 0x07) << 3) | (settings_ug.RAY_DOU_NUM & 0x07)
|
||||||
prd_cmd_array.append([prd_unit.CmdCode.WRITE_ISA, [ settings_ug.ADDR_UG_LITERA_1, result_1,
|
prd_cmd_array.append([prd_unit.CmdCode.WRITE_ISA, [ settings_ug.ADDR_UG_LITERA_1, result_1,
|
||||||
settings_ug.ADDR_UG_LITERA_2, result_2,
|
settings_ug.ADDR_UG_LITERA_2, result_2,
|
||||||
settings_ug.ADDR_UG_LITERA_3, settings_ug.ATT_UM_3,
|
settings_ug.ADDR_UG_LITERA_3, settings_ug.ATT_UM_3,
|
||||||
]
|
]
|
||||||
])
|
])
|
||||||
return true
|
return true
|
||||||
|
|
||||||
@@ -655,7 +778,7 @@ static func manage_fs(mode: bool, pribor: String, p_conf: Dictionary, fs_params:
|
|||||||
params.width,
|
params.width,
|
||||||
sectors[litera - 1] if litera == 1 else sectors[litera - 5] if litera > 5 else sectors[litera - 4] if litera > 3 else sectors[litera - 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('emit_changed', mode)
|
#signaller.emit_signal('emit_changed', mode) TODO: не отключаю подавление (даже если при входе в контроль он был отключен)
|
||||||
signaller.emit_signal('interfer_init', interfer_name, fs_arr, power_um)
|
signaller.emit_signal('interfer_init', interfer_name, fs_arr, power_um)
|
||||||
|
|
||||||
|
|
||||||
@@ -673,12 +796,13 @@ static func check_block_ip(status_prd: PackedByteArray, ip_config: Dictionary) -
|
|||||||
|
|
||||||
|
|
||||||
## Проверка кассеты у-5 (ЯУ-07Б, ЭМС-Г, УГ, УКП-1, УКП-2)
|
## Проверка кассеты у-5 (ЯУ-07Б, ЭМС-Г, УГ, УКП-1, УКП-2)
|
||||||
static func check_block_kasseta_y5(status_prd: PackedByteArray, y5_config: Dictionary) -> Dictionary:
|
static func check_block_kasseta_y5(status_prd: PackedByteArray, y5_config: Dictionary, flag_not_trust: bool) -> Dictionary:
|
||||||
y5_config.yau07 = true
|
y5_config.yau07 = not flag_not_trust
|
||||||
y5_config.ems = (status_prd[0] & 1) and ((status_prd[0] >> 4) & 1)
|
if y5_config.yau07:
|
||||||
y5_config.ug = (status_prd[0] >> 1) & 1
|
y5_config.ems = (status_prd[0] & 1) and ((status_prd[0] >> 4) & 1)
|
||||||
y5_config.ukp1 = (status_prd[0] >> 2) & 1
|
y5_config.ug = (status_prd[0] >> 1) & 1
|
||||||
y5_config.ukp2 = (status_prd[0] >> 3) & 1
|
y5_config.ukp1 = (status_prd[0] >> 2) & 1
|
||||||
|
y5_config.ukp2 = (status_prd[0] >> 3) & 1
|
||||||
return y5_config
|
return y5_config
|
||||||
|
|
||||||
|
|
||||||
@@ -696,7 +820,6 @@ static func check_temperature_um(status_prd: PackedByteArray) -> Dictionary:
|
|||||||
var return_dic_temp: Dictionary
|
var return_dic_temp: Dictionary
|
||||||
var ukp1_online: int = (status_prd[0] >> 2) & 1
|
var ukp1_online: int = (status_prd[0] >> 2) & 1
|
||||||
var ukp2_online = (status_prd[0] >> 3) & 1
|
var ukp2_online = (status_prd[0] >> 3) & 1
|
||||||
|
|
||||||
if ukp1_online:
|
if ukp1_online:
|
||||||
var tmp_1: int
|
var tmp_1: int
|
||||||
var temperature_ukp_1: int
|
var temperature_ukp_1: int
|
||||||
@@ -704,14 +827,11 @@ static func check_temperature_um(status_prd: PackedByteArray) -> Dictionary:
|
|||||||
temperature_ukp_1 = status_prd.decode_u16(Constants.TEMPERATURE_UKP_1 + 2 * i_temp)
|
temperature_ukp_1 = status_prd.decode_u16(Constants.TEMPERATURE_UKP_1 + 2 * i_temp)
|
||||||
tmp_1 = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3)
|
tmp_1 = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3)
|
||||||
return_dic_temp[arr_um[i_temp]] = tmp_1
|
return_dic_temp[arr_um[i_temp]] = tmp_1
|
||||||
|
|
||||||
|
|
||||||
if ukp2_online:
|
if ukp2_online:
|
||||||
for i_temp in 8:
|
for i_temp in 8:
|
||||||
var temperature_ukp_2: int = status_prd.decode_u16(Constants.TEMPERATURE_UKP_2 + 2 * i_temp)
|
var temperature_ukp_2: int = status_prd.decode_u16(Constants.TEMPERATURE_UKP_2 + 2 * i_temp)
|
||||||
var tmp_2: int = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3)
|
var tmp_2: int = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3)
|
||||||
return_dic_temp[arr_um[i_temp+8]] = tmp_2
|
return_dic_temp[arr_um[i_temp+8]] = tmp_2
|
||||||
|
|
||||||
return return_dic_temp
|
return return_dic_temp
|
||||||
|
|
||||||
|
|
||||||
@@ -722,7 +842,7 @@ static func check_dkm(status_prd: PackedByteArray, bit_dkm: int) -> bool:
|
|||||||
return status_dkm
|
return status_dkm
|
||||||
|
|
||||||
|
|
||||||
##
|
## Распределения номеров ФС по пирборам
|
||||||
static func _create_fs_mapping(s_name: String) -> Dictionary:
|
static func _create_fs_mapping(s_name: String) -> Dictionary:
|
||||||
var suffixes: Dictionary = {
|
var suffixes: Dictionary = {
|
||||||
0: '1к', 1: '4к', 2: '3к', 3: '2к',
|
0: '1к', 1: '4к', 2: '3к', 3: '2к',
|
||||||
@@ -740,7 +860,7 @@ static func _create_fs_mapping(s_name: String) -> Dictionary:
|
|||||||
return mapping
|
return mapping
|
||||||
|
|
||||||
|
|
||||||
##
|
## Получения статуса ФС
|
||||||
static func on_fs_state(packet_type_7: Dictionary, fs_mapping: Dictionary, fs_results: Dictionary, fs_rules_config: Array) -> Dictionary:
|
static func on_fs_state(packet_type_7: Dictionary, fs_mapping: Dictionary, fs_results: Dictionary, fs_rules_config: Array) -> Dictionary:
|
||||||
var updated_results := fs_results.duplicate()
|
var updated_results := fs_results.duplicate()
|
||||||
for fs_num in packet_type_7:
|
for fs_num in packet_type_7:
|
||||||
@@ -759,7 +879,7 @@ static func _should_apply_rule(fs_num: int, rule: Dictionary, results: Dictionar
|
|||||||
return bool(fs_num >= rule.min and fs_num < rule.max) and results.has(rule.key)
|
return bool(fs_num >= rule.min and fs_num < rule.max) and results.has(rule.key)
|
||||||
|
|
||||||
|
|
||||||
##
|
## Получение мощности при выполнении контроля
|
||||||
static func power_um_ukp(status: PackedByteArray, litera: 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}
|
const Constants: Dictionary = {'POWER_UKP_1' : 31, 'POWER_UKP_2': 63}
|
||||||
var power_values: Array = []
|
var power_values: Array = []
|
||||||
@@ -833,34 +953,7 @@ static func update_max_power_values(power_data: Array, max_power_values: Array)
|
|||||||
return max_power_values.duplicate()
|
return max_power_values.duplicate()
|
||||||
|
|
||||||
|
|
||||||
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 litera == 2 else 'dou_3'
|
|
||||||
if pribor == '1к' or pribor == '2к' or pribor == '3к' or pribor == '4к':
|
|
||||||
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 litera == 4 else 'dou_5'
|
|
||||||
|
|
||||||
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 \
|
|
||||||
ray_dic[RAY_25].size() == 0 or \
|
|
||||||
ray_dic[RAY_35].size() == 0 or \
|
|
||||||
ray_dic[RAY_45].size() == 0:
|
|
||||||
control_dic[dou] = false
|
|
||||||
return control_dic
|
|
||||||
|
|
||||||
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:
|
|
||||||
all_dou_ok = false
|
|
||||||
|
|
||||||
control_dic[dou] = all_dou_ok
|
|
||||||
|
|
||||||
return control_dic
|
|
||||||
|
|
||||||
|
|
||||||
static func prep_power(power_dic: Dictionary, prd_name: String)-> Dictionary:
|
static func prep_power(power_dic: Dictionary, prd_name: String)-> Dictionary:
|
||||||
const RAY_KEYS := ["RAY_m5", "RAY_5", "RAY_15", "RAY_25", "RAY_35", "RAY_45"]
|
const RAY_KEYS := ["RAY_m5", "RAY_5", "RAY_15", "RAY_25", "RAY_35", "RAY_45"]
|
||||||
var prep_pow_dic: Dictionary = {}
|
var prep_pow_dic: Dictionary = {}
|
||||||
@@ -912,3 +1005,68 @@ static func prep_power(power_dic: Dictionary, prd_name: String)-> Dictionary:
|
|||||||
for um_index in range(current_um_names.size()):
|
for um_index in range(current_um_names.size()):
|
||||||
prep_pow_dic[current_um_names[um_index]] = um_data[um_index]
|
prep_pow_dic[current_um_names[um_index]] = um_data[um_index]
|
||||||
return prep_pow_dic
|
return prep_pow_dic
|
||||||
|
|
||||||
|
|
||||||
|
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 litera == 2 else 'dou_3'
|
||||||
|
if pribor == '1к' or pribor == '2к' or pribor == '3к' or pribor == '4к':
|
||||||
|
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 litera == 4 else 'dou_5'
|
||||||
|
|
||||||
|
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 \
|
||||||
|
ray_dic[RAY_25].size() == 0 or \
|
||||||
|
ray_dic[RAY_35].size() == 0 or \
|
||||||
|
ray_dic[RAY_45].size() == 0:
|
||||||
|
control_dic[dou] = false
|
||||||
|
return control_dic
|
||||||
|
|
||||||
|
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:
|
||||||
|
all_dou_ok = false
|
||||||
|
|
||||||
|
control_dic[dou] = all_dou_ok
|
||||||
|
return control_dic
|
||||||
|
|
||||||
|
|
||||||
|
# Сеттер для статуса
|
||||||
|
func _set_status(new_status: String) -> void:
|
||||||
|
if current_status != new_status:
|
||||||
|
current_status = new_status
|
||||||
|
call_deferred('emit_signal', 'status_updated', new_status)
|
||||||
|
|
||||||
|
|
||||||
|
# Геттер для текущего статуса (чтобы можно было забрать в любой момент)
|
||||||
|
func get_current_status() -> String:
|
||||||
|
return current_status
|
||||||
|
|
||||||
|
|
||||||
|
func _get_ray_name(ray_num: int) -> String:
|
||||||
|
match ray_num:
|
||||||
|
0: return "-5°"
|
||||||
|
1: return "5°"
|
||||||
|
2: return "15°"
|
||||||
|
3: return "25°"
|
||||||
|
4: return "35°"
|
||||||
|
5: return "45°"
|
||||||
|
6: return "ДКМ"
|
||||||
|
_: return "неизвестный угол"
|
||||||
|
|
||||||
|
|
||||||
|
# Геттер для результатов контроля
|
||||||
|
func get_control_results() -> Dictionary:
|
||||||
|
return {
|
||||||
|
'control_is_over': flag_control_is_over,
|
||||||
|
'result_dic': control_results,
|
||||||
|
'power_dic': power_result,
|
||||||
|
'block_kasseta_y5_config': block_kasseta_y5_config,
|
||||||
|
'block_ip_config': block_ip_config,
|
||||||
|
'temperature_um': temperature_um,
|
||||||
|
'POWER_THRESHOLD': constants.POWER_THRESHOLD,
|
||||||
|
'name_prd': self_name
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user