92 Commits

Author SHA1 Message Date
TotMaxim
c74d5ccdad Отладка интегрального контроля УФ 2025-12-07 20:14:51 +03:00
TotMaxim
a7c816e6ca Доработка интегрального контроля УФ 2025-12-07 18:49:03 +03:00
MaD_CaT
f89540dfdc Исправления ящик сундуков 2025-12-05 16:44:31 +03:00
MaD_CaT
c45842266a Исправления названия столбца в списках целей, корректировка курса 2025-12-05 10:18:21 +03:00
TotMaxim
64703c46dc Исправление опечатки в кнопки включения схем Э2 2025-12-04 20:15:43 +03:00
TotMaxim
b022e9e418 Доработка рекомендации отображении кнопки запуска контроля 2025-12-04 19:58:33 +03:00
MaD_CaT
428831d83f отладка яу 2025-12-04 17:10:27 +03:00
TotMaxim
021eba8a08 Доработка интегрального контроля 2025-12-03 16:51:33 +03:00
TotMaxim
3030eac0c9 Доработка от godot, сам отрефакторил кэш 2025-12-03 12:43:19 +03:00
TotMaxim
b7fa8cca66 Merge remote-tracking branch 'origin/MAD_CAT' into prd-control 2025-12-03 12:34:54 +03:00
MaD_CaT
5dac4fae5e Доработка. Исправность секторов ФС зависит от связи с КАПС РПБ и ЯУ-07. 2025-12-03 12:09:01 +03:00
TotMaxim
02f8a6a8c5 Merge remote-tracking branch 'lepshiy/master-tniis' into prd-control
# Conflicts:
#	scenes/tilemap/tilemap.gd
#	scenes/контроль/кнопка-прибора.gd
#	scenes/работа/работа.tscn
2025-12-03 11:29:02 +03:00
MaD_CaT
9e74a67e86 Доработка. Выключение помехи, если КАПС РПБ не на связи 2025-12-03 10:15:51 +03:00
MaD_CaT
17460b5b0d отладка отправки помех в капс рпб 2025-12-02 12:44:50 +03:00
MaD_CaT
d622001db6 в процессе отладки отправки помех 2025-12-02 11:40:03 +03:00
TotMaxim
98cc111092 Доработка после объединения 2025-12-01 22:38:35 +03:00
TotMaxim
4db6060ed7 Merge remote-tracking branch 'origin/sasha80' into prd-control
# Conflicts:
#	scenes/контроль/кнопка-прибора.gd
#	scenes/контроль/контроль.tscn
#	scripts/network.gd
2025-12-01 22:35:26 +03:00
sasha80
64b120b086 Исправление. ERROR: Подготовить шаблон: Указанный путь экспорта не существует.
at: add_message (editor/export/editor_export_platform.h:243)
ERROR: Project export for preset "Linux-X11" failed.
   at: _fs_changed (editor/editor_node.cpp:1103)
2025-12-01 16:25:01 +03:00
sasha80
32f2649734 Исправление. ERROR: This project doesn't have an export_presets.cfg file at its root. Create an export preset from the "Project > Export" dialog and try again. 2025-12-01 16:21:11 +03:00
MaD_CaT
28704039d2 Исправление. Сообщения накапливаются в буфере при высоком количестве пакетов для отправки 2025-12-01 14:01:28 +03:00
MaD_CaT
88b350cdba Рефактор. Табуляция 2025-12-01 13:37:03 +03:00
TotMaxim
bee611be07 Доработка выхода из контроля 2025-11-30 21:29:36 +03:00
TotMaxim
ed82e5b67d Доработка Логики конфигураций 2025-11-30 19:27:08 +03:00
TotMaxim
dfe88a1205 Доработка. Не вмешивается в режим работу (отключение помех при переходе в другие режимы) 2025-11-28 21:51:49 +03:00
TotMaxim
388b92836c Доработка. Убрана поправка в 270 градусов направления рисунка корабля. Выставление луча контроль в режиме "Работа". Чтение номера байта состояния от СПТ25. Имена комплексов на вкладке ЭМС. 2025-11-28 21:31:09 +03:00
TotMaxim
5f14600459 Доработка индикации контроля AnimatedSprite2D 2025-11-27 00:16:36 +03:00
TotMaxim
37eb6f75a4 Откат изменений 2025-11-26 14:45:21 +03:00
TotMaxim
e6ea873294 Исправление логики переключений лучей во время контроля 2025-11-26 14:08:49 +03:00
TotMaxim
20eec6e8be Отладка убран лишний коннект прибор нода 2025-11-26 12:42:23 +03:00
TotMaxim
0c8f02bc77 Доработка интегрального контроля (в процессе) 2025-11-25 20:36:47 +03:00
TotMaxim
bfb9d3a4e8 Доработка работы с ecms в контроле + форматирование пробелов 2025-11-25 12:31:45 +03:00
TotMaxim
5eb44fd20a Доработка мини баров 2025-11-23 21:28:45 +03:00
TotMaxim
5b1984a307 Добавление проверки в serviceability 2025-11-23 19:03:34 +03:00
TotMaxim
dd642ea057 Добавление подписки на line change от яу 07 2025-11-23 17:22:14 +03:00
TotMaxim
63de1118b0 Свчетчик пакетов при ДКМ 2025-11-23 16:44:18 +03:00
TotMaxim
831b2e0ea8 Доработка кнопки отладки контроля в настройках 2025-11-22 21:51:51 +03:00
TotMaxim
423411cf94 Доработка машины сосотояний и результатов контроля 2025-11-22 21:41:11 +03:00
TotMaxim
8f2a6b031b рефактор 2025-11-22 16:03:56 +03:00
TotMaxim
2e5edc793e Доработка класса по загрузке конфигураций контроля 2025-11-22 02:26:31 +03:00
TotMaxim
b273a01bf5 Фиксация после слияний версий /sasha/master 2025-11-22 01:53:09 +03:00
TotMaxim
c6ed61b6ce Merge remote-tracking branch 'kitya/uarep-master' into prd-control
# Conflicts:
#	scenes/контроль/кнопка-прибора.gd
#	scenes/контроль/контроль.tscn
#	scenes/эмс2/эмс_тг.gd
#	scripts/interfer.gd
#	table/table.gd
2025-11-22 01:43:27 +03:00
TotMaxim
7954048f11 Промежуточная фиксация изменений 2025-11-22 01:30:51 +03:00
lepshiy
6b8f767a89 Merge remote-tracking branch 'refs/remotes/sasha/master' 2025-11-20 13:49:25 +03:00
lepshiy
8c330d08a6 Отображение координат и масштаба карты перенеcены наверх (в один ряд с кнопкой "Тренаж") 2025-11-20 13:45:21 +03:00
TotMaxim
a8b085a514 Доработка проверки яу 07б
и корректировка температур ум в контроле
2025-11-18 19:59:45 +03:00
TotMaxim
3fb2601aca Доработка мини баров + сообщения оператору 2025-11-18 16:24:05 +03:00
TotMaxim
38c2aa9f80 Рефактор. pribor-prd.gd и позиции сцены 2025-11-17 23:35:43 +03:00
TotMaxim
f39212232a Модификация провекри и результата контроля ум, если 3 луча проходят по мощности, то ум считается исправным 2025-11-17 21:16:48 +03:00
TotMaxim
dc362ad26f Изменения границ температур на усилителях в контроле 2025-11-17 15:07:29 +03:00
TotMaxim
208406971f Отображение ПРД-К интерфейса в контроле 2025-11-17 14:37:56 +03:00
TotMaxim
9eb31c0d4a После объединения 2025-11-17 14:28:03 +03:00
TotMaxim
033e9869f1 Merge remote-tracking branch 'kitya/Dniissasha' into prd-control
# Conflicts:
#	project.godot
#	scenes/работа/работа.gd
#	scripts/interfer.gd
#	scripts/signaller.gd
#	scripts/threats.gd
2025-11-17 14:08:57 +03:00
TotMaxim
5e78e06626 Доработка индикации прогресс бара, проверку загрузки файла, сброс результатов контроля 2025-11-17 13:58:11 +03:00
TotMaxim
56a0fd8af8 Доработка перехода из одной литеры в дургую, провекра ecm, корректировка подписей 2025-11-17 12:49:35 +03:00
TotMaxim
5293313f0e Доработка отображения мощностей и конфертацию json парсера 2025-11-16 22:27:38 +03:00
TotMaxim
04da0d0cfd исправления обработки кнопки "тренаж" 2025-11-16 20:50:41 +03:00
TotMaxim
89bc19ec98 добавления файлов конфигурации для контроля прд 2025-11-16 20:17:15 +03:00
TotMaxim
9f32e293a0 доработка нового блока (блок-к.tscn) 2025-11-16 20:12:44 +03:00
TotMaxim
217281ce51 доработка мониторинга температур контроля 2025-11-16 19:30:59 +03:00
TotMaxim
de86d281ca загрузка json 2025-11-16 16:43:32 +03:00
TotMaxim
9727eb04a9 Корректировка интерфейса контроля 2025-11-16 14:05:57 +03:00
lepshiy
e1cd37bcfd Доработка. 2025-11-14 14:05:07 +03:00
lepshiy
dcd806309c Merge remote-tracking branch 'refs/remotes/sasha/master'
# Conflicts:
#	scenes/tilemap/tilemap.gd
#	scenes/работа/работа.gd
#	scripts/settings.gd
#	scripts/signaller.gd
#	scripts/trassa.gd
2025-11-14 13:23:28 +03:00
lepshiy
3915bd59d1 Доработка. 2025-11-14 13:23:15 +03:00
TotMaxim
69b455f811 Добавление анимации кнопки запуска контроля 2025-11-13 00:23:39 +03:00
TotMaxim
9856e300e9 Отладил отображение контроля фс и зависимости от резальтата 2025-11-12 21:40:57 +03:00
TotMaxim
87e360e1a9 После отладки, добавление индикации состояний эмс ячеек 2025-11-12 20:47:35 +03:00
TotMaxim
2980aa9f15 корректировка объединений 2025-11-11 16:41:39 +03:00
TotMaxim
5b5b5d31c6 Merge remote-tracking branch 'origin/MAD_CAT' into prd-control
# Conflicts:
#	scenes/tabs-switch/tab-switch.tscn
#	scenes/эмс2/эмс_тг.gd
#	scripts/signaller.gd
2025-11-11 16:37:37 +03:00
TotMaxim
1785d23e43 Подтянул прд-н и прд-к 2025-11-11 15:17:25 +03:00
TotMaxim
85c02f3f6c Отлажен прд-в гд, осталась проблема "обращение к удалённому элементу", мониторинг температур 2025-11-11 14:39:39 +03:00
MaD_CaT
3f469935bc Доработка. Колонка со статусом выполнения помехи для конкретной цели. (замечание комиссии) 2025-11-10 16:10:08 +03:00
TotMaxim
15be378743 состояние, где нужна отладка темепературы, мощности, модулей ФС 2025-11-10 14:00:04 +03:00
MaD_CaT
6ea649cf31 Доработка. Более яркий сектор для которого назначена помеха (замечание комиссии) 2025-11-10 12:15:10 +03:00
MaD_CaT
78b6f5a14e Доработка. При выполняемом сеансе помехи кнопка подавить красная (замечание комиссии) 2025-11-10 12:01:56 +03:00
MaD_CaT
1e500dec2c Доработка. Номер цели и номер сеанса помехи в заголовке таблиц теперь отображается значком (замечание комиссии) 2025-11-10 11:51:51 +03:00
MaD_CaT
6a5eae450c Исправление. Обновление состояния выполнения помехи по цели при программном снятии помехи. 2025-11-10 11:31:22 +03:00
MaD_CaT
f6ee2d95a4 Исправление. Учёт курса при снятии помехи со своей цели. 2025-11-10 11:05:05 +03:00
TotMaxim
94f0eccaa1 доработан переход из контроля и позицию приборов в сцене 2025-11-10 10:23:43 +03:00
TotMaxim
2d4fd57789 lineseparators 2025-11-09 22:14:58 +03:00
TotMaxim
71176c4869 Забрал изменения по выбору приборов + отредактировал положение индикаторов внешнее управление, состояния и тренажа 2025-11-09 16:18:31 +03:00
TotMaxim
36e47bbd13 Глобальное изменение: Параллеьный контроль. Новая ветка prd-control. Первый коммит инициализации. 2025-11-09 15:45:22 +03:00
MaD_CaT
cebf645e4d Godot4. Исправление сепараторов на LF 2025-11-08 12:18:38 +03:00
MaD_CaT
77e15627d0 Доработка. Подсчёт опасных целей 1 раз в секунду. 2025-11-06 12:41:46 +03:00
MaD_CaT
effbbb9272 Доработка. Изменение кодов состояния выполнения помехи для 5П-28 2025-11-05 12:28:33 +03:00
MaD_CaT
56343338c2 Доработка. Добавлено отображение информации от Трассы на экране ЭМС ТГ. 2025-11-05 11:22:49 +03:00
sasha80
3bff1cd90f Доработка. Статическая проверка 2025-11-04 15:33:24 +03:00
lepshiy
5657892887 Трасса - кластер 2025-11-01 15:21:59 +03:00
lepshiy
606f5ea689 Merge remote-tracking branch 'refs/remotes/Sasha/master' 2025-10-28 15:33:29 +03:00
lepshiy
6c62419bdb Экран ЭМС ТГ - картинки 2025-10-28 11:10:57 +03:00
sasha80
5991a079c7 Доработка. Важное пояснение 2025-10-24 16:14:29 +03:00
sasha80
2a29e4bd54 Доработка. Важное пояснение 2025-10-24 16:05:42 +03:00
53 changed files with 4934 additions and 2105 deletions

1
.gitignore vendored
View File

@@ -2,7 +2,6 @@
.import/
.dev/
export.cfg
export_presets.cfg
# Imported translations (automatically generated from CSV files)
*.translation

View File

@@ -12,6 +12,8 @@ TARGET_BIN="uarep-ctl.linux.x86_64"
# Путь к папке в которой будет расположен исполняемый файл (загружаемый модуль)
TARGET_PATH="./bin"
mkdir "${TARGET_PATH}"
# Путь к исполняемому файлу редактора Godot
EDITOR="/opt/godot/godot.linuxbsd.editor.x86_64"

View File

@@ -0,0 +1,223 @@
{
"config_version": "1.0.0",
"device_constants": {
"PRD_N": {
"constants": {
"POWER_UKP_1": 31,
"POWER_UKP_2": 63,
"DKM_BIT_2": 1,
"DKM_BIT_3": 2,
"BASE_ADDR_EMS_G": 288,
"ADDR_UG_LITERA_1": 262,
"ADDR_UG_LITERA_2": 264,
"ADDR_UG_LITERA_3": 266,
"TEMP_THRESHOLD": 70,
"POWER_THRESHOLD": 40,
"RAY_DOU_NUM": 3,
"ATT_UM_2": 2,
"ATT_UM_3": 3,
"POWER_UM": 100,
"TIMER_DELAY": 15.0,
"STATE_MASHINE_TIMER": 0.2
},
"pribor_config": {
"1н": {"angle": 0.0, "sectors": [4, 8]},
"2н": {"angle": 90.0, "sectors": [7, 11]},
"3н": {"angle": 180.0, "sectors": [6, 10]},
"4н": {"angle": 270.0, "sectors": [5, 9]}
},
"fs_params": {
"2": {"freq": 932.0, "width": 100.0},
"3": {"freq": 1157.0, "width": 100.0}
},
"start_litera": 2
},
"PRD_V": {
"constants": {
"POWER_UKP_1": 31,
"POWER_UKP_2": 63,
"DKM_BIT_4": 3,
"DKM_BIT_5": 4,
"BASE_ADDR_EMS_G": 288,
"ADDR_UG_LITERA_1": 262,
"ADDR_UG_LITERA_2": 264,
"ADDR_UG_LITERA_3": 266,
"TEMP_THRESHOLD": 70,
"POWER_THRESHOLD": 40,
"RAY_DOU_NUM": 3,
"ATT_UM_4": 2,
"ATT_UM_5": 3,
"POWER_UM": 100,
"TIMER_DELAY": 15.0,
"STATE_MASHINE_TIMER": 0.2
},
"pribor_config": {
"1в": {"angle": 0.0, "sectors": [12, 16]},
"2в": {"angle": 90.0, "sectors": [15, 19]},
"3в": {"angle": 180.0, "sectors": [14, 18]},
"4в": {"angle": 270.0, "sectors": [13, 17]}
},
"fs_params": {
"4": {"freq": 1227.0, "width": 100.0},
"5": {"freq": 1575.0, "width": 110.0}
},
"start_litera": 4
},
"PRD_K": {
"constants": {
"POWER_UKP_1": 31,
"POWER_UKP_2": 63,
"DKM_BIT_1": 0,
"DKM_BIT_6": 5,
"DKM_BIT_7": 6,
"BASE_ADDR_EMS_G": 288,
"ADDR_UG_LITERA_1": 262,
"ADDR_UG_LITERA_2": 264,
"ADDR_UG_LITERA_3": 266,
"TEMP_THRESHOLD": 40,
"POWER_THRESHOLD": 40,
"RAY_DOU_NUM": 3,
"ATT_UM_1": 0,
"ATT_UM_6": 3,
"ATT_UM_7": 2,
"POWER_UM": 100,
"TIMER_DELAY": 15.0,
"STATE_MASHINE_TIMER": 0.2
},
"pribor_config": {
"1к": {"angle": 0.0, "sectors": [0, 20, 24]},
"2к": {"angle": 90.0, "sectors": [3, 23, 27]},
"3к": {"angle": 180.0, "sectors": [2, 22, 26]},
"4к": {"angle": 270.0, "sectors": [1, 21, 25]}
},
"fs_params": {
"1": {"freq": 450.0, "width": 80.0},
"6": {"freq": 2450.0, "width": 110.0},
"7": {"freq": 4750.0, "width": 110.0}
},
"start_litera": 1
}
},
"base_configs": {
"block_ip": {
"maa2000_1": [0, false],
"maa2000_2": [1, false],
"ip9_50_1": [2, false],
"ip9_50_2": [3, false],
"ip12_50_1": [4, false],
"ip5_25": [7, false]
},
"block_kasseta": {
"yau07": false,
"ems": false,
"ug": false,
"ukp1": false,
"ukp2": false
}
},
"device_configs": {
"PRD_N": {
"block_ip": "base",
"block_kasseta": "base",
"control_results": {
"block_kasseta":false,
"block_ip": false,
"temperature": true,
"dkm_2": false,
"dkm_3": false,
"dou_2": false,
"dou_3": false,
"fs_2": false,
"fs_3": false,
"is_over_control": false
}
},
"PRD_V": {
"block_ip": "base",
"block_kasseta": "base",
"control_results": {
"block_kasseta":false,
"block_ip": false,
"temperature": true,
"dkm_4": false,
"dkm_5": false,
"dou_4": false,
"dou_5": false,
"fs_4": false,
"fs_5": false,
"is_over_control": false
}
},
"PRD_K": {
"block_ip": {
"maa2000_1": [0, false],
"maa2000_2": [1, false],
"ip9_50_1": [2, false],
"ip9_50_2": [3, false],
"ip12_50_1": [4, false],
"ip9_50_3": [5, false],
"ip12_50_2": [6, false],
"ip5_25": [7, false]
},
"block_kasseta": "base",
"control_results": {
"block_kasseta":false,
"block_ip": false,
"temperature": true,
"dkm_1": false,
"dkm_6": false,
"dkm_7": false,
"dou_6": false,
"dou_7": false,
"fs_1": false,
"fs_6": false,
"fs_7": false,
"is_over_control": false
}
}
},
"ray_types": ["RAY_m5", "RAY_5", "RAY_15", "RAY_25", "RAY_35", "RAY_45"],
"data_indices": {
"STATUS_BOARD": 0,
"IN_BLANK_PRD": 1,
"IN_IMPULS_PRD": 7,
"OUT_BLANK_PRD": 13,
"OUT_IMPULS_PRD": 19,
"DRY_CONTACT": 27,
"DKM": 28,
"POWER_UKP_1": 31,
"TEMPERATURE_UKP_1": 47,
"POWER_UKP_2": 63,
"TEMPERATURE_UKP_2": 79
},
"fs_keys": {
"1": "fs_1",
"2": "fs_2",
"3": "fs_3",
"4": "fs_4",
"5": "fs_5",
"6": "fs_6",
"7": "fs_7"
},
"temperature_constants": {
"CONST_MIN_TEMP": -25,
"MAXIMUM_CODE_ADC": 3796,
"MINIMUM_CODE_AD": 2660,
"TEMPERATURE_UKP_1": 47,
"TEMPERATURE_UKP_2": 79
},
"ems_input_bits_config": {
"PRD_N": {"bit1": 9, "bit2": 10},
"PRD_V": {"bit1": 11, "bit2": 12},
"PRD_K": {"bit1": 13, "bit2": 14, "bit_lit": 8}
},
"fs_rules":[
{"key": "fs_1", "min": 0, "max": 4},
{"key": "fs_2", "min": 4, "max": 8},
{"key": "fs_3", "min": 8, "max": 12},
{"key": "fs_4", "min": 12, "max": 16},
{"key": "fs_5", "min": 16, "max": 20},
{"key": "fs_6", "min": 20, "max": 24},
{"key": "fs_7", "min": 24, "max": 28}
]
}

View File

@@ -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

112
export_presets.cfg Normal file
View File

