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')
|
||||
for temp in power_amplifier:
|
||||
temp.value1 = -70
|
||||
# Подписываемся на сигналы
|
||||
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()
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
set_frame($input_0, unit_prd_k.ems_input_1)
|
||||
set_frame($input_1, unit_prd_k.ems_input_2)
|
||||
set_frame($input_2, unit_prd_k.ems_input_lit_1)
|
||||
set_frame($output_0, unit_prd_k.ems_output_1)
|
||||
set_frame($output_1, unit_prd_k.ems_output_2)
|
||||
set_frame($output_2, unit_prd_k.ems_output_lit_1)
|
||||
set_frame($input_0, unit_prd_k.ems_g_sock_dic.ems_input_1)
|
||||
set_frame($input_1, unit_prd_k.ems_g_sock_dic.ems_input_2)
|
||||
set_frame($input_2, unit_prd_k.ems_g_sock_dic.ems_input_lit_1)
|
||||
set_frame($output_0, unit_prd_k.ems_g_sock_dic.ems_output_1)
|
||||
set_frame($output_1, unit_prd_k.ems_g_sock_dic.ems_output_2)
|
||||
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)
|
||||
@@ -52,8 +55,8 @@ static func set_default_state(default_reset_array_node: Array, power_amplifier_a
|
||||
func _enter_tree() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
$control_result.text = 'Ожидается запуск контроля ...' # TODO: Необходимо сделать пулл сообщений
|
||||
$control_result.add_theme_color_override('font_color', Color.ALICE_BLUE)
|
||||
if unit_prd_k:
|
||||
_update_status_text(unit_prd_k.get_current_status())
|
||||
|
||||
|
||||
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:
|
||||
var temperature_meta: String = i_node_temperature.get_meta('um')
|
||||
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:
|
||||
for i_powapm in power_amplifier:
|
||||
var powamp_meta: String = i_powapm.get_meta('um')
|
||||
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier_arr_node: Array, POWER_THRESHOLD: int) -> void:
|
||||
for i_node_temperature in power_amplifier_arr_node:
|
||||
var powamp_meta: String = i_node_temperature.get_meta('um')
|
||||
var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE
|
||||
if not pow_dic.has(powamp_meta): return
|
||||
if pow_dic:
|
||||
if not pow_dic.has(powamp_meta):
|
||||
break
|
||||
if pow_dic[powamp_meta].size() < 6:
|
||||
status = STATE_VAL.ERROR
|
||||
else:
|
||||
if powamp_meta == 'um_8' and not fs_result.fs_1: return
|
||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_6: return
|
||||
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_7: return
|
||||
|
||||
if powamp_meta == 'um_8':
|
||||
i_powapm.value0 = [pow_dic[powamp_meta][5]]
|
||||
if pow_dic[powamp_meta][5] < POWER_THRESHOLD:
|
||||
status = STATE_VAL.ERROR
|
||||
else:
|
||||
i_powapm.value0 = pow_dic[powamp_meta]
|
||||
for i_p in pow_dic[powamp_meta]:
|
||||
if i_p < POWER_THRESHOLD:
|
||||
status = STATE_VAL.ERROR
|
||||
i_powapm.state = status
|
||||
# Проверки fs_result
|
||||
if powamp_meta == 'um_8' and not fs_result.fs_1: return
|
||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_6: return
|
||||
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_7: return
|
||||
|
||||
if powamp_meta == 'um_8':
|
||||
i_node_temperature.value0 = [pow_dic[powamp_meta][5]]
|
||||
status = STATE_VAL.ERROR if pow_dic[powamp_meta][5] < POWER_THRESHOLD else STATE_VAL.GOOD
|
||||
else:
|
||||
i_node_temperature.value0 = pow_dic[powamp_meta]
|
||||
# Проверки 3 значения = исправен
|
||||
var count_above_threshold = 0
|
||||
for i_p in pow_dic[powamp_meta]:
|
||||
if i_p >= POWER_THRESHOLD:
|
||||
count_above_threshold += 1
|
||||
status = STATE_VAL.GOOD if count_above_threshold >= 3 else STATE_VAL.ERROR
|
||||
i_node_temperature.state = status
|
||||
|
||||
|
||||
func on_press_device() -> void:
|
||||
@@ -107,26 +107,20 @@ func on_press_device() -> void:
|
||||
var dou_6: Node = $dou6_A7
|
||||
var module_fs_7: Node = $kasseta_fs_kd/ref_A7
|
||||
var dou_7: Node = $dou7_A8
|
||||
var control_data: Dictionary = unit_prd_k.get_control_results()
|
||||
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,
|
||||
'node_ip_power_arr': node_ip_power_arr,
|
||||
'fs_nodes': fs_nodes,
|
||||
'power_amplifier': power_amplifier,
|
||||
'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_6': module_fs_6,
|
||||
'dou_6': dou_6,
|
||||
'module_fs_7': module_fs_7,
|
||||
'dou_7': dou_7,
|
||||
}
|
||||
for_control_result.merge(control_data, true)
|
||||
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 not block_kasseta_y5_prd_config_k['yau07']:
|
||||
node_y5.state = STATE_VAL.ERROR if meta_y5 == 'yau07' else STATE_VAL.NONE
|
||||
break
|
||||
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_k[meta_y5] else STATE_VAL.ERROR
|
||||
else:
|
||||
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
|
||||
for power_supply in for_result_dic.node_ip_power_arr:
|
||||
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
|
||||
else:
|
||||
power_supply.state = STATE_VAL.NONE
|
||||
|
||||
if not for_result_dic.control_is_over:
|
||||
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']:
|
||||
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):
|
||||
if node1 is Label:
|
||||
@@ -193,3 +183,22 @@ func find_labels(node1: Node):
|
||||
node1.set_meta("tooltip_set", true)
|
||||
for child in node1.get_children():
|
||||
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
|
||||
fname = "Кассета П-2"
|
||||
|
||||
[node name="input_0" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="input_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(392, 472)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="input_1" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="input_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(444, 472)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="input_2" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="input_2" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(294, 473)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="output_0" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="output_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(394, 318)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="output_1" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="output_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(444, 318)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="output_2" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="output_2" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(294, 318)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
|
||||
@@ -17,7 +17,11 @@ func _ready() -> void:
|
||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
for temp in power_amplifier:
|
||||
temp.value1 = -70
|
||||
# Подписываемся на сигналы
|
||||
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()
|
||||
on_press_device()
|
||||
|
||||
@@ -25,10 +29,10 @@ func _ready() -> void:
|
||||
func _process(_delta: float) -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
set_frame($input_0, unit_prd_n.ems_input_1)
|
||||
set_frame($input_1, unit_prd_n.ems_input_2)
|
||||
set_frame($output_0, unit_prd_n.ems_output_1)
|
||||
set_frame($output_1, unit_prd_n.ems_output_2)
|
||||
set_frame($input_0, unit_prd_n.ems_g_sock_dic.ems_input_1)
|
||||
set_frame($input_1, unit_prd_n.ems_g_sock_dic.ems_input_2)
|
||||
set_frame($output_0, unit_prd_n.ems_g_sock_dic.ems_output_1)
|
||||
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)
|
||||
@@ -50,8 +54,8 @@ static func set_default_state(default_reset_array_node: Array, power_amplifier_a
|
||||
func _enter_tree() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
$control_result.text = 'Ожидается запуск контроля ...' # TODO: Необходимо сделать пулл сообщений
|
||||
$control_result.add_theme_color_override('font_color', Color.ALICE_BLUE)
|
||||
if unit_prd_n:
|
||||
_update_status_text(unit_prd_n.get_current_status())
|
||||
|
||||
|
||||
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:
|
||||
var temperature_meta: String = i_node_temperature.get_meta('um')
|
||||
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:
|
||||
@@ -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_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]
|
||||
var count_above_threshold = 0
|
||||
for i_p in pow_dic[powamp_meta]:
|
||||
if i_p < POWER_THRESHOLD:
|
||||
status = STATE_VAL.ERROR
|
||||
if i_p >= POWER_THRESHOLD:
|
||||
count_above_threshold += 1
|
||||
|
||||
status = STATE_VAL.GOOD if count_above_threshold >= 3 else STATE_VAL.ERROR
|
||||
i_node_powapm.state = status
|
||||
|
||||
|
||||
@@ -91,25 +98,19 @@ func on_press_device() -> void:
|
||||
var dou_2: Node = $dou2_A5
|
||||
var module_fs_3: Node = $kasseta_FS_ND/ref_A3
|
||||
var dou_3: Node = $dou3_A6
|
||||
var control_data: Dictionary = unit_prd_n.get_control_results()
|
||||
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,
|
||||
'node_ip_power_arr': node_ip_power_arr,
|
||||
'fs_nodes': fs_nodes,
|
||||
'power_amplifier': power_amplifier_arr_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,
|
||||
'dou_2': dou_2,
|
||||
'module_fs_3': module_fs_3,
|
||||
'dou_3': dou_3,
|
||||
}
|
||||
for_control_result.merge(control_data, true)
|
||||
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:
|
||||
var meta_y5 = node_y5.get_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
|
||||
break
|
||||
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_n[meta_y5] else STATE_VAL.ERROR
|
||||
else:
|
||||
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
|
||||
for power_supply in for_result_dic.node_ip_power_arr:
|
||||
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
|
||||
else:
|
||||
power_supply.state = STATE_VAL.NONE
|
||||
|
||||
if not for_result_dic.control_is_over:
|
||||
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']:
|
||||
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):
|
||||
@@ -173,3 +170,22 @@ func find_labels(node1: Node):
|
||||
node1.set_meta("tooltip_set", true)
|
||||
for child in node1.get_children():
|
||||
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
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="input_0" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="input_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(495, 443)
|
||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||
|
||||
[node name="input_1" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="input_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(246, 440)
|
||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||
|
||||
[node name="output_0" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="output_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(497, 330)
|
||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||
|
||||
[node name="output_1" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="output_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(249, 331)
|
||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||
|
||||
|
||||
@@ -17,17 +17,21 @@ func _ready() -> void:
|
||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
for temp in power_amplifier:
|
||||
temp.value1 = -70
|
||||
# Подписываемся на сигналы
|
||||
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()
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
set_frame($input_0, unit_prd_v.ems_input_1)
|
||||
set_frame($input_1, unit_prd_v.ems_input_2)
|
||||
set_frame($output_0, unit_prd_v.ems_output_1)
|
||||
set_frame($output_1, unit_prd_v.ems_output_2)
|
||||
set_frame($input_0, unit_prd_v.ems_g_sock_dic.ems_input_1)
|
||||
set_frame($input_1, unit_prd_v.ems_g_sock_dic.ems_input_2)
|
||||
set_frame($output_0, unit_prd_v.ems_g_sock_dic.ems_output_1)
|
||||
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)
|
||||
@@ -49,8 +53,8 @@ static func set_default_state(default_reset_array_node: Array, power_amplifier_a
|
||||
func _enter_tree() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
$control_result.text = 'Ожидается запуск контроля ...' # TODO: Необходимо сделать пулл сообщений
|
||||
$control_result.add_theme_color_override('font_color', Color.ALICE_BLUE)
|
||||
if unit_prd_v:
|
||||
_update_status_text(unit_prd_v.get_current_status())
|
||||
|
||||
|
||||
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:
|
||||
var temperature_meta: String = i_node_temperature.get_meta('um')
|
||||
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:
|
||||
for i_powapm in power_amplifier:
|
||||
var powamp_meta: String = i_powapm.get_meta('um')
|
||||
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier_arr_node: Array, POWER_THRESHOLD: int) -> void:
|
||||
for i_node_powapm in power_amplifier_arr_node:
|
||||
var powamp_meta: String = i_node_powapm.get_meta('um')
|
||||
var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE
|
||||
if not pow_dic.has(powamp_meta): return
|
||||
if pow_dic[powamp_meta].size() < 6:
|
||||
status = STATE_VAL.ERROR
|
||||
else:
|
||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_4: return
|
||||
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_5: return
|
||||
i_powapm.value0 = pow_dic[powamp_meta]
|
||||
for i_p in pow_dic[powamp_meta]:
|
||||
if i_p < POWER_THRESHOLD:
|
||||
status = STATE_VAL.ERROR
|
||||
i_powapm.state = status
|
||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_4: return
|
||||
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_5: return
|
||||
i_node_powapm.value0 = pow_dic[powamp_meta]
|
||||
var count_above_threshold = 0
|
||||
for i_p in pow_dic[powamp_meta]:
|
||||
if i_p >= POWER_THRESHOLD:
|
||||
count_above_threshold += 1
|
||||
|
||||
status = STATE_VAL.GOOD if count_above_threshold >= 3 else STATE_VAL.ERROR
|
||||
i_node_powapm.state = status
|
||||
|
||||
|
||||
func on_press_device() -> void:
|
||||
@@ -93,25 +97,19 @@ func on_press_device() -> void:
|
||||
var dou_4: Node = $dou4_A5
|
||||
var module_fs_5: Node = $kasseta_FS_VD/ref_A2
|
||||
var dou_5: Node = $dou5_A6
|
||||
var control_data = unit_prd_v.get_control_results()
|
||||
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,
|
||||
'node_ip_power_arr': node_ip_power_arr,
|
||||
'fs_nodes': fs_nodes,
|
||||
'power_amplifier': power_amplifier,
|
||||
'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,
|
||||
'dou_4': dou_4,
|
||||
'module_fs_5': module_fs_5,
|
||||
'dou_5': dou_5,
|
||||
}
|
||||
for_control_result.merge(control_data, true)
|
||||
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:
|
||||
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['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
|
||||
break
|
||||
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_v[meta_y5] else STATE_VAL.ERROR
|
||||
|
||||
else:
|
||||
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
|
||||
for power_supply in for_result_dic.node_ip_power_arr:
|
||||
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
|
||||
else:
|
||||
power_supply.state = STATE_VAL.NONE
|
||||
|
||||
if not for_result_dic.control_is_over:
|
||||
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']:
|
||||
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):
|
||||
if node1 is Label:
|
||||
@@ -176,3 +169,22 @@ func find_labels(node1: Node):
|
||||
node1.set_meta("tooltip_set", true)
|
||||
for child in node1.get_children():
|
||||
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"
|
||||
metadata/um = "um_14"
|
||||
|
||||
[node name="input_0" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="input_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(496, 440)
|
||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||
|
||||
[node name="input_1" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="input_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(248, 440)
|
||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||
|
||||
[node name="output_0" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="output_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(496, 336)
|
||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||
|
||||
[node name="output_1" type="AnimatedSprite2D" parent="." groups=["debag_control"]]
|
||||
visible = false
|
||||
[node name="output_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(248, 336)
|
||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ func status_uf() -> void:
|
||||
$lbl_header2.text = 'Прибор исправен'
|
||||
$lbl_header2.modulate = Color.GREEN
|
||||
else:
|
||||
$lbl_header2.text = 'Прибор не исправен'
|
||||
$lbl_header2.text = 'Прибор неисправен'
|
||||
$lbl_header2.modulate = Color.RED
|
||||
$lbl_header2.visible = true
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ func _stop_pulse():
|
||||
pulsing = false
|
||||
disabled = false
|
||||
text = original_text
|
||||
tooltip_text = ''
|
||||
|
||||
|
||||
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]
|
||||
min_value1 = -40.0
|
||||
max_value0 = 1400.0
|
||||
max_value1 = 60.0
|
||||
max_value1 = 55.0
|
||||
step0 = 1.0
|
||||
step1 = 1.0
|
||||
value_name0 = "P,%"
|
||||
@@ -476,10 +476,10 @@ size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "
|
||||
Текущее: 0.00
|
||||
Диапазон: -40.00…70.00"
|
||||
Диапазон: -40.00…60.00"
|
||||
mouse_filter = 0
|
||||
min_value = -40.0
|
||||
max_value = 60.0
|
||||
max_value = 55.0
|
||||
fill_mode = 3
|
||||
nine_patch_stretch = true
|
||||
stretch_margin_left = 8
|
||||
|
||||
@@ -35,7 +35,7 @@ signal pressed(control: PanelContainer)
|
||||
if not is_inside_tree():
|
||||
return
|
||||
$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:
|
||||
@@ -262,7 +262,7 @@ value0 = [20.0, 30.0, 40.0, 50.0, 60.0, 70.0]
|
||||
value1 = -40.0
|
||||
min_value1 = -40.0
|
||||
max_value0 = 1400.0
|
||||
max_value1 = 60.0
|
||||
max_value1 = 55.0
|
||||
step0 = 1.0
|
||||
step1 = 1.0
|
||||
value_name0 = "P,%"
|
||||
@@ -366,10 +366,10 @@ size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "
|
||||
Текущее: -40.00
|
||||
Диапазон: -40.00…70.00"
|
||||
Диапазон: -40.00…60.00"
|
||||
mouse_filter = 0
|
||||
min_value = -40.0
|
||||
max_value = 60.0
|
||||
max_value = 55.0
|
||||
value = -40.0
|
||||
fill_mode = 3
|
||||
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_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():
|
||||
@@ -90,6 +91,7 @@ func _ready():
|
||||
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_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 == 'уарэп-эмс':
|
||||
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:
|
||||
count_device_control_is_ready = 0
|
||||
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
|
||||
|
||||
|
||||
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:
|
||||
ctl_btn_state = state
|
||||
update_pribor_items_visibility()
|
||||
@@ -194,9 +211,6 @@ animations = [{
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_lbx5w"]
|
||||
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||
|
||||
[node name="Контроль" type="Panel"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -470,10 +484,12 @@ texture_normal = ExtResource("2_0nvm1")
|
||||
stretch_mode = 0
|
||||
script = ExtResource("3_4pt7j")
|
||||
state_colors = [Color(1, 1, 1, 1), Color(0, 1, 0, 1), Color(1, 0, 0, 1)]
|
||||
state = 1
|
||||
metadata/unit_name = ["уарэп-эмс"]
|
||||
metadata/online_proc = "on_line_changed"
|
||||
|
||||
[node name="label" type="Label" parent="pribor_uf"]
|
||||
self_modulate = Color(0, 1, 0, 1)
|
||||
layout_mode = 0
|
||||
offset_left = 15.0
|
||||
offset_top = -44.0
|
||||
@@ -1700,24 +1716,15 @@ default_color = Color(1, 1, 1, 0.352941)
|
||||
|
||||
[node name="control_prd" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 1101.0
|
||||
offset_left = 1043.0
|
||||
offset_top = 64.0
|
||||
offset_right = 1326.0
|
||||
offset_right = 1390.0
|
||||
offset_bottom = 104.0
|
||||
focus_mode = 0
|
||||
text = "Запуск контроля"
|
||||
script = ExtResource("18_lbx5w")
|
||||
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_uf" to="pribor_uf" 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_k_4" to="pribor_prd_k_4" method="_on_toggled"]
|
||||
[connection signal="pressed" from="control_prd" to="." method="_on_control_prd_pressed"]
|
||||
[connection signal="toggled" from="check_debag" to="." method="_on_check_debag_toggled"]
|
||||
|
||||
Reference in New Issue
Block a user