Отладка интегрального контроля
This commit is contained in:
@@ -13,9 +13,9 @@ enum DEVICE_STATUS {
|
||||
}
|
||||
|
||||
const STATUS_CONFIG := {
|
||||
DEVICE_STATE.NONE: {"text": "Нет связи", "color": Color.WHITE, "font_color": Color.BLACK},
|
||||
DEVICE_STATE.GOOD: {"text": "Исправно", "color": Color.GREEN, "font_color": Color.BLACK},
|
||||
DEVICE_STATE.ERR: {"text": "Отказ", "color": Color.RED, "font_color": Color.WHITE}
|
||||
DEVICE_STATE.NONE: {'text': 'Нет связи', 'color': Color.WHITE, 'font_color': Color.BLACK},
|
||||
DEVICE_STATE.GOOD: {'text': 'Исправно', 'color': Color.GREEN, 'font_color': Color.BLACK},
|
||||
DEVICE_STATE.ERR: {'text': 'Отказ', 'color': Color.RED, 'font_color': Color.WHITE}
|
||||
}
|
||||
|
||||
class DeviceObserver:
|
||||
@@ -62,7 +62,7 @@ var status_uf: int = DEVICE_STATE.NONE # Статус УФ (УАРЭП-ЭМС)
|
||||
|
||||
func _ready() -> void:
|
||||
tooltip_text = 'Нет связи с приборами комплекса'
|
||||
add_theme_color_override("font_color", Color.BLACK)
|
||||
add_theme_color_override('font_color', Color.BLACK)
|
||||
|
||||
# Инициализация наблюдателей
|
||||
_initialize_observers()
|
||||
@@ -161,15 +161,15 @@ func _recalculate_overall_state() -> void:
|
||||
|
||||
|
||||
func _update_display() -> void:
|
||||
var config: Dictionary
|
||||
var config: Dictionary = STATUS_CONFIG[overall_prd_state].duplicate()
|
||||
text = config.text
|
||||
modulate = config.color
|
||||
add_theme_color_override("font_color", config.font_color)
|
||||
add_theme_color_override('font_color', config.font_color)
|
||||
tooltip_text = _get_tooltip_text()
|
||||
|
||||
|
||||
func _get_tooltip_text() -> String:
|
||||
var tooltip := ""
|
||||
var tooltip := ''
|
||||
|
||||
# Получаем статистику по ПРД
|
||||
var prd_summary = _get_prd_summary()
|
||||
@@ -177,17 +177,17 @@ func _get_tooltip_text() -> String:
|
||||
|
||||
match overall_prd_state:
|
||||
DEVICE_STATE.NONE:
|
||||
tooltip = "Нет исправных систем в комплексе"
|
||||
tooltip = 'Нет исправных систем в комплексе'
|
||||
DEVICE_STATE.GOOD:
|
||||
tooltip = "Комплекс исправен"
|
||||
tooltip = 'Комплекс исправен'
|
||||
DEVICE_STATE.ERR:
|
||||
tooltip = "Обнаружены неисправности в комплексе"
|
||||
tooltip = 'Обнаружены неисправности в комплексе'
|
||||
|
||||
tooltip += "\n\nСтатус ПРД систем: " + prd_summary
|
||||
tooltip += "\nСтатус УФ: " + uf_status_str
|
||||
tooltip += '\n\nСтатус ПРД систем: ' + prd_summary
|
||||
tooltip += '\nСтатус УФ: ' + uf_status_str
|
||||
|
||||
# Детализация по источникам статуса
|
||||
tooltip += "\n\nСостояние систем:"
|
||||
tooltip += '\n\nСостояние систем:'
|
||||
|
||||
# ПРД системы
|
||||
var prd_ok_count = 0
|
||||
@@ -198,10 +198,10 @@ func _get_tooltip_text() -> String:
|
||||
if observer.status[DEVICE_STATUS.STATUS]:
|
||||
prd_ok_count += 1
|
||||
|
||||
tooltip += "\nПРД: %d/%d исправно" % [prd_ok_count, prd_total]
|
||||
tooltip += '\nПРД: %d/%d исправно' % [prd_ok_count, prd_total]
|
||||
|
||||
# УФ система
|
||||
tooltip += "\nУФ: " + _get_uf_status_text()
|
||||
tooltip += '\nУФ: ' + _get_uf_status_text()
|
||||
|
||||
return tooltip
|
||||
|
||||
@@ -217,21 +217,21 @@ func _get_prd_summary() -> String:
|
||||
operational_count += 1
|
||||
|
||||
if online_count == 0:
|
||||
return "Нет связи"
|
||||
return 'Нет связи'
|
||||
else:
|
||||
return "%d/%d исправно" % [operational_count, online_count]
|
||||
return '%d/%d исправно' % [operational_count, online_count]
|
||||
|
||||
|
||||
func _get_uf_status_text() -> String:
|
||||
match status_uf:
|
||||
DEVICE_STATE.NONE:
|
||||
return "Нет данных"
|
||||
return 'Нет данных'
|
||||
DEVICE_STATE.GOOD:
|
||||
return "Исправен"
|
||||
return 'Исправен'
|
||||
DEVICE_STATE.ERR:
|
||||
return "Неисправен"
|
||||
return 'Неисправен'
|
||||
_:
|
||||
return "Неизвестно"
|
||||
return 'Неизвестно'
|
||||
|
||||
|
||||
func _has_prd_errors() -> bool:
|
||||
@@ -253,11 +253,11 @@ func get_device_status(device_name: String) -> Dictionary:
|
||||
var observer: DeviceObserver = device_observers.get(device_name)
|
||||
if observer:
|
||||
return {
|
||||
"online": observer.status[DEVICE_STATUS.ONLINE],
|
||||
"operational": observer.status[DEVICE_STATUS.STATUS],
|
||||
"control_complete": observer.status[DEVICE_STATUS.CONTROL],
|
||||
"last_results": observer.last_results,
|
||||
"status_uf": status_uf
|
||||
'online': observer.status[DEVICE_STATUS.ONLINE],
|
||||
'operational': observer.status[DEVICE_STATUS.STATUS],
|
||||
'control_complete': observer.status[DEVICE_STATUS.CONTROL],
|
||||
'last_results': observer.last_results.duplicate(),
|
||||
'status_uf': status_uf
|
||||
}
|
||||
return {}
|
||||
|
||||
@@ -276,10 +276,10 @@ func get_overall_status() -> Dictionary:
|
||||
control_complete_count += 1
|
||||
|
||||
return {
|
||||
"overall_state": overall_prd_state,
|
||||
"online_devices": online_count,
|
||||
"operational_devices": operational_count,
|
||||
"total_devices": device_observers.size(),
|
||||
"control_complete_devices": control_complete_count,
|
||||
"uf_status": status_uf
|
||||
'overall_state': overall_prd_state,
|
||||
'online_devices': online_count,
|
||||
'operational_devices': operational_count,
|
||||
'total_devices': device_observers.size(),
|
||||
'control_complete_devices': control_complete_count,
|
||||
'uf_status': status_uf
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://c3cyog3gy24ft" path="res://data/У-ЭП.png" id="16_gjf0t"]
|
||||
[ext_resource type="Script" uid="uid://xjs7owe2iexn" path="res://scenes/контроль/control_prd.gd" id="18_lbx5w"]
|
||||
[ext_resource type="Texture2D" uid="uid://b2vf7en1jj8dv" path="res://data/У-РЭП-РПД-В.png" id="20_l5wui"]
|
||||
[ext_resource type="Script" path="res://scenes/контроль/panel_container.gd" id="21_l5wui"]
|
||||
[ext_resource type="Script" uid="uid://j16hg3u2uvu5" path="res://scenes/контроль/panel_container.gd" id="21_l5wui"]
|
||||
[ext_resource type="Texture2D" uid="uid://cllxcfa130vqu" path="res://data/УА-РЭП.png" id="22_1s34a"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_iqgf5"]
|
||||
|
||||
@@ -1140,7 +1140,7 @@ static func _create_fs_mapping(s_name: String) -> 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
|
||||
var updated_results := fs_results.duplicate()
|
||||
for fs_num in packet_type_7:
|
||||
if not (fs_num in fs_mapping and fs_mapping[fs_num]['condition']):
|
||||
continue
|
||||
@@ -1209,19 +1209,19 @@ static func power_um_ukp(status: PackedByteArray, litera: int, pwr_result: Array
|
||||
static func update_max_power_values(power_data: Array, max_power_values: Array) -> Array:
|
||||
if power_data.size() != 6:
|
||||
if max_power_values.is_empty():
|
||||
max_power_values = power_data
|
||||
max_power_values = power_data.duplicate()
|
||||
elif power_data[0] > max_power_values[0]:
|
||||
max_power_values = power_data
|
||||
max_power_values = power_data.duplicate()
|
||||
return max_power_values
|
||||
|
||||
if max_power_values.is_empty():
|
||||
max_power_values = power_data
|
||||
max_power_values = power_data.duplicate()
|
||||
else:
|
||||
for i in 6:
|
||||
if power_data[i] > max_power_values[i]:
|
||||
max_power_values[i] = power_data[i]
|
||||
|
||||
return max_power_values
|
||||
return max_power_values.duplicate()
|
||||
|
||||
|
||||
## Подготовка принятых данных по контролю для передачи в сцену
|
||||
@@ -1322,7 +1322,7 @@ func _deep_copy_power_structure() -> Dictionary:
|
||||
for litera in power_for_litera:
|
||||
copy[litera] = {}
|
||||
for ray_type in power_for_litera[litera]:
|
||||
copy[litera][ray_type] = power_for_litera[litera][ray_type]
|
||||
copy[litera][ray_type] = power_for_litera[litera][ray_type].duplicate()
|
||||
return copy
|
||||
|
||||
## Восстановление состояний по умолчанию
|
||||
|
||||
Reference in New Issue
Block a user