@@ -0,0 +1,112 @@
[preset.0]
name="Linux-X11"
platform="Linux"
runnable=true
advanced_options=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="bin/uarep-ctl.linux.x86_64"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
encrypt_pck=false
encrypt_directory=false
script_export_mode=0
[preset.0.options]
custom_template/debug=""
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
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=true
ssh_remote_deploy/host="user@192.168.11.105"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""
texture_format/bptc=true
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
[preset.1]
name="Windows Desktop"
platform="Windows Desktop"
runnable=true
advanced_options=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="bin/uarep-ctl.exe"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
encrypt_pck=false
encrypt_directory=false
script_export_mode=0
[preset.1.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=true
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
binary_format/architecture="x86_64"
codesign/enable=false
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PackedStringArray()
application/modify_resources=true
application/icon=""
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
application/export_angle=0
application/export_d3d12=0
application/d3d12_agility_sdk_multiarch=true
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
$settings = New-ScheduledTaskSettingsSet
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
Start-ScheduledTask -TaskName godot_remote_debug
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
Remove-Item -Recurse -Force '{temp_dir}'"

View File

@@ -35,8 +35,8 @@ func get_radius_outter() -> float: return material.get('shader_parameter/radius
func get_radius_inner_0() -> float: return material.get('shader_parameter/radius_inner_0')
func get_radius_inner_1() -> float: return material.get('shader_parameter/radius_inner_1')
func get_band_colors(val: Array): return material.get('shader_parameter/ant_band_c')
func get_band_failures(val: Array): return material.get('shader_parameter/ant_band_m')
func get_band_colors(_val: Array): return material.get('shader_parameter/ant_band_c')
func get_band_failures(_val: Array): return material.get('shader_parameter/ant_band_m')
func set_band_colors(val: Array): material.set('shader_parameter/ant_band_c', val)
func set_band_failures(val: Array): material.set('shader_parameter/ant_band_m', val)

View File

@@ -65,7 +65,7 @@ layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
strips_rotation = 15.0
text = "СПРС"
text = "JTIDS"
metadata/rfi_name = "sprs"
[node name="btn_kupd" parent="grd_forced" groups=["группа-принудительно"] instance=ExtResource("4_7ys3c")]

View File

@@ -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
@@ -75,7 +75,7 @@ func on_threat_update(th, table_index: Dictionary):
elif th.emit_state == 2:
emit_txr.visible = true
emit_txr.self_modulate = Color.RED
## Обрабатывает сигнал [b]threat_lost[/b].

View File

@@ -147,6 +147,6 @@ layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
strips_rotation = 30.0
text = "ЕПРЛС"
text = "ЕРЛС"
disabled = true
metadata/rfi_name = "eprls"

View File

@@ -30,7 +30,9 @@ autostart = true
[node name="bort" parent="." instance=ExtResource("3_d7iti")]
layout_mode = 0
offset_left = 24.0
offset_top = 27.7778
offset_right = 604.0
offset_bottom = 1216.78
metadata/DeviceName = &"Устройство РР левого борта"

View File

@@ -7,9 +7,9 @@
[node name="pribor_afsp" type="Control"]
layout_mode = 3
anchors_preset = 0
offset_left = 81.0
offset_left = 82.0
offset_top = 108.0
offset_right = 81.0
offset_right = 82.0
offset_bottom = 108.0
scale = Vector2(1, 0.9)
script = ExtResource("1_tfses")
@@ -30,9 +30,9 @@ autostart = true
[node name="bort" parent="." instance=ExtResource("3_xpxb5")]
layout_mode = 0
offset_left = -11.0
offset_left = 12.0
offset_top = -59.0
offset_right = 569.0
offset_right = 592.0
offset_bottom = 1130.0
metadata/DeviceName = &"Устройство РР правого борта"

View File

@@ -99,4 +99,4 @@ func _on_request_completed(result, _response_code, headers, body: PackedByteArra
func _on_item_pressed(block_a: Control):
var metas = block_a.get_meta_list()
for n in metas:
var v = block_a.get_meta(n)
var _v = block_a.get_meta(n)

View File

@@ -9,9 +9,9 @@
layout_mode = 3
anchors_preset = 0
offset_left = 115.0
offset_top = 150.0
offset_top = 148.0
offset_right = 115.0
offset_bottom = 150.0
offset_bottom = 148.0
script = ExtResource("1_bhc4e")
prefix_path = "DeviceDescription[DeviceName]"
this_bpo1_name = "Устройство БПО левого борта"
@@ -24,10 +24,10 @@ settings_path_to_wait_time = "Период опроса состояния БП
[node name="mod_pit_g1" parent="." instance=ExtResource("2_jp6m0")]
layout_mode = 2
offset_left = 40.0
offset_top = 535.0
offset_right = 560.0
offset_bottom = 605.0
offset_left = 9.0
offset_top = 377.0
offset_right = 529.0
offset_bottom = 447.0
size_flags_horizontal = 7
size_flags_vertical = 7
fname = "Модуль электропитания"
@@ -35,20 +35,20 @@ rname = "G1"
[node name="blok_bpo_a1" parent="." instance=ExtResource("2_jp6m0")]
layout_mode = 0
offset_left = 40.0
offset_top = 135.0
offset_right = 560.0
offset_bottom = 330.0
offset_left = 9.0
offset_top = -23.0
offset_right = 529.0
offset_bottom = 172.0
show_state = false
fname = "Блок БПО левого борта"
rname = "А1"
[node name="grid_bpo_a1" type="GridContainer" parent="."]
layout_mode = 0
offset_left = 50.0
offset_top = 175.0
offset_right = 498.0
offset_bottom = 320.0
offset_left = 19.0
offset_top = 17.0
offset_right = 467.0
offset_bottom = 162.0
columns = 4
[node name="kanal1" parent="grid_bpo_a1" groups=["потребитель-питания"] instance=ExtResource("2_jp6m0")]
@@ -108,30 +108,30 @@ fname = "Канал 8"
metadata/state = "SelfTest[0].SystemList[0].DevList[7]['TestPassed']"
[node name="yas_bpo_a1" parent="." groups=["потребитель-питания"] instance=ExtResource("3_jcpjs")]
offset_left = 500.0
offset_top = 175.0
offset_right = 550.0
offset_bottom = 320.0
offset_left = 469.0
offset_top = 17.0
offset_right = 519.0
offset_bottom = 162.0
show_rname = false
self_size = Vector2i(50, 145)
fname = "Яч. связи"
[node name="blok_bpo_a2" parent="." instance=ExtResource("2_jp6m0")]
layout_mode = 0
offset_left = 40.0
offset_top = 335.0
offset_right = 560.0
offset_bottom = 530.0
offset_left = 9.0
offset_top = 177.0
offset_right = 529.0
offset_bottom = 372.0
show_state = false
fname = "Блок БПО правого борта"
rname = "А2"
[node name="grid_bpo_a2" type="GridContainer" parent="."]
layout_mode = 0
offset_left = 50.0
offset_top = 375.0
offset_right = 498.0
offset_bottom = 520.0
offset_left = 19.0
offset_top = 217.0
offset_right = 467.0
offset_bottom = 362.0
columns = 4
[node name="kanal1" parent="grid_bpo_a2" groups=["потребитель-питания", "управляется-по-шине-2"] instance=ExtResource("2_jp6m0")]
@@ -191,10 +191,10 @@ fname = "Канал 8"
metadata/state = "SelfTest[0].SystemList[0].DevList[7]['TestPassed']"
[node name="yas_bpo_a2" parent="." groups=["потребитель-питания"] instance=ExtResource("3_jcpjs")]
offset_left = 500.0
offset_top = 375.0
offset_right = 550.0
offset_bottom = 520.0
offset_left = 469.0
offset_top = 217.0
offset_right = 519.0
offset_bottom = 362.0
show_rname = false
self_size = Vector2i(50, 145)
fname = "Яч. связи"

View File

@@ -49,7 +49,7 @@ offset_top = 33.0
offset_right = 155.0
offset_bottom = 183.0
fname = "Блок ФС-2"
rname = "A2"
rname = "A6"
[node name="ref_A6" parent="." groups=["default_reset", "fs_group"] instance=ExtResource("3_kqnvt")]
offset_left = 155.0
@@ -57,7 +57,7 @@ offset_top = 33.0
offset_right = 205.0
offset_bottom = 183.0
fname = "Модуль ФС"
rname = "A5"
rname = "A3"
metadata/fs = "fs_6"
[node name="ref_A5" parent="." groups=["default_reset", "fs_group"] instance=ExtResource("3_kqnvt")]
@@ -66,7 +66,7 @@ offset_top = 33.0
offset_right = 255.0
offset_bottom = 183.0
fname = "Модуль ФС"
rname = "A3"
rname = "A2"
metadata/fs = "fs_7"
[node name="ref_A7" parent="." groups=["default_reset"] instance=ExtResource("3_kqnvt")]
@@ -75,4 +75,4 @@ offset_top = 33.0
offset_right = 305.0
offset_bottom = 183.0
fname = "Блок ФС-6"
rname = "A6"
rname = "A5"

View File

@@ -1,252 +1,197 @@
@tool
extends 'res://scenes/контроль/прибор.gd'
const constants_k: Dictionary = {
'POWER_UKP_1': 31,
'POWER_UKP_2': 63,
'DKM_BIT_1': 0,
'DKM_BIT_6': 5,
'DKM_BIT_7': 6,
'BASE_ADDR_EMS_G': 0x120,
'ADDR_UG_LITERA_1': 0x106,
'ADDR_UG_LITERA_2': 0x108,
'ADDR_UG_LITERA_3': 0x10A,
'TEMP_THRESHOLD': 40,
'POWER_THRESHOLD': 40,
'RAY_DOU_NUM': 0x3,
'ATT_UM_1': 0x0,
'ATT_UM_6': 0x3,
'ATT_UM_7': 0x2,
'POWER_UM': 100,
'TIMER_DELAY': 10.0,
'STATE_MASHINE_TIMER': 0.3,
}
# Конфигурация параметров для каждого прибора
const PRIBOR_CONFIG := {
'': {'angle': 0.0, 'sectors': [0, 20, 24]},
'': {'angle': 90.0, 'sectors': [3, 23, 27]},
'': {'angle': 180.0, 'sectors': [2, 22, 26]},
'': {'angle': 270.0, 'sectors': [1, 21, 25]},
}
# Конфигурация частот и ширин для каждого ФС
const FS_PARAMS := {
1: {'freq': 450.0, 'width': 80.0},
6: {'freq': 2450.0, 'width': 110.0},
7: {'freq': 4750.0, 'width': 110.0}
}
enum STATE_VAL { NONE = 0, GOOD = 1, ERROR = 2 }
var block_ip_config_k := {
'maa2000_1': [0, false],
'maa2000_2': [1, false],
'ip9_50_1': [2, false],
'ip9_50_2': [3, false],
'ip12_50_1': [4, false],
'ip9_50_3': [5, false],
'ip12_50_2': [6, false],
'ip5_25': [7, false],
}
var block_kasseta_y5_prd_config_k: = {
'yau07': false,
'ems': false,
'ug': false,
'ukp1': false,
'ukp2': false,
}
# Основные переменные
var start_litera: int = 1
var ug_work_1: int = 3 ## Аттенюация усилителей мощности
var ug_work_2: int = 2 ## Аттенюация усилителей мощности
var ug_work_3: int = 0 ## Аттенюация усилителей мощности
var mashine_timer: Timer = Timer.new()
var prd_k_module: Object
var unit_prd_k: Object
var control_prd_k: Object
# Результаты контроля
var control_results_k: Dictionary = {
'block_ip': false, # Проверка касет П1 и ИП МА2000
'temperature': true,
'dkm_1': false,
'dkm_6': false,
'dkm_7': false,
'dou_6': false,
'dou_7': false,
'fs_1': 2,
'fs_6': 2,
'fs_7': 2,
}
var test_control_k = preload('res://scripts/pribor-prd.gd')
var ctrl_pos = 30
func _ready() -> void:
if Engine.is_editor_hint():
return
initialize_connections()
setup_timer()
set_default_state()
find_labels(self)
func on_state_mashine() -> void:
control_prd_k.state_control_machine()
func initialize_connections() -> void:
var unit_name = get_meta('unit_name')[0]
prd_k_module = prd.prd_dict[unit_name]
unit_prd_k = prd_k_module.unit_yau07
unit_prd_k.connect('line_changed', Callable(self, 'on_line_changed'))
var power_amplifiers: Array = get_tree().get_nodes_in_group('power_amplifier')
var init_data: Dictionary = {
'control_label': $control_result,
'power_amplifiers': power_amplifiers,
'unit_prd': unit_prd_k,
'module_prd' : prd_k_module,
'constants': constants_k,
'prd_config': PRIBOR_CONFIG,
'fs_params': FS_PARAMS,
'block_ip_prd_config': block_ip_config_k,
'block_kasseta_y5_prd_config': block_kasseta_y5_prd_config_k,
'control_results': control_results_k,
'current_litera': start_litera,
}
control_prd_k = test_control_k.TestPRD.new(init_data)
add_child(control_prd_k)
control_prd_k.connect('control_is_over', Callable(self, 'on_control_result'))
var prd_k_module = prd.prd_dict[unit_name]
unit_prd_k = prd_k_module.unit_control
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
for temp in power_amplifier:
temp.value1 = -70
# Подписываемся на сигналы
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)
func setup_timer() -> void:
add_child(mashine_timer)
mashine_timer.connect('timeout', Callable(self, 'on_state_mashine'))
mashine_timer.wait_time = constants_k.STATE_MASHINE_TIMER
mashine_timer.start()
func _process(_delta: float) -> void:
if Engine.is_editor_hint():
return
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_default_state() -> void:
for group in get_tree().get_nodes_in_group('default_reset'):
group.state = STATE_VAL.NONE
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
for group in get_tree().get_nodes_in_group('power_amplifier'):
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'))
await get_tree().create_timer(1.0).timeout
on_press_device(unit_prd_k.self_name)
static func set_default_state(default_reset_array_node: Array) -> void:
for group in default_reset_array_node:
group.state = STATE_VAL.NONE
func _enter_tree() -> void:
if Engine.is_editor_hint():
return
$control_result.text = 'Выполняется ...'
$control_result.add_theme_color_override('font_color', Color.ALICE_BLUE)
signaller.connect('режим_работа', Callable(self, 'on_mode_changed').bind(false))
signaller.connect('режим_журнал', Callable(self, 'on_mode_changed').bind(false))
signaller.connect('режим_эмс', Callable(self, 'on_mode_changed').bind(false))
signaller.connect('режим_настройки', Callable(self, 'on_mode_changed').bind(false))
signaller.connect('режим_контроль', Callable(self, 'on_mode_changed').bind(true))
if unit_prd_k:
_update_status_text(unit_prd_k.get_current_status())
func _exit_tree() -> void:
if Engine.is_editor_hint():
return
prd_k_module.cmd_array.append([unit_prd_k.CmdCode.WRITE_ISA, [constants_k.ADDR_UG_LITERA_1, ug_work_1, constants_k.ADDR_UG_LITERA_2, ug_work_2, constants_k.ADDR_UG_LITERA_3, ug_work_3]])
#prd_k_module.cmd_array.append([unit_prd_k.CmdCode.WRITE_ISA, [constants_k.ADDR_UG_LITERA_1, ug_work_1, constants_k.ADDR_UG_LITERA_2, ug_work_2, constants_k.ADDR_UG_LITERA_3, ug_work_3]])
func on_line_changed(unit_pribor: Object) -> void:
if not unit_pribor.online:
set_default_state()
static func temperature_fill(temperature_arr_node: Array, temperature_dic: Dictionary)->void:
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] if temperature_dic[temperature_meta] < 361 else -40
func on_mode_changed(in_tree: bool) -> void:
if not in_tree:
mashine_timer.stop()
prd_k_module.cmd_array.append([unit_prd_k.CmdCode.WRITE_ISA, [constants_k.ADDR_UG_LITERA_1, ug_work_1, constants_k.ADDR_UG_LITERA_2, ug_work_2, constants_k.ADDR_UG_LITERA_3, ug_work_3]])
signaller.emit_signal('interfer_off_all')
else:
set_default_state()
control_prd_k.state = control_prd_k.STATE_MASHINE.INIT
mashine_timer.start()
func power_fill(pow_dic: Dictionary, fs_result: Dictionary) -> void:
#if not control_prd_k.block_kasseta_y5_config.yau07 or not control_prd_k.block_kasseta_y5_config.ukp1 or not control_prd_k.block_kasseta_y5_config.ukp2:
#return
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
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 pow_dic:
if not pow_dic.has(powamp_meta):
break
if pow_dic[powamp_meta].size() < 6:
status = STATE_VAL.ERROR
if not pow_dic.has(powamp_meta): continue
# Проверки fs_result
if powamp_meta == 'um_8' and not fs_result.fs_1: continue
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_6: continue
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_7: continue
if powamp_meta == 'um_8':
var power_value = pow_dic[powamp_meta][5]
i_node_temperature.value0 = [power_value]
# Проверка для um_8: если значение < 1 → STATE_VAL.NONE
if power_value < 1:
status = STATE_VAL.NONE
else:
if powamp_meta == 'um_7' 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_8', 'um_9', 'um_10', 'um_11', 'um_12', 'um_13'] and not fs_result.fs_7: return
i_powapm.value0 = pow_dic[powamp_meta]
for i_p in pow_dic[powamp_meta]:
if i_p < constants_k.POWER_THRESHOLD:
status = STATE_VAL.ERROR
i_powapm.state = status
status = STATE_VAL.ERROR if power_value < POWER_THRESHOLD else STATE_VAL.GOOD
else:
var power_array: Array = pow_dic[powamp_meta]
i_node_temperature.value0 = power_array
# Проверка: если ВСЕ значения в массиве < 1 → STATE_VAL.NONE
var all_below_one: bool = true
for i_p in power_array:
if i_p >= 1:
all_below_one = false
break
if all_below_one:
status = STATE_VAL.NONE
else:
var count_above_threshold = 0
for i_p in power_array:
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_control_result(result_dic: Dictionary, power_dic: Dictionary) -> void:
mashine_timer.stop()
block_kasseta_y5_prd_config_k = control_prd_k.block_kasseta_y5_config
func on_press_device(_name_davice: String) -> void:
var nodes_y5: Array = get_tree().get_nodes_in_group('y-5')
var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply')
var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group')
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
var default_reset_array_node: Array = get_tree().get_nodes_in_group('default_reset')
var module_fs_1: Node = $kasseta_fs_kd/ref_A2
var module_fs_6: Node = $kasseta_fs_kd/ref_A4
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 = {
'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,
'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)
static func on_control_result(for_result_dic: Dictionary) -> void:
temperature_fill(for_result_dic.power_amplifier, for_result_dic.temperature_um)
var all_y5_good: bool = true
var block_kasseta_y5_prd_config_k: Dictionary = for_result_dic.block_kasseta_y5_config
var nodes_y5: Array = for_result_dic.nodes_y5
for node_y5 in nodes_y5:
var meta_y5 = node_y5.get_meta('y5')
if block_kasseta_y5_prd_config_k.has(meta_y5):
if block_kasseta_y5_prd_config_k['yau07'] == false:
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
block_ip_config_k = control_prd_k.block_ip_config
var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply')
for power_supply in node_ip_power_arr:
else:
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_k[meta_y5] else STATE_VAL.ERROR
# Проверяем состояние после установки
if node_y5.state == STATE_VAL.ERROR:
all_y5_good = false
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 power_supply.state == STATE_VAL.ERROR:
all_y5_good = false
var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group')
for f in fs_nodes:
if not for_result_dic.control_is_over:
set_default_state(for_result_dic.default_reset_array_node)
set_default_state(for_result_dic.power_amplifier)
return
var result_dic: Dictionary = for_result_dic.result_dic
for f in for_result_dic.fs_nodes:
var fs_meta: String = f.get_meta('fs')
if result_dic.has(fs_meta):
var new_state = result_dic[fs_meta]
f.state = new_state
result_dic[fs_meta] = new_state
f.state = result_dic[fs_meta]
if result_dic.fs_1 == 1:
$kasseta_fs_kd/ref_A2.state = STATE_VAL.GOOD if result_dic.dkm_1 else STATE_VAL.ERROR
else:
result_dic.fs_1 = false
if result_dic.fs_6 == 1:
$kasseta_fs_kd/ref_A4.state = STATE_VAL.GOOD if result_dic.dkm_6 else STATE_VAL.ERROR
$dou6_A7.state = STATE_VAL.GOOD if result_dic.dou_6 else STATE_VAL.ERROR
else:
result_dic.fs_6 = false
if result_dic.fs_7 == 1:
$kasseta_fs_kd/ref_A7.state = STATE_VAL.GOOD if result_dic.dkm_7 else STATE_VAL.ERROR
$dou7_A8.state = STATE_VAL.GOOD if result_dic.dou_7 else STATE_VAL.ERROR
else:
result_dic.fs_7 = false
if not all_y5_good: return
var fs_1 = true if int(result_dic.fs_1) == 1 else false
if fs_1 and block_kasseta_y5_prd_config_k['yau07']:
for_result_dic.module_fs_1.state = STATE_VAL.GOOD if result_dic.dkm_1 else STATE_VAL.ERROR
power_fill(power_dic, result_dic)
var fs_6 = true if int(result_dic.fs_6) == 1 else false
if fs_6 and block_kasseta_y5_prd_config_k['yau07']:
for_result_dic.module_fs_6.state = STATE_VAL.GOOD if result_dic.dkm_6 else STATE_VAL.ERROR
for_result_dic.dou_6.state = STATE_VAL.GOOD if result_dic.dou_6 else STATE_VAL.ERROR
var result = true
for device in result_dic.values():
if not device:
result = false
var fs_7 = true if int(result_dic.fs_7) == 1 else false
if fs_7 and block_kasseta_y5_prd_config_k['yau07']:
for_result_dic.module_fs_7.state = STATE_VAL.GOOD if result_dic.dkm_7 else STATE_VAL.ERROR
for_result_dic.dou_7.state = STATE_VAL.GOOD if result_dic.dou_7 else STATE_VAL.ERROR
var name_prd = control_prd_k.self_name
if result:
$control_result.text = 'Прибор ПРД-%s исправен' % name_prd
$control_result.add_theme_color_override('font_color', Color.GREEN)
else:
$control_result.text = 'Прибор ПРД-%s неисправен' % name_prd
$control_result.add_theme_color_override('font_color', Color.RED)
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)
func find_labels(node1: Node):
@@ -263,3 +208,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)

