Compare commits
25 Commits
sasha
...
c0018044a5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0018044a5 | ||
|
|
cdb884f18d | ||
|
|
2f4ee7be3c | ||
|
|
e7076354b4 | ||
|
|
b44b0aafd1 | ||
|
|
cb1637e21c | ||
|
|
115004194b | ||
|
|
9156249e74 | ||
|
|
6dc31afa15 | ||
|
|
bd78e1010d | ||
|
|
426da5ff04 | ||
|
|
b69eaa29d9 | ||
|
|
c74d5ccdad | ||
|
|
a7c816e6ca | ||
|
|
f89540dfdc | ||
|
|
c45842266a | ||
|
|
64703c46dc | ||
|
|
b022e9e418 | ||
|
|
428831d83f | ||
|
|
021eba8a08 | ||
|
|
3030eac0c9 | ||
|
|
b7fa8cca66 | ||
|
|
5dac4fae5e | ||
|
|
02f8a6a8c5 | ||
|
|
9e74a67e86 |
@@ -4,19 +4,6 @@
|
||||
|
||||
[resource]
|
||||
fallbacks = Array[Font]([ExtResource("1_cxid7")])
|
||||
cache/0/17/0/ascent = 0.0
|
||||
cache/0/17/0/descent = 0.0
|
||||
cache/0/17/0/underline_position = 0.0
|
||||
cache/0/17/0/underline_thickness = 0.0
|
||||
cache/0/17/0/scale = 1.0
|
||||
cache/0/17/0/kerning_overrides/17/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/16/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/18/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/14/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/8/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/15/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/13/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/20/0 = Vector2(0, 0)
|
||||
cache/0/16/0/ascent = 0.0
|
||||
cache/0/16/0/descent = 0.0
|
||||
cache/0/16/0/underline_position = 0.0
|
||||
@@ -30,6 +17,24 @@ cache/0/16/0/kerning_overrides/8/0 = Vector2(0, 0)
|
||||
cache/0/16/0/kerning_overrides/15/0 = Vector2(0, 0)
|
||||
cache/0/16/0/kerning_overrides/13/0 = Vector2(0, 0)
|
||||
cache/0/16/0/kerning_overrides/20/0 = Vector2(0, 0)
|
||||
cache/0/17/0/ascent = 0.0
|
||||
cache/0/17/0/descent = 0.0
|
||||
cache/0/17/0/underline_position = 0.0
|
||||
cache/0/17/0/underline_thickness = 0.0
|
||||
cache/0/17/0/scale = 1.0
|
||||
cache/0/17/0/kerning_overrides/17/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/16/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/18/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/14/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/8/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/15/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/13/0 = Vector2(0, 0)
|
||||
cache/0/17/0/kerning_overrides/20/0 = Vector2(0, 0)
|
||||
cache/0/22/0/ascent = 0.0
|
||||
cache/0/22/0/descent = 0.0
|
||||
cache/0/22/0/underline_position = 0.0
|
||||
cache/0/22/0/underline_thickness = 0.0
|
||||
cache/0/22/0/scale = 1.0
|
||||
cache/0/18/0/ascent = 0.0
|
||||
cache/0/18/0/descent = 0.0
|
||||
cache/0/18/0/underline_position = 0.0
|
||||
@@ -113,8 +118,3 @@ cache/0/19/0/descent = 0.0
|
||||
cache/0/19/0/underline_position = 0.0
|
||||
cache/0/19/0/underline_thickness = 0.0
|
||||
cache/0/19/0/scale = 1.0
|
||||
cache/0/22/0/ascent = 0.0
|
||||
cache/0/22/0/descent = 0.0
|
||||
cache/0/22/0/underline_position = 0.0
|
||||
cache/0/22/0/underline_thickness = 0.0
|
||||
cache/0/22/0/scale = 1.0
|
||||
|
||||
@@ -21,8 +21,8 @@ script_export_mode=0
|
||||
[preset.0.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_wrapper=2
|
||||
custom_template/release="/home/user/temp/godot.linuxbsd.template_release.x86_64"
|
||||
debug/export_console_wrapper=0
|
||||
binary_format/embed_pck=true
|
||||
texture_format/s3tc_bptc=true
|
||||
texture_format/etc2_astc=false
|
||||
|
||||
@@ -61,8 +61,8 @@ script = ExtResource("1_ui6sg")
|
||||
visible = false
|
||||
z_as_relative = false
|
||||
layout_mode = 2
|
||||
border_color = Color(0, 0.549509, 0.921779, 1)
|
||||
border_width = 5.0
|
||||
border_color = Color(0.0941176, 0.0941176, 0.698039, 1)
|
||||
border_width = 10.0
|
||||
editor_only = false
|
||||
|
||||
[node name="back" type="Sprite2D" parent="."]
|
||||
|
||||
@@ -127,6 +127,7 @@ func on_interfer_new(ecm, table_index):
|
||||
|
||||
|
||||
func on_interfer_off(ecm, table_index):
|
||||
if not table_index.has(ecm.ispp): return
|
||||
$table.remove_row(table_index[ecm.ispp])
|
||||
rehash(table_index)
|
||||
var sel_rows: Array
|
||||
|
||||
@@ -10,7 +10,7 @@ const EmitLed = preload('res://scenes/frame-threats/emit-led.tscn') ##
|
||||
const TABLE_HEADER = [ TableHeader, TableHeader, TableHeader, TableHeader , TableHeader ] ## Описание ряда заголовка.
|
||||
const TABLE_ROW = [ CellLineEdit, CellLineEdit, CellLineEdit, CellLineEdit, EmitLed ] ## Описание ряда.
|
||||
const TABLE_COLUMN_PARAM = ['id', 'aoa', 'freq', 'proto', 'emit' ] ## Параметры цели отображаемые в таблице.
|
||||
const TABLE_HEADERS_TEXT = ['№', 'Пеленг', 'Частота, МГц', 'Протокол', 'Помеха' ] ## Заголовки таблицы.
|
||||
const TABLE_HEADERS_TEXT = ['Номер', 'Пеленг', 'Частота, МГц', 'Протокол', 'Помеха' ] ## Заголовки таблицы.
|
||||
const TABLE_COLUMN_SIZE = [ 65, 70, 110, 140, 65] ## Ширины колонок.
|
||||
|
||||
const TABLE_TEXT_ROWS = 4
|
||||
|
||||
@@ -21,6 +21,7 @@ func _ready() -> void:
|
||||
signaller.conn(signaller.start_contol_device, Callable(self, '_on_start_control'))
|
||||
unit_prd_k.connect('control_is_over', Callable(self, 'on_press_device'))
|
||||
unit_prd_k.connect('status_updated', Callable(self, '_on_status_updated'))
|
||||
find_labels(self)
|
||||
# Устанавливаем начальный статус
|
||||
_update_status_text(unit_prd_k.get_current_status())
|
||||
on_press_device(unit_prd_k.self_name)
|
||||
@@ -43,7 +44,6 @@ func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
|
||||
func _on_start_control() -> void:
|
||||
set_default_state(get_tree().get_nodes_in_group('default_reset'))
|
||||
set_default_state(get_tree().get_nodes_in_group('power_amplifier'))
|
||||
find_labels(self)
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
on_press_device(unit_prd_k.self_name)
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ func _ready() -> void:
|
||||
signaller.conn(signaller.start_contol_device, Callable(self, '_on_start_control'))
|
||||
unit_prd_n.connect('control_is_over', Callable(self, 'on_press_device'))
|
||||
unit_prd_n.connect('status_updated', Callable(self, '_on_status_updated'))
|
||||
find_labels(self)
|
||||
# Устанавливаем начальный статус
|
||||
_update_status_text(unit_prd_n.get_current_status())
|
||||
on_press_device(unit_prd_n.self_name)
|
||||
@@ -43,7 +44,6 @@ func _on_start_control() -> void:
|
||||
set_default_state(get_tree().get_nodes_in_group('power_amplifier'))
|
||||
for um in get_tree().get_nodes_in_group('power_amplifier'):
|
||||
um.value0 = [0, 0, 0, 0, 0, 0]
|
||||
find_labels(self)
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
on_press_device(unit_prd_n.self_name)
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ func _ready() -> void:
|
||||
signaller.conn(signaller.start_contol_device, Callable(self, '_on_start_control'))
|
||||
unit_prd_v.connect('control_is_over', Callable(self, 'on_press_device'))
|
||||
unit_prd_v.connect('status_updated', Callable(self, '_on_status_updated'))
|
||||
find_labels(self)
|
||||
# Устанавливаем начальный статус
|
||||
_update_status_text(unit_prd_v.get_current_status())
|
||||
on_press_device(unit_prd_v.self_name)
|
||||
@@ -43,7 +44,6 @@ func _on_start_control() -> void:
|
||||
set_default_state(get_tree().get_nodes_in_group('power_amplifier'))
|
||||
for um in get_tree().get_nodes_in_group('power_amplifier'):
|
||||
um.value0 = [0, 0, 0, 0, 0, 0]
|
||||
find_labels(self)
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
on_press_device(unit_prd_v.self_name)
|
||||
|
||||
|
||||
@@ -1,113 +1,103 @@
|
||||
@tool
|
||||
class_name pribor_uf extends 'res://scenes/контроль/прибор.gd'
|
||||
|
||||
signal control_is_over(device_name: String) # Когда контроль завершен
|
||||
enum STATE_VAL {NONE = 0, GOOD = 1, ERROR = 2}
|
||||
const DEV_LIST: Array = ['00:1f.6', '07:00.0', '08:00.0', '0b:00.0']
|
||||
const USB_TRACKERBALL: String = '13ba:0018'
|
||||
const REVFF: String = '(rev ff)'
|
||||
var unit_uf: Object
|
||||
var uf_control: Object
|
||||
var ctrl_pos = 100
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if Engine.is_editor_hint(): return
|
||||
signaller.conn(signaller.start_contol_device, Callable(self, '_on_start_contol_device'))
|
||||
unit_uf = network.get_unit_instance('уарэп-эмс')
|
||||
unit_uf.connect('line_changed', on_line_changed)
|
||||
on_line_changed()
|
||||
#control_vk()
|
||||
control_ems(unit_uf.status)
|
||||
status_uf()
|
||||
uf_control = get_parent().uf_control
|
||||
signaller.connect('update_uf_serviceability', on_update_uf_serviceability)
|
||||
var uf_status = uf_control.get_current_status()
|
||||
control_ems(uf_status)
|
||||
find_labels(self)
|
||||
|
||||
|
||||
func _on_start_contol_device():
|
||||
on_line_changed()
|
||||
control_ems(unit_uf.status) # проверка ЭМС ячеек
|
||||
status_uf() # отслеживание состояния прибора
|
||||
func on_update_uf_serviceability(_state: int):
|
||||
control_ems(uf_control.get_current_status())
|
||||
|
||||
|
||||
func on_line_changed():
|
||||
if unit_uf.online: # проверка ЯУ, внутреннего коммутатора и ИП-5Б
|
||||
#func control_vk() -> void:
|
||||
#var out_usb_str = ''
|
||||
#var out_pci_str = ''
|
||||
#var out_usb = []
|
||||
#var out_pci = []
|
||||
#
|
||||
#OS.execute('lsusb', [], out_usb) # TODO: Не переносимое, платформозависимое
|
||||
#for element in out_usb:
|
||||
#out_usb_str += element
|
||||
#
|
||||
#OS.execute('lspci', [], out_pci) # TODO: Не переносимое, платформозависимое
|
||||
#for element in out_pci:
|
||||
#out_pci_str += element
|
||||
#
|
||||
#out_usb_str = out_usb_str.split('\n')
|
||||
#out_pci_str = out_pci_str.split('\n')
|
||||
#
|
||||
#var i: int = 0
|
||||
#
|
||||
#for string in out_usb_str:
|
||||
#if USB_TRACKERBALL in string:
|
||||
#i += 1
|
||||
#break
|
||||
#for string in out_pci_str:
|
||||
#for item in DEV_LIST:
|
||||
#if item in string:
|
||||
#i += 1
|
||||
#if REVFF in string:
|
||||
#i -= 1
|
||||
#break
|
||||
#
|
||||
#if i == (DEV_LIST.size() + 1):
|
||||
#$ref_uf/ref_bu1/ref_A8_BU.state = STATE_VAL.GOOD
|
||||
#else:
|
||||
#$ref_uf/ref_bu1/ref_A8_BU.state = STATE_VAL.ERROR
|
||||
|
||||
|
||||
func control_ems(status: Dictionary) -> void:
|
||||
if status['УФ-онлайн']:
|
||||
$ref_uf/ref_kassetav13/ref_A7_YAU07.state = STATE_VAL.GOOD
|
||||
$ref_uf/ref_kassetav13/ref_A3_IP5B.state = STATE_VAL.GOOD
|
||||
$ref_uf/ref_bu1/ref_A8_BU.state = STATE_VAL.GOOD
|
||||
$ref_uf/ref_kassetav13/ref_A9_ESW.state = STATE_VAL.GOOD
|
||||
$ref_uf/ref_bu1/ref_A8_BU.state = STATE_VAL.GOOD ## заглушка для зеленения ВК-110
|
||||
$ref_uf/ref_kassetav13/ref_A4_KEMS.state = STATE_VAL.GOOD if status['КЭМС-Б1'] else STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A5_EMS.state = STATE_VAL.GOOD if status['ЭМС-Б1'] else STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A6_EMS.state = STATE_VAL.GOOD if status['ЭМС-Б2'] else STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A12_IP27B.state = STATE_VAL.GOOD if status['ИП220-27Б'] else STATE_VAL.ERROR
|
||||
else:
|
||||
$ref_uf/ref_kassetav13/ref_A7_YAU07.state = STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A3_IP5B.state = STATE_VAL.NONE
|
||||
$ref_uf/ref_bu1/ref_A8_BU.state = STATE_VAL.NONE
|
||||
$ref_uf/ref_kassetav13/ref_A9_ESW.state = STATE_VAL.NONE
|
||||
$ref_uf/ref_kassetav13/ref_A4_KEMS.state = STATE_VAL.NONE
|
||||
$ref_uf/ref_kassetav13/ref_A5_EMS.state = STATE_VAL.NONE
|
||||
$ref_uf/ref_kassetav13/ref_A6_EMS.state = STATE_VAL.NONE
|
||||
$ref_uf/ref_kassetav13/ref_A3_IP5B.state = STATE_VAL.NONE
|
||||
$ref_uf/ref_kassetav13/ref_A9_ESW.state = STATE_VAL.NONE
|
||||
$ref_uf/ref_kassetav13/ref_A12_IP27B.state = STATE_VAL.NONE
|
||||
$ref_uf/ref_bu1/ref_A8_BU.state = STATE_VAL.NONE
|
||||
status_uf(status)
|
||||
|
||||
|
||||
func control_vk() -> void:
|
||||
var out_usb_str = ''
|
||||
var out_pci_str = ''
|
||||
var out_usb = []
|
||||
var out_pci = []
|
||||
|
||||
OS.execute('lsusb', [], out_usb) # TODO: Не переносимое, платформозависимое
|
||||
for element in out_usb:
|
||||
out_usb_str += element
|
||||
|
||||
OS.execute('lspci', [], out_pci) # TODO: Не переносимое, платформозависимое
|
||||
for element in out_pci:
|
||||
out_pci_str += element
|
||||
|
||||
out_usb_str = out_usb_str.split('\n')
|
||||
out_pci_str = out_pci_str.split('\n')
|
||||
|
||||
var i: int = 0
|
||||
|
||||
for string in out_usb_str:
|
||||
if USB_TRACKERBALL in string:
|
||||
i += 1
|
||||
break
|
||||
for string in out_pci_str:
|
||||
for item in DEV_LIST:
|
||||
if item in string:
|
||||
i += 1
|
||||
if REVFF in string:
|
||||
i -= 1
|
||||
break
|
||||
|
||||
if i == (DEV_LIST.size() + 1):
|
||||
$ref_uf/ref_bu1/ref_A8_BU.state = STATE_VAL.GOOD
|
||||
else:
|
||||
$ref_uf/ref_bu1/ref_A8_BU.state = STATE_VAL.ERROR
|
||||
|
||||
|
||||
func control_ems(status: Array) -> void:
|
||||
if status:
|
||||
$ref_uf/ref_kassetav13/ref_A4_KEMS.state = STATE_VAL.GOOD if ((status[0] >> 0) & 1) and ((status[0] >> 3) & 1) else STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A5_EMS.state = STATE_VAL.GOOD if ((status[0] >> 1) & 1) and ((status[0] >> 4) & 1) else STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A6_EMS.state = STATE_VAL.GOOD if ((status[0] >> 2) & 1) and ((status[0] >> 5) & 1) else STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A12_IP27B.state = STATE_VAL.GOOD if ((status[2] >> 6) & 1) else STATE_VAL.ERROR
|
||||
|
||||
|
||||
func status_uf() -> void:
|
||||
var status_bu: int = $ref_uf/ref_bu1/ref_A8_BU.state
|
||||
var status_yau: int = $ref_uf/ref_kassetav13/ref_A7_YAU07.state
|
||||
var status_kyems: int = $ref_uf/ref_kassetav13/ref_A4_KEMS.state
|
||||
var status_yems0: int = $ref_uf/ref_kassetav13/ref_A5_EMS.state
|
||||
var status_yems1: int = $ref_uf/ref_kassetav13/ref_A6_EMS.state
|
||||
var status_ip5: int = $ref_uf/ref_kassetav13/ref_A3_IP5B.state
|
||||
var status_ip27: int = $ref_uf/ref_kassetav13/ref_A12_IP27B.state
|
||||
|
||||
if (status_yau == 1) and (status_bu == 1) and (status_kyems == 1) \
|
||||
and (status_yems0 == 1) and (status_yems1 == 1) and (status_ip5 == 1) and (status_ip27 == 1):
|
||||
$lbl_header2.text = 'Прибор исправен'
|
||||
$lbl_header2.modulate = Color.GREEN
|
||||
else:
|
||||
$lbl_header2.text = 'Прибор неисправен'
|
||||
$lbl_header2.modulate = Color.RED
|
||||
func status_uf(status_uf_dic: Dictionary) -> void:
|
||||
var is_ok: bool = true
|
||||
if not status_uf_dic['УФ-онлайн']:
|
||||
$lbl_header2.text = 'Ожидание связи с ЯУ-07Б'
|
||||
$lbl_header2.modulate = Color.WHITE
|
||||
elif status_uf_dic['УФ-онлайн']:
|
||||
for socket in status_uf_dic:
|
||||
if not status_uf_dic[socket]:
|
||||
is_ok = false
|
||||
if is_ok:
|
||||
$lbl_header2.text = 'Прибор исправен'
|
||||
$lbl_header2.modulate = Color.GREEN
|
||||
elif not is_ok:
|
||||
$lbl_header2.text = 'Прибор неисправен'
|
||||
$lbl_header2.modulate = Color.RED
|
||||
$lbl_header2.visible = true
|
||||
emit_signal('control_is_over', unit_uf.name)
|
||||
|
||||
|
||||
func find_labels(node1: Node):
|
||||
|
||||
93
scenes/pribor-uf/uf-ctl.gd
Normal file
93
scenes/pribor-uf/uf-ctl.gd
Normal file
@@ -0,0 +1,93 @@
|
||||
class_name UFControl extends Node
|
||||
|
||||
signal update_uf_serviceability(status: int)
|
||||
|
||||
#region Константы и переменные
|
||||
enum StatusIndex {SOCKETS = 0, IP_220_27B = 2}
|
||||
enum STATE_VAL {NONE = 0, GOOD = 1, ERROR = 2}
|
||||
var unit_uf: Object
|
||||
var uf_status: Dictionary = {'УФ-онлайн': false, 'КЭМС-Б1': false, 'ЭМС-Б1': false, 'ЭМС-Б2': false, 'ИП220-27Б': false}
|
||||
|
||||
var _self_name: String
|
||||
var _serviceability: int = STATE_VAL.NONE
|
||||
var serviceability_uf: int:
|
||||
get:
|
||||
return _serviceability
|
||||
set(value):
|
||||
if value != _serviceability:
|
||||
_serviceability = value
|
||||
signaller.emit_signal('update_uf_serviceability', value)
|
||||
#endregion
|
||||
|
||||
#region Инициализация
|
||||
func _init(name_uf: String) -> void:
|
||||
_self_name = name_uf
|
||||
unit_uf = network.get_unit_instance(_self_name)
|
||||
unit_uf.connect('line_changed', on_line_changed)
|
||||
unit_uf.connect('data_received', on_data_received)
|
||||
#endregion
|
||||
|
||||
#region Обработчики сигналов
|
||||
func on_line_changed(status: Object) -> void:
|
||||
'''Обработка изменения состояния линии связи'''
|
||||
uf_status['УФ-онлайн'] = status.online
|
||||
update_serviceability()
|
||||
|
||||
func on_data_received(yau: Object) -> void:
|
||||
'''Обработка полученных данных от УФ'''
|
||||
var new_ems_status = control_ems(yau.status)
|
||||
var status_changed = false
|
||||
|
||||
# Обновляем только ключи КЭМС/ЭМС, сохраняя 'УФ-онлайн'
|
||||
for key in ['КЭМС-Б1', 'ЭМС-Б1', 'ЭМС-Б2', 'ИП220-27Б']:
|
||||
var old_value = uf_status.get(key, false)
|
||||
var new_value = new_ems_status.get(key, false)
|
||||
|
||||
if old_value != new_value:
|
||||
uf_status[key] = new_value
|
||||
status_changed = true
|
||||
|
||||
if status_changed:
|
||||
update_serviceability()
|
||||
#endregion
|
||||
|
||||
#region Статус и сервисабельность
|
||||
func get_current_status() -> Dictionary:
|
||||
'''Получение текущего статуса (только для чтения)'''
|
||||
return uf_status.duplicate(true)
|
||||
|
||||
func is_operational() -> bool:
|
||||
'''Проверка, все ли системы работают нормально'''
|
||||
return serviceability_uf and uf_status.get('УФ-онлайн', false)
|
||||
|
||||
|
||||
func update_serviceability() -> void:
|
||||
'''Обновление общего статуса сервисабельности'''
|
||||
var new_serviceability: int = STATE_VAL.GOOD
|
||||
|
||||
# Проверяем онлайн-статус
|
||||
if uf_status.get('УФ-онлайн', false) == false:
|
||||
new_serviceability = STATE_VAL.NONE
|
||||
else:
|
||||
# Проверяем все статусы КЭМС/ЭМС
|
||||
for key in ['КЭМС-Б1', 'ЭМС-Б1', 'ЭМС-Б2', 'ИП220-27Б']:
|
||||
if uf_status.get(key, true) == false:
|
||||
new_serviceability = STATE_VAL.ERROR
|
||||
break
|
||||
# Новое значение через setter
|
||||
self.serviceability_uf = new_serviceability
|
||||
#endregion
|
||||
|
||||
#region Вспомогательные методы
|
||||
static func control_ems(status: Array) -> Dictionary:
|
||||
'''Анализ статусов КЭМС/ЭМС'''
|
||||
var status_dic: Dictionary = {}
|
||||
if status.is_empty() or status.size() < 3:
|
||||
return status_dic
|
||||
|
||||
status_dic['КЭМС-Б1'] = bool((status[StatusIndex.SOCKETS] >> 0) & 1) and bool((status[StatusIndex.SOCKETS] >> 3) & 1)
|
||||
status_dic['ЭМС-Б1'] = bool((status[StatusIndex.SOCKETS] >> 1) & 1) and bool((status[StatusIndex.SOCKETS] >> 4) & 1)
|
||||
status_dic['ЭМС-Б2'] = bool((status[StatusIndex.SOCKETS] >> 2) & 1) and bool((status[StatusIndex.SOCKETS] >> 5) & 1)
|
||||
status_dic['ИП220-27Б'] = bool((status[StatusIndex.IP_220_27B] >> 6) & 1)
|
||||
return status_dic
|
||||
#endregion
|
||||
1
scenes/pribor-uf/uf-ctl.gd.uid
Normal file
1
scenes/pribor-uf/uf-ctl.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b6avo0uvwrxnj
|
||||
@@ -1,6 +1,6 @@
|
||||
extends Label
|
||||
|
||||
enum PRD_STATE {
|
||||
enum DEVICE_STATE {
|
||||
NONE, # Нет связи
|
||||
GOOD, # Исправно
|
||||
ERR # Отказ
|
||||
@@ -13,9 +13,9 @@ enum DEVICE_STATUS {
|
||||
}
|
||||
|
||||
const STATUS_CONFIG := {
|
||||
PRD_STATE.NONE: {"text": "Нет связи", "color": Color.WHITE, "font_color": Color.BLACK},
|
||||
PRD_STATE.GOOD: {"text": "Исправно", "color": Color.GREEN, "font_color": Color.BLACK},
|
||||
PRD_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:
|
||||
@@ -58,7 +58,8 @@ class DeviceObserver:
|
||||
return changed
|
||||
|
||||
var device_observers: Dictionary = {}
|
||||
var overall_prd_state: PRD_STATE = PRD_STATE.NONE
|
||||
var overall_prd_state: DEVICE_STATE = DEVICE_STATE.NONE
|
||||
var status_uf: int = DEVICE_STATE.NONE # Статус УФ (УАРЭП-ЭМС)
|
||||
|
||||
func _ready() -> void:
|
||||
tooltip_text = 'Нет связи с приборами комплекса'
|
||||
@@ -77,9 +78,7 @@ func _ready() -> void:
|
||||
prd_module.unit_yau07.connect('line_changed', Callable(self, '_on_prd_online_changed').bind(prd_module))
|
||||
|
||||
# Подписка на УФ
|
||||
var unit_uf = network.get_unit_instance('уарэп-эмс')
|
||||
if unit_uf:
|
||||
unit_uf.data_received.connect(Callable(self, '_on_uf_status_receive'))
|
||||
signaller.connect('update_uf_serviceability', _on_uf_status_receive)
|
||||
|
||||
# Инициализация начального состояния
|
||||
_recalculate_overall_state()
|
||||
@@ -111,41 +110,51 @@ func _on_prd_control_results(results: Dictionary, prd_module: Object) -> void:
|
||||
_recalculate_overall_state()
|
||||
|
||||
|
||||
func _on_uf_status_receive(_unit_uf: Object) -> void:
|
||||
# Логика для УФ (раскомментируй если нужно)
|
||||
# var KEMS_B = ((unit_uf.status[0] >> 0) & 1) and ((unit_uf.status[0] >> 3) & 1)
|
||||
# var EMS_B_1 = ((unit_uf.status[0] >> 1) & 1) and ((unit_uf.status[0] >> 4) & 1)
|
||||
# var EMS_B_2 = ((unit_uf.status[0] >> 2) & 1) and ((unit_uf.status[0] >> 5) & 1)
|
||||
# var IP27B = ((unit_uf.status[2] >> 6) & 1)
|
||||
# var uf_operational = KEMS_B and EMS_B_1 and EMS_B_2 and IP27B
|
||||
# signaller.emit_signal('update_uf_serviceability', uf_operational)
|
||||
pass
|
||||
func _on_uf_status_receive(unit_uf_status: int) -> void:
|
||||
if status_uf != unit_uf_status:
|
||||
status_uf = unit_uf_status
|
||||
_recalculate_overall_state()
|
||||
|
||||
|
||||
func _recalculate_overall_state() -> void:
|
||||
var new_state := PRD_STATE.NONE
|
||||
var has_online_devices := false
|
||||
var all_operational := true
|
||||
var new_state := DEVICE_STATE.NONE
|
||||
|
||||
# Проверяем статус ПРД
|
||||
var prd_state := DEVICE_STATE.NONE
|
||||
var has_online_prd := false
|
||||
var all_prd_operational := true
|
||||
|
||||
for observer in device_observers.values():
|
||||
if observer.status[DEVICE_STATUS.ONLINE]:
|
||||
has_online_devices = true
|
||||
has_online_prd = true
|
||||
|
||||
if observer.status[DEVICE_STATUS.CONTROL]:
|
||||
# Если контроль завершен - строгая проверка
|
||||
if not observer.status[DEVICE_STATUS.STATUS]:
|
||||
all_operational = false
|
||||
all_prd_operational = false
|
||||
break
|
||||
else:
|
||||
# Если контроль в процессе - мягкая проверка
|
||||
if not observer.status[DEVICE_STATUS.STATUS]:
|
||||
all_operational = false
|
||||
# Не прерываем, чтобы проверить все устройства
|
||||
all_prd_operational = false
|
||||
|
||||
if has_online_devices:
|
||||
new_state = PRD_STATE.GOOD if all_operational else PRD_STATE.ERR
|
||||
if has_online_prd:
|
||||
if all_prd_operational:
|
||||
prd_state = DEVICE_STATE.GOOD
|
||||
else:
|
||||
prd_state = DEVICE_STATE.ERR
|
||||
else:
|
||||
new_state = PRD_STATE.NONE
|
||||
prd_state = DEVICE_STATE.NONE
|
||||
|
||||
# Комбинируем статусы по правилу:
|
||||
# 1. Если хоть один ERROR → ERROR
|
||||
# 2. Если нет ERROR и хоть один GOOD → GOOD
|
||||
# 3. Иначе → NONE
|
||||
|
||||
if prd_state == DEVICE_STATE.ERR or status_uf == DEVICE_STATE.ERR:
|
||||
new_state = DEVICE_STATE.ERR
|
||||
elif prd_state == DEVICE_STATE.GOOD or status_uf == DEVICE_STATE.GOOD:
|
||||
new_state = DEVICE_STATE.GOOD
|
||||
else:
|
||||
new_state = DEVICE_STATE.NONE
|
||||
|
||||
if overall_prd_state != new_state:
|
||||
overall_prd_state = new_state
|
||||
@@ -162,15 +171,83 @@ func _update_display() -> void:
|
||||
|
||||
|
||||
func _get_tooltip_text() -> String:
|
||||
var tooltip := ""
|
||||
|
||||
# Получаем статистику по ПРД
|
||||
var prd_summary = _get_prd_summary()
|
||||
var uf_status_str = _get_uf_status_text()
|
||||
|
||||
match overall_prd_state:
|
||||
PRD_STATE.NONE:
|
||||
return "Нет связи с приборами комплекса"
|
||||
PRD_STATE.GOOD:
|
||||
return "Все приборы комплекса исправны"
|
||||
PRD_STATE.ERR:
|
||||
return "Обнаружены неисправности в комплексе"
|
||||
DEVICE_STATE.NONE:
|
||||
tooltip = "Нет исправных систем в комплексе"
|
||||
DEVICE_STATE.GOOD:
|
||||
tooltip = "Комплекс исправен"
|
||||
DEVICE_STATE.ERR:
|
||||
tooltip = "Обнаружены неисправности в комплексе"
|
||||
|
||||
tooltip += "\n\nСтатус ПРД систем: " + prd_summary
|
||||
tooltip += "\nСтатус УФ: " + uf_status_str
|
||||
|
||||
# Детализация по источникам статуса
|
||||
tooltip += "\n\nСостояние систем:"
|
||||
|
||||
# ПРД системы
|
||||
var prd_ok_count = 0
|
||||
var prd_total = 0
|
||||
for observer in device_observers.values():
|
||||
if observer.status[DEVICE_STATUS.ONLINE]:
|
||||
prd_total += 1
|
||||
if observer.status[DEVICE_STATUS.STATUS]:
|
||||
prd_ok_count += 1
|
||||
|
||||
tooltip += "\nПРД: %d/%d исправно" % [prd_ok_count, prd_total]
|
||||
|
||||
# УФ система
|
||||
tooltip += "\nУФ: " + _get_uf_status_text()
|
||||
|
||||
return tooltip
|
||||
|
||||
|
||||
func _get_prd_summary() -> String:
|
||||
var online_count := 0
|
||||
var operational_count := 0
|
||||
|
||||
for observer in device_observers.values():
|
||||
if observer.status[DEVICE_STATUS.ONLINE]:
|
||||
online_count += 1
|
||||
if observer.status[DEVICE_STATUS.STATUS]:
|
||||
operational_count += 1
|
||||
|
||||
if online_count == 0:
|
||||
return "Нет связи"
|
||||
else:
|
||||
return "%d/%d исправно" % [operational_count, online_count]
|
||||
|
||||
|
||||
func _get_uf_status_text() -> String:
|
||||
match status_uf:
|
||||
DEVICE_STATE.NONE:
|
||||
return "Нет данных"
|
||||
DEVICE_STATE.GOOD:
|
||||
return "Исправен"
|
||||
DEVICE_STATE.ERR:
|
||||
return "Неисправен"
|
||||
_:
|
||||
return "Неизвестное состояние"
|
||||
return "Неизвестно"
|
||||
|
||||
|
||||
func _has_prd_errors() -> bool:
|
||||
for observer in device_observers.values():
|
||||
if observer.status[DEVICE_STATUS.ONLINE] and not observer.status[DEVICE_STATUS.STATUS]:
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
func _has_operational_prd() -> bool:
|
||||
for observer in device_observers.values():
|
||||
if observer.status[DEVICE_STATUS.ONLINE] and observer.status[DEVICE_STATUS.STATUS]:
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
# Публичные методы для получения информации
|
||||
@@ -181,7 +258,8 @@ func get_device_status(device_name: String) -> Dictionary:
|
||||
"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()
|
||||
"last_results": observer.last_results.duplicate(),
|
||||
"status_uf": status_uf
|
||||
}
|
||||
return {}
|
||||
|
||||
@@ -204,5 +282,6 @@ func get_overall_status() -> Dictionary:
|
||||
"online_devices": online_count,
|
||||
"operational_devices": operational_count,
|
||||
"total_devices": device_observers.size(),
|
||||
"control_complete_devices": control_complete_count
|
||||
"control_complete_devices": control_complete_count,
|
||||
"uf_status": status_uf
|
||||
}
|
||||
|
||||
@@ -45,6 +45,14 @@ func enter_press():
|
||||
Input.parse_input_event(enter_event)
|
||||
|
||||
|
||||
func _on_settings_changed():
|
||||
if not is_inside_tree(): return
|
||||
var white_color = ProjectSettings.get_setting('Схема прибора. Белый цвет', Color.LIGHT_GRAY)
|
||||
var black_color = ProjectSettings.get_setting('Схема прибора. Чёрный цвет', Color.BLACK)
|
||||
$pic_functional.material.set('shader_parameter/white', white_color)
|
||||
$pic_functional.material.set('shader_parameter/black', black_color)
|
||||
|
||||
|
||||
@export var state: int:
|
||||
set(v):
|
||||
v = 0 if v < 0 else v % state_colors.size()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=30 format=3 uid="uid://lwmw4egynmd1"]
|
||||
[gd_scene load_steps=33 format=3 uid="uid://lwmw4egynmd1"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bar8k5qef7kch" path="res://data/УФ.png" id="2_0nvm1"]
|
||||
[ext_resource type="Script" uid="uid://q3gmpsqspjfp" path="res://scenes/контроль/внешний.gd" id="2_8r80x"]
|
||||
@@ -54,6 +54,7 @@ const PRIBORS_RES = \\
|
||||
'pribor_uf': ['res://scenes/pribor-uf/pribor-uf.tscn', 'Контроль исправности прибора УФ'],
|
||||
'pribor_uyep': ['res://scenes/pribor-uyep/pribor-uyep.tscn', 'Контроль исправности устройства У-ЭП'],
|
||||
}
|
||||
var uf_control: UFControl
|
||||
var ctl_btn_state := false
|
||||
var cur_pribor_node = null
|
||||
var check_ready_control: Dictionary = {}
|
||||
@@ -67,8 +68,8 @@ func on_serv_changed(u, pribor_node, _pribor_meta): pribor_node.state = int(u.se
|
||||
func on_mode_changed():
|
||||
clean_pribor_items()
|
||||
reset_pribor_buttons()
|
||||
$chk_show_functional.disabled = true
|
||||
$chk_show_functional.button_pressed = false
|
||||
$frame_button/chk_show_functional.disabled = true
|
||||
$frame_button/chk_show_functional.button_pressed = false
|
||||
|
||||
|
||||
func reset_pribor_buttons():
|
||||
@@ -106,6 +107,7 @@ func _ready():
|
||||
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'))
|
||||
if item == 'уарэп-эмс':
|
||||
uf_control = UFControl.new('уарэп-эмс')
|
||||
signaller.connect('update_uf_serviceability', Callable(self, 'on_update_uf_serviceability').bind(pribor_node))
|
||||
|
||||
# Пиктограммы приборов, которые отображают состояние подключения только
|
||||
@@ -115,6 +117,7 @@ func _ready():
|
||||
var conn_node: = pribor_node.get_node('connect_pribor')
|
||||
unit_instance.connect('line_changed', on_line_changed.bind(conn_node, unit_name))
|
||||
|
||||
|
||||
signaller.conn(signaller.режим_работа, on_mode_changed)
|
||||
signaller.conn(signaller.режим_журнал, on_mode_changed)
|
||||
signaller.conn(signaller.режим_настройки, on_mode_changed)
|
||||
@@ -142,8 +145,8 @@ func clean_pribor_items():
|
||||
func on_pribor_press(pribor_path, header_text, pribor_node):
|
||||
if cur_pribor_node:
|
||||
cur_pribor_node.show_functional = false
|
||||
$chk_show_functional.disabled = false
|
||||
$chk_show_functional.button_pressed = false
|
||||
$frame_button/chk_show_functional.disabled = false
|
||||
$frame_button/chk_show_functional.button_pressed = false
|
||||
cur_pribor_node = pribor_node
|
||||
clean_pribor_items()
|
||||
var pribor_obj = load(pribor_path)
|
||||
@@ -155,7 +158,7 @@ func on_pribor_press(pribor_path, header_text, pribor_node):
|
||||
push_error('экземпляр не создан: \\\"%s\\\" (%s)' % [pribor_path, header_text])
|
||||
return
|
||||
$lbl_header.text = header_text
|
||||
$chk_show_functional.disabled = false
|
||||
$frame_button/chk_show_functional.disabled = false
|
||||
var meta_list = pribor_node.get_meta_list()
|
||||
if meta_list.find('unit_name') > -1:
|
||||
var unit_name = pribor_node.get_meta('unit_name')
|
||||
@@ -170,8 +173,8 @@ func on_serviceability_changed(state: int, prd_pribor_node: Node)-> void:
|
||||
prd_pribor_node.state = state
|
||||
|
||||
|
||||
func on_update_uf_serviceability(uf_serviceaability: bool, uf_pribor: Node)-> void:
|
||||
uf_pribor.state = 1 if uf_serviceaability else 2
|
||||
func on_update_uf_serviceability(uf_serviceaability: int, uf_pribor: Node)-> void:
|
||||
uf_pribor.state = uf_serviceaability
|
||||
|
||||
|
||||
func _on_chk_show_functional_toggled(toggled_on: bool) -> void:
|
||||
@@ -219,8 +222,8 @@ func _on_gui_input(event: InputEvent) -> void:
|
||||
node.button_pressed = false
|
||||
clean_pribor_items()
|
||||
cur_pribor_node = null
|
||||
$chk_show_functional.button_pressed = false
|
||||
$chk_show_functional.disabled = true
|
||||
$frame_button/chk_show_functional.button_pressed = false
|
||||
$frame_button/chk_show_functional.disabled = true
|
||||
|
||||
|
||||
func on_control_button_pressed(state: bool) -> void:
|
||||
@@ -252,10 +255,32 @@ animations = [{
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_71ec4"]
|
||||
shader = ExtResource("9_71ec4")
|
||||
shader_parameter/white = Vector3(0.14, 0.13, 0.13)
|
||||
shader_parameter/black = Vector3(0.95, 0.55, 0.05)
|
||||
shader_parameter/white = Vector3(0, 0, 0)
|
||||
shader_parameter/black = Vector3(1, 1, 1)
|
||||
shader_parameter/gamma = 2.0
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6hcgs"]
|
||||
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_l5wui"]
|
||||
bg_color = Color(0.47451, 0.47451, 0.47451, 1)
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0.890196, 0.486275, 0.196078, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_j3xqy"]
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0.890196, 0.486275, 0.196078, 1)
|
||||
|
||||
[node name="Контроль" type="Panel"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -456,7 +481,7 @@ texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
flip_h = true
|
||||
script = ExtResource("3_4pt7j")
|
||||
state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(0.65, 0.0715, 0.0715, 1)]
|
||||
state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(100, 0, 0, 1)]
|
||||
metadata/online_proc = "on_line_changed"
|
||||
metadata/unit_name = ["уарэп-яу07-1н"]
|
||||
|
||||
@@ -547,7 +572,6 @@ 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
|
||||
@@ -1425,7 +1449,7 @@ texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
flip_h = true
|
||||
script = ExtResource("3_4pt7j")
|
||||
state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(0.65, 0.0715, 0.0715, 1)]
|
||||
state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(100, 0, 0, 1)]
|
||||
metadata/unit_name = ["уарэп-яу07-1в"]
|
||||
metadata/online_proc = "on_line_changed"
|
||||
|
||||
@@ -1512,7 +1536,7 @@ texture_normal = ExtResource("6_i1yfn")
|
||||
stretch_mode = 4
|
||||
flip_h = true
|
||||
script = ExtResource("3_4pt7j")
|
||||
state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(0.65, 0.0715, 0.0715, 1)]
|
||||
state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(100, 0, 0, 1)]
|
||||
metadata/unit_name = ["уарэп-яу07-1к"]
|
||||
metadata/online_proc = "on_line_changed"
|
||||
|
||||
@@ -1911,14 +1935,24 @@ text = "Контроль исправности прибора"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="chk_show_functional" type="CheckButton" parent="."]
|
||||
[node name="frame_button" type="Panel" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 1029.0
|
||||
offset_top = 15.0
|
||||
offset_right = 1408.0
|
||||
offset_bottom = 49.0
|
||||
offset_left = 1040.0
|
||||
offset_top = 12.0
|
||||
offset_right = 1416.0
|
||||
offset_bottom = 52.0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_6hcgs")
|
||||
|
||||
[node name="chk_show_functional" type="CheckButton" parent="frame_button"]
|
||||
layout_mode = 0
|
||||
offset_left = 2.0
|
||||
offset_top = 3.0
|
||||
offset_right = 374.0
|
||||
offset_bottom = 37.0
|
||||
focus_mode = 0
|
||||
theme_override_font_sizes/font_size = 22
|
||||
text = "Показать функциональную схему Э2"
|
||||
disabled = true
|
||||
text = "Функциональная схема Э2"
|
||||
flat = true
|
||||
|
||||
[node name="connect_legend0" type="AnimatedSprite2D" parent="."]
|
||||
@@ -1977,11 +2011,16 @@ default_color = Color(1, 1, 1, 0.352941)
|
||||
|
||||
[node name="control_prd_button" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 1043.0
|
||||
offset_left = 1040.0
|
||||
offset_top = 64.0
|
||||
offset_right = 1390.0
|
||||
offset_right = 1416.0
|
||||
offset_bottom = 104.0
|
||||
focus_mode = 0
|
||||
theme_override_colors/font_hover_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_l5wui")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxFlat_l5wui")
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_j3xqy")
|
||||
text = "Запуск контроля"
|
||||
script = ExtResource("18_lbx5w")
|
||||
metadata/_edit_lock_ = true
|
||||
@@ -2014,5 +2053,5 @@ texture = ExtResource("22_1s34a")
|
||||
[connection signal="toggled" from="pribor_prd_v_4" to="pribor_prd_v_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="chk_show_functional" to="." method="_on_chk_show_functional_toggled"]
|
||||
[connection signal="toggled" from="frame_button/chk_show_functional" to="." method="_on_chk_show_functional_toggled"]
|
||||
[connection signal="pressed" from="control_prd_button" to="." method="_on_control_prd_pressed"]
|
||||
|
||||
@@ -192,7 +192,7 @@ func init_fs_failed():
|
||||
var sectors_count = $canvas.fs_default_colors.size()
|
||||
fs_failed.resize(sectors_count)
|
||||
for i in fs_failed.size():
|
||||
fs_failed[i] = AntBandState.ANT_BAND_READY
|
||||
fs_failed[i] = AntBandState.ANT_BAND_FAILED
|
||||
|
||||
|
||||
## Производит инициализацию.
|
||||
@@ -629,7 +629,7 @@ func on_interfer_prinuditelno(prenuditelno_sectors):
|
||||
## Вызывается при получении информации о состоянии модулей ФС от КАПС РПБ.
|
||||
func on_fs_update_state(fs_dict: Dictionary):
|
||||
for key in fs_dict.keys():
|
||||
fs_failed[key] = fs_dict[key].isg
|
||||
fs_failed[key] = fs_dict[key].ready
|
||||
|
||||
|
||||
func on_btn_center_toggled(toggled_on: bool) -> void:
|
||||
|
||||
@@ -384,8 +384,8 @@ texture_normal = ExtResource("14_ggrwd")
|
||||
[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate_toggled"]
|
||||
[connection signal="toggled" from="btn_center" to="." method="on_btn_center_toggled"]
|
||||
[connection signal="button_down" from="zoom_plus" to="tilemap" method="_on_zoom_plus_button_down"]
|
||||
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_plus_button_up"]
|
||||
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_button_up"]
|
||||
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_plus_button_up"]
|
||||
[connection signal="button_down" from="zoom_minus" to="tilemap" method="_on_zoom_minus_button_down"]
|
||||
[connection signal="button_up" from="zoom_minus" to="tilemap" method="_on_zoom_button_up"]
|
||||
[connection signal="pressed" from="btn_all_work" to="." method="_on_btn_all_work_pressed"]
|
||||
|
||||
@@ -310,10 +310,12 @@ class EmsBoard:
|
||||
return true
|
||||
|
||||
func set_load_done():
|
||||
if unit_ems.cmd_state != unit_ems.CmdState.DONE: return
|
||||
state_board = LOADING
|
||||
unit_ems.send_load_ems_done(unit_ems.CmdCode.LOAD_EMS_DONE)
|
||||
|
||||
func execute_cmd():
|
||||
if unit_ems.cmd_state != unit_ems.CmdState.DONE: return
|
||||
if len(cmd_array):
|
||||
state_board = WRITE
|
||||
var cmd: Array = cmd_array.pop_front()
|
||||
|
||||
@@ -485,11 +485,15 @@ text = "Изделие"
|
||||
|
||||
[node name="Label" type="Label" parent="СкруглённыйПрямоугСалатный"]
|
||||
offset_left = -33.0
|
||||
offset_top = -10.2857
|
||||
offset_top = -17.1429
|
||||
offset_right = 35.0
|
||||
offset_bottom = 8.71429
|
||||
offset_bottom = 13.8571
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "Комплекс"
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "Источник
|
||||
информации"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 3
|
||||
|
||||
[node name="Label3" type="Label" parent="СкруглённыйПрямоугСалатный"]
|
||||
offset_left = 133.0
|
||||
@@ -519,19 +523,22 @@ horizontal_alignment = 1
|
||||
|
||||
[node name="Label6" type="Label" parent="СкруглённыйПрямоугСалатный"]
|
||||
offset_left = 516.75
|
||||
offset_top = -10.2857
|
||||
offset_top = -18.8572
|
||||
offset_right = 574.75
|
||||
offset_bottom = 8.7143
|
||||
offset_bottom = 22.1428
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "Верхняя"
|
||||
text = "Верхняя
|
||||
частота"
|
||||
|
||||
[node name="Label7" type="Label" parent="СкруглённыйПрямоугСалатный"]
|
||||
offset_left = 441.0
|
||||
offset_top = -10.2857
|
||||
offset_top = -19.7143
|
||||
offset_right = 495.0
|
||||
offset_bottom = 8.7143
|
||||
offset_bottom = 21.2857
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "Нижняя"
|
||||
text = "Нижняя
|
||||
частота"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label8" type="Label" parent="СкруглённыйПрямоугСалатный"]
|
||||
offset_left = 362.25
|
||||
|
||||
@@ -289,10 +289,10 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit_instance) -> v
|
||||
var ecm_active = true
|
||||
if not gos_flag:
|
||||
if ecm.nmfs in gos_nmfs:
|
||||
interfer_off(ecm, unit_instance)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
ecm_active = false
|
||||
if ecm_active and (prd.fs_caps_id[ecm.nmfs] in fs_closed):
|
||||
interfer_off(ecm, unit_instance)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
|
||||
var th_id = thr.id
|
||||
for ecm_i in thrs.keys():
|
||||
@@ -302,9 +302,9 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit_instance) -> v
|
||||
ecm.kni = fposmod(thr.aoa - course, 360)
|
||||
call_ecm_proc(ecm)
|
||||
if ecm.nmfs in gos_nmfs:
|
||||
interfer_off(ecm, unit_instance)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
elif prd.fs_caps_id[ecm.nmfs] in fs_closed:
|
||||
interfer_off(ecm, unit_instance)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
else:
|
||||
send_ecm(ecm, unit_instance)
|
||||
signaller.emit_signal('fs_update_color', ecms)
|
||||
@@ -394,7 +394,7 @@ func on_interfer_create(interfer_name, sel_threats, fs_arr, power, u, ecms) -> v
|
||||
for ecm in ecms.values():
|
||||
if ecm.nmfs == item.nmfs:
|
||||
if item.priority > ecm.priority:
|
||||
interfer_off(ecm, u)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
elif item.priority < ecm.priority:
|
||||
need_continue = true
|
||||
break
|
||||
@@ -508,7 +508,6 @@ func interfer_create(u, interfer_name, ecms, param, kni, id, dict, source_interf
|
||||
func send_ecm(ecm, unit0) -> void:
|
||||
if ecm.krp != INTERFER_OFF:
|
||||
if not ecm.modulation:
|
||||
ecm.svk = 0
|
||||
call_deferred('emit_signal', 'interfer_update', ecm)
|
||||
return
|
||||
msg6_num += 1
|
||||
@@ -516,17 +515,17 @@ func send_ecm(ecm, unit0) -> void:
|
||||
unit0.tx_stack.append(json_data)
|
||||
|
||||
|
||||
func on_interfer_off_all(unit0, ecms: Dictionary) -> void:
|
||||
func on_interfer_off_all(_unit0, ecms: Dictionary) -> void:
|
||||
for ecm in ecms.values():
|
||||
interfer_off(ecm, unit0)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
|
||||
|
||||
func on_threats_lost(th, ecms, unit0) -> void:
|
||||
func on_threats_lost(th, ecms, _unit0) -> void:
|
||||
for key in interfer.thrs:
|
||||
if interfer.thrs[key] == th.id:
|
||||
var ecm_id = key
|
||||
var ecm = ecms[ecm_id]
|
||||
interfer_off(ecm, unit0)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
|
||||
|
||||
func pop_id() -> int:
|
||||
@@ -653,19 +652,36 @@ func get_krp(threat: threats.Threat):
|
||||
for key in ITERFER_MODE.keys():
|
||||
var ecm_params = ITERFER_MODE[key][1]
|
||||
if not ecm_params.has('files'): continue
|
||||
if ecm_params['files'] == threat.rparams['filename']:
|
||||
krp = key
|
||||
return krp
|
||||
if typeof(ecm_params['files']) == TYPE_DICTIONARY:
|
||||
for value in ecm_params['files'].values():
|
||||
if typeof(value) == TYPE_STRING:
|
||||
if value == threat.rparams['filename']:
|
||||
krp = key
|
||||
return krp
|
||||
elif typeof(value) == TYPE_ARRAY:
|
||||
if value[0] == threat.rparams['filename']:
|
||||
krp = key
|
||||
return krp
|
||||
elif typeof(ecm_params['files']) == TYPE_STRING:
|
||||
if ecm_params['files'] == threat.rparams['filename']:
|
||||
krp = key
|
||||
return krp
|
||||
return krp
|
||||
|
||||
|
||||
func on_interfer_off(ecm: Interfer, _ecms, unit_caps):
|
||||
func on_interfer_off(ecm: Interfer, ecms, unit_caps):
|
||||
ecm.krp = INTERFER_OFF
|
||||
send_ecm(ecm, unit_caps)
|
||||
|
||||
|
||||
func interfer_off(ecm, _unit_caps):
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
if not unit_caps.online:
|
||||
var sz = ecms.size()
|
||||
signaller.emit_signal('on_prog_ecm_off', ecm)
|
||||
ecms.erase(ecm.ispp)
|
||||
thrs.erase(ecm.ispp)
|
||||
cu.erase(ecm.ispp)
|
||||
fs.erase(ecm.ispp)
|
||||
push_id(ecm.ispp)
|
||||
if sz != ecms.size():
|
||||
interfer.call_deferred('emit_signal', 'interfer_resized', ecms)
|
||||
|
||||
|
||||
func on_interfer_new(ecm, unit_caps):
|
||||
|
||||
@@ -2,6 +2,8 @@ extends Node
|
||||
|
||||
enum PrdState {WORK, CONTROL}
|
||||
|
||||
const TIME_YAU07_SEND = 50
|
||||
|
||||
## Границы секторов блоков ФС по частоте в режиме РТО.
|
||||
const FS_BAND_RTO: Dictionary = {
|
||||
0: [200.0, 250.0],
|
||||
@@ -119,6 +121,9 @@ class Fs:
|
||||
var freq_caps_rx: float = 0.0 ## Частота принятая от КАПС РПБ
|
||||
var width_caps_rx: float = 0.0 ## Ширина полосы принятая от КАПС РПБ
|
||||
var msvk: Array
|
||||
var ready: bool = false ## Готовность сектора к излучению
|
||||
var caps_online: bool = false ## Состояние связи с КАПС РПБ
|
||||
var yau_07_online: bool = false ## Состояние связи ЯУ-07
|
||||
|
||||
signal update_modulation(index)
|
||||
|
||||
@@ -149,6 +154,9 @@ class Fs:
|
||||
data_arr.append(um_port)
|
||||
data_arr.append(val)
|
||||
|
||||
# Установка готовности модуля ФС к излучению
|
||||
func set_ready():
|
||||
ready = isg and caps_online and yau_07_online
|
||||
|
||||
class PRD:
|
||||
enum STATE_DEVICE {
|
||||
@@ -208,7 +216,6 @@ class PRD:
|
||||
if port == fs.um_port:
|
||||
fs.um_code_rx = u.isa_ports[port] & 0x7
|
||||
|
||||
|
||||
func on_line_changed(unit_ems):
|
||||
if not unit_ems.online:
|
||||
yemsg_board.ems_load = yemsg_board.LoadState.NOT_DEFINED
|
||||
@@ -303,11 +310,13 @@ class PRD:
|
||||
break
|
||||
return STATE_DEVICE.NONE if all_online else STATE_DEVICE.ERROR
|
||||
|
||||
|
||||
func execute_cmd():
|
||||
var time_now = Time.get_ticks_msec()
|
||||
if (time_now - unit_yau07.time_tx) < TIME_YAU07_SEND: return
|
||||
if not len(cmd_array): return
|
||||
if unit_yau07.cmd_state != unit_yau07.CmdState.DONE: return
|
||||
var cmd: Array = cmd_array.pop_front()
|
||||
unit_yau07.time_tx = time_now
|
||||
unit_yau07.send_isa(cmd[0], cmd[1])
|
||||
|
||||
func start_load():
|
||||
@@ -338,14 +347,16 @@ class PRD:
|
||||
yemsg_board.set_wait()
|
||||
log.error('Не удалось прочитать файл настроек ячейки ЭМС-Г %s' %abs_dir)
|
||||
|
||||
|
||||
func on_update_modulation(index):
|
||||
yemsg_board.add_cmd(index/4, fs_dic[index].modulation)
|
||||
|
||||
func set_um(data_arr):
|
||||
cmd_array.append([unit_yau07.CmdCode.WRITE_ISA, data_arr])
|
||||
|
||||
|
||||
func set_fs_caps_online(caps_online: bool):
|
||||
for fs in fs_dic.values():
|
||||
fs.caps_online = caps_online
|
||||
fs.set_ready()
|
||||
|
||||
func _ready() -> void:
|
||||
check_dir()
|
||||
@@ -353,6 +364,7 @@ func _ready() -> void:
|
||||
var unit_prd = network.get_unit_instance(prd_name)
|
||||
var new_prd = PRD.new(prd_name, unit_prd)
|
||||
prd_dict[prd_name] = new_prd
|
||||
new_prd.unit_yau07.connect('line_changed', on_yau07_line_changed.bind(new_prd))
|
||||
var unit_control = TestPRD.new({'unit_prd': unit_prd}, new_prd.cmd_array)
|
||||
add_child(unit_control)
|
||||
new_prd.unit_control = unit_control
|
||||
@@ -367,6 +379,7 @@ func _ready() -> void:
|
||||
fs_caps_id[FS_PRD[key][1]] = key
|
||||
var unit_caps = network.get_unit_instance('уарэп-капсрпб')
|
||||
unit_caps.connect('data_received', Callable(self, 'on_data_capsrpb_received'))
|
||||
unit_caps.connect('line_changed', Callable(self, 'on_caps_line_changed'))
|
||||
signaller.connect('режим_контроль', Callable(self, 'on_mode_changed').bind(PrdState.CONTROL))
|
||||
signaller.connect('режим_работа', Callable(self, 'on_mode_changed').bind(PrdState.WORK))
|
||||
var unit_nav = network.get_unit_instance('навигация')
|
||||
@@ -433,7 +446,6 @@ func update_fs_state(ecms, trenaz_mode: bool):
|
||||
prd_module.set_um(um_data_array)
|
||||
|
||||
|
||||
|
||||
## Проверяет ниличие директории, если их нет, создаёт
|
||||
func check_dir():
|
||||
var dir = DirAccess.open(yemsconsts.emsg_files_folder)
|
||||
@@ -461,6 +473,7 @@ func on_data_capsrpb_received(unit0: capsrpb.CapsRpb):
|
||||
var fs_module = fs_dict[ii]
|
||||
if fs.has('isg'):
|
||||
fs_module.isg = int(fs['isg'])
|
||||
fs_module.set_ready()
|
||||
if fs.has('pow'):
|
||||
fs_module.pow_caps_rx = int(fs['pow'])
|
||||
if fs.has('freq'):
|
||||
@@ -479,3 +492,16 @@ func on_mode_changed(changed_mode: int) -> void:
|
||||
|
||||
func on_navi_data_received(data: Dictionary):
|
||||
course = data.get('k', 0.0)
|
||||
|
||||
|
||||
func on_caps_line_changed(unit_caps):
|
||||
for pribor_prd in prd_dict.values():
|
||||
pribor_prd.set_fs_caps_online(unit_caps.online)
|
||||
signaller.emit_signal('fs_update_state', fs_dict)
|
||||
|
||||
|
||||
func on_yau07_line_changed(unit_yau07, prd_pribor):
|
||||
for fs in prd_pribor.fs_dic.values():
|
||||
fs.yau_07_online = unit_yau07.online
|
||||
fs.set_ready()
|
||||
signaller.emit_signal('fs_update_state', fs_dict)
|
||||
|
||||
@@ -14,7 +14,7 @@ const PROGRESS_RAY_STATES: float = 50.0
|
||||
const PROGRESS_COMPLETE: float = 100.0
|
||||
|
||||
## Константы для работы с лучами управления
|
||||
const COUNT_PACK_POWER_RECIEVE = 15
|
||||
const COUNT_PACK_POWER_RECIEVE = 10
|
||||
const RAY_MASK = 0x07
|
||||
const SPECIAL_LITERAS = [3, 5, 7]
|
||||
const RAY_m5: String = 'RAY_m5'
|
||||
@@ -160,7 +160,7 @@ var current_status: String = 'Ожидание запуска контроля'
|
||||
## Сигналы класса
|
||||
signal control_is_over(device_name: String) # Когда контроль завершен
|
||||
signal status_updated(status_text: String) # Сигнал для обновления статуса
|
||||
signal control_results_updated(control_results: Dictionary) # Обновление результатов контроля
|
||||
signal control_results_updated(control_results: Dictionary) # Обновление результатов контроля
|
||||
signal update_progress(progress_value: float) # Обновление статуса выполнения контроля
|
||||
signal update_max_value_progress(max_progress_value: int) # Установка максимального значения для прогресс бара
|
||||
|
||||
@@ -390,7 +390,6 @@ func _handle_init_state() -> void:
|
||||
if _get_current_ecm(): return
|
||||
state = STATE_MACHINE.CHEK_KASSETA_Y5
|
||||
else:
|
||||
if _get_current_ecm(): return
|
||||
# Завершение контроля если литеры закончились
|
||||
flags.control_is_over = true
|
||||
power_result = prep_power(power_for_litera, self_name)
|
||||
@@ -996,18 +995,17 @@ static func on_y5_control_result(block_kasseta: Dictionary) -> bool:
|
||||
## Установка угла и аттенюации для УМ
|
||||
static func on_ug_setting(prd_unit: Object, settings_ug: Dictionary, prd_cmd_array: Array, cur_litera: int) -> bool:
|
||||
var result_1: int
|
||||
var result_2: int
|
||||
if cur_litera == 1:
|
||||
result_1 = ((settings_ug.ATT_UM_1 & 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_3, settings_ug.ATT_UM_3]])
|
||||
else:
|
||||
#if cur_litera in [2, 4, 6]:
|
||||
result_1 = ((settings_ug.ATT_UM_1 & 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]])
|
||||
#elif cur_litera in [3, 5, 7]:
|
||||
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_2, result_2]])
|
||||
if cur_litera in [2, 4, 6]:
|
||||
result_1 = ((settings_ug.ATT_UM_1 & 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]])
|
||||
elif cur_litera in [3, 5, 7]:
|
||||
result_1 = ((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_2, result_1]])
|
||||
return true
|
||||
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ signal update_coordinates_map(new_coordinates)
|
||||
|
||||
## Вызывается при изменении исправности прибора УФ.[br]
|
||||
## [param uf_serviceaability] - обновленное значение состояния исправности ([b]true[/b]
|
||||
signal update_uf_serviceability(uf_serviceaability: bool)
|
||||
signal update_uf_serviceability(uf_serviceaability: int)
|
||||
|
||||
|
||||
signal tool_tip(new_ctrl_pos)
|
||||
|
||||
@@ -39,6 +39,7 @@ class Threat:
|
||||
func set_from_dic(dic: Dictionary):
|
||||
var items: = fflags.keys().filter(func(vn): return dic.has(vn))
|
||||
items.any(func(vn): set(vn, dic[vn]); fflags[vn] = true; return false)
|
||||
if dic.has('pow'): power = dic['pow']
|
||||
|
||||
|
||||
signal threat_new(th: Threat)
|
||||
|
||||
@@ -41,6 +41,7 @@ class YaU07 extends unit.Unit:
|
||||
var isa_block: = {} ## Результат выполнения команды "читать массив из порта"
|
||||
var flash_data: = PackedByteArray() ## Данные прочитанные из Flash
|
||||
var flash_len: = 0 ## Длинна данных прочитанных из Flash
|
||||
var time_tx: int = 0 ## Время последней отправки команды
|
||||
|
||||
|
||||
func _to_string() -> String: return String('яу07: %s %s' % [self.name, ['отключен', 'на связи'][int(online)]])
|
||||
@@ -72,6 +73,8 @@ class YaU07 extends unit.Unit:
|
||||
rc = Error.OK
|
||||
cmd_tick_tx = tick
|
||||
cmd_retry -= 1
|
||||
cmd_num_tx = (cmd_num_rx + 1) % 0xffff
|
||||
tx_data.encode_u16(2, cmd_num_tx)
|
||||
else:
|
||||
cmd_state = CmdState.FAIL
|
||||
emit_signal('command_fail', self)
|
||||
|
||||
Reference in New Issue
Block a user