View File

@@ -1,14 +1,39 @@
[gd_scene load_steps=10 format=3 uid="uid://m5s87q7m66lj"]
[gd_scene load_steps=16 format=3 uid="uid://m5s87q7m66lj"]
[ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="1_8dmgr"]
[ext_resource type="Script" uid="uid://cwvikiygf8b1m" path="res://scenes/pribor-prd-k/pribor-prd-k.gd" id="1_tpdyp"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="2_14h25"]
[ext_resource type="PackedScene" uid="uid://cm5jd4gjrrpba" path="res://scenes/контроль/кассета-у-5-к.tscn" id="2_tb85r"]
[ext_resource type="PackedScene" uid="uid://bcyxqni7gxvtq" path="res://scenes/контроль/блок-в.tscn" id="5_c7lv8"]
[ext_resource type="PackedScene" uid="uid://ffi1njkjceb5" path="res://scenes/контроль/блок-к.tscn" id="6_wd1vi"]
[ext_resource type="PackedScene" uid="uid://bmagw8nd0ulhj" path="res://scenes/pribor-prd-k/kasseta-fs-kd.tscn" id="7_ia27q"]
[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="7_xpa2n"]
[ext_resource type="PackedScene" uid="uid://dq31j24gv5vi4" path="res://scenes/контроль/кассета-п-2.tscn" id="8_6fdp7"]
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="8_la5yt"]
[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="10_c7lv8"]
[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="11_wd1vi"]
[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="12_bjebg"]
[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="13_kc77u"]
[sub_resource type="SpriteFrames" id="SpriteFrames_di0aa"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("10_c7lv8")
}, {
"duration": 1.0,
"texture": ExtResource("11_wd1vi")
}, {
"duration": 1.0,
"texture": ExtResource("12_bjebg")
}, {
"duration": 1.0,
"texture": ExtResource("13_kc77u")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[node name="pribor_prd_k" type="Control"]
layout_mode = 3
@@ -21,55 +46,55 @@ script = ExtResource("1_tpdyp")
[node name="kasseta_u5" parent="." instance=ExtResource("2_tb85r")]
layout_mode = 0
offset_left = 175.0
offset_top = 242.0
offset_right = 485.0
offset_bottom = 432.0
offset_left = 214.0
offset_top = 96.0
offset_right = 524.0
offset_bottom = 286.0
[node name="maa2000_A22" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("1_8dmgr")]
[node name="maa2000_A22" parent="." groups=["power_supply"] instance=ExtResource("1_8dmgr")]
layout_mode = 0
offset_left = 485.0
offset_top = 907.0
offset_right = 652.0
offset_bottom = 949.0
offset_left = 524.0
offset_top = 761.0
offset_right = 691.0
offset_bottom = 803.0
fname = "MAA2000"
rname = "A28"
metadata/ip = "maa2000_1"
[node name="dou6_A7" parent="." groups=["default_reset"] instance=ExtResource("1_8dmgr")]
layout_mode = 0
offset_left = 8.0
offset_top = 862.0
offset_right = 175.0
offset_bottom = 907.0
offset_left = 47.0
offset_top = 716.0
offset_right = 214.0
offset_bottom = 761.0
fname = "ДОУ-6"
rname = "A7"
[node name="maa2000_A23" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("1_8dmgr")]
[node name="maa2000_A23" parent="." groups=["power_supply"] instance=ExtResource("1_8dmgr")]
layout_mode = 0
offset_left = 8.0
offset_top = 907.0
offset_right = 175.0
offset_bottom = 949.0
offset_left = 47.0
offset_top = 761.0
offset_right = 214.0
offset_bottom = 803.0
fname = "MAA2000"
rname = "A27"
metadata/ip = "maa2000_2"
[node name="dou7_A8" parent="." groups=["default_reset"] instance=ExtResource("1_8dmgr")]
layout_mode = 0
offset_left = 8.0
offset_top = 812.0
offset_right = 175.0
offset_bottom = 860.0
offset_left = 47.0
offset_top = 666.0
offset_right = 214.0
offset_bottom = 714.0
fname = "ДОУ-7"
rname = "A8"
[node name="ref_ZZ3" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 175.0
offset_top = 812.0
offset_right = 485.0
offset_bottom = 949.0
offset_left = 214.0
offset_top = 666.0
offset_right = 524.0
offset_bottom = 803.0
texture = ExtResource("2_14h25")
patch_margin_left = 16
patch_margin_top = 16
@@ -90,175 +115,175 @@ vertical_alignment = 1
[node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
layout_mode = 0
offset_left = 485.0
offset_top = 242.0
offset_right = 652.0
offset_bottom = 337.0
offset_left = 524.0
offset_top = 96.0
offset_right = 691.0
offset_bottom = 191.0
value0 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
fname = "УМ1535Б"
rname = "A10"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_1"
[node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
layout_mode = 0
offset_left = 485.0
offset_top = 337.0
offset_right = 652.0
offset_bottom = 432.0
offset_left = 524.0
offset_top = 191.0
offset_right = 691.0
offset_bottom = 286.0
fname = "УМ1535Б"
rname = "A11"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_2"
[node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
layout_mode = 0
offset_left = 485.0
offset_top = 432.0
offset_right = 652.0
offset_bottom = 527.0
offset_left = 524.0
offset_top = 286.0
offset_right = 691.0
offset_bottom = 381.0
fname = "УМ1535Б"
rname = "A12"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_3"
[node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
layout_mode = 0
offset_left = 485.0
offset_top = 527.0
offset_right = 652.0
offset_bottom = 622.0
offset_left = 524.0
offset_top = 381.0
offset_right = 691.0
offset_bottom = 476.0
fname = "УМ1535Б"
rname = "A13"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_4"
[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
layout_mode = 0
offset_left = 485.0
offset_top = 622.0
offset_right = 652.0
offset_bottom = 717.0
offset_left = 524.0
offset_top = 476.0
offset_right = 691.0
offset_bottom = 571.0
fname = "УМ1535Б"
rname = "A14"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_5"
[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
layout_mode = 0
offset_left = 485.0
offset_top = 717.0
offset_right = 652.0
offset_bottom = 812.0
offset_left = 524.0
offset_top = 571.0
offset_right = 691.0
offset_bottom = 666.0
fname = "УМ1535Б"
rname = "A15"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_6"
[node name="utm80_A9" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
[node name="блок-к" parent="." groups=["power_amplifier"] instance=ExtResource("6_wd1vi")]
layout_mode = 0
offset_left = 485.0
offset_top = 812.0
offset_right = 652.0
offset_bottom = 907.0
offset_left = 524.0
offset_top = 666.0
offset_right = 691.0
offset_bottom = 761.0
fname = "УТМ80"
rname = "A9"
value0_info = "Мощность, Вт"
value1_info = "Температура,°C"
metadata/um = "um_7"
[node name="rm1620m_A16" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
layout_mode = 0
offset_left = 8.0
offset_top = 242.0
offset_right = 175.0
offset_bottom = 337.0
fname = "УМ1535Б"
rname = "A16"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_8"
[node name="rm1620m_A17" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
[node name="rm1620m_A16" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
layout_mode = 0
offset_left = 8.0
offset_top = 337.0
offset_right = 173.0
offset_bottom = 432.0
fname = "УМ1535Б"
rname = "A17"
value0_info = "Мощность, Вт"
offset_left = 47.0
offset_top = 96.0
offset_right = 214.0
offset_bottom = 191.0
fname = "РМ16-20М"
rname = "A16"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_9"
[node name="rm1620m_A18" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
[node name="rm1620m_A17" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
layout_mode = 0
offset_left = 8.0
offset_top = 432.0
offset_right = 175.0
offset_bottom = 527.0
fname = "УМ1535Б"
rname = "A18"
value0_info = "Мощность, Вт"
offset_left = 47.0
offset_top = 191.0
offset_right = 212.0
offset_bottom = 286.0
fname = "РМ16-20М"
rname = "A17"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_10"
[node name="rm1620m_A19" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
[node name="rm1620m_A18" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
layout_mode = 0
offset_left = 8.0
offset_top = 527.0
offset_right = 175.0
offset_bottom = 622.0
fname = "УМ1535Б"
rname = "A19"
value0_info = "Мощность, Вт"
offset_left = 47.0
offset_top = 286.0
offset_right = 214.0
offset_bottom = 381.0
fname = "РМ16-20М"
rname = "A18"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_11"
[node name="rm1620m_A20" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
[node name="rm1620m_A19" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
layout_mode = 0
offset_left = 8.0
offset_top = 622.0
offset_right = 175.0
offset_bottom = 717.0
fname = "УМ1535Б"
rname = "A20"
value0_info = "Мощность, Вт"
offset_left = 47.0
offset_top = 381.0
offset_right = 214.0
offset_bottom = 476.0
fname = "РМ16-20М"
rname = "A19"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_12"
[node name="rm1620m_A21" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
[node name="rm1620m_A20" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
layout_mode = 0
offset_left = 8.0
offset_top = 717.0
offset_right = 175.0
offset_bottom = 812.0
fname = "УМ1535Б"
rname = "A21"
value0_info = "Мощность, Вт"
offset_left = 47.0
offset_top = 476.0
offset_right = 214.0
offset_bottom = 571.0
fname = "РМ16-20М"
rname = "A20"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_13"
[node name="rm1620m_A21" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
layout_mode = 0
offset_left = 47.0
offset_top = 571.0
offset_right = 214.0
offset_bottom = 666.0
fname = "РМ16-20М"
rname = "A21"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_14"
[node name="kasseta_fs_kd" parent="." instance=ExtResource("7_ia27q")]
layout_mode = 0
offset_left = 175.0
offset_top = 432.0
offset_right = 485.0
offset_bottom = 622.0
offset_left = 214.0
offset_top = 286.0
offset_right = 524.0
offset_bottom = 476.0
fname = "Кассета ФС-КД"
[node name="kasseta_p_1" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 175.0
offset_top = 622.0
offset_right = 340.0
offset_bottom = 812.0
offset_left = 214.0
offset_top = 476.0
offset_right = 379.0
offset_bottom = 666.0
texture = ExtResource("2_14h25")
patch_margin_left = 16
patch_margin_top = 16
@@ -267,7 +292,7 @@ patch_margin_bottom = 16
script = ExtResource("7_xpa2n")
fname = "Кассета П-1"
[node name="ref_A26" parent="kasseta_p_1" groups=["default_reset", "power_supply"] instance=ExtResource("8_la5yt")]
[node name="ref_A26" parent="kasseta_p_1" groups=["power_supply"] instance=ExtResource("8_la5yt")]
offset_left = 9.0
offset_top = 33.0
offset_right = 59.0
@@ -276,7 +301,7 @@ fname = "ИП9-50"
rname = "A23"
metadata/ip = "ip9_50_1"
[node name="ref_A23" parent="kasseta_p_1" groups=["default_reset", "power_supply"] instance=ExtResource("8_la5yt")]
[node name="ref_A23" parent="kasseta_p_1" groups=["power_supply"] instance=ExtResource("8_la5yt")]
offset_left = 59.0
offset_top = 33.0
offset_right = 109.0
@@ -285,7 +310,7 @@ fname = "ИП9-50"
rname = "A24"
metadata/ip = "ip9_50_2"
[node name="ref_A24" parent="kasseta_p_1" groups=["default_reset", "power_supply"] instance=ExtResource("8_la5yt")]
[node name="ref_A24" parent="kasseta_p_1" groups=["power_supply"] instance=ExtResource("8_la5yt")]
offset_left = 109.0
offset_top = 33.0
offset_right = 159.0
@@ -297,9 +322,9 @@ metadata/ip = "ip12_50_1"
[node name="lbl_fname" type="Label" parent="kasseta_p_1"]
self_modulate = Color(1, 1, 1, 0.62)
layout_mode = 0
offset_left = 7.0
offset_left = 2.0
offset_top = 8.0
offset_right = 159.0
offset_right = 162.0
offset_bottom = 33.0
text = "Кассета П-1"
horizontal_alignment = 1
@@ -307,18 +332,50 @@ vertical_alignment = 1
[node name="kasseta_p_2" parent="." instance=ExtResource("8_6fdp7")]
layout_mode = 0
offset_left = 365.0
offset_top = 622.0
offset_right = 485.0
offset_bottom = 812.0
offset_left = 404.0
offset_top = 476.0
offset_right = 524.0
offset_bottom = 666.0
fname = "Кассета П-2"
[node name="input_0" type="AnimatedSprite2D" parent="."]
position = Vector2(392, 472)
sprite_frames = SubResource("SpriteFrames_di0aa")
[node name="input_1" type="AnimatedSprite2D" parent="."]
position = Vector2(444, 472)
sprite_frames = SubResource("SpriteFrames_di0aa")
[node name="input_2" type="AnimatedSprite2D" parent="."]
position = Vector2(294, 473)
sprite_frames = SubResource("SpriteFrames_di0aa")
[node name="output_0" type="AnimatedSprite2D" parent="."]
position = Vector2(394, 318)
sprite_frames = SubResource("SpriteFrames_di0aa")
[node name="output_1" type="AnimatedSprite2D" parent="."]
position = Vector2(444, 318)
sprite_frames = SubResource("SpriteFrames_di0aa")
[node name="output_2" type="AnimatedSprite2D" parent="."]
position = Vector2(294, 318)
sprite_frames = SubResource("SpriteFrames_di0aa")
[node name="control_result" type="Label" parent="."]
layout_mode = 0
offset_left = 9.0
offset_top = 960.0
offset_right = 649.0
offset_bottom = 1003.0
text = "Прибор ПРД- неисправен"
offset_left = 49.0
offset_top = 993.0
offset_right = 689.0
offset_bottom = 1036.0
theme_override_font_sizes/font_size = 22
horizontal_alignment = 1
metadata/_edit_lock_ = true
[node name="line" type="Line2D" parent="."]
position = Vector2(59, 920)
scale = Vector2(1.03548, 1)
points = PackedVector2Array(-8, 0, 61.8069, 0, 608, 0)
width = 2.0
default_color = Color(1, 1, 1, 0.352941)
metadata/_edit_lock_ = true

View File

@@ -1,235 +1,183 @@
@tool
extends 'res://scenes/контроль/прибор.gd'
const constants_n = {
'POWER_UKP_1': 31,
'POWER_UKP_2': 63,
'DKM_BIT_2': 1,
'DKM_BIT_3': 2,
'BASE_ADDR_EMS_G': 0x120,
'ADDR_UG_LITERA_1': 0x106,
'ADDR_UG_LITERA_2': 0x108,
'ADDR_UG_LITERA_3': 0x10A,
'TEMP_THRESHOLD': 70,
'POWER_THRESHOLD': 40,
'RAY_DOU_NUM': 0x3,
'ATT_UM_2': 0x2,
'ATT_UM_3': 0x3,
'POWER_UM': 100,
'TIMER_DELAY': 10.0,
'STATE_MASHINE_TIMER': 0.3,
}
# Конфигурация параметров для каждого прибора
const PRIBOR_CONFIG_N := {
'': {'angle': 0.0, 'sectors': [4, 8]},
'': {'angle': 90.0, 'sectors': [7, 11]},
'': {'angle': 180.0, 'sectors': [6, 10]},
'': {'angle': 270.0, 'sectors': [5, 9]},
}
# Конфигурация частот и ширин для каждого ФС
const FS_PARAMS_N := {
2: {'freq': 932.0, 'width': 100.0},
3: {'freq': 1157.0, 'width': 100.0}
}
enum STATE_VAL { NONE = 0, GOOD = 1, ERROR = 2 }
var block_ip_config_n:= {
'maa2000_1': [0, false],
'maa2000_2': [1, false],
'ip9_50_1': [2, false],
'ip9_50_2': [3, false],
'ip12_50_1': [4, false],
'ip5_25': [7, false],
}
var block_kasseta_y5_prd_config_n: = {
'yau07': false,
'ems': false,
'ug': false,
'ukp1': false,
'ukp2': false,
}
# Основные переменные
var start_litera: int = 2
var ug_work_1: int = 2 ## Аттенюация усилителей мощности
var ug_work_2: int = 3 ## Аттенюация усилителей мощности
# Флаги и таймеры
var mashine_timer: Timer = Timer.new()
var prd_n_module: Object
var unit_prd_n: Object
var control_prd_n: Object
# Результаты контроля
var control_results_n: Dictionary = {
'block_ip': false, # Проверка касет П1 и ИП МА2000
'temperature': true, # Проверка температур УМ
'dkm_2': false,
'dkm_3': false,
'dou_2': false,
'dou_3': false,
'fs_2': 2,
'fs_3': 2,
}
var test_control_n = preload('res://scripts/pribor-prd.gd')
var ctrl_pos = 0
################################
func on_state_mashine() -> void:
control_prd_n.state_control_machine()
func _ready() -> void:
if Engine.is_editor_hint():
return
initialize_connections()
setup_timer()
set_default_state()
find_labels(self)
func initialize_connections() -> void:
var unit_name = get_meta('unit_name')[0]
prd_n_module = prd.prd_dict[unit_name]
unit_prd_n = prd_n_module.unit_yau07
unit_prd_n.connect('line_changed', Callable(self, 'on_line_changed'))
var power_amplifiers: Array = get_tree().get_nodes_in_group('power_amplifier')
var init_data: Dictionary = {
'control_label': $control_result,
'power_amplifiers': power_amplifiers,
'unit_prd': unit_prd_n,
'module_prd' : prd_n_module,
'constants': constants_n,
'prd_config': PRIBOR_CONFIG_N,
'fs_params': FS_PARAMS_N,
'block_ip_prd_config': block_ip_config_n,
'block_kasseta_y5_prd_config': block_kasseta_y5_prd_config_n,
'control_results': control_results_n,
'current_litera': start_litera,
}
control_prd_n = test_control_n.TestPRD.new(init_data)
add_child(control_prd_n)
control_prd_n.connect('control_is_over', Callable(self, 'on_control_result'))
var prd_n_module = prd.prd_dict[unit_name]
unit_prd_n = prd_n_module.unit_control
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
for temp in power_amplifier:
temp.value1 = -70
# Подписываемся на сигналы
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)
func setup_timer() -> void:
add_child(mashine_timer)
mashine_timer.connect('timeout', Callable(self, 'on_state_mashine'))
mashine_timer.wait_time = constants_n.STATE_MASHINE_TIMER
mashine_timer.start()
func _process(_delta: float) -> void:
if Engine.is_editor_hint():
return
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_default_state() -> void:
for group in get_tree().get_nodes_in_group('default_reset'):
group.state = STATE_VAL.NONE
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
for group in get_tree().get_nodes_in_group('power_amplifier'):
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'))
for um in get_tree().get_nodes_in_group('power_amplifier'):
um.value0 = [0, 0, 0, 0, 0, 0]
await get_tree().create_timer(1.0).timeout
on_press_device(unit_prd_n.self_name)
static func set_default_state(default_reset_array_node: Array) -> void:
for group in default_reset_array_node:
group.state = STATE_VAL.NONE
func _enter_tree() -> void:
if Engine.is_editor_hint():
return
$control_result.text = 'Выполняется ...'
$control_result.add_theme_color_override('font_color', Color.ALICE_BLUE)
signaller.connect('режим_работа', Callable(self, 'on_mode_changed').bind(false))
signaller.connect('режим_журнал', Callable(self, 'on_mode_changed').bind(false))
signaller.connect('режим_эмс', Callable(self, 'on_mode_changed').bind(false))
signaller.connect('режим_настройки', Callable(self, 'on_mode_changed').bind(false))
signaller.connect('режим_контроль', Callable(self, 'on_mode_changed').bind(true))
if unit_prd_n:
_update_status_text(unit_prd_n.get_current_status())
func _exit_tree() -> void:
if Engine.is_editor_hint():
return
prd_n_module.cmd_array.append([unit_prd_n.CmdCode.WRITE_ISA, [constants_n.ADDR_UG_LITERA_1, ug_work_1, constants_n.ADDR_UG_LITERA_2, ug_work_2]])
#prd_n_module.cmd_array.append([unit_prd_n.CmdCode.WRITE_ISA, [constants_n.ADDR_UG_LITERA_1, ug_work_1, constants_n.ADDR_UG_LITERA_2, ug_work_2]])
func on_line_changed(unit_pribor: Object) -> void:
if not unit_pribor.online:
set_default_state()
static func temperature_fill(temperature_arr_node: Array, temperature_dic: Dictionary)->void:
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] if temperature_dic[temperature_meta] < 361 else -40
func on_mode_changed(in_tree: bool) -> void:
if not in_tree:
mashine_timer.stop()
signaller.emit_signal('interfer_off_all')
prd_n_module.cmd_array.append([unit_prd_n.CmdCode.WRITE_ISA, [constants_n.ADDR_UG_LITERA_1, ug_work_1, constants_n.ADDR_UG_LITERA_2, ug_work_2]])
else:
set_default_state()
control_prd_n.state = control_prd_n.STATE_MASHINE.INIT
mashine_timer.start()
func power_fill(pow_dic: Dictionary, fs_result: Dictionary) -> void:
#if not control_prd_n.block_kasseta_y5_config.yau07 or not control_prd_n.block_kasseta_y5_config.ukp1 or not control_prd_n.block_kasseta_y5_config.ukp2:
#return
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
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 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_2: return
if powamp_meta in ['um_7', 'um_8', 'um_9', 'um_10', 'um_11', 'um_12'] and not fs_result.fs_3: return
i_powapm.value0 = pow_dic[powamp_meta]
for i_p in pow_dic[powamp_meta]:
if i_p < constants_n.POWER_THRESHOLD:
status = STATE_VAL.ERROR
i_powapm.state = status
if not pow_dic.has(powamp_meta): return
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_2: return
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_3: return
i_node_powapm.value0 = pow_dic[powamp_meta]
# Проверка: если ВСЕ значения в массиве < 1 → STATE_VAL.NONE
var power_array: Array = pow_dic[powamp_meta]
var all_below_one: bool = true
for i_p in power_array:
if i_p >= 1:
all_below_one = false
break
if all_below_one:
i_node_powapm.state = STATE_VAL.NONE
continue
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_control_result(result_dic: Dictionary, power_dic: Dictionary) -> void:
mashine_timer.stop()
block_kasseta_y5_prd_config_n = control_prd_n.block_kasseta_y5_config
func on_press_device(_device_name: String) -> void:
var nodes_y5: Array = get_tree().get_nodes_in_group('y-5')
var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply')
var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group')
var power_amplifier_arr_node: Array = get_tree().get_nodes_in_group('power_amplifier')
var default_reset_array_node = get_tree().get_nodes_in_group('default_reset')
var module_fs_2: Node = $kasseta_FS_ND/ref_A4
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 = {
'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,
'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)
static func on_control_result(for_result_dic: Dictionary) -> void:
temperature_fill(for_result_dic.power_amplifier, for_result_dic.temperature_um)
var all_y5_good: bool = true
var block_kasseta_y5_prd_config_n: Dictionary = for_result_dic.block_kasseta_y5_config
var nodes_y5: Array = for_result_dic.nodes_y5
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 block_kasseta_y5_prd_config_n['yau07'] == false:
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
# Проверяем состояние после установки
if node_y5.state == STATE_VAL.ERROR:
all_y5_good = false
block_ip_config_n = control_prd_n.block_ip_config
var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply')
for power_supply in node_ip_power_arr:
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 power_supply.state == STATE_VAL.ERROR:
all_y5_good = false
var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group')
for f in fs_nodes:
if not for_result_dic.control_is_over:
set_default_state(for_result_dic.default_reset_array_node)
set_default_state(for_result_dic.power_amplifier)
return
var result_dic: Dictionary = for_result_dic.result_dic
for f in for_result_dic.fs_nodes:
var fs_meta: String = f.get_meta('fs')
if result_dic.has(fs_meta):
var new_state = result_dic[fs_meta]
f.state = new_state
result_dic[fs_meta] = new_state
f.state = result_dic[fs_meta]
if result_dic.fs_2 == 1:
$kasseta_FS_ND/ref_A4.state = STATE_VAL.GOOD if result_dic.dkm_2 else STATE_VAL.ERROR
$dou2_A5.state = STATE_VAL.GOOD if result_dic.dou_2 else STATE_VAL.ERROR
else:
result_dic.fs_2 = 0
if result_dic.fs_3 == 1:
$kasseta_FS_ND/ref_A3.state = STATE_VAL.GOOD if result_dic.dkm_3 else STATE_VAL.ERROR
$dou3_A6.state = STATE_VAL.GOOD if result_dic.dou_3 else STATE_VAL.ERROR
else:
result_dic.fs_3 = 0
if not all_y5_good: return
var fs_2 = true if int(result_dic.fs_2) == 1 else false
if fs_2 and block_kasseta_y5_prd_config_n['yau07']:
for_result_dic.module_fs_2.state = STATE_VAL.GOOD if result_dic.dkm_2 else STATE_VAL.ERROR
for_result_dic.dou_2.state = STATE_VAL.GOOD if result_dic.dou_2 else STATE_VAL.ERROR
power_fill(power_dic, result_dic)
var fs_3 = true if int(result_dic.fs_3) == 1 else false
if fs_3 and block_kasseta_y5_prd_config_n['yau07']:
for_result_dic.module_fs_3.state = STATE_VAL.GOOD if result_dic.dkm_3 else STATE_VAL.ERROR
for_result_dic.dou_3.state = STATE_VAL.GOOD if result_dic.dou_3 else STATE_VAL.ERROR
var result = true
for device in result_dic.values():
if not device:
result = false
var name_prd = control_prd_n.self_name
if result:
$control_result.text = 'Прибор ПРД-%s исправен' % name_prd
$control_result.add_theme_color_override('font_color', Color.GREEN)
else:
$control_result.text = 'Прибор ПРД-%s неисправен' % name_prd
$control_result.add_theme_color_override('font_color', Color.RED)
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)
func find_labels(node1: Node):
@@ -246,3 +194,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)

View File

@@ -1,12 +1,35 @@
[gd_scene load_steps=8 format=3 uid="uid://dnuexoef2nnv5"]
[gd_scene load_steps=12 format=3 uid="uid://dnuexoef2nnv5"]
[ext_resource type="Script" uid="uid://cto2r4ipew65m" path="res://scenes/pribor-prd-n/pribor-prd-n.gd" id="1_bnnv3"]
[ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_is25t"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="3_meukj"]
[ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="4_xkifg"]
[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_b5wvk"]
[ext_resource type="PackedScene" uid="uid://bcyxqni7gxvtq" path="res://scenes/контроль/блок-в.tscn" id="7_bnnv3"]
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_eoqf2"]
[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="8_bnnv3"]
[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="9_is25t"]
[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="10_meukj"]
[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="11_xkifg"]
[sub_resource type="SpriteFrames" id="SpriteFrames_1wf07"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("8_bnnv3")
}, {
"duration": 1.0,
"texture": ExtResource("9_is25t")
}, {
"duration": 1.0,
"texture": ExtResource("10_meukj")
}, {
"duration": 1.0,
"texture": ExtResource("11_xkifg")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[node name="pribor_prd_n" type="Control"]
layout_mode = 3
@@ -17,50 +40,50 @@ offset_right = 15.0
offset_bottom = 30.0
script = ExtResource("1_bnnv3")
[node name="maa2000_A23" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("2_is25t")]
[node name="maa2000_A23" parent="." groups=["power_supply"] instance=ExtResource("2_is25t")]
layout_mode = 2
offset_left = 8.0
offset_top = 877.0
offset_right = 175.0
offset_bottom = 949.0
offset_left = 47.0
offset_top = 731.0
offset_right = 214.0
offset_bottom = 803.0
fname = "MAA2000"
rname = "A23"
metadata/ip = "maa2000_2"
[node name="maa2000_A22" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("2_is25t")]
[node name="maa2000_A22" parent="." groups=["power_supply"] instance=ExtResource("2_is25t")]
layout_mode = 2
offset_left = 485.0
offset_top = 877.0
offset_right = 652.0
offset_bottom = 949.0
offset_left = 524.0
offset_top = 731.0
offset_right = 691.0
offset_bottom = 803.0
fname = "MAA2000"
rname = "A22"
metadata/ip = "maa2000_1"
[node name="dou2_A5" parent="." groups=["default_reset"] instance=ExtResource("2_is25t")]
layout_mode = 2
offset_left = 485.0
offset_top = 812.0
offset_right = 652.0
offset_bottom = 877.0
offset_left = 524.0
offset_top = 666.0
offset_right = 691.0
offset_bottom = 731.0
fname = "ДОУ-2"
rname = "A5"
[node name="dou3_A6" parent="." groups=["default_reset"] instance=ExtResource("2_is25t")]
layout_mode = 2
offset_left = 8.0
offset_top = 812.0
offset_right = 175.0
offset_bottom = 877.0
offset_left = 47.0
offset_top = 666.0
offset_right = 214.0
offset_bottom = 731.0
fname = "ДОУ-3"
rname = "A6"
[node name="ref_ZZ3" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 175.0
offset_top = 812.0
offset_right = 485.0
offset_bottom = 949.0
offset_left = 214.0
offset_top = 666.0
offset_right = 524.0
offset_bottom = 803.0
texture = ExtResource("3_meukj")
patch_margin_left = 16
patch_margin_top = 16
@@ -79,19 +102,90 @@ text = "Панель
horizontal_alignment = 1
vertical_alignment = 1
[node name="kasseta_U5" parent="." instance=ExtResource("4_xkifg")]
[node name="kasseta_U5" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 175.0
offset_top = 242.0
offset_right = 485.0
offset_bottom = 432.0
offset_left = 214.0
offset_top = 96.0
offset_right = 524.0
offset_bottom = 286.0
texture = ExtResource("3_meukj")
patch_margin_left = 16
patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
script = ExtResource("6_b5wvk")
[node name="lbl_fname" type="Label" parent="kasseta_U5"]
self_modulate = Color(1, 1, 1, 0.62)
layout_mode = 0
offset_left = 5.0
offset_top = 7.0
offset_right = 305.0
offset_bottom = 35.0
text = "Кассета У5"
horizontal_alignment = 1
vertical_alignment = 1
[node name="ref_A24" parent="kasseta_U5" groups=["power_supply"] instance=ExtResource("7_eoqf2")]
offset_left = 5.0
offset_top = 32.0
offset_right = 55.0
offset_bottom = 182.0
fname = "ИП5-25"
rname = "A24"
metadata/ip = "ip5_25"
[node name="ref_A30" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")]
offset_left = 55.0
offset_top = 32.0
offset_right = 105.0
offset_bottom = 182.0
fname = "ЯУ-07Б"
rname = "A30"
metadata/y5 = "yau07"
[node name="ref_A26" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")]
offset_left = 105.0
offset_top = 32.0
offset_right = 155.0
offset_bottom = 182.0
fname = "ЭМС-Г"
rname = "A26"
metadata/y5 = "ems"
[node name="ref_A27" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")]
offset_left = 155.0
offset_top = 32.0
offset_right = 205.0
offset_bottom = 182.0
fname = "УГ"
rname = "A27"
metadata/y5 = "ug"
[node name="ref_A28" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")]
offset_left = 205.0
offset_top = 32.0
offset_right = 255.0
offset_bottom = 182.0
fname = "УКП"
rname = "A28"
metadata/y5 = "ukp1"
[node name="ref_A29" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")]
offset_left = 254.0
offset_top = 32.0
offset_right = 304.0
offset_bottom = 182.0
fname = "УКП"
rname = "A29"
metadata/y5 = "ukp2"
[node name="kasseta_FS_ND" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 175.0
offset_top = 432.0
offset_right = 485.0
offset_bottom = 622.0
offset_left = 214.0
offset_top = 286.0
offset_right = 524.0
offset_bottom = 476.0
texture = ExtResource("3_meukj")
patch_margin_left = 16
patch_margin_top = 16
@@ -118,7 +212,7 @@ offset_top = 32.0
offset_right = 105.0
offset_bottom = 182.0
fname = "Блок ФС-3"
rname = "A3"
rname = "A4"
[node name="ref_A1" parent="kasseta_FS_ND" groups=["default_reset", "fs_group"] instance=ExtResource("7_eoqf2")]
offset_left = 105.0
@@ -126,7 +220,7 @@ offset_top = 32.0
offset_right = 155.0
offset_bottom = 182.0
fname = "Модуль ФС"
rname = "A1"
rname = "A2"
metadata/fs = "fs_3"
[node name="ref_A2" parent="kasseta_FS_ND" groups=["default_reset", "fs_group"] instance=ExtResource("7_eoqf2")]
@@ -135,7 +229,7 @@ offset_top = 32.0
offset_right = 205.0
offset_bottom = 182.0
fname = "Модуль ФС"
rname = "A2"
rname = "A1"
metadata/fs = "fs_2"
[node name="ref_A4" parent="kasseta_FS_ND" groups=["default_reset"] instance=ExtResource("7_eoqf2")]
@@ -144,14 +238,14 @@ offset_top = 32.0
offset_right = 255.0
offset_bottom = 182.0
fname = "Блок ФС-2"
rname = "A4"
rname = "A3"
[node name="kasseta_P_1" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 175.0
offset_top = 622.0
offset_right = 485.0
offset_bottom = 812.0
offset_left = 214.0
offset_top = 476.0
offset_right = 524.0
offset_bottom = 666.0
texture = ExtResource("3_meukj")
patch_margin_left = 16
patch_margin_top = 16
@@ -160,7 +254,7 @@ patch_margin_bottom = 16
script = ExtResource("6_b5wvk")
fname = "Кассета П-1"
[node name="ref_A21" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_eoqf2")]
[node name="ref_A21" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_eoqf2")]
offset_left = 9.0
offset_top = 33.0
offset_right = 59.0
@@ -169,7 +263,7 @@ fname = "ИП12-50"
rname = "A21"
metadata/ip = "ip12_50_1"
[node name="ref_A20" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_eoqf2")]
[node name="ref_A20" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_eoqf2")]
offset_left = 59.0
offset_top = 33.0
offset_right = 109.0
@@ -178,7 +272,7 @@ fname = "ИП9-50"
rname = "A20"
metadata/ip = "ip9_50_1"
[node name="ref_A19" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_eoqf2")]
[node name="ref_A19" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_eoqf2")]
offset_left = 109.0
offset_top = 33.0
offset_right = 159.0
@@ -200,153 +294,178 @@ vertical_alignment = 1
[node name="um1535_A7" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 485.0
offset_top = 242.0
offset_right = 652.0
offset_bottom = 337.0
fname = "УМ1535Б"
offset_left = 524.0
offset_top = 96.0
offset_right = 691.0
offset_bottom = 191.0
fname = "УМ1535А"
rname = "A7"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_1"
[node name="um1535_A8" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 485.0
offset_top = 337.0
offset_right = 652.0
offset_bottom = 432.0
offset_left = 524.0
offset_top = 191.0
offset_right = 691.0
offset_bottom = 286.0
fname = "УМ1535А"
rname = "A8"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_2"
[node name="um1535_A9" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 485.0
offset_top = 432.0
offset_right = 652.0
offset_bottom = 527.0
offset_left = 524.0
offset_top = 286.0
offset_right = 691.0
offset_bottom = 381.0
fname = "УМ1535А"
rname = "A9"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_3"
[node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 485.0
offset_top = 527.0
offset_right = 652.0
offset_bottom = 622.0
offset_left = 524.0
offset_top = 381.0
offset_right = 691.0
offset_bottom = 476.0
fname = "УМ1535А"
rname = "A10"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_4"
[node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 485.0
offset_top = 622.0
offset_right = 652.0
offset_bottom = 717.0
offset_left = 524.0
offset_top = 476.0
offset_right = 691.0
offset_bottom = 571.0
fname = "УМ1535А"
rname = "A11"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_5"
[node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 485.0
offset_top = 717.0
offset_right = 652.0
offset_bottom = 812.0
offset_left = 524.0
offset_top = 571.0
offset_right = 691.0
offset_bottom = 666.0
fname = "УМ1535А"
rname = "A12"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_6"
[node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 8.0
offset_top = 242.0
offset_right = 175.0
offset_bottom = 337.0
offset_left = 47.0
offset_top = 96.0
offset_right = 214.0
offset_bottom = 191.0
fname = "УМ1535А"
rname = "A13"
value0_info = "Мощность, Вт"
value1_info = "Температура,°C"
metadata/um = "um_7"
[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 8.0
offset_top = 337.0
offset_right = 175.0
offset_bottom = 432.0
fname = "УМ1535А"
rname = "A14"
value0_info = "Мощность, Вт"
value1_info = "Температура,°C"
metadata/um = "um_8"
[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 8.0
offset_top = 432.0
offset_right = 175.0
offset_bottom = 527.0
fname = "УМ1535А"
rname = "A15"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_9"
[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 8.0
offset_top = 527.0
offset_right = 175.0
offset_bottom = 622.0
offset_left = 47.0
offset_top = 191.0
offset_right = 214.0
offset_bottom = 286.0
fname = "УМ1535А"
rname = "A16"
value0_info = "Мощность, Вт"
rname = "A14"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_10"
[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 8.0
offset_top = 622.0
offset_right = 175.0
offset_bottom = 717.0
offset_left = 47.0
offset_top = 286.0
offset_right = 214.0
offset_bottom = 381.0
fname = "УМ1535А"
rname = "A17"
value0_info = "Мощность, Вт"
rname = "A15"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_11"
[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 8.0
offset_top = 717.0
offset_right = 175.0
offset_bottom = 812.0
offset_left = 47.0
offset_top = 381.0
offset_right = 214.0
offset_bottom = 476.0
fname = "УМ1535А"
rname = "A18"
value0_info = "Мощность, Вт"
rname = "A16"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_12"
[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 47.0
offset_top = 476.0
offset_right = 214.0
offset_bottom = 571.0
fname = "УМ1535А"
rname = "A17"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_13"
[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
layout_mode = 0
offset_left = 47.0
offset_top = 571.0
offset_right = 214.0
offset_bottom = 666.0
fname = "УМ1535А"
rname = "A18"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_14"
[node name="control_result" type="Label" parent="."]
layout_mode = 0
offset_left = 9.0
offset_top = 960.0
offset_right = 649.0
offset_bottom = 1003.0
offset_left = 49.0
offset_top = 993.0
offset_right = 689.0
offset_bottom = 1036.0
theme_override_font_sizes/font_size = 22
horizontal_alignment = 1
metadata/_edit_lock_ = true
[node name="input_0" type="AnimatedSprite2D" parent="."]
position = Vector2(495, 443)
sprite_frames = SubResource("SpriteFrames_1wf07")
[node name="input_1" type="AnimatedSprite2D" parent="."]
position = Vector2(246, 440)
sprite_frames = SubResource("SpriteFrames_1wf07")
[node name="output_0" type="AnimatedSprite2D" parent="."]
position = Vector2(497, 330)
sprite_frames = SubResource("SpriteFrames_1wf07")
[node name="output_1" type="AnimatedSprite2D" parent="."]
position = Vector2(249, 331)
sprite_frames = SubResource("SpriteFrames_1wf07")
[node name="line" type="Line2D" parent="."]
position = Vector2(59, 920)
scale = Vector2(1.03548, 1)
points = PackedVector2Array(-8, 0, 61.8069, 0, 608, 0)
width = 2.0
default_color = Color(1, 1, 1, 0.352941)
metadata/_edit_lock_ = true

View File

@@ -1,234 +1,179 @@
@tool
extends 'res://scenes/контроль/прибор.gd'
const constants_v = {
'POWER_UKP_1': 31,
'POWER_UKP_2': 63,
'DKM_BIT_4': 3,
'DKM_BIT_5': 4,
'BASE_ADDR_EMS_G': 0x120,
'ADDR_UG_LITERA_1': 0x106,
'ADDR_UG_LITERA_2': 0x108,
'ADDR_UG_LITERA_3': 0x10A,
'TEMP_THRESHOLD': 70,
'POWER_THRESHOLD': 40,
'RAY_DOU_NUM': 0x3,
'ATT_UM_4': 0x2,
'ATT_UM_5': 0x3,
'POWER_UM': 100,
'TIMER_DELAY': 10.0,
'STATE_MASHINE_TIMER': 0.3,
}
# Конфигурация параметров для каждого прибора
const PRIBOR_CONFIG_V := {
'': {'angle': 0.0, 'sectors': [12, 16]},
'': {'angle': 90.0, 'sectors': [15, 19]},
'': {'angle': 180.0, 'sectors': [14, 18]},
'': {'angle': 270.0, 'sectors': [13, 17]},
}
# Конфигурация частот и ширин для каждого ФС
const FS_PARAMS_V := {
4: {'freq': 1227.0, 'width': 100.0},
5: {'freq': 1575.0, 'width': 110.0},
}
enum STATE_VAL { NONE = 0, GOOD = 1, ERROR = 2 }
var block_ip_config_v := {
'maa2000_1': [0, false],
'maa2000_2': [1, false],
'ip9_50_1': [2, false],
'ip9_50_2': [3, false],
'ip12_50_1': [4, false],
'ip5_25': [7, false],
}
var block_kasseta_y5_prd_config_v: = {
'yau07': false,
'ems': false,
'ug': false,
'ukp1': false,
'ukp2': false,
}
# Основные переменные
var start_litera: int = 4
var ug_work_1: int = 2 ## Аттенюация усилителей мощности
var ug_work_2: int = 3 ## Аттенюация усилителей мощности
# Флаги и таймеры
var mashine_timer: Timer = Timer.new()
var prd_v_module: Object
var unit_prd_v: Object
var control_prd_v: Object
# Результаты контроля
var control_results_v: Dictionary = {
'block_ip': false, # Проверка касет П1 и ИП МА2000
'temperature': true, # Проверка температур УМ
'dkm_4': false,
'dkm_5': false,
'dou_4': false,
'dou_5': false,
'fs_4': 2,
'fs_5': 2,
}
var test_control_v = preload('res://scripts/pribor-prd.gd')
var ctrl_pos = 70
func on_state_mashine() -> void:
control_prd_v.state_control_machine()
func _ready() -> void:
if Engine.is_editor_hint():
return
initialize_connections()
setup_timer()
set_default_state()
find_labels(self)
func initialize_connections() -> void:
var unit_name = get_meta('unit_name')[0]
prd_v_module = prd.prd_dict[unit_name]
unit_prd_v = prd_v_module.unit_yau07
unit_prd_v.connect('line_changed', Callable(self, 'on_line_changed'))
var power_amplifiers: Array = get_tree().get_nodes_in_group('power_amplifier')
var init_data: Dictionary = {
'control_label': $control_result,
'power_amplifiers': power_amplifiers,
'unit_prd': unit_prd_v,
'module_prd' : prd_v_module,
'constants': constants_v,
'prd_config': PRIBOR_CONFIG_V,
'fs_params': FS_PARAMS_V,
'block_ip_prd_config': block_ip_config_v,
'block_kasseta_y5_prd_config': block_kasseta_y5_prd_config_v,
'control_results': control_results_v,
'current_litera': start_litera,
}
control_prd_v = test_control_v.TestPRD.new(init_data)
add_child(control_prd_v)
control_prd_v.connect('control_is_over', Callable(self, 'on_control_result'))
var prd_v_module = prd.prd_dict[unit_name]
unit_prd_v = prd_v_module.unit_control
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
for temp in power_amplifier:
temp.value1 = -70
# Подписываемся на сигналы
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)
func setup_timer() -> void:
add_child(mashine_timer)
mashine_timer.connect('timeout', Callable(self, 'on_state_mashine'))
mashine_timer.wait_time = constants_v.STATE_MASHINE_TIMER
mashine_timer.start()
func _process(_delta: float) -> void:
if Engine.is_editor_hint():
return
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_default_state() -> void:
for group in get_tree().get_nodes_in_group('default_reset'):
group.state = STATE_VAL.NONE
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
for group in get_tree().get_nodes_in_group('power_amplifier'):
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'))
for um in get_tree().get_nodes_in_group('power_amplifier'):
um.value0 = [0, 0, 0, 0, 0, 0]
await get_tree().create_timer(1.0).timeout
on_press_device(unit_prd_v.self_name)
static func set_default_state(default_reset_array_node: Array) -> void:
for group in default_reset_array_node:
group.state = STATE_VAL.NONE
func _enter_tree() -> void:
if Engine.is_editor_hint():
return
$control_result.text = 'Выполняется ...'
$control_result.add_theme_color_override('font_color', Color.ALICE_BLUE)
signaller.connect('режим_работа', Callable(self, 'on_mode_changed').bind(false))
signaller.connect('режим_журнал', Callable(self, 'on_mode_changed').bind(false))
signaller.connect('режим_эмс', Callable(self, 'on_mode_changed').bind(false))
signaller.connect('режим_настройки', Callable(self, 'on_mode_changed').bind(false))
signaller.connect('режим_контроль', Callable(self, 'on_mode_changed').bind(true))
if unit_prd_v:
_update_status_text(unit_prd_v.get_current_status())
func _exit_tree() -> void:
if Engine.is_editor_hint():
return
prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]])
func on_line_changed(unit_pribor: Object) -> void:
if not unit_pribor.online:
set_default_state()
static func temperature_fill(temperature_arr_node: Array, temperature_dic: Dictionary)->void:
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] if temperature_dic[temperature_meta] < 361 else -40
func on_mode_changed(in_tree: bool) -> void:
if not in_tree:
mashine_timer.stop()
prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]])
signaller.emit_signal('interfer_off_all')
else:
set_default_state()
control_prd_v.state = control_prd_v.STATE_MASHINE.INIT
mashine_timer.start()
func power_fill(pow_dic: Dictionary, fs_result: Dictionary) -> void:
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
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 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_7', 'um_8', 'um_9', 'um_10', 'um_11', 'um_12'] 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 < constants_v.POWER_THRESHOLD:
status = STATE_VAL.ERROR
i_powapm.state = status
if not pow_dic.has(powamp_meta): return
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]
# Проверка: если ВСЕ значения в массиве < 1 → STATE_VAL.NONE
var power_array: Array = pow_dic[powamp_meta]
var all_below_one: bool = true
for i_p in power_array:
if i_p >= 1:
all_below_one = false
break
if all_below_one:
i_node_powapm.state = STATE_VAL.NONE
continue
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_control_result(result_dic: Dictionary, power_dic: Dictionary) -> void:
mashine_timer.stop()
block_kasseta_y5_prd_config_v = control_prd_v.block_kasseta_y5_config
func on_press_device(_device_name: String) -> void:
var nodes_y5: Array = get_tree().get_nodes_in_group('y-5')
var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply')
var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group')
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
var default_reset_array_node: Array = get_tree().get_nodes_in_group('default_reset')
var module_fs_4: Node = $kasseta_FS_VD/ref_A6
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 = {
'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,
'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)
static func on_control_result(for_result_dic: Dictionary) -> void:
temperature_fill(for_result_dic.power_amplifier, for_result_dic.temperature_um)
var all_y5_good: bool = true
var block_kasseta_y5_prd_config_v: Dictionary = for_result_dic.block_kasseta_y5_config
var nodes_y5: Array = for_result_dic.nodes_y5
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
if node_y5.state == STATE_VAL.ERROR:
all_y5_good = false
block_ip_config_v = control_prd_v.block_ip_config
var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply')
for power_supply in node_ip_power_arr:
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 power_supply.state == STATE_VAL.ERROR:
all_y5_good = false
var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group')
for f in fs_nodes:
if not for_result_dic.control_is_over:
set_default_state(for_result_dic.default_reset_array_node)
set_default_state(for_result_dic.power_amplifier)
return
var result_dic: Dictionary = for_result_dic.result_dic
for f in for_result_dic.fs_nodes:
var fs_meta: String = f.get_meta('fs')
if result_dic.has(fs_meta):
var new_state = result_dic[fs_meta]
f.state = new_state
result_dic[fs_meta] = new_state
f.state = result_dic[fs_meta]
if result_dic.fs_5 == 1:
$kasseta_FS_VD/ref_A2.state = STATE_VAL.GOOD if result_dic.dkm_5 else STATE_VAL.ERROR
$dou5_A6.state = STATE_VAL.GOOD if result_dic.dou_5 else STATE_VAL.ERROR
else:
result_dic.fs_5 = 0
if result_dic.fs_4 == 1:
$kasseta_FS_VD/ref_A6.state = STATE_VAL.GOOD if result_dic.dkm_4 else STATE_VAL.ERROR
$dou4_A5.state = STATE_VAL.GOOD if result_dic.dou_4 else STATE_VAL.ERROR
else:
result_dic.fs_4 = 0
power_fill(power_dic, result_dic)
if not all_y5_good: return
var fs_5 = true if int(result_dic.fs_5) == 1 else false
if fs_5 and block_kasseta_y5_prd_config_v['yau07']:
for_result_dic.module_fs_5.state = STATE_VAL.GOOD if result_dic.dkm_5 else STATE_VAL.ERROR
for_result_dic.dou_5.state = STATE_VAL.GOOD if result_dic.dou_5 else STATE_VAL.ERROR
var result = true
for device in result_dic.values():
if not device:
result = false
var fs_4 = true if int(result_dic.fs_4) == 1 else false
if fs_4 and block_kasseta_y5_prd_config_v['yau07']:
for_result_dic.module_fs_4.state = STATE_VAL.GOOD if result_dic.dkm_4 else STATE_VAL.ERROR
for_result_dic.dou_4.state = STATE_VAL.GOOD if result_dic.dou_4 else STATE_VAL.ERROR
var name_prd = control_prd_v.self_name
if result:
$control_result.text = 'Прибор ПРД-%s исправен' % name_prd
$control_result.add_theme_color_override('font_color', Color.GREEN)
else:
$control_result.text = 'Прибор ПРД-%s неисправен' % name_prd
$control_result.add_theme_color_override('font_color', Color.RED)
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)
func find_labels(node1: Node):
@@ -245,3 +190,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)

View File

@@ -1,13 +1,36 @@
[gd_scene load_steps=9 format=3 uid="uid://cvskpe1ti3p45"]
[gd_scene load_steps=13 format=3 uid="uid://cvskpe1ti3p45"]
[ext_resource type="Script" uid="uid://cvuosuvjaci1h" path="res://scenes/pribor-prd-v/pribor-prd-v.gd" id="1_c20s6"]
[ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_xpo4b"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="3_wyy1b"]
[ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="4_gl2bl"]
[ext_resource type="PackedScene" uid="uid://cd5sue1e8iyrv" path="res://scenes/pribor-prd-n/kasseta-fs-nd.tscn" id="5_nhd2k"]
[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_os4mt"]
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_38u2b"]
[ext_resource type="PackedScene" uid="uid://bcyxqni7gxvtq" path="res://scenes/контроль/блок-в.tscn" id="8_4e87c"]
[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="9_4e87c"]
[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="10_g8fvp"]
[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="11_gsby4"]
[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="12_vxfkm"]
[sub_resource type="SpriteFrames" id="SpriteFrames_s5gcy"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("9_4e87c")
}, {
"duration": 1.0,
"texture": ExtResource("10_g8fvp")
}, {
"duration": 1.0,
"texture": ExtResource("11_gsby4")
}, {
"duration": 1.0,
"texture": ExtResource("12_vxfkm")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[node name="pribor_prd_v" type="Control"]
layout_mode = 3
@@ -18,50 +41,50 @@ offset_right = 15.0
offset_bottom = 30.0
script = ExtResource("1_c20s6")
[node name="maa2000_A22" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("2_xpo4b")]
[node name="maa2000_A22" parent="." groups=["power_supply"] instance=ExtResource("2_xpo4b")]
layout_mode = 2
offset_left = 485.0
offset_top = 877.0
offset_right = 652.0
offset_bottom = 949.0
offset_left = 524.0
offset_top = 731.0
offset_right = 691.0
offset_bottom = 803.0
fname = "MAA2000"
rname = "A22"
metadata/ip = "maa2000_1"
[node name="dou4_A5" parent="." groups=["default_reset"] instance=ExtResource("2_xpo4b")]
layout_mode = 2
offset_left = 485.0
offset_top = 812.0
offset_right = 652.0
offset_bottom = 877.0
offset_left = 524.0
offset_top = 666.0
offset_right = 691.0
offset_bottom = 731.0
fname = "ДОУ-4"
rname = "A5"
[node name="maa2000_A23" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("2_xpo4b")]
[node name="maa2000_A23" parent="." groups=["power_supply"] instance=ExtResource("2_xpo4b")]
layout_mode = 2
offset_left = 8.0
offset_top = 877.0
offset_right = 175.0
offset_bottom = 949.0
offset_left = 47.0
offset_top = 731.0
offset_right = 214.0
offset_bottom = 803.0
fname = "MAA2000"
rname = "A23"
metadata/ip = "maa2000_2"
[node name="dou5_A6" parent="." groups=["default_reset"] instance=ExtResource("2_xpo4b")]
layout_mode = 2
offset_left = 8.0
offset_top = 812.0
offset_right = 175.0
offset_bottom = 877.0
offset_left = 47.0
offset_top = 666.0
offset_right = 214.0
offset_bottom = 731.0
fname = "ДОУ-5"
rname = "A6"
[node name="ref_ZZ3" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 175.0
offset_top = 812.0
offset_right = 485.0
offset_bottom = 949.0
offset_left = 214.0
offset_top = 666.0
offset_right = 524.0
offset_bottom = 803.0
texture = ExtResource("3_wyy1b")
patch_margin_left = 16
patch_margin_top = 16
@@ -80,27 +103,98 @@ text = "Панель
horizontal_alignment = 1
vertical_alignment = 1
[node name="kasseta_U5" parent="." instance=ExtResource("4_gl2bl")]
[node name="kasseta_U5" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 175.0
offset_top = 242.0
offset_right = 485.0
offset_bottom = 432.0
offset_left = 214.0
offset_top = 96.0
offset_right = 524.0
offset_bottom = 286.0
texture = ExtResource("3_wyy1b")
patch_margin_left = 16
patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
script = ExtResource("6_os4mt")
[node name="lbl_fname" type="Label" parent="kasseta_U5"]
self_modulate = Color(1, 1, 1, 0.62)
layout_mode = 0
offset_left = 5.0
offset_top = 7.0
offset_right = 305.0
offset_bottom = 35.0
text = "Кассета У5"
horizontal_alignment = 1
vertical_alignment = 1
[node name="ref_A24" parent="kasseta_U5" groups=["power_supply"] instance=ExtResource("7_38u2b")]
offset_left = 5.0
offset_top = 32.0
offset_right = 55.0
offset_bottom = 182.0
fname = "ИП5-25"
rname = "A24"
metadata/ip = "ip5_25"
[node name="ref_A30" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")]
offset_left = 55.0
offset_top = 32.0
offset_right = 105.0
offset_bottom = 182.0
fname = "ЯУ-07Б"
rname = "A30"
metadata/y5 = "yau07"
[node name="ref_A26" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")]
offset_left = 105.0
offset_top = 32.0
offset_right = 155.0
offset_bottom = 182.0
fname = "ЭМС-Г"
rname = "A26"
metadata/y5 = "ems"
[node name="ref_A27" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")]
offset_left = 155.0
offset_top = 32.0
offset_right = 205.0
offset_bottom = 182.0
fname = "УГ"
rname = "A27"
metadata/y5 = "ug"
[node name="ref_A28" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")]
offset_left = 205.0
offset_top = 32.0
offset_right = 255.0
offset_bottom = 182.0
fname = "УКП"
rname = "A28"
metadata/y5 = "ukp1"
[node name="ref_A29" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")]
offset_left = 254.0
offset_top = 32.0
offset_right = 304.0
offset_bottom = 182.0
fname = "УКП"
rname = "A29"
metadata/y5 = "ukp2"
[node name="kasseta_FS_VD" parent="." instance=ExtResource("5_nhd2k")]
layout_mode = 0
offset_left = 175.0
offset_top = 432.0
offset_right = 485.0
offset_bottom = 622.0
offset_left = 214.0
offset_top = 286.0
offset_right = 524.0
offset_bottom = 476.0
fname = "Кассета ФС-ВД"
[node name="kasseta_P_1" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 175.0
offset_top = 622.0
offset_right = 485.0
offset_bottom = 812.0
offset_left = 214.0
offset_top = 476.0
offset_right = 524.0
offset_bottom = 666.0
texture = ExtResource("3_wyy1b")
patch_margin_left = 16
patch_margin_top = 16
@@ -109,7 +203,7 @@ patch_margin_bottom = 16
script = ExtResource("6_os4mt")
fname = "Кассета П-1В"
[node name="ref_A19" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_38u2b")]
[node name="ref_A19" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_38u2b")]
offset_left = 9.0
offset_top = 33.0
offset_right = 59.0
@@ -118,7 +212,7 @@ fname = "ИП9-50"
rname = "A19"
metadata/ip = "ip9_50_1"
[node name="ref_A20" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_38u2b")]
[node name="ref_A20" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_38u2b")]
offset_left = 59.0
offset_top = 33.0
offset_right = 109.0
@@ -127,7 +221,7 @@ fname = "ИП9-50"
rname = "A20"
metadata/ip = "ip9_50_2"
[node name="ref_A21" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_38u2b")]
[node name="ref_A21" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_38u2b")]
offset_left = 109.0
offset_top = 33.0
offset_right = 159.0
@@ -149,153 +243,178 @@ vertical_alignment = 1
[node name="um1535_A7" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 485.0
offset_top = 242.0
offset_right = 652.0
offset_bottom = 337.0
fname = "УМ1535Б"
offset_left = 524.0
offset_top = 96.0
offset_right = 691.0
offset_bottom = 191.0
fname = "УМ1535А"
rname = "A7"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_1"
[node name="um1535_A8" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 485.0
offset_top = 337.0
offset_right = 652.0
offset_bottom = 432.0
offset_left = 524.0
offset_top = 191.0
offset_right = 691.0
offset_bottom = 286.0
fname = "УМ1535А"
rname = "A8"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_2"
[node name="um1535_A9" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 485.0
offset_top = 432.0
offset_right = 652.0
offset_bottom = 527.0
offset_left = 524.0
offset_top = 286.0
offset_right = 691.0
offset_bottom = 381.0
fname = "УМ1535А"
rname = "A9"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_3"
[node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 485.0
offset_top = 527.0
offset_right = 652.0
offset_bottom = 622.0
offset_left = 524.0
offset_top = 381.0
offset_right = 691.0
offset_bottom = 476.0
fname = "УМ1535А"
rname = "A10"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_4"
[node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 485.0
offset_top = 622.0
offset_right = 652.0
offset_bottom = 717.0
offset_left = 524.0
offset_top = 476.0
offset_right = 691.0
offset_bottom = 571.0
fname = "УМ1535А"
rname = "A11"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_5"
[node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 485.0
offset_top = 717.0
offset_right = 652.0
offset_bottom = 812.0
offset_left = 524.0
offset_top = 571.0
offset_right = 691.0
offset_bottom = 666.0
fname = "УМ1535А"
rname = "A12"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_6"
[node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 8.0
offset_top = 242.0
offset_right = 175.0
offset_bottom = 337.0
offset_left = 47.0
offset_top = 96.0
offset_right = 214.0
offset_bottom = 191.0
fname = "УМ1535А"
rname = "A13"
value0_info = "Мощность, Вт"
value1_info = "Температура,°C"
metadata/um = "um_7"
[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 8.0
offset_top = 337.0
offset_right = 175.0
offset_bottom = 432.0
fname = "УМ1535А"
rname = "A14"
value0_info = "Мощность, Вт"
value1_info = "Температура,°C"
metadata/um = "um_8"
[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 8.0
offset_top = 432.0
offset_right = 175.0
offset_bottom = 527.0
fname = "УМ1535А"
rname = "A15"
value0_info = "Мощность, Вт"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_9"
[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 8.0
offset_top = 527.0
offset_right = 175.0
offset_bottom = 622.0
offset_left = 47.0
offset_top = 191.0
offset_right = 214.0
offset_bottom = 286.0
fname = "УМ1535А"
rname = "A16"
value0_info = "Мощность, Вт"
rname = "A14"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_10"
[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 8.0
offset_top = 622.0
offset_right = 175.0
offset_bottom = 717.0
offset_left = 47.0
offset_top = 286.0
offset_right = 214.0
offset_bottom = 381.0
fname = "УМ1535А"
rname = "A17"
value0_info = "Мощность, Вт"
rname = "A15"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_11"
[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 8.0
offset_top = 717.0
offset_right = 175.0
offset_bottom = 812.0
offset_left = 47.0
offset_top = 381.0
offset_right = 214.0
offset_bottom = 476.0
fname = "УМ1535А"
rname = "A18"
value0_info = "Мощность, Вт"
rname = "A16"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_12"
[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 47.0
offset_top = 476.0
offset_right = 214.0
offset_bottom = 571.0
fname = "УМ1535А"
rname = "A17"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_13"
[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
layout_mode = 0
offset_left = 47.0
offset_top = 571.0
offset_right = 214.0
offset_bottom = 666.0
fname = "УМ1535А"
rname = "A18"
value0_info = "Мощность"
value1_info = "Температура,°C"
metadata/um = "um_14"
[node name="input_0" type="AnimatedSprite2D" parent="."]
position = Vector2(496, 440)
sprite_frames = SubResource("SpriteFrames_s5gcy")
[node name="input_1" type="AnimatedSprite2D" parent="."]
position = Vector2(248, 440)
sprite_frames = SubResource("SpriteFrames_s5gcy")
[node name="output_0" type="AnimatedSprite2D" parent="."]
position = Vector2(496, 336)
sprite_frames = SubResource("SpriteFrames_s5gcy")
[node name="output_1" type="AnimatedSprite2D" parent="."]
position = Vector2(248, 336)
sprite_frames = SubResource("SpriteFrames_s5gcy")
[node name="line" type="Line2D" parent="."]
position = Vector2(59, 920)
scale = Vector2(1.03548, 1)
points = PackedVector2Array(-8, 0, 61.8069, 0, 608, 0)
width = 2.0
default_color = Color(1, 1, 1, 0.352941)
metadata/_edit_lock_ = true
[node name="control_result" type="Label" parent="."]
layout_mode = 0
offset_left = 9.0
offset_top = 960.0
offset_right = 649.0
offset_bottom = 1003.0
offset_left = 49.0
offset_top = 993.0
offset_right = 689.0
offset_bottom = 1036.0
theme_override_font_sizes/font_size = 22
horizontal_alignment = 1
metadata/_edit_lock_ = true

View File

@@ -2,106 +2,101 @@
class_name pribor_uf extends 'res://scenes/контроль/прибор.gd'
enum STATE_VAL {NONE = 0, GOOD = 1, ERROR = 2}
const DEV_LIST = ['00:1f.6', '07:00.0', '08:00.0', '0b:00.0']
const USB_TRACKERBALL = '13ba:0018'
const REVFF = '(rev ff)'
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 uf_control: Object
var ctrl_pos = 100
func _ready() -> void:
if Engine.is_editor_hint():
return
var unit_uf: = network.get_unit_instance('уарэп-эмс')
unit_uf.connect('line_changed', on_line_changed)
control_vk()
on_line_changed(unit_uf)
if Engine.is_editor_hint(): return
#control_vk()
uf_control = get_parent().uf_control
uf_control.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_timer(unit_name: StringName):
var unit_uf = network.get_unit_instance(unit_name)
status_uf() # отслеживание состояния прибора
if unit_uf.online: # проверка ЯУ, внутреннего коммутатора и ИП-5Б
control_ems(unit_uf.status) # проверка ЭМС ячеек
func on_update_uf_serviceability(_state: int):
control_ems(uf_control.get_current_status())
func on_line_changed(unit_uf):
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_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
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
$ref_uf/ref_bu1/ref_A8_BU.state = STATE_VAL.GOOD ## заглушка для зеленения ВК-110
func control_ems(status: Array) -> void:
$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

View File

@@ -7,14 +7,16 @@
[node name="pribor_uf" type="Control"]
layout_mode = 3
anchors_preset = 0
offset_left = -121.0
offset_right = -121.0
script = ExtResource("1_7gtpa")
[node name="ref_uf" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 187.0
offset_top = 247.0
offset_right = 708.0
offset_bottom = 955.0
offset_left = 244.0
offset_top = 128.0
offset_right = 765.0
offset_bottom = 836.0
texture = ExtResource("2_ho0da")
patch_margin_left = 16
patch_margin_top = 16
@@ -142,19 +144,20 @@ offset_bottom = 35.0
text = "Кассета В-13"
[node name="lbl_header2" type="Label" parent="."]
visible = false
layout_mode = 0
offset_left = 199.0
offset_top = 974.0
offset_right = 704.0
offset_bottom = 1000.0
offset_left = 252.0
offset_top = 1009.0
offset_right = 757.0
offset_bottom = 1064.0
theme_override_font_sizes/font_size = 22
text = "Прибор не исправен
"
text = "Ожидание запуска контроля"
horizontal_alignment = 1
vertical_alignment = 1
[node name="timer" type="Timer" parent="."]
autostart = true
[connection signal="timeout" from="timer" to="." method="on_timer" binds= [&"уарэп-эмс"]]
[node name="line" type="Line2D" parent="."]
position = Vector2(195, 950)
scale = Vector2(1.03548, 1)
points = PackedVector2Array(-8, 0, 61.8069, 0, 608, 0)
width = 2.0
default_color = Color(1, 1, 1, 0.352941)
metadata/_edit_lock_ = true

View 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: 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 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 = 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

View File

@@ -0,0 +1 @@
uid://b6avo0uvwrxnj

View File

@@ -17,10 +17,10 @@ script = ExtResource("1_46rp6")
[node name="ref_G1" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 70.0
offset_top = 303.0
offset_right = 660.0
offset_bottom = 1085.0
offset_left = 88.0
offset_top = 128.0
offset_right = 678.0
offset_bottom = 910.0
texture = ExtResource("1_6olof")
patch_margin_left = 16
patch_margin_top = 16
@@ -29,10 +29,10 @@ patch_margin_bottom = 16
[node name="spt25_A1" parent="." instance=ExtResource("6_60xs3")]
layout_mode = 0
offset_left = 88.0
offset_top = 319.0
offset_right = 343.0
offset_bottom = 749.0
offset_left = 106.0
offset_top = 144.0
offset_right = 361.0
offset_bottom = 574.0
tooltip_text = "Ящик - 11, Позиция - 3"
script = ExtResource("4_v0lil")
unit_name = "уарэп-спт25-1"
@@ -64,10 +64,10 @@ offset_bottom = 417.0
[node name="spt25_A2" parent="." instance=ExtResource("6_60xs3")]
layout_mode = 0
offset_left = 392.0
offset_top = 320.0
offset_right = 642.0
offset_bottom = 750.0
offset_left = 410.0
offset_top = 145.0
offset_right = 660.0
offset_bottom = 575.0
tooltip_text = "Ящик - 11, Позиция - 2"
script = ExtResource("4_v0lil")
unit_name = "уарэп-спт25-2"
@@ -98,10 +98,10 @@ offset_right = 235.0
offset_bottom = 417.0
[node name="sch3" parent="." instance=ExtResource("7_qu7ja")]
offset_left = 88.0
offset_top = 774.0
offset_right = 643.0
offset_bottom = 1059.0
offset_left = 106.0
offset_top = 599.0
offset_right = 661.0
offset_bottom = 884.0
unit_name = "уарэп-щ3"
fname = "Щ3 (контроль и управление питанием)"
rname = "A1"

View File

@@ -32,29 +32,29 @@ func disable_all():
func on_data_received(data: PackedByteArray):
# Сеть 1. Использование
$block_input1.state = STATE_VAL.GOOD if data[4] & (1 << 5) else STATE_VAL.ERROR
$block_input1.state = STATE_VAL.GOOD if data[3] & (1 << 5) else STATE_VAL.ERROR
# Сеть 1. Вход
$block_input1.state0 = STATE_VAL.GOOD if ((data[4] & (1 << 1)) == 0) and ((data[4] & (1 << 3)) == 0) else STATE_VAL.ERROR
$block_input1.state0 = STATE_VAL.GOOD if ((data[3] & (1 << 1)) == 0) and ((data[3] & (1 << 3)) == 0) else STATE_VAL.ERROR
# Сеть 1. Неисправность блока инвертора 1 канала
$block_input1.state1 = STATE_VAL.GOOD if (data[6] & (1 << 2)) == 0 else STATE_VAL.ERROR
$block_input1.state1 = STATE_VAL.GOOD if (data[5] & (1 << 2)) == 0 else STATE_VAL.ERROR
# Сеть 1. Перегрев 1 канала
$block_input1.state2 = STATE_VAL.GOOD if (data[5] & (1 << 3)) == 0 else STATE_VAL.ERROR
$block_input1.state2 = STATE_VAL.GOOD if (data[4] & (1 << 3)) == 0 else STATE_VAL.ERROR
# Сеть 2. Использование
$block_input2.state = STATE_VAL.GOOD if data[4] & (1 << 6) else STATE_VAL.ERROR
$block_input2.state = STATE_VAL.GOOD if data[3] & (1 << 6) else STATE_VAL.ERROR
# Сеть 2. Вход
$block_input2.state0 = STATE_VAL.GOOD if ((data[4] & (1 << 2)) == 0) and ((data[4] & (1 << 4)) == 0) else STATE_VAL.ERROR
$block_input2.state0 = STATE_VAL.GOOD if ((data[3] & (1 << 2)) == 0) and ((data[3] & (1 << 4)) == 0) else STATE_VAL.ERROR
# Сеть 2. Неисправность блока инвертора 2 канала
$block_input2.state1 = STATE_VAL.GOOD if (data[6] & (1 << 3)) == 0 else STATE_VAL.ERROR
$block_input2.state1 = STATE_VAL.GOOD if (data[5] & (1 << 3)) == 0 else STATE_VAL.ERROR
# Сеть 2. Перегрев 2 канала
$block_input2.state2 = STATE_VAL.GOOD if (data[5] & (1 << 4)) == 0 else STATE_VAL.ERROR
$block_input2.state2 = STATE_VAL.GOOD if (data[4] & (1 << 4)) == 0 else STATE_VAL.ERROR
# Неисправность, напряжение меньше номинального, напряжение выше номинального
$block_output.state0 = STATE_VAL.GOOD if ((data[4] & (1 << 0)) == 0) and ((data[4] & (1 << 7)) == 0) and ((data[5] & (1 << 2)) == 0) else STATE_VAL.ERROR
$block_output.state0 = STATE_VAL.GOOD if ((data[3] & (1 << 0)) == 0) and ((data[3] & (1 << 7)) == 0) and ((data[4] & (1 << 2)) == 0) else STATE_VAL.ERROR
# Перегрузка и короткое замыкание по выходу
$block_output.state1 = STATE_VAL.GOOD if ((data[5] & (1 << 0)) == 0) and ((data[5] & (1 << 1)) == 0) else STATE_VAL.ERROR
$block_output.state1 = STATE_VAL.GOOD if ((data[4] & (1 << 0)) == 0) and ((data[4] & (1 << 1)) == 0) else STATE_VAL.ERROR
# Критическая температура
$block_output.state2 = STATE_VAL.GOOD if ((data[5] & (1 << 5)) == 0) else STATE_VAL.ERROR
$block_output.state2 = STATE_VAL.GOOD if ((data[4] & (1 << 5)) == 0) else STATE_VAL.ERROR
# Обобщённое состояние
state = STATE_VAL.GOOD \

View File

@@ -1,48 +1,287 @@
extends Label
# Используем более понятные имена переменных
const STATUS_GOOD := {"text": "Исправно", "color": Color.GREEN, "font_color": Color.BLACK}
const STATUS_BAD := {"text": "Отказ", "color": Color.RED, "font_color": Color.WHITE}
var _is_uf_status_initialized: bool = false
var is_prd_operational: bool = true
var is_uf_operational: bool = false
enum DEVICE_STATE {
NONE, # Нет связи
GOOD, # Исправно
ERR # Отказ
}
enum DEVICE_STATUS {
ONLINE, # Связь есть
STATUS, # Статус исправности
CONTROL # Контроль завершен
}
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}
}
class DeviceObserver:
var device_name: String
var status: Array = [false, false, false] # [online, operational, control_complete]
var last_results: Dictionary = {}
func update_online_state(online: bool) -> bool:
if status[DEVICE_STATUS.ONLINE] != online:
status[DEVICE_STATUS.ONLINE] = online
return true
return false
func update_control_results(results: Dictionary) -> bool:
var changed := false
last_results = results.duplicate()
if results.get('is_over_control', false):
# Контроль завершен - проверяем все результаты
var all_ok := true
for key in results:
if key != 'is_over_control' and not results[key]:
all_ok = false
break
if status[DEVICE_STATUS.STATUS] != all_ok or status[DEVICE_STATUS.CONTROL] != true:
status[DEVICE_STATUS.STATUS] = all_ok
status[DEVICE_STATUS.CONTROL] = true
changed = true
else:
# Контроль в процессе - проверяем базовые параметры
var basic_ok: bool = results.get('block_kasseta', false) and \
results.get('block_ip', false) and \
results.get('temperature', true)
if status[DEVICE_STATUS.STATUS] != basic_ok or status[DEVICE_STATUS.CONTROL] != false:
status[DEVICE_STATUS.STATUS] = basic_ok
status[DEVICE_STATUS.CONTROL] = false
changed = true
return changed
var device_observers: Dictionary = {}
var overall_prd_state: DEVICE_STATE = DEVICE_STATE.NONE
var status_uf: int = DEVICE_STATE.NONE # Статус УФ (УАРЭП-ЭМС)
func _ready() -> void:
tooltip_text = 'Нет связи с приборами комплекса'
for prd_module in prd.prd_dict.values():
prd_module.connect('update_serviceability', Callable(self, 'on_serviceability_changed').bind(prd_module))
var unit_uf: = network.get_unit_instance('уарэп-эмс')
unit_uf.connect('data_received', Callable(self, 'on_uf_status_receive'))
add_theme_color_override("font_color", Color.BLACK)
# Инициализация наблюдателей
_initialize_observers()
func on_serviceability_changed(unit_prd_module: Object) -> void:
var check_service: bool = true
# Подписка на сигналы ПРД модулей
for prd_module in prd.prd_dict.values():
if prd_module.unit_yau07.online:
if not unit_prd_module.serviceability:
check_service = false
if check_service != is_prd_operational:
is_prd_operational = check_service
_update_serviceability_display()
# Подключаемся к контролю ПРД
if prd_module.unit_control:
prd_module.unit_control.connect('control_results_updated', Callable(self, '_on_prd_control_results').bind(prd_module))
# Подключаемся к онлайн-статусу ЯУ-07
if prd_module.unit_yau07:
prd_module.unit_yau07.connect('line_changed', Callable(self, '_on_prd_online_changed').bind(prd_module))
# Подписка на УФ
signaller.connect('update_uf_serviceability', _on_uf_status_receive)
# Инициализация начального состояния
_recalculate_overall_state()
func _update_serviceability_display() -> void:
var status := STATUS_GOOD if (is_uf_operational and is_prd_operational) else STATUS_BAD
text = status.text
modulate = status.color
tooltip_text = 'Результаты обобщенного признака работоспособности изделия'
add_theme_color_override("font_color", status.font_color)
func _initialize_observers() -> void:
var device_names := [
'уарэп-яу07-1н', 'уарэп-яу07-1в', 'уарэп-яу07-1к',
'уарэп-яу07-2н', 'уарэп-яу07-2в', 'уарэп-яу07-2к',
'уарэп-яу07-3н', 'уарэп-яу07-3в', 'уарэп-яу07-3к',
'уарэп-яу07-4н', 'уарэп-яу07-4в', 'уарэп-яу07-4к'
]
for device_name in device_names:
device_observers[device_name] = DeviceObserver.new()
device_observers[device_name].device_name = device_name
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 check_service: bool = KEMS_B and EMS_B_1 and EMS_B_2 and IP27B
if not _is_uf_status_initialized or check_service != is_uf_operational:
is_uf_operational = check_service
_update_serviceability_display()
signaller.emit_signal('update_uf_serviceability', check_service)
_is_uf_status_initialized = true
func _on_prd_online_changed(line_status: Object, prd_module: Object) -> void:
var online: bool = line_status.online
var observer: DeviceObserver = device_observers.get(prd_module.prd_name)
if observer and observer.update_online_state(online):
_recalculate_overall_state()
func _on_prd_control_results(results: Dictionary, prd_module: Object) -> void:
var observer: DeviceObserver = device_observers.get(prd_module.prd_name)
if observer and observer.update_control_results(results):
_recalculate_overall_state()
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 := 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_prd = true
if observer.status[DEVICE_STATUS.CONTROL]:
if not observer.status[DEVICE_STATUS.STATUS]:
all_prd_operational = false
break
else:
if not observer.status[DEVICE_STATUS.STATUS]:
all_prd_operational = false
if has_online_prd:
if all_prd_operational:
prd_state = DEVICE_STATE.GOOD
else:
prd_state = DEVICE_STATE.ERR
else:
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
_update_display()
func _update_display() -> void:
var config: Dictionary = STATUS_CONFIG[overall_prd_state].duplicate()
text = config.text
modulate = config.color
add_theme_color_override("font_color", config.font_color)
tooltip_text = _get_tooltip_text()
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:
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 "Неизвестно"
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
# Публичные методы для получения информации
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.duplicate(),
"status_uf": status_uf
}
return {}
func get_overall_status() -> Dictionary:
var online_count := 0
var operational_count := 0
var control_complete_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 observer.status[DEVICE_STATUS.CONTROL]:
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
}

View File

@@ -1 +1 @@
uid://b5ykwyk5vpi6
uid://b5ykwyk5vpi6

View File

@@ -79,25 +79,10 @@ visible = false
layout_mode = 2
metadata/_tab_index = 5
[node name="lbl_ready" type="Label" parent="."]
layout_mode = 0
offset_left = 1503.0
offset_right = 1600.0
offset_bottom = 27.0
tooltip_text = "Готовность аппаратуры к работе"
mouse_filter = 0
theme_override_font_sizes/font_size = 14
theme_override_styles/normal = SubResource("StyleBoxFlat_o1r22")
text = "Нет связи"
horizontal_alignment = 1
vertical_alignment = 1
script = ExtResource("8_tidwt")
metadata/_edit_lock_ = true
[node name="remote_control" type="Label" parent="."]
layout_mode = 2
offset_left = 1244.0
offset_right = 1401.0
offset_left = 1242.0
offset_right = 1402.0
offset_bottom = 27.0
tooltip_text = "Комплекс находится под внешним управлением"
mouse_filter = 0
@@ -109,7 +94,7 @@ vertical_alignment = 1
[node name="тренаж_режим" type="Button" parent="."]
layout_mode = 0
offset_left = 1404.0
offset_left = 1405.0
offset_right = 1501.0
offset_bottom = 27.0
tooltip_text = "Задействовать режим Тренаж"
@@ -125,5 +110,20 @@ toggle_mode = true
text = "Тренаж"
script = ExtResource("9_41d34")
[node name="lbl_ready" type="Label" parent="."]
layout_mode = 0
offset_left = 1504.0
offset_right = 1600.0
offset_bottom = 27.0
tooltip_text = "Готовность аппаратуры к работе"
mouse_filter = 0
theme_override_font_sizes/font_size = 14
theme_override_styles/normal = SubResource("StyleBoxFlat_o1r22")
text = "Нет связи"
horizontal_alignment = 1
vertical_alignment = 1
script = ExtResource("8_tidwt")
metadata/_edit_lock_ = true
[connection signal="tab_changed" from="tab_switch" to="tab_switch" method="_on_tab_changed"]
[connection signal="toggled" from="тренаж_режим" to="tab_switch" method="_on_button_trenaj_toggled"]
[connection signal="toggled" from="тренаж_режим" to="tab_switch" method="_on_button_trenazh_toggled"]

View File

@@ -1,11 +1,11 @@
extends Button
func _ready():
connect("toggled", Callable(self, "_on_button_toggled"))
func _on_button_toggled(mode: bool):
if mode:
tooltip_text = "Режим \"Тренаж\" задействован\nТекущее состояние: включено"
else:
tooltip_text = "Задейстовать режим \"Тренаж\"\nТекущее состояние: отключено"
extends Button
func _ready():
connect("toggled", Callable(self, "_on_button_toggled"))
func _on_button_toggled(mode: bool):
if mode:
tooltip_text = "Режим \"Тренаж\" задействован\nТекущее состояние: включено"
else:
tooltip_text = "Задейстовать режим \"Тренаж\"\nТекущее состояние: отключено"

View File

@@ -1 +1 @@
uid://roajn6c6wvc1
uid://roajn6c6wvc1

View File

@@ -373,7 +373,7 @@ func _process(delta) -> void:
remove_child(req)
req.queue_free()
_req_count -= 1
push_error('запрос \"%s\" не отправлен' % tile.url)
push_error('запрос \"%s\" не отправлен' % tile.url) #TODO: For Debug
if _queue.is_empty():
emit_signal('load_completed')

View File

@@ -0,0 +1,95 @@
extends Button
var base_style: StyleBoxFlat
var tween
var pulsing: bool = false
var original_text: String
var flag_control_is_over: bool = false
func _ready():
original_text = text
_setup_styles()
_setup_signals()
func _setup_styles() -> void:
if get("theme_override_styles/disabled") == null:
base_style = StyleBoxFlat.new()
base_style.border_color = Color(1.0, 0.5, 0.0)
base_style.border_width_top = 4
base_style.border_width_bottom = 4
base_style.border_width_left = 4
base_style.border_width_right = 4
base_style.bg_color = Color(0.2, 0.2, 0.2)
set("theme_override_styles/disabled", base_style)
else:
base_style = get("theme_override_styles/disabled")
set("theme_override_colors/font_disabled_color", Color(1.0, 1.0, 1.0))
func _setup_signals() -> void:
connect("pressed", Callable(self, "_on_pressed"))
if not signaller:
return
var signals_to_connect := ["режим_работа", "режим_журнал", "режим_эмс", "режим_настройки", "режим_контроль"]
for signal_name in signals_to_connect:
if signaller.has_signal(signal_name):
signaller.connect(signal_name, Callable(self, "_on_status_change"))
func _on_pressed():
disabled = true
text = "Идет выполнение контроля"
flag_control_is_over = false
_start_pulse()
func _start_pulse():
if pulsing:
return
pulsing = true
tween = create_tween()
tween.set_loops()
var color1 = Color(1.0, 0.5, 0.0) # оранжевый
var color2 = Color(0.4, 0.4, 0.4) # серый
tween.tween_property(base_style, "border_color", color2, 0.5)\
.set_trans(Tween.TRANS_SINE)\
.set_ease(Tween.EASE_IN_OUT)
tween.tween_property(base_style, "border_color", color1, 0.5)\
.set_trans(Tween.TRANS_SINE)\
.set_ease(Tween.EASE_IN_OUT)
func _stop_pulse():
if tween:
tween.kill()
tween = null
base_style.border_color = Color(1.0, 0.5, 0.0)
pulsing = false
disabled = false
text = original_text
tooltip_text = ''
func _on_status_change():
if not flag_control_is_over:
_stop_pulse()
func _on_stop_control():
var time_dict = Time.get_datetime_dict_from_system()
text = 'Контроль выполнен %02d:%02d/%02d.%02d' % [
time_dict.hour,
time_dict.minute,
time_dict.day,
time_dict.month]
disabled = false
tooltip_text = 'Нажать для повторного контроля '
flag_control_is_over = true
func _exit_tree() -> void:
if tween:
tween.kill()

View File

@@ -0,0 +1 @@
uid://xjs7owe2iexn

View File

@@ -35,7 +35,8 @@ 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.WHITE
$margin/vbox/grid1/level7.tint_progress = Color.RED if v >= 50 else Color.GOLD if v >= 40 else Color.WHITE
on_level_changed(v, $margin/vbox/grid1/level7, value1_info)
@export var min_value0: float:
@@ -150,12 +151,11 @@ func _ready():
item.connect('value_changed', on_level_changed.bind(item, value0_info))
on_level_changed(item.value, item, value0_info)
var level7: = $margin/vbox/grid1/level7
level7.connect('value_changed', on_level_changed.bind(level7, value1_info))
on_level_changed(level7.value, level7, value1_info)
func on_level_changed(_val: float, item: TextureProgressBar, info: String):
item.tooltip_text = '%s\\nТекущее: %0.2f\\nДиапазон: %0.2f…%0.2f' % [info, item.value, item.min_value, item.max_value]
func on_level_changed(val: float, item: TextureProgressBar, info: String):
item.tooltip_text = '%s\\nТекущее: %0.2f\\nДиапазон: %0.2f…%0.2f' % [info, val, item.min_value, item.max_value]
func set_group_param(items: Array, param: StringName, v) -> void:
@@ -191,8 +191,8 @@ func _enter_tree_defered():
$margin/vbox/grid0/rname.text = rname
$margin/vbox/grid0/fname.text = fname
$margin/vbox/grid0/state.texture = textures[state]
else:
push_warning('обращение к %s вне дерева' % self)
#else:
#push_warning('обращение к %s вне дерева' % self) TODO: пишеться только когда заходишь в проект а дальше не используется
func get_level_nodes() -> Array:
@@ -273,10 +273,9 @@ theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u")
script = SubResource("GDScript_oj3k3")
textures = [ExtResource("1_n1aqt"), ExtResource("2_rim3u"), ExtResource("3_3w8fg")]
value0 = [20.0, 30.0, 40.0, 50.0, 60.0, 70.0]
value1 = 56.0
min_value1 = -50.0
max_value0 = 100.0
max_value1 = 120.0
min_value1 = -40.0
max_value0 = 1400.0
max_value1 = 55.0
step0 = 1.0
step1 = 1.0
value_name0 = "P,%"
@@ -476,12 +475,11 @@ layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
tooltip_text = "
Текущее: 56.00
Диапазон: -50.00…120.00"
Текущее: 0.00
Диапазон: -40.00…55.00"
mouse_filter = 0
min_value = -50.0
max_value = 120.0
value = 56.0
min_value = -40.0
max_value = 55.0
fill_mode = 3
nine_patch_stretch = true
stretch_margin_left = 8

View File

@@ -0,0 +1,410 @@
[gd_scene load_steps=15 format=3 uid="uid://ffi1njkjceb5"]
[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="1_uojqc"]
[ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="2_a8ar3"]
[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="3_xwd13"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_eobkx"]
[ext_resource type="Texture2D" uid="uid://00871pb6moln" path="res://data/прогресс-фон-1.png" id="5_mg57e"]
[ext_resource type="Texture2D" uid="uid://c1k856fxhrjnh" path="res://data/прогресс-заполнение-1.png" id="6_of7rd"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3nd2u"]
[sub_resource type="GDScript" id="GDScript_oj3k3"]
script/source = "@tool
class_name blok_v extends PanelContainer
@export var textures: Array
@export var animation_duration: float = 1.5
signal pressed(control: PanelContainer)
## Значения уровней
@export var value0: Array:
set(v):
value0.assign(v)
var items: Array = get_level_nodes()
var count: int = min(items.size(), v.size())
for i in count:
set_value0_animated(items[i], v[i])
## Значение уровня
@export var value1: float:
set(v):
value1 = v
if not is_inside_tree():
return
$margin/vbox/grid1/level7.value = v
$margin/vbox/grid1/level7.tint_progress = Color.RED if v >= 50 else Color.GOLD if v >= 40 else Color.WHITE
on_level_changed(v, $margin/vbox/grid1/level7, value1_info)
@export var min_value0: float:
set(v):
min_value0 = v
var items: = get_level_nodes()
set_group_param(items, 'min_value', v)
@export var min_value1: float:
set(v):
min_value1 = v
if not is_inside_tree():
return
$margin/vbox/grid1/level7.min_value = v
@export var max_value0: float:
set(v):
max_value0 = v
var items: = get_level_nodes()
set_group_param(items, 'max_value', v)
@export var max_value1: float:
set(v):
max_value1 = v
if not is_inside_tree():
return
$margin/vbox/grid1/level7.max_value = v
@export var step0: float:
set(v):
step0 = v
var items: = get_level_nodes()
set_group_param(items, 'step', v)
@export var step1: float:
set(v):
step1 = v
if not is_inside_tree():
return
$margin/vbox/grid1/level7.step = v
@export var value_name0: String:
set(v):
value_name0 = v
var items: Array = get_name_nodes()
set_group_param(items, 'text', v)
@export var value_name1: String:
set(v):
value_name1 = v
if not is_inside_tree():
return
$margin/vbox/grid2/lbl7.text = v
@export var fname: String:
set(v):
fname = v
if not is_inside_tree():
return
$margin/vbox/grid0/fname.text = v
@export var rname: String:
set(v):
rname = v
if not is_inside_tree():
return
$margin/vbox/grid0/rname.text = v
@export var state: int:
set(v):
state = tools.clip_value(v, 0, textures.size() - 1)
if not is_inside_tree():
return
$margin/vbox/grid0/state.texture = textures[state]
@export var alignment: int:
set(v):
alignment = v
if is_inside_tree():
$margin/vbox.alignment = v
@export var value0_info: String:
set(v):
value0_info = v
@export var value1_info: String:
set(v):
value1_info = v
func _on_button_pressed(): emit_signal('pressed', self)
func set_value0(value: Array): value0.assign(value)
func _enter_tree() -> void: call_deferred('_enter_tree_defered')
func _ready():
var items: Array = get_level_nodes()
for item in items:
item.connect('value_changed', on_level_changed.bind(item, value0_info))
on_level_changed(item.value, item, value0_info)
var level7: = $margin/vbox/grid1/level7
on_level_changed(level7.value, level7, value1_info)
func on_level_changed(val: float, item: TextureProgressBar, info: String):
item.tooltip_text = '%s\\nТекущее: %0.2f\\nДиапазон: %0.2f…%0.2f' % [info, val, item.min_value, item.max_value]
func set_group_param(items: Array, param: StringName, v) -> void:
if not is_inside_tree():
return
if not get_tree():
return
for i in items.size():
items[i].set(param, v)
func set_value0_by_index(index: int, value: float) -> void:
var items: Array = get_level_nodes()
items[index].value = value
func _enter_tree_defered():
var items: Array = get_level_nodes()
var count: int = min(items.size(), value0.size())
for i in count:
items[i].min_value = min_value0
items[i].max_value = 1400 # max_value0: TODO для отладки
items[i].step = step0
items = get_name_nodes()
set_group_param(items, 'text', value_name0)
if is_inside_tree():
$margin/vbox/grid1/level7.value = value1
$margin/vbox/grid1/level7.min_value = min_value1
$margin/vbox/grid1/level7.max_value = max_value1
$margin/vbox/grid1/level7.step = step1
$margin/vbox/grid2/lbl7.text = value_name1
$margin/vbox.alignment = alignment
$margin/vbox/grid0/rname.text = rname
$margin/vbox/grid0/fname.text = fname
$margin/vbox/grid0/state.texture = textures[state]
func get_level_nodes() -> Array:
if not is_inside_tree():
return []
if not get_tree():
return []
return [$margin/vbox/grid1/level1]
func get_name_nodes() -> Array:
if not is_inside_tree():
return []
if not get_tree():
return []
return [$margin/vbox/grid2/lbl1]
func set_value0_animated(target_node, target_value: float) -> void:
var tween: Tween = create_tween()
tween.set_ease(Tween.EASE_OUT)
tween.set_trans(Tween.TRANS_QUINT)
tween.tween_property(target_node, 'value', target_value, animation_duration)
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_rceim"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8yvwo"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_6qu57"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_mlxje"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3dspb"]
[sub_resource type="GDScript" id="GDScript_45hqb"]
script/source = "@tool
extends MarginContainer
func _enter_tree() -> void:
margins = [8, 8, 8, 8]
@export var margins: Array:
set(vals):
add_theme_constant_override('margin_top', vals[0])
add_theme_constant_override('margin_left', vals[1])
add_theme_constant_override('margin_bottom', vals[2])
add_theme_constant_override('margin_right', vals[3])
get:
var vals = [0, 0, 0, 0]
vals[0] = get_theme_constant('margin_top')
vals[1] = get_theme_constant('margin_left')
vals[2] = get_theme_constant('margin_bottom')
vals[3] = get_theme_constant('margin_right')
return vals
"
[node name="блок-к" type="PanelContainer"]
editor_description = "Элемент замены из ЗИП"
offset_right = 160.0
offset_bottom = 88.0
theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u")
script = SubResource("GDScript_oj3k3")
textures = [ExtResource("1_uojqc"), ExtResource("2_a8ar3"), ExtResource("3_xwd13")]
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 = 55.0
step0 = 1.0
step1 = 1.0
value_name0 = "P,%"
value_name1 = "°C"
fname = "Блок В"
rname = "A1"
[node name="button" type="Button" parent="."]
layout_mode = 2
theme_override_styles/focus = SubResource("StyleBoxEmpty_rceim")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_8yvwo")
theme_override_styles/hover = SubResource("StyleBoxEmpty_6qu57")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_mlxje")
theme_override_styles/normal = SubResource("StyleBoxEmpty_3dspb")
[node name="rect" type="NinePatchRect" parent="."]
layout_mode = 2
texture = ExtResource("4_eobkx")
draw_center = false
region_rect = Rect2(0, 0, 63, 63)
patch_margin_left = 17
patch_margin_top = 17
patch_margin_right = 17
patch_margin_bottom = 15
[node name="margin" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
script = SubResource("GDScript_45hqb")
margins = [8, 8, 8, 8]
[node name="vbox" type="VBoxContainer" parent="margin"]
layout_mode = 2
[node name="grid0" type="GridContainer" parent="margin/vbox"]
layout_mode = 2
columns = 3
[node name="state" type="TextureRect" parent="margin/vbox/grid0"]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
size_flags_horizontal = 2
size_flags_vertical = 6
texture = ExtResource("1_uojqc")
expand_mode = 1
[node name="fname" type="Label" parent="margin/vbox/grid0"]
self_modulate = Color(1, 1, 1, 0.627451)
custom_minimum_size = Vector2(0, 20)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_font_sizes/font_size = 17
text = "Блок В"
horizontal_alignment = 1
vertical_alignment = 1
[node name="rname" type="Label" parent="margin/vbox/grid0"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 6
theme_override_font_sizes/font_size = 18
text = "A1"
horizontal_alignment = 2
vertical_alignment = 1
[node name="grid1" type="GridContainer" parent="margin/vbox"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 3
columns = 7
[node name="level1" type="TextureProgressBar" parent="margin/vbox/grid1" groups=["уровни"]]
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
tooltip_text = "
Текущее: 0.00
Диапазон: 0.00…1400.00"
mouse_filter = 0
max_value = 1400.0
fill_mode = 3
nine_patch_stretch = true
stretch_margin_left = 8
stretch_margin_top = 8
stretch_margin_right = 8
stretch_margin_bottom = 8
texture_under = ExtResource("5_mg57e")
texture_progress = ExtResource("6_of7rd")
tint_under = Color(1, 1, 1, 0.419608)
tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
[node name="level7" type="TextureProgressBar" parent="margin/vbox/grid1"]
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
tooltip_text = "
Текущее: -40.00
Диапазон: -40.00…55.00"
mouse_filter = 0
min_value = -40.0
max_value = 55.0
value = -40.0
fill_mode = 3
nine_patch_stretch = true
stretch_margin_left = 8
stretch_margin_top = 8
stretch_margin_right = 8
stretch_margin_bottom = 8
texture_under = ExtResource("5_mg57e")
texture_progress = ExtResource("6_of7rd")
tint_under = Color(0.890196, 0.486275, 0.196078, 1)
tint_over = Color(0.890196, 0.486275, 0.196078, 1)
[node name="grid2" type="GridContainer" parent="margin/vbox"]
clip_contents = true
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
columns = 7
[node name="lbl1" type="Label" parent="margin/vbox/grid2" groups=["названия"]]
clip_contents = true
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 8
text = "P,%"
horizontal_alignment = 1
[node name="lbl7" type="Label" parent="margin/vbox/grid2"]
clip_contents = true
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 8
text = "°C"
horizontal_alignment = 1
[connection signal="pressed" from="button" to="." method="_on_button_pressed"]

View File

@@ -14,7 +14,7 @@ patch_margin_right = 16
patch_margin_bottom = 16
script = ExtResource("2_mdnod")
[node name="ref_A26" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("3_4a27g")]
[node name="ref_A26" parent="." groups=["power_supply"] instance=ExtResource("3_4a27g")]
offset_left = 10.0
offset_top = 30.0
offset_right = 60.0
@@ -23,7 +23,7 @@ fname = "ИП9-50"
rname = "A22"
metadata/ip = "ip9_50_3"
[node name="ref_A23" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("3_4a27g")]
[node name="ref_A23" parent="." groups=["power_supply"] instance=ExtResource("3_4a27g")]
offset_left = 60.0
offset_top = 30.0
offset_right = 110.0
@@ -35,9 +35,10 @@ metadata/ip = "ip12_50_2"
[node name="lbl_fname" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.62)
layout_mode = 0
offset_left = 5.0
offset_left = 8.0
offset_top = 5.0
offset_right = 105.0
offset_right = 112.0
offset_bottom = 30.0
text = "Касета П-2"
horizontal_alignment = 1
vertical_alignment = 1

View File

@@ -31,7 +31,7 @@ offset_top = 32.0
offset_right = 55.0
offset_bottom = 182.0
fname = "ИП5-25"
rname = "A24"
rname = "A31"
metadata/ip = "ip5_25"
[node name="ref_A30" parent="." groups=["y-5"] instance=ExtResource("3_picsk")]
@@ -40,7 +40,7 @@ offset_top = 32.0
offset_right = 105.0
offset_bottom = 182.0
fname = "ЯУ-07Б"
rname = "A30"
rname = "A37"
metadata/y5 = "yau07"
[node name="ref_A26" parent="." groups=["y-5"] instance=ExtResource("3_picsk")]
@@ -49,7 +49,7 @@ offset_top = 32.0
offset_right = 155.0
offset_bottom = 182.0
fname = "ЭМС-Г"
rname = "A26"
rname = "A33"
metadata/y5 = "ems"
[node name="ref_A27" parent="." groups=["y-5"] instance=ExtResource("3_picsk")]
@@ -58,7 +58,7 @@ offset_top = 32.0
offset_right = 205.0
offset_bottom = 182.0
fname = "УГ"
rname = "A27"
rname = "A34"
metadata/y5 = "ug"
[node name="ref_A28" parent="." groups=["y-5"] instance=ExtResource("3_picsk")]
@@ -67,7 +67,7 @@ offset_top = 32.0
offset_right = 255.0
offset_bottom = 182.0
fname = "УКП"
rname = "A28"
rname = "A36"
metadata/y5 = "ukp1"
[node name="ref_A29" parent="." groups=["y-5"] instance=ExtResource("3_picsk")]
@@ -76,5 +76,5 @@ offset_top = 32.0
offset_right = 304.0
offset_bottom = 182.0
fname = "УКП"
rname = "A29"
rname = "A35"
metadata/y5 = "ukp2"

View File

@@ -1,19 +1,48 @@
@tool
extends TextureButton
@onready var tween: Tween
@export var state_colors: Array
func _on_toggled(toggled_on): $frame.visible = toggled_on
func _ready():
toggle_mode = true
focus_mode = Control.FOCUS_ALL
connect("focus_entered", _on_focus_entered)
connect("focus_exited", _on_focus_exited)
func _enter_tree() -> void:
$label.self_modulate = state_colors[state]
ProjectSettings.connect('settings_changed', _on_settings_changed)
if has_node("label"):
$label.self_modulate = state_colors[state]
func _exit_tree() -> void:
ProjectSettings.disconnect('settings_changed', _on_settings_changed)
func update_progress_bar(target_value) -> void:
if tween:
tween.kill()
tween = create_tween()
tween.tween_property($control_progress, "value", target_value, 0.3)
func _on_toggled(toggled_on):
if has_node("frame"):
$frame.visible = toggled_on
func _on_focus_entered():
button_pressed = true
#enter_press() TODO: Пока что без выбора прибора
func _on_focus_exited():
pass
func enter_press():
var enter_event = InputEventAction.new()
enter_event.action = "ui_accept"
enter_event.pressed = true
Input.parse_input_event(enter_event)
func _on_settings_changed():
@@ -28,10 +57,42 @@ func _on_settings_changed():
set(v):
v = 0 if v < 0 else v % state_colors.size()
state = v
if is_inside_tree():
if is_inside_tree() and has_node("label"):
$label.self_modulate = state_colors[v]
@export var progress_value: float = 0.0:
set(v):
progress_value = v
if is_inside_tree():
update_progress_bar(v)
var max_val = $control_progress.get('max_value')
var percentage = (v / max_val) * 100.0
$control_progress.tooltip_text = 'Процесс контроля %01d%%' % percentage
@export var progress_visible: bool:
set(v):
progress_visible = v
if is_inside_tree():
$control_progress.visible = v
@export var progress_max_value: int:
set(v):
progress_max_value = v
if is_inside_tree():
$control_progress.max_value = v
@export var progress_min_value: int:
set(v):
progress_min_value = v
if is_inside_tree():
$control_progress.min_value = v
@export var show_functional: bool:
set(v):
show_functional = v

File diff suppressed because it is too large Load Diff

View File

@@ -35,6 +35,7 @@ const SETTING_TABLE = [
['Кнопка «Подавление»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
['Виртуальная клавиатура', TableEdit, TableToggle, 'Включить отображение экранной клавиатуры'],
['Скрыть вкладку ЭМС 2', TableEdit, TableToggle, 'Отображать вкладку \\\"ЭМС-2\\\"'],
['Отладка контроля', TableEdit, TableToggle, 'Отображать отладку контроля'],
['Текущая версия ПО УАРЭП', TableEdit, TableEdit, 'Время сборки, версия и номер фиксации'],
['уарэп-яу07-частный', TableEdit, TableEdit, 'IP-адрес для получения частных сообщений от ЯУ-07'],
['уарэп-яу07-общий', TableEdit, TableEdit, 'IP-адрес для получения широковещательных сообщений от ЯУ-07'],
@@ -73,8 +74,9 @@ const TRASSA = 17
const SUPPRESS = 18 ## Строка - Подавление
const KEYBOARD = 19 ## Строка - Виртуальная клавиатура
const HIDE_EMS2 = 20 ## Строка - Скрыть вкладку ЭМС 2
const COMMIT = 21 ## Строка - Версия УАРЭП
const GOS_BTN = 51 ## Разрешить работу по своим целям
const DEBAG_CONTROL = 21## Строка - Отладка контроля
const COMMIT = 22 ## Строка - Версия УАРЭП
const GOS_BTN = 52 ## Разрешить работу по своим целям
var name_to_line_index: = {} ## Для преобразования названия параметра в номер строки
@@ -114,6 +116,11 @@ func on_ems2_pressed(btn) -> void:
signaller.emit_signal('ems2_hide_pressed', state)
func on_debag_control_pressed(btn) -> void:
var state = btn.button_pressed
signaller.emit_signal(\"debag_control_pressed\", state)
func on_row_pressed(i_row: int):
$scroll_set/table.clear_rows_selected()
$scroll_set/table.set_row_selected(i_row, true)
@@ -231,6 +238,10 @@ func button_settings():
on_ems2_pressed(ems2_hide_node)
var gos_node = $scroll_set/table.get_node2(1, GOS_BTN).get_children()[0]
gos_node.connect('pressed', on_gos_pressed.bind(gos_node))
var debag_control = $scroll_set/table.get_node2(1, DEBAG_CONTROL).get_children()[0]
debag_control.connect('pressed', on_debag_control_pressed.bind(debag_control))
debag_control.set_pressed(false)
on_debag_control_pressed(debag_control)
func _on_btn_save_settings_pressed():

View File

@@ -160,7 +160,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
## Производит инициализацию.
@@ -578,7 +578,7 @@ func set_btns_disabled(value: bool, btn):
btn.set_disabled(value)
func on_interfer_prinuditelno (prenuditelno_sectors, btns):
func on_interfer_prinuditelno(prenuditelno_sectors, btns):
for key in prenuditelno_sectors:
var sectors = []
for sector in prenuditelno_sectors[key]:
@@ -593,7 +593,7 @@ func on_interfer_prinuditelno (prenuditelno_sectors, btns):
## Вызывается при получении информации о состоянии модулей ФС от КАПС РПБ.
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:

View File

@@ -54,15 +54,15 @@ const EMS_G_BOARDS = {
## Таблица с данными для входов, первое значение - индекс устройства в ячейке КЭМС.
const INPUT_KEMS = [
[1 ,['УИЗП №1', 'Х7', '0.00', '0.00']],
[1 ,['5П-26М', 'Х7', '0.00', '0.00']],
[2 ,['УИЗПФ №1','Х8', '0.00', '0.00']],
[3 ,['УИЗП №2', 'Х10', '0.00', '0.00']],
[3 ,['НРЛС МР-231', 'Х10', '0.00', '0.00']],
[4 ,['УИЗПФ №2','Х11', '0.00', '0.00']],
[5 ,['УИЗП №3', 'Х13', '0.00', '0.00']],
[5 ,['НРЛС-231-3', 'Х13', '0.00', '0.00']],
[6 ,['УИЗПФ №3','Х14', '0.00', '0.00']],
[7 ,['УИЗП №4', 'Х16', '0.00', '0.00']],
[7 ,['3Р87-1Ф', 'Х16', '0.00', '0.00']],
[8 ,['УИЗПФ №4','Х17', '0.00', '0.00']],
[9 ,['УИЗП №5', 'Х19', '0.00', '0.00']],
[9 ,['ПРЛ ИСБУ-23900', 'Х19', '0.00', '0.00']],
[10,['УИЗПФ №5','Х20', '0.00', '0.00']],
[11,['УИЗП №6', 'Х22', '0.00', '0.00']],
[12,['УИЗПФ №6','Х23', '0.00', '0.00']],
@@ -77,11 +77,11 @@ const INPUT_KEMS = [
## Таблица с данными для выходов, первое значение - индекс устройства в ячейке КЭМС.
const OUTPUT_KEMS = [
[47,['Бланк №1','Х6', '0.00', '0.00']],
[48,['Бланк №2','Х9', '0.00', '0.00']],
[49,['Бланк №3','Х12', '0.00', '0.00']],
[50,['Бланк №4','Х15', '0.00', '0.00']],
[51,['Бланк №5','Х18', '0.00', '0.00']],
[47,['5П-26М','Х6', '0.00', '0.00']],
[48,['НРЛС МР-231','Х9', '0.00', '0.00']],
[49,['НРЛС-231-3','Х12', '0.00', '0.00']],
[50,['3Р87-1Ф','Х15', '0.00', '0.00']],
[51,['ПРЛ ИСБУ-23900','Х18', '0.00', '0.00']],
[52,['Бланк №6','Х21', '0.00', '0.00']],
[53,['Бланк №7','Х24', '0.00', '0.00']],
[55,['Бланк_МП №1', 'X28 : 8', '0.00', '0.00']],

View File

@@ -30,7 +30,7 @@ func on_trassa_line_changed(unit_trassa):
$'СкруглённыйПрямоугольникБелый/Label10'.text = '-'
func on_sector_klaster(data, unit_trassa):
func on_sector_klaster(_data, unit_trassa):
$'СкруглённыйПрямоугольникБелый/Label6'.text = str(unit_trassa.dap)
$'СкруглённыйПрямоугольникБелый/Label7'.text = str(unit_trassa.daa)
$'СкруглённыйПрямоугольникБелый/Label8'.text = '1'

View File

@@ -205,7 +205,7 @@ func _ready() -> void:
signaller.connect('interfer_new', Callable(self, 'on_interfer_new').bind(unit_caps))
signaller.connect('interfer_off_all', Callable(self, 'on_interfer_off_all').bind(unit_caps, ecms))
signaller.connect('th_aoa_update', Callable(self, 'on_th_aoa_update').bind(ecms, unit_caps))
signaller.connect('interfer_off', Callable(self, 'on_interfer_off').bind(ecms))
signaller.connect('interfer_off', Callable(self, 'on_interfer_off').bind(ecms, unit_caps))
signaller.connect('manual_control', Callable(self, 'on_manual_control'))
signaller.connect('full_auto', Callable(self, 'on_full_auto'))
signaller.connect('interfer_prinuditelno', Callable(self, 'on_interfer_prinuditelno'))
@@ -218,6 +218,7 @@ func _ready() -> void:
ProjectSettings.connect('settings_changed', on_settings_changed)
var unit_nav: = network.get_unit_instance('навигация')
unit_nav.connect('data_received', on_nav_data_received.bind(unit_caps))
call_deferred('emit_signal', 'interfer_resized', ecms)
func on_trenazh_mode(val: bool): trenazh_mode = val
@@ -276,10 +277,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():
@@ -289,9 +290,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)
@@ -334,10 +335,12 @@ func map_msvk_to_ecms(unit_instance: unit.Unit, ecms: Dictionary):
var json_dic = unit_instance.json_dic
if not json_dic.has('msvk'): return
var msvk = unit_instance.json_dic.get('msvk', [])
var ispp_arr: Array = []
for dic_msvk in msvk:
if dic_msvk is not Dictionary: continue
if not dic_msvk.has('ispp'): continue
var ispp = int(dic_msvk['ispp'])
ispp_arr.append(ispp)
var errmsg = dic_msvk.get('errmsg', '')
if errmsg:
log.error('сеанс %d: \"%s\"' % [ispp, errmsg])
@@ -345,11 +348,17 @@ func map_msvk_to_ecms(unit_instance: unit.Unit, ecms: Dictionary):
var ecm = ecms[ispp]
ecm.set_from_dic(dic_msvk)
call_deferred('emit_signal', 'interfer_update', ecm)
else:
var ecm = Interfer.new()
ecm.set_from_dic(dic_msvk)
ecm.krp = INTERFER_OFF
send_ecm(ecm, unit_instance)
for ecm in ecms.values():
if (ecm.ispp not in ispp_arr) and (ecm.krp == INTERFER_OFF):
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)
## Извлекает массив пространственно-частотных фильтров
@@ -373,7 +382,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
@@ -487,7 +496,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
@@ -495,17 +503,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:
@@ -638,22 +646,19 @@ func get_krp(threat: threats.Threat):
return krp
func on_interfer_off(ecm: Interfer, ecms):
var sz = ecms.size()
signaller.emit_signal('on_prog_ecm_off', ecm)
ecms.erase(ecm.ispp)
thrs.erase(ecm.ispp)
interfer.cu.erase(ecm.ispp)
interfer.fs.erase(ecm.ispp)
interfer.push_id(ecm.ispp)
if sz != ecms.size():
interfer.call_deferred('emit_signal', 'interfer_resized', ecms)
func interfer_off(ecm, unit_caps):
func on_interfer_off(ecm: Interfer, ecms, unit_caps):
ecm.krp = INTERFER_OFF
send_ecm(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):

240
scripts/prd-ctl-config.gd Normal file
View File

@@ -0,0 +1,240 @@
class_name PRDConfigManager
extends RefCounted
## Менеджер конфигурации для системы контроля ПРД
## Загружает и управляет настройками из JSON-конфигурации
#region CONSTANTS
const CONFIG_PATH = "user://config/setting_prd_control.json"
const DEFAULT_CONFIG_PATH = "res://config/setting_prd_control.json"
const CONFIG_VERSION = "1.0.0" # Версия конфигурации - увеличивать при изменениях
#endregion
#region PRIVATE_VARIABLES
var _config_data: Dictionary # Все данные конфигурации
var _device_constants: Dictionary # Константы устройств
var _base_configs: Dictionary # Базовые конфигурации
var _device_configs: Dictionary # Конфигурации устройств
var _data_indices: Dictionary # Индексы данных
var _fs_keys: Dictionary # Ключи ФС (функциональных систем)
var _temperature_constants: Dictionary # Константы температуры
var _ems_input_bits_config: Dictionary # Конфигурация битов ввода ЭМС
var _fs_rules: Array # Правила ФС
var _is_loaded: bool = false # Флаг успешной загрузки
var _current_version: String = "" # Текущая версия загруженной конфигурации
#endregion
#region INITIALIZATION
func _init() -> void:
"""Инициализация менеджера конфигурации"""
_load_configuration()
#endregion
#region PUBLIC_API
## Проверяет, успешно ли загружена конфигурация
func is_loaded() -> bool:
return _is_loaded
## Возвращает текущую версию загруженной конфигурации
func get_config_version() -> String:
return _current_version
## Проверяет, актуальна ли конфигурация
func is_config_up_to_date() -> bool:
return _current_version == CONFIG_VERSION
## Возвращает все данные конфигурации
func get_config_data() -> Dictionary:
return _config_data.duplicate(true)
## Возвращает константы устройств
func get_device_constants() -> Dictionary:
return _device_constants.duplicate(true)
## Возвращает базовые конфигурации
func get_base_configs() -> Dictionary:
return _base_configs.duplicate(true)
## Возвращает конфигурации устройств
func get_device_configs() -> Dictionary:
return _device_configs.duplicate(true)
## Возвращает индексы данных
func get_data_indices() -> Dictionary:
return _data_indices.duplicate(true)
## Возвращает ключи ФС
func get_fs_keys() -> Dictionary:
return _fs_keys.duplicate(true)
## Возвращает константы температуры
func get_temperature_constants() -> Dictionary:
return _temperature_constants.duplicate(true)
## Возвращает конфигурацию битов ввода ЭМС
func get_ems_input_bits_config() -> Dictionary:
return _ems_input_bits_config.duplicate(true)
## Возвращает правила ФС
func get_fs_rules() -> Array:
return _fs_rules.duplicate(true)
## Возвращает индекс данных по ключу
func get_data_index(key: String) -> int:
return _data_indices.get(key, -1)
#endregion
#region PRIVATE_METHODS
## Загружает конфигурацию из JSON файла
func _load_configuration() -> void:
if not _ensure_config_exists():
_is_loaded = false
return
var config_file = FileAccess.open(CONFIG_PATH, FileAccess.READ)
if config_file:
var json_text = config_file.get_as_text()
config_file.close()
var json = JSON.new()
var parse_result = json.parse(json_text)
if parse_result == OK:
_config_data = json.data
_current_version = _config_data.get("config_version", "0.0.0")
_parse_config_data()
_is_loaded = true
else:
push_error("Ошибка разбора JSON конфигурации: " + json.get_error_message())
_is_loaded = false
else:
push_error("Ошибка загрузки файла конфигурации: " + CONFIG_PATH)
_is_loaded = false
## Парсит данные конфигурации по секциям
func _parse_config_data() -> void:
_device_constants = _convert_numbers(_config_data.get("device_constants", {}))
_base_configs = _convert_numbers(_config_data.get("base_configs", {}))
_device_configs = _convert_numbers(_config_data.get("device_configs", {}))
_data_indices = _convert_numbers(_config_data.get("data_indices", {}))
_fs_keys = _convert_numbers(_config_data.get("fs_keys", {}))
_temperature_constants = _convert_numbers(_config_data.get("temperature_constants", {}))
_ems_input_bits_config = _convert_numbers(_config_data.get("ems_input_bits_config", {}))
_fs_rules = _convert_numbers(_config_data.get("fs_rules", []))
## Конвертирует числовые значения в правильные типы (float -> int если возможно)
static func _convert_numbers(value):
if value is float:
# Конвертируем float в int если нет дробной части
if value == int(value):
return int(value)
return value
elif value is Dictionary:
var result = {}
for key in value:
result[key] = _convert_numbers(value[key])
return result
elif value is Array:
var result = []
for item in value:
result.append(_convert_numbers(item))
return result
else:
return value
## Обеспечивает существование файла конфигурации
## Создает папку и копирует дефолтный файл если нужно
func _ensure_config_exists() -> bool:
# Создаем папку конфигурации если не существует
DirAccess.make_dir_recursive_absolute("user://config")
# Проверяем, нужно ли обновить конфигурацию
if _should_update_config():
return _update_config()
# Если файл уже существует - все ок
if FileAccess.file_exists(CONFIG_PATH):
return true
# Если дефолтного файла нет - ошибка
if not FileAccess.file_exists(DEFAULT_CONFIG_PATH):
return false
# Копируем дефолтный конфиг в user директорию
return _copy_default_config()
## Проверяет, нужно ли обновить конфигурацию
func _should_update_config() -> bool:
# Если файла конфигурации нет - нужно создать
if not FileAccess.file_exists(CONFIG_PATH):
return true
# Проверяем версию существующей конфигурации
var config_file = FileAccess.open(CONFIG_PATH, FileAccess.READ)
if config_file:
var json_text = config_file.get_as_text()
config_file.close()
var json = JSON.new()
if json.parse(json_text) == OK:
var existing_version = json.data.get("config_version", "0.0.0")
# Сравниваем версии
return _compare_versions(existing_version, CONFIG_VERSION) < 0
else:
# Если ошибка парсинга - нужно обновить
return true
return false
## Сравнивает две версии (semantic versioning)
## Возвращает -1 если version1 < version2, 0 если равны, 1 если version1 > version2
static func _compare_versions(version1: String, version2: String) -> int:
var v1_parts = version1.split(".")
var v2_parts = version2.split(".")
for i in range(max(v1_parts.size(), v2_parts.size())):
var v1_part = int(v1_parts[i]) if i < v1_parts.size() else 0
var v2_part = int(v2_parts[i]) if i < v2_parts.size() else 0
if v1_part < v2_part:
return -1
elif v1_part > v2_part:
return 1
return 0
## Обновляет конфигурацию до актуальной версии
func _update_config() -> bool:
# Создаем резервную копию старой конфигурации
if FileAccess.file_exists(CONFIG_PATH):
var backup_path = CONFIG_PATH + ".backup_v" + _current_version
DirAccess.copy_absolute(CONFIG_PATH, backup_path)
print("Создана резервная копия: ", backup_path)
# Копируем актуальную конфигурацию
return _copy_default_config()
## Копирует дефолтную конфигурацию в user директорию
func _copy_default_config() -> bool:
if not FileAccess.file_exists(DEFAULT_CONFIG_PATH):
push_error("Дефолтный файл конфигурации не найден: " + DEFAULT_CONFIG_PATH)
return false
var src := FileAccess.open(DEFAULT_CONFIG_PATH, FileAccess.READ)
var dst := FileAccess.open(CONFIG_PATH, FileAccess.WRITE)
if src == null or dst == null:
push_error("Ошибка копирования конфигурации")
return false
dst.store_string(src.get_as_text())
src.close()
dst.close()
return true
#endregion

View File

@@ -0,0 +1 @@
uid://bi7elq60squds

View File

@@ -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],
@@ -105,8 +107,8 @@ class Fs:
[10, 20],
[20, 30],
[30, 40],
[40, 50],
[50, 55]]
[40, 90],
[90, 100]]
var index ## Индекс блока усилителей
var modulation: bool ## Состояние модуляции
@@ -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,24 +154,38 @@ 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 {
NONE,
GOOD,
ERROR
}
var prd_name: String ## Имя прибора
var unit_yau07 ## Юнит эмс
var unit_yau07: Object ## Юнит эмс
var unit_control: Object ## Класс проверки прибора ПРД
var fs_dic: Dictionary ## Массив блоков ФС
var yemsg_board: yemsboards.EmsBoard ## Плата ЭМС-Г
var state = PrdState.WORK
var cmd_array: Array ## Очередь команд
var ug_online: bool = false ## Состояние ячейки УГ
var serviceability: bool = false
var set_ug_state: bool = true ## Необходимо ли записать в УГ настройки
signal update_serviceability()
signal update_serviceability(state: int) ## Сообщает изменение текущего состояния юнита ПРД
var serviceability: int:
set(v):
if v != serviceability:
serviceability = v
emit_signal('update_serviceability', v)
func _init(u_name, u_yau07):
prd_name = u_name
unit_yau07 = u_yau07
init_ems_g()
func init_ems_g():
var in_tbl: Array = []
var out_tbl: Array = []
@@ -197,13 +216,12 @@ class PRD:
if port == fs.um_port:
fs.um_code_rx = u.isa_ports[port] & 0x7
func on_line_changed(unit_ems):
emit_signal('update_serviceability')
if not unit_ems.online:
yemsg_board.ems_load = yemsg_board.LoadState.NOT_DEFINED
yemsg_board.set_wait()
set_ug_state = true
serviceability = STATE_DEVICE.NONE
func on_data_received(_u):
set_prd_status()
@@ -221,24 +239,84 @@ class PRD:
return
execute_cmd()
func set_prd_status():
## Мониторинг состояния юнита прд
func set_prd_status() -> void:
# Обновление статуса платы ЯУ-07
yemsg_board.set_status(unit_yau07.status)
# Проверка онлайн-статусов основных модулей
ug_online = (unit_yau07.status[0] >> 1) & 1
if not ug_online:
set_ug_state = true
var ukp_1_online = (unit_yau07.status[0] >> 2) & 1
var ukp_2_online = (unit_yau07.status[0] >> 3) & 1
var ems_g_online = (unit_yau07.status[0] & 1) & 1
var check_serviceability = ug_online and ukp_1_online and ukp_2_online and ems_g_online
if serviceability != check_serviceability:
serviceability = check_serviceability
emit_signal('update_serviceability')
var ems_g_online = (unit_yau07.status[0] & 1) & 1
# Установка флага состояния УГ
if not ug_online:
set_ug_state = true
# Проверка источников питания
var ip_online: bool = _check_dry_contact(unit_yau07.status, prd_name)
var check_temperature_um: bool = unit_control.flags.temperature_ok
var check_dic: Dictionary = {
'ukp_1_online': ukp_1_online,
'ukp_2_online': ukp_2_online,
'ems_g_online': ems_g_online,
'ip_online': ip_online,
'ug_online': ug_online,
'temperature_um': check_temperature_um
}
# Определение состояния обслуживания
if unit_control:
if unit_control.flags.control_is_over:
serviceability = _set_serviceability_from_control_results(unit_control)
else:
serviceability = _set_serviceability_from_online_status(check_dic)
## Проверка онлайн-статуса сухих контактов
static func _check_dry_contact(unit_yau07_status: PackedByteArray, self_name: String) -> bool:
var bit_ip_config: Array = [0, 1, 2, 3, 4, 5, 6, 7]
var is_k_type: bool = self_name in ['уарэп-яу07-1к', 'уарэп-яу07-2к', 'уарэп-яу07-3к', 'уарэп-яу07-4к']
for bit in bit_ip_config:
if not is_k_type and bit in [5, 6]: # Игнорируем биты 5 и 6 для всех приборов, кроме типа "к"
continue
var status: bool = unit_yau07_status[27] >> bit & 1
if status:
return false
return true
## Установка состояния обслуживания на основе результатов контроля
static func _set_serviceability_from_control_results(unit_ctrl: Object) -> int:
var control_results = unit_ctrl.get_control_results()
var result_dic = control_results.result_dic
const CRITICAL_DEVICES: Array = [
'fs_1', 'fs_2', 'fs_3', 'fs_4', 'fs_5', 'fs_6', 'fs_7',
'dkm_1', 'dkm_2', 'dkm_3', 'dkm_4', 'dkm_5', 'dkm_6', 'dkm_7',
'block_ip', 'dou_2', 'dou_3', 'dou_4', 'dou_5', 'dou_6', 'dou_7'
]
var all_ok: bool = true
for device_key in CRITICAL_DEVICES:
if result_dic.has(device_key) and result_dic[device_key] is bool:
if not result_dic[device_key]:
all_ok = false
break
return STATE_DEVICE.GOOD if all_ok else STATE_DEVICE.ERROR
## Установка состояния обслуживания на основе онлайн-статусов
static func _set_serviceability_from_online_status(check_dic: Dictionary) -> int:
var all_online: bool = true
for status in check_dic:
if not check_dic[status]:
all_online = false
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():
@@ -269,13 +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()
@@ -283,6 +364,10 @@ 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
for key in FS_PRD.keys():
var fs = Fs.new(key, FS_PRD[key][0])
fs_dict[key] = fs
@@ -294,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('навигация')
@@ -360,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)
@@ -388,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'):
@@ -406,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)

File diff suppressed because it is too large Load Diff

View File

@@ -182,6 +182,11 @@ signal kb_pressed(state)
signal ems2_hide_pressed(state)
## Вызывается при нажатии на кнопку отладки контроля
## [param state] - состояние показа отладки контроля
signal debag_control_pressed(state)
## Вызывается при нажатии на кнопку экранной клавиатуры
## [param state] - состояние скрытия кнопки ЭМС2
signal emit_changed(state)
@@ -199,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)
@@ -216,6 +221,10 @@ signal sector_klaster (new_sector_data)
signal clear_klaster ()
## Вызывается при нажатии на кнопку "Запуск контроля".[br]
signal start_contol_device()
## Вызывается при программном отключении помехи.[br]
## [param ecm] - выключаемая помеха ([b]true[/b]
signal on_prog_ecm_off(ecm: interfer.Interfer)

View File

@@ -269,8 +269,6 @@ class Trassa extends unit.Unit:
tx_stack[65] = 0
for ecm in ecms.values():
if ecm.krp == "srni1" and ecm.svk == 1:
ecm.krp = interfer.INTERFER_OFF
interfer.send_ecm(ecm, unit_caps)
signaller.emit_signal('interfer_off', ecm)
if jtids == 1:
tx_stack[66] = 1
@@ -279,6 +277,4 @@ class Trassa extends unit.Unit:
tx_stack[66] = 0
for ecm in ecms.values():
if ecm.krp == 'svi1' and ecm.svk == 1:
ecm.krp = interfer.INTERFER_OFF
interfer.send_ecm(ecm, unit_caps)
signaller.emit_signal('interfer_off', ecm)

View File

@@ -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)]])

View File

@@ -322,7 +322,6 @@ func _set_row_selected(i_row: int, selected: bool = true) -> void:
push_error('нет такого ряда: %d (всего %d рядов)\n' % [i_row, rows_count])
return
if nodes.has(selector_key) and (not selected):
var node = nodes[node_key]
var selector = nodes[selector_key]
nodes.erase(selector_key)
if is_instance_valid(selector):
@@ -450,9 +449,11 @@ func remove_row(i_row: int):
if nodes.has(sel_key):
var selector = nodes[sel_key]
var prnt = selector.get_parent()
prnt.remove_child(selector)
selector.queue_free()
if is_instance_valid(selector):
var prnt = selector.get_parent()
if prnt:
prnt.remove_child(selector)
selector.queue_free()
nodes.erase(sel_key)
for i_col in columns: