Merge remote-tracking branch 'refs/remotes/kotik/prd-control'
# Conflicts: # scenes/tabs-switch/lbl_ready.gd # scenes/tabs-switch/tab-switch.tscn # scenes/tilemap/tilemap.gd # scenes/контроль/control_prd.gd # scenes/контроль/control_prd.gd.uid # scenes/контроль/контроль.tscn
This commit is contained in:
219
config/setting_prd_control.json
Normal file
219
config/setting_prd_control.json
Normal file
@@ -0,0 +1,219 @@
|
||||
{
|
||||
"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": 10.0,
|
||||
"STATE_MASHINE_TIMER": 0.3
|
||||
},
|
||||
"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,
|
||||
"progress_max": 20
|
||||
},
|
||||
"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": 10.0,
|
||||
"STATE_MASHINE_TIMER": 0.3
|
||||
},
|
||||
"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,
|
||||
"progress_max": 20
|
||||
},
|
||||
"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": 10.0,
|
||||
"STATE_MASHINE_TIMER": 0.3
|
||||
},
|
||||
"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,
|
||||
"progress_max": 30
|
||||
}
|
||||
},
|
||||
"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_ip": false,
|
||||
"temperature": true,
|
||||
"dkm_2": false,
|
||||
"dkm_3": false,
|
||||
"dou_2": false,
|
||||
"dou_3": false,
|
||||
"fs_2": 0,
|
||||
"fs_3": 0
|
||||
}
|
||||
},
|
||||
"PRD_V": {
|
||||
"block_ip": "base",
|
||||
"block_kasseta": "base",
|
||||
"control_results": {
|
||||
"block_ip": false,
|
||||
"temperature": true,
|
||||
"dkm_4": false,
|
||||
"dkm_5": false,
|
||||
"dou_4": false,
|
||||
"dou_5": false,
|
||||
"fs_4": 0,
|
||||
"fs_5": 0
|
||||
}
|
||||
},
|
||||
"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_ip": false,
|
||||
"temperature": true,
|
||||
"dkm_1": false,
|
||||
"dkm_6": false,
|
||||
"dkm_7": false,
|
||||
"dou_6": false,
|
||||
"dou_7": false,
|
||||
"fs_1": 0,
|
||||
"fs_6": 0,
|
||||
"fs_7": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": 27}
|
||||
]
|
||||
}
|
||||
@@ -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"
|
||||
|
||||
@@ -18,9 +18,24 @@ func _ready() -> void:
|
||||
for temp in power_amplifier:
|
||||
temp.value1 = -70
|
||||
unit_prd_k.connect('control_is_over', Callable(self, 'on_press_device'))
|
||||
#unit_prd_k.power_amplify = power_amplifier
|
||||
on_press_device()
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
set_frame($input_0, unit_prd_k.ems_input_1)
|
||||
set_frame($input_1, unit_prd_k.ems_input_2)
|
||||
set_frame($input_2, unit_prd_k.ems_input_lit_1)
|
||||
set_frame($output_0, unit_prd_k.ems_output_1)
|
||||
set_frame($output_1, unit_prd_k.ems_output_2)
|
||||
set_frame($output_2, unit_prd_k.ems_output_lit_1)
|
||||
|
||||
|
||||
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
|
||||
|
||||
|
||||
func start_control() -> void:
|
||||
set_default_state()
|
||||
find_labels(self)
|
||||
@@ -47,6 +62,13 @@ func _exit_tree() -> void:
|
||||
#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]])
|
||||
|
||||
|
||||
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]
|
||||
|
||||
|
||||
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier: Array, POWER_THRESHOLD: int) -> void:
|
||||
for i_powapm in power_amplifier:
|
||||
var powamp_meta: String = i_powapm.get_meta('um')
|
||||
@@ -58,9 +80,9 @@ static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifi
|
||||
if pow_dic[powamp_meta].size() < 6:
|
||||
status = STATE_VAL.ERROR
|
||||
else:
|
||||
if powamp_meta == 'um_7' and not fs_result.fs_1: return
|
||||
if powamp_meta == 'um_8' and not fs_result.fs_1: return
|
||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_6: return
|
||||
if powamp_meta in ['um_8', 'um_9', 'um_10', 'um_11', 'um_12', 'um_13'] and not fs_result.fs_7: return
|
||||
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] 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 < POWER_THRESHOLD:
|
||||
@@ -83,6 +105,7 @@ func on_press_device() -> void:
|
||||
'power_dic': unit_prd_k.power_result,
|
||||
'block_kasseta_y5_config': unit_prd_k.block_kasseta_y5_config,
|
||||
'block_ip_config': unit_prd_k.block_ip_config,
|
||||
'temperature_um' : unit_prd_k.temperature_um,
|
||||
'nodes_y5': nodes_y5,
|
||||
'node_ip_power_arr': node_ip_power_arr,
|
||||
'fs_nodes': fs_nodes,
|
||||
@@ -99,13 +122,14 @@ func on_press_device() -> void:
|
||||
|
||||
|
||||
func on_control_result(for_result_dic: Dictionary) -> void:
|
||||
## If control is end
|
||||
temperature_fill(for_result_dic.power_amplifier, for_result_dic.temperature_um)
|
||||
|
||||
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
|
||||
@@ -117,29 +141,25 @@ func on_control_result(for_result_dic: Dictionary) -> void:
|
||||
if block_ip_config_k.has(meta_ip) and block_kasseta_y5_prd_config_k.ug:
|
||||
power_supply.state = STATE_VAL.GOOD if block_ip_config_k[meta_ip][1] else STATE_VAL.ERROR
|
||||
|
||||
## If control is end
|
||||
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:
|
||||
if result_dic.fs_1 == 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
|
||||
else:
|
||||
result_dic.fs_1 = 0
|
||||
if result_dic.fs_6 == 1:
|
||||
|
||||
if result_dic.fs_6 == 1 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
|
||||
else:
|
||||
result_dic.fs_6 = 0
|
||||
if result_dic.fs_7 == 1:
|
||||
|
||||
if result_dic.fs_7 == 1 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
|
||||
else:
|
||||
result_dic.fs_7 = 0
|
||||
|
||||
if block_kasseta_y5_prd_config_k['yau07']:
|
||||
power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD)
|
||||
|
||||
var result: bool = true
|
||||
|
||||
@@ -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
|
||||
@@ -161,7 +186,7 @@ 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
|
||||
@@ -169,9 +194,7 @@ offset_right = 652.0
|
||||
offset_bottom = 907.0
|
||||
fname = "УТМ80"
|
||||
rname = "A9"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_7"
|
||||
metadata/um = "um_8"
|
||||
|
||||
[node name="rm1620m_A16" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
@@ -179,11 +202,11 @@ offset_left = 8.0
|
||||
offset_top = 242.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 337.0
|
||||
fname = "УМ1535Б"
|
||||
fname = "РМ16-20М"
|
||||
rname = "A16"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_8"
|
||||
metadata/um = "um_9"
|
||||
|
||||
[node name="rm1620m_A17" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
@@ -191,11 +214,11 @@ offset_left = 8.0
|
||||
offset_top = 337.0
|
||||
offset_right = 173.0
|
||||
offset_bottom = 432.0
|
||||
fname = "УМ1535Б"
|
||||
fname = "РМ16-20М"
|
||||
rname = "A17"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_9"
|
||||
metadata/um = "um_10"
|
||||
|
||||
[node name="rm1620m_A18" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
@@ -203,11 +226,11 @@ offset_left = 8.0
|
||||
offset_top = 432.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 527.0
|
||||
fname = "УМ1535Б"
|
||||
fname = "РМ16-20М"
|
||||
rname = "A18"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_10"
|
||||
metadata/um = "um_11"
|
||||
|
||||
[node name="rm1620m_A19" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
@@ -215,11 +238,11 @@ offset_left = 8.0
|
||||
offset_top = 527.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 622.0
|
||||
fname = "УМ1535Б"
|
||||
fname = "РМ16-20М"
|
||||
rname = "A19"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_11"
|
||||
metadata/um = "um_12"
|
||||
|
||||
[node name="rm1620m_A20" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
@@ -227,11 +250,11 @@ offset_left = 8.0
|
||||
offset_top = 622.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 717.0
|
||||
fname = "УМ1535Б"
|
||||
fname = "РМ16-20М"
|
||||
rname = "A20"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_12"
|
||||
metadata/um = "um_13"
|
||||
|
||||
[node name="rm1620m_A21" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
@@ -239,11 +262,11 @@ offset_left = 8.0
|
||||
offset_top = 717.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 812.0
|
||||
fname = "УМ1535Б"
|
||||
fname = "РМ16-20М"
|
||||
rname = "A21"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_13"
|
||||
metadata/um = "um_14"
|
||||
|
||||
[node name="kasseta_fs_kd" parent="." instance=ExtResource("7_ia27q")]
|
||||
layout_mode = 0
|
||||
@@ -297,9 +320,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
|
||||
@@ -322,3 +345,42 @@ offset_bottom = 1003.0
|
||||
text = "Прибор ПРД- неисправен"
|
||||
horizontal_alignment = 1
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="input_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(234, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="Label" type="Label" parent="input_0"]
|
||||
offset_left = -38.0
|
||||
offset_top = 16.0
|
||||
offset_right = 30.0
|
||||
offset_bottom = 35.0
|
||||
text = "Вход ЕМС"
|
||||
|
||||
[node name="input_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(277, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="input_2" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(188, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="output_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(421, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="Label" type="Label" parent="output_0"]
|
||||
offset_left = -40.0
|
||||
offset_top = 14.0
|
||||
offset_right = 36.0
|
||||
offset_bottom = 33.0
|
||||
text = "Модуляция"
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="output_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(462, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="output_2" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(383, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
@@ -17,10 +17,25 @@ func _ready() -> void:
|
||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
for temp in power_amplifier:
|
||||
temp.value1 = -70
|
||||
temp.max_value1 = 70
|
||||
temp.min_value1 = -40
|
||||
unit_prd_n.connect('control_is_over', Callable(self, 'on_press_device'))
|
||||
#unit_prd_n.power_amplify = power_amplifier
|
||||
on_press_device()
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
set_frame($input_0, unit_prd_n.ems_input_1)
|
||||
set_frame($input_1, unit_prd_n.ems_input_2)
|
||||
set_frame($output_0, unit_prd_n.ems_output_1)
|
||||
set_frame($output_1, unit_prd_n.ems_output_2)
|
||||
|
||||
|
||||
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
|
||||
|
||||
|
||||
func start_control() -> void:
|
||||
set_default_state()
|
||||
find_labels(self)
|
||||
@@ -47,28 +62,32 @@ func _exit_tree() -> void:
|
||||
#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]])
|
||||
|
||||
|
||||
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier: Array, POWER_THRESHOLD: int) -> void:
|
||||
for i_powapm in power_amplifier:
|
||||
var powamp_meta: String = i_powapm.get_meta('um')
|
||||
static func 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]
|
||||
|
||||
|
||||
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier_arr_node: Array, POWER_THRESHOLD: int) -> void:
|
||||
for i_node_powapm in power_amplifier_arr_node:
|
||||
var powamp_meta: String = i_node_powapm.get_meta('um')
|
||||
var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE
|
||||
if not pow_dic.has(powamp_meta): return
|
||||
if pow_dic[powamp_meta].size() < 6:
|
||||
status = STATE_VAL.ERROR
|
||||
else:
|
||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_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]
|
||||
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]
|
||||
for i_p in pow_dic[powamp_meta]:
|
||||
if i_p < POWER_THRESHOLD:
|
||||
status = STATE_VAL.ERROR
|
||||
i_powapm.state = status
|
||||
i_node_powapm.state = status
|
||||
|
||||
|
||||
func on_press_device() -> 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 power_amplifier_arr_node: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
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
|
||||
@@ -78,10 +97,11 @@ func on_press_device() -> void:
|
||||
'power_dic': unit_prd_n.power_result,
|
||||
'block_kasseta_y5_config': unit_prd_n.block_kasseta_y5_config,
|
||||
'block_ip_config': unit_prd_n.block_ip_config,
|
||||
'temperature_um' : unit_prd_n.temperature_um,
|
||||
'nodes_y5': nodes_y5,
|
||||
'node_ip_power_arr': node_ip_power_arr,
|
||||
'fs_nodes': fs_nodes,
|
||||
'power_amplifier': power_amplifier,
|
||||
'power_amplifier': power_amplifier_arr_node,
|
||||
'POWER_THRESHOLD': unit_prd_n.constants.POWER_THRESHOLD,
|
||||
'name_prd': unit_prd_n.self_name,
|
||||
'module_fs_2': module_fs_2,
|
||||
@@ -93,13 +113,14 @@ func on_press_device() -> void:
|
||||
|
||||
|
||||
func on_control_result(for_result_dic: Dictionary) -> void:
|
||||
## If control is end
|
||||
temperature_fill(for_result_dic.power_amplifier, for_result_dic.temperature_um)
|
||||
|
||||
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
|
||||
@@ -111,27 +132,23 @@ func on_control_result(for_result_dic: Dictionary) -> void:
|
||||
if block_ip_config_n.has(meta_ip) and block_kasseta_y5_prd_config_n.ug:
|
||||
power_supply.state = STATE_VAL.GOOD if block_ip_config_n[meta_ip][1] else STATE_VAL.ERROR
|
||||
|
||||
## If control is end
|
||||
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:
|
||||
if result_dic.fs_2 == 1 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
|
||||
else:
|
||||
result_dic.fs_2 = 0
|
||||
if result_dic.fs_3 == 1:
|
||||
|
||||
if result_dic.fs_3 == 1 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
|
||||
else:
|
||||
result_dic.fs_3 = 0
|
||||
|
||||
if block_kasseta_y5_prd_config_n['yau07']:
|
||||
power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD)
|
||||
|
||||
var result: bool = true
|
||||
for device in result_dic.values():
|
||||
if not device:
|
||||
|
||||
@@ -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
|
||||
@@ -79,12 +102,83 @@ 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
|
||||
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
|
||||
@@ -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,7 +238,7 @@ 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
|
||||
@@ -204,7 +298,7 @@ offset_left = 485.0
|
||||
offset_top = 242.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 337.0
|
||||
fname = "УМ1535Б"
|
||||
fname = "УМ1535А"
|
||||
rname = "A7"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
@@ -280,7 +374,7 @@ fname = "УМ1535А"
|
||||
rname = "A13"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_7"
|
||||
metadata/um = "um_9"
|
||||
|
||||
[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
@@ -292,7 +386,7 @@ fname = "УМ1535А"
|
||||
rname = "A14"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_8"
|
||||
metadata/um = "um_10"
|
||||
|
||||
[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
@@ -304,7 +398,7 @@ fname = "УМ1535А"
|
||||
rname = "A15"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_9"
|
||||
metadata/um = "um_11"
|
||||
|
||||
[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
@@ -316,7 +410,7 @@ fname = "УМ1535А"
|
||||
rname = "A16"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_10"
|
||||
metadata/um = "um_12"
|
||||
|
||||
[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
@@ -328,7 +422,7 @@ fname = "УМ1535А"
|
||||
rname = "A17"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_11"
|
||||
metadata/um = "um_13"
|
||||
|
||||
[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
@@ -340,7 +434,7 @@ fname = "УМ1535А"
|
||||
rname = "A18"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_12"
|
||||
metadata/um = "um_14"
|
||||
|
||||
[node name="control_result" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
@@ -350,3 +444,33 @@ offset_right = 649.0
|
||||
offset_bottom = 1003.0
|
||||
horizontal_alignment = 1
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="input_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(234, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||
|
||||
[node name="Label" type="Label" parent="input_0"]
|
||||
offset_left = -15.0
|
||||
offset_top = 15.0
|
||||
offset_right = 53.0
|
||||
offset_bottom = 34.0
|
||||
text = "Вход ЕМС"
|
||||
|
||||
[node name="input_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(277, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||
|
||||
[node name="output_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(381, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||
|
||||
[node name="Label" type="Label" parent="output_0"]
|
||||
offset_left = -19.0
|
||||
offset_top = 14.0
|
||||
offset_right = 57.0
|
||||
offset_bottom = 33.0
|
||||
text = "Модуляция"
|
||||
|
||||
[node name="output_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(422, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||
|
||||
@@ -21,6 +21,18 @@ func _ready() -> void:
|
||||
on_press_device()
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
set_frame($input_0, unit_prd_v.ems_input_1)
|
||||
set_frame($input_1, unit_prd_v.ems_input_2)
|
||||
set_frame($output_0, unit_prd_v.ems_output_1)
|
||||
set_frame($output_1, unit_prd_v.ems_output_2)
|
||||
|
||||
|
||||
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
|
||||
|
||||
|
||||
func start_control() -> void:
|
||||
set_default_state()
|
||||
find_labels(self)
|
||||
@@ -47,6 +59,13 @@ func _exit_tree() -> void:
|
||||
#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]])
|
||||
|
||||
|
||||
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]
|
||||
|
||||
|
||||
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier: Array, POWER_THRESHOLD: int) -> void:
|
||||
for i_powapm in power_amplifier:
|
||||
var powamp_meta: String = i_powapm.get_meta('um')
|
||||
@@ -56,7 +75,7 @@ static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifi
|
||||
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
|
||||
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_5: return
|
||||
i_powapm.value0 = pow_dic[powamp_meta]
|
||||
for i_p in pow_dic[powamp_meta]:
|
||||
if i_p < POWER_THRESHOLD:
|
||||
@@ -64,6 +83,53 @@ static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifi
|
||||
i_powapm.state = status
|
||||
|
||||
|
||||
## Проверка температур УМ от УКП
|
||||
static func check_temperature_um(status_prd: PackedByteArray, power_amplifier: Array) -> bool:
|
||||
if power_amplifier.size() < 1: return false
|
||||
const Constants: Dictionary = {
|
||||
'CONST_MIN_TEMP': -25,
|
||||
'MAXIMUM_CODE_ADC': 3796,
|
||||
'MINIMUM_CODE_AD': 2660,
|
||||
'TEMPERATURE_UKP_1': 47,
|
||||
'TEMPERATURE_UKP_2': 79,
|
||||
}
|
||||
const TEMP: float = 115.0 / (Constants.MAXIMUM_CODE_ADC - Constants.MINIMUM_CODE_AD)
|
||||
var ukp1_online: int = (status_prd[0] >> 2) & 1
|
||||
var ukp2_online = (status_prd[0] >> 3) & 1
|
||||
var all_temp_is_ok: bool = true
|
||||
|
||||
if ukp1_online:
|
||||
var tmp_1: int
|
||||
var temperature_ukp_1: int
|
||||
for i_temp in 6:
|
||||
temperature_ukp_1 = status_prd.decode_u16(Constants.TEMPERATURE_UKP_1 + 2 * i_temp)
|
||||
tmp_1 = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3)
|
||||
power_amplifier[i_temp].value1 = tmp_1
|
||||
if tmp_1>70:
|
||||
all_temp_is_ok = false
|
||||
|
||||
if power_amplifier.size() > 12: # Темпуратура от УМ литеры 1
|
||||
temperature_ukp_1 = status_prd.decode_u16(Constants.TEMPERATURE_UKP_1 + 2 * 7)
|
||||
tmp_1 = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3)
|
||||
power_amplifier[6].value1 = tmp_1
|
||||
if tmp_1>70:
|
||||
all_temp_is_ok = false
|
||||
|
||||
if ukp2_online:
|
||||
for i_temp in 6:
|
||||
var temperature_ukp_2: int = status_prd.decode_u16(Constants.TEMPERATURE_UKP_2 + 2 * i_temp)
|
||||
var tmp_2: int = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3)
|
||||
if power_amplifier.size() > 12:
|
||||
power_amplifier[i_temp+7].value1 = tmp_2
|
||||
if tmp_2>70:
|
||||
all_temp_is_ok = false
|
||||
else:
|
||||
power_amplifier[i_temp+6].value1 = tmp_2
|
||||
if tmp_2>70:
|
||||
all_temp_is_ok = false
|
||||
return all_temp_is_ok
|
||||
|
||||
|
||||
func on_press_device() -> 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')
|
||||
@@ -78,6 +144,7 @@ func on_press_device() -> void:
|
||||
'power_dic': unit_prd_v.power_result,
|
||||
'block_kasseta_y5_config': unit_prd_v.block_kasseta_y5_config,
|
||||
'block_ip_config': unit_prd_v.block_ip_config,
|
||||
'temperature_um' : unit_prd_v.temperature_um,
|
||||
'nodes_y5': nodes_y5,
|
||||
'node_ip_power_arr': node_ip_power_arr,
|
||||
'fs_nodes': fs_nodes,
|
||||
@@ -93,7 +160,8 @@ func on_press_device() -> void:
|
||||
|
||||
|
||||
static func on_control_result(for_result_dic: Dictionary) -> void:
|
||||
## If control is end
|
||||
temperature_fill(for_result_dic.power_amplifier, for_result_dic.temperature_um)
|
||||
|
||||
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:
|
||||
@@ -110,25 +178,22 @@ static func on_control_result(for_result_dic: Dictionary) -> void:
|
||||
if block_ip_config_v.has(meta_ip) and block_kasseta_y5_prd_config_v.ug:
|
||||
power_supply.state = STATE_VAL.GOOD if block_ip_config_v[meta_ip][1] else STATE_VAL.ERROR
|
||||
|
||||
## If control is end
|
||||
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:
|
||||
if result_dic.fs_5 == 1 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
|
||||
else:
|
||||
result_dic.fs_5 = 0
|
||||
if result_dic.fs_4 == 1:
|
||||
|
||||
if result_dic.fs_4 == 1 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
|
||||
else:
|
||||
result_dic.fs_4 = 0
|
||||
|
||||
if block_kasseta_y5_prd_config_v['yau07']:
|
||||
power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD)
|
||||
|
||||
var result: bool = true
|
||||
|
||||
@@ -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
|
||||
@@ -80,12 +103,83 @@ 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
|
||||
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
|
||||
@@ -153,7 +247,7 @@ offset_left = 485.0
|
||||
offset_top = 242.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 337.0
|
||||
fname = "УМ1535Б"
|
||||
fname = "УМ1535А"
|
||||
rname = "A7"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
@@ -229,7 +323,7 @@ fname = "УМ1535А"
|
||||
rname = "A13"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_7"
|
||||
metadata/um = "um_9"
|
||||
|
||||
[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
@@ -241,7 +335,7 @@ fname = "УМ1535А"
|
||||
rname = "A14"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_8"
|
||||
metadata/um = "um_10"
|
||||
|
||||
[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
@@ -253,7 +347,7 @@ fname = "УМ1535А"
|
||||
rname = "A15"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_9"
|
||||
metadata/um = "um_11"
|
||||
|
||||
[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
@@ -265,7 +359,7 @@ fname = "УМ1535А"
|
||||
rname = "A16"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_10"
|
||||
metadata/um = "um_12"
|
||||
|
||||
[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
@@ -277,7 +371,7 @@ fname = "УМ1535А"
|
||||
rname = "A17"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_11"
|
||||
metadata/um = "um_13"
|
||||
|
||||
[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
@@ -289,7 +383,7 @@ fname = "УМ1535А"
|
||||
rname = "A18"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_12"
|
||||
metadata/um = "um_14"
|
||||
|
||||
[node name="control_result" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
@@ -299,3 +393,33 @@ offset_right = 649.0
|
||||
offset_bottom = 1003.0
|
||||
horizontal_alignment = 1
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="input_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(234, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||
|
||||
[node name="Label" type="Label" parent="input_0"]
|
||||
offset_left = -15.0
|
||||
offset_top = 15.0
|
||||
offset_right = 53.0
|
||||
offset_bottom = 34.0
|
||||
text = "Вход ЕМС"
|
||||
|
||||
[node name="input_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(277, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||
|
||||
[node name="output_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(381, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||
|
||||
[node name="Label" type="Label" parent="output_0"]
|
||||
offset_left = -19.0
|
||||
offset_top = 14.0
|
||||
offset_right = 57.0
|
||||
offset_bottom = 33.0
|
||||
text = "Модуляция"
|
||||
|
||||
[node name="output_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(422, 177)
|
||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||
|
||||
@@ -3,53 +3,32 @@ 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 = false # true
|
||||
var is_uf_operational: bool = false
|
||||
var is_prd_operational: bool = true
|
||||
var is_uf_operational: bool = true
|
||||
|
||||
|
||||
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('уарэп-эмс')
|
||||
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)
|
||||
|
||||
#func on_serviceability_changed(unit_prd_module: Object) -> void:
|
||||
func on_serviceability_changed() -> void:
|
||||
|
||||
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:
|
||||
if not prd_module.serviceability:
|
||||
if not unit_prd_module.serviceability:
|
||||
check_service = false
|
||||
if check_service != is_prd_operational:
|
||||
is_prd_operational = check_service
|
||||
_update_serviceability_display()
|
||||
|
||||
|
||||
## Обработчики кнопок
|
||||
#func _on_button_test_on() -> void:
|
||||
#print("[TEST] Оба исправны")
|
||||
#is_prd_operational = true
|
||||
#is_uf_operational = true
|
||||
#_update_serviceability_display()
|
||||
#
|
||||
#func _on_button_test_off() -> void:
|
||||
#print("[TEST] Оба неисправны")
|
||||
#is_prd_operational = false
|
||||
#is_uf_operational = false
|
||||
#_update_serviceability_display()
|
||||
#
|
||||
#func _on_button_test_mix() -> void:
|
||||
#is_prd_operational = !is_prd_operational
|
||||
#is_uf_operational = !is_uf_operational
|
||||
#print("[TEST] Смешанный режим → UF:", is_uf_operational, "PRD:", is_prd_operational)
|
||||
#_update_serviceability_display()
|
||||
|
||||
|
||||
func _update_serviceability_display() -> void:
|
||||
var status = STATUS_GOOD if (is_uf_operational and is_prd_operational) else STATUS_BAD
|
||||
var status := STATUS_GOOD if (is_uf_operational and is_prd_operational) else STATUS_BAD
|
||||
text = status.text
|
||||
modulate = status.color
|
||||
tooltip_text = 'Результаты обобщенного признака работоспособности изделия'
|
||||
@@ -57,9 +36,9 @@ func _update_serviceability_display() -> void:
|
||||
|
||||
|
||||
func on_uf_status_receive(unit_uf: Object) -> void:
|
||||
var KEMS_B = ((unit_uf.status[0] >> 0) & 1) & ((unit_uf.status[0] >> 3) & 1)
|
||||
var EMS_B_1 = ((unit_uf.status[0] >> 1) & 1) & ((unit_uf.status[0] >> 4) & 1)
|
||||
var EMS_B_2 = ((unit_uf.status[0] >> 2) & 1) & ((unit_uf.status[0] >> 5) & 1)
|
||||
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:
|
||||
|
||||
@@ -79,21 +79,6 @@ visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 5
|
||||
|
||||
[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
|
||||
|
||||
[node name="remote_control" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
offset_left = 1242.0
|
||||
@@ -125,35 +110,20 @@ toggle_mode = true
|
||||
text = "Тренаж"
|
||||
script = ExtResource("9_41d34")
|
||||
|
||||
[node name="buttontest" type="Button" parent="."]
|
||||
visible = false
|
||||
[node name="lbl_ready" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 1408.0
|
||||
offset_top = 64.0
|
||||
offset_right = 1456.0
|
||||
offset_bottom = 88.0
|
||||
text = "mix"
|
||||
|
||||
[node name="buttonteston" type="Button" parent="."]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 1472.0
|
||||
offset_top = 64.0
|
||||
offset_right = 1520.0
|
||||
offset_bottom = 88.0
|
||||
text = "on"
|
||||
|
||||
[node name="buttontestoff" type="Button" parent="."]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 1536.0
|
||||
offset_top = 64.0
|
||||
offset_right = 1584.0
|
||||
offset_bottom = 88.0
|
||||
text = "off"
|
||||
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="pressed" from="buttontest" to="lbl_ready" method="_on_button_test_mix"]
|
||||
[connection signal="pressed" from="buttonteston" to="lbl_ready" method="_on_button_test_on"]
|
||||
[connection signal="pressed" from="buttontestoff" to="lbl_ready" method="_on_button_test_off"]
|
||||
[connection signal="toggled" from="тренаж_режим" to="tab_switch" method="_on_button_trenazh_toggled"]
|
||||
|
||||
@@ -373,7 +373,7 @@ func _process(delta) -> void:
|
||||
remove_child(req)
|
||||
req.queue_free()
|
||||
_req_count -= 1
|
||||
|
||||
push_error('запрос \"%s\" не отправлен' % tile.url) #TODO: For Deugs
|
||||
if _queue.is_empty():
|
||||
emit_signal('load_completed')
|
||||
|
||||
@@ -717,7 +717,7 @@ func set_coordinates(lon: float, lat: float, course: float) -> void:
|
||||
add_mark_from_lon_lat(ship_id, lon, lat, ship_instance, 0.0)
|
||||
else:
|
||||
_marks[ship_id].position = lonlat_to_world(lon, lat)
|
||||
ship_instance.rotation_degrees = fmod(course, 360.0)
|
||||
ship_instance.rotation_degrees = fmod(270.0 + course, 360.0)
|
||||
queue_redraw()
|
||||
|
||||
|
||||
|
||||
@@ -3,10 +3,16 @@ extends Button
|
||||
var base_style: StyleBoxFlat
|
||||
var tween
|
||||
var pulsing: bool = false
|
||||
@onready var progress_bars := get_tree().get_nodes_in_group("control_progress")
|
||||
var original_text: String
|
||||
|
||||
|
||||
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)
|
||||
@@ -14,19 +20,28 @@ func _ready():
|
||||
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 = "Идет выполнение контроля"
|
||||
_start_pulse()
|
||||
var callback = Callable(self, "_check_progress_end")
|
||||
for pb in progress_bars:
|
||||
if not pb.is_connected("value_changed", callback):
|
||||
pb.connect("value_changed", callback)
|
||||
|
||||
|
||||
func _start_pulse():
|
||||
@@ -52,14 +67,13 @@ func _stop_pulse():
|
||||
base_style.border_color = Color(1.0, 0.5, 0.0)
|
||||
pulsing = false
|
||||
disabled = false
|
||||
var callback = Callable(self, "_check_progress_end")
|
||||
for pb in progress_bars:
|
||||
if pb.is_connected("value_changed", callback):
|
||||
pb.disconnect("value_changed", callback)
|
||||
text = original_text
|
||||
|
||||
|
||||
func _check_progress_end(value):
|
||||
for pb in progress_bars:
|
||||
if pb.value < pb.max_value:
|
||||
return
|
||||
func _on_status_change():
|
||||
_stop_pulse()
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if tween:
|
||||
tween.kill()
|
||||
|
||||
@@ -1 +1 @@
|
||||
uid://cjj7pbbhk8q7c
|
||||
uid://xjs7owe2iexn
|
||||
|
||||
@@ -35,7 +35,7 @@ signal pressed(control: PanelContainer)
|
||||
if not is_inside_tree():
|
||||
return
|
||||
$margin/vbox/grid1/level7.value = v
|
||||
$margin/vbox/grid1/level7.tint_progress = Color.RED if v > 70 else Color.WHITE
|
||||
$margin/vbox/grid1/level7.tint_progress = Color.RED if v >= 70 else Color.GOLD if v >= 60 else Color.WHITE
|
||||
|
||||
|
||||
@export var min_value0: float:
|
||||
@@ -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,8 @@ 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
|
||||
max_value0 = 1400.0
|
||||
max_value1 = 70.0
|
||||
step0 = 1.0
|
||||
step1 = 1.0
|
||||
value_name0 = "P,%"
|
||||
@@ -476,12 +474,10 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "
|
||||
Текущее: 56.00
|
||||
Диапазон: -50.00…120.00"
|
||||
Текущее: 0.00
|
||||
Диапазон: 0.00…70.00"
|
||||
mouse_filter = 0
|
||||
min_value = -50.0
|
||||
max_value = 120.0
|
||||
value = 56.0
|
||||
max_value = 70.0
|
||||
fill_mode = 3
|
||||
nine_patch_stretch = true
|
||||
stretch_margin_left = 8
|
||||
|
||||
406
scenes/контроль/блок-к.tscn
Normal file
406
scenes/контроль/блок-к.tscn
Normal file
@@ -0,0 +1,406 @@
|
||||
[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 >= 70 else Color.GOLD if v >= 60 else Color.WHITE
|
||||
|
||||
|
||||
@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
|
||||
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 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]
|
||||
max_value0 = 1400.0
|
||||
max_value1 = 70.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 = "
|
||||
Текущее: 0.00
|
||||
Диапазон: 0.00…70.00"
|
||||
mouse_filter = 0
|
||||
max_value = 70.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"]
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=22 format=3 uid="uid://lwmw4egynmd1"]
|
||||
[gd_scene load_steps=21 format=3 uid="uid://lwmw4egynmd1"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bar8k5qef7kch" path="res://data/УФ.png" id="2_0nvm1"]
|
||||
[ext_resource type="Script" uid="uid://q3gmpsqspjfp" path="res://scenes/контроль/внешний.gd" id="2_8r80x"]
|
||||
@@ -17,7 +17,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://00871pb6moln" path="res://data/прогресс-фон-1.png" id="9_w6m6a"]
|
||||
[ext_resource type="Texture2D" uid="uid://c1k856fxhrjnh" path="res://data/прогресс-заполнение-1.png" id="10_lbx5w"]
|
||||
[ext_resource type="Script" uid="uid://bncy1x53jp73d" path="res://scenes/контроль/connect_pribor.gd" id="11_u7tym"]
|
||||
[ext_resource type="Script" uid="uid://cjj7pbbhk8q7c" path="res://scenes/контроль/control_prd.gd" id="18_lbx5w"]
|
||||
[ext_resource type="Script" uid="uid://xjs7owe2iexn" path="res://scenes/контроль/control_prd.gd" id="18_lbx5w"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_iqgf5"]
|
||||
script/source = "extends Panel
|
||||
@@ -178,15 +178,6 @@ animations = [{
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_lbx5w"]
|
||||
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||
border_width_left = 10
|
||||
border_width_top = 10
|
||||
border_width_right = 10
|
||||
border_width_bottom = 10
|
||||
border_color = Color(0.833286, 0.436556, 0.229611, 1)
|
||||
border_blend = true
|
||||
|
||||
[node name="Контроль" type="Panel"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -422,7 +413,7 @@ sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_1" groups=["control_progress"]]
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_1"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = -4.0
|
||||
@@ -465,6 +456,7 @@ metadata/unit_name = ["уарэп-эмс"]
|
||||
metadata/online_proc = "on_line_changed"
|
||||
|
||||
[node name="label" type="Label" parent="pribor_uf"]
|
||||
self_modulate = Color(0, 1, 0, 1)
|
||||
layout_mode = 0
|
||||
offset_left = 15.0
|
||||
offset_top = -44.0
|
||||
@@ -541,6 +533,16 @@ patch_margin_top = 16
|
||||
patch_margin_right = 16
|
||||
patch_margin_bottom = 16
|
||||
|
||||
[node name="label2" type="Label" parent="pribor_rtr"]
|
||||
layout_mode = 0
|
||||
offset_left = 11.0
|
||||
offset_top = -49.0
|
||||
offset_right = 94.0
|
||||
offset_bottom = -30.0
|
||||
text = "РТР"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_rtr"]
|
||||
light_mask = 3
|
||||
position = Vector2(53, -15)
|
||||
@@ -596,6 +598,17 @@ patch_margin_top = 16
|
||||
patch_margin_right = 16
|
||||
patch_margin_bottom = 16
|
||||
|
||||
[node name="label2" type="Label" parent="pribor_afsp_1"]
|
||||
layout_mode = 0
|
||||
offset_left = 175.0
|
||||
offset_top = -245.0
|
||||
offset_right = 272.0
|
||||
offset_bottom = -225.0
|
||||
scale = Vector2(5, 5)
|
||||
text = "АФСП 1"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_afsp_1"]
|
||||
light_mask = 3
|
||||
position = Vector2(415, -40)
|
||||
@@ -652,6 +665,17 @@ patch_margin_top = 16
|
||||
patch_margin_right = 16
|
||||
patch_margin_bottom = 16
|
||||
|
||||
[node name="label2" type="Label" parent="pribor_afsp_2"]
|
||||
layout_mode = 0
|
||||
offset_left = 175.0
|
||||
offset_top = -240.0
|
||||
offset_right = 272.0
|
||||
offset_bottom = -220.0
|
||||
scale = Vector2(5, 5)
|
||||
text = "АФСП 2"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_afsp_2"]
|
||||
light_mask = 3
|
||||
position = Vector2(415, -40)
|
||||
@@ -763,7 +787,7 @@ sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_2" groups=["control_progress"]]
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_2"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = -4.0
|
||||
@@ -840,7 +864,7 @@ sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_2" groups=["control_progress"]]
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_2"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = -4.0
|
||||
@@ -915,7 +939,7 @@ sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_2" groups=["control_progress"]]
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_2"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = -4.0
|
||||
@@ -990,7 +1014,7 @@ sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_3" groups=["control_progress"]]
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_3"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = -8.0
|
||||
@@ -1065,7 +1089,7 @@ sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_3" groups=["control_progress"]]
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_3"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = -7.0
|
||||
@@ -1140,7 +1164,7 @@ sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_3" groups=["control_progress"]]
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_3"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = -8.0
|
||||
@@ -1215,7 +1239,7 @@ sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_1" groups=["control_progress"]]
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_1"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = -4.0
|
||||
@@ -1290,7 +1314,7 @@ sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_1" groups=["control_progress"]]
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_1"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = -4.0
|
||||
@@ -1364,7 +1388,7 @@ sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_4" groups=["control_progress"]]
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_4"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = -6.0
|
||||
@@ -1438,7 +1462,7 @@ sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_4" groups=["control_progress"]]
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_4"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = -8.0
|
||||
@@ -1512,7 +1536,7 @@ sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_4" groups=["control_progress"]]
|
||||
[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_4"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = -8.0
|
||||
@@ -1656,16 +1680,16 @@ points = PackedVector2Array(-8, 0, 608, 0)
|
||||
width = 2.0
|
||||
default_color = Color(1, 1, 1, 0.352941)
|
||||
|
||||
[node name="control_prd" type="Button" parent="." groups=["control_progress"]]
|
||||
[node name="control_prd" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 1106.0
|
||||
offset_left = 1101.0
|
||||
offset_top = 64.0
|
||||
offset_right = 1331.0
|
||||
offset_right = 1326.0
|
||||
offset_bottom = 104.0
|
||||
focus_mode = 0
|
||||
theme_override_styles/disabled = SubResource("StyleBoxFlat_lbx5w")
|
||||
text = "Запуск контроля"
|
||||
script = ExtResource("18_lbx5w")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[connection signal="toggled" from="pribor_prd_n_1" to="pribor_prd_n_1" method="_on_toggled"]
|
||||
[connection signal="toggled" from="pribor_uf" to="pribor_uf" method="_on_toggled"]
|
||||
|
||||
@@ -675,4 +675,3 @@ func set_th_emit(th: threats.Threat, ecm: Interfer):
|
||||
return
|
||||
else:
|
||||
th.emit_state = 1
|
||||
|
||||
|
||||
@@ -285,8 +285,7 @@ func _ready() -> void:
|
||||
var unit_prd = network.get_unit_instance(prd_name)
|
||||
var new_prd = PRD.new(prd_name, unit_prd)
|
||||
prd_dict[prd_name] = new_prd
|
||||
var control_pribor_prd = preload('res://scripts/pribor-prd.gd')
|
||||
var unit_control = control_pribor_prd.TestPRD.new({'unit_prd': unit_prd}, new_prd.cmd_array)
|
||||
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():
|
||||
|
||||
@@ -1,208 +1,16 @@
|
||||
class TestPRD extends Node:
|
||||
const DEVICE_CONSTANT: Dictionary = {
|
||||
'PRD_N': {
|
||||
CONSTANTS = {
|
||||
'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,
|
||||
},
|
||||
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': 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,
|
||||
},
|
||||
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': 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,
|
||||
},
|
||||
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
|
||||
}
|
||||
}
|
||||
class_name TestPRD
|
||||
extends Node
|
||||
# Константы
|
||||
const CONFIG_PATH = "user://config/setting_prd_control.json"
|
||||
|
||||
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 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 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 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 block_kasseta_y5_prd_config_k: = {
|
||||
'yau07': false,
|
||||
'ems': false,
|
||||
'ug': false,
|
||||
'ukp1': false,
|
||||
'ukp2': false,
|
||||
}
|
||||
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 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],
|
||||
}
|
||||
####
|
||||
|
||||
const RAY_m5:= 'RAY_m5'
|
||||
const RAY_5:= 'RAY_5'
|
||||
const RAY_15:= 'RAY_15'
|
||||
const RAY_25:= 'RAY_25'
|
||||
const RAY_35:= 'RAY_35'
|
||||
const RAY_45:= 'RAY_45'
|
||||
enum DataIndices {
|
||||
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,
|
||||
}
|
||||
const RAY_m5: String = "RAY_m5"
|
||||
const RAY_5: String = "RAY_5"
|
||||
const RAY_15: String = "RAY_15"
|
||||
const RAY_25: String = "RAY_25"
|
||||
const RAY_35: String = "RAY_35"
|
||||
const RAY_45: String = "RAY_45"
|
||||
|
||||
const RAY_TYPES := [RAY_m5, RAY_5, RAY_15, RAY_25, RAY_35, RAY_45]
|
||||
enum STATE_MACHINE {
|
||||
INIT,
|
||||
FS_TURN_ON,
|
||||
@@ -223,38 +31,28 @@ class TestPRD extends Node:
|
||||
STOP_CONTROL,
|
||||
AWAIT
|
||||
}
|
||||
const FS_KEYS := {
|
||||
1: 'fs_1',
|
||||
2: 'fs_2',
|
||||
3: 'fs_3',
|
||||
4: 'fs_4',
|
||||
5: 'fs_5',
|
||||
6: 'fs_6',
|
||||
7: 'fs_7'
|
||||
}
|
||||
const TEMPERATURE_CONSTANTS := {
|
||||
'CONST_MIN_TEMP': -25,
|
||||
'MAXIMUM_CODE_ADC': 3796,
|
||||
'MINIMUM_CODE_AD': 2660,
|
||||
'TEMPERATURE_UKP_1': 47,
|
||||
'TEMPERATURE_UKP_2': 79,
|
||||
}
|
||||
|
||||
var power_for_litera: Dictionary = {
|
||||
1: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],},
|
||||
2: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],},
|
||||
3: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],},
|
||||
4: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],},
|
||||
5: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],},
|
||||
6: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],},
|
||||
7: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],},
|
||||
}
|
||||
# Загруженные конфигурации
|
||||
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 _ray_state_mapping: Dictionary
|
||||
# Переменные класса
|
||||
var constants: Dictionary
|
||||
var pribor_config: Dictionary
|
||||
var fs_parameters: Dictionary
|
||||
var block_ip_config: Dictionary
|
||||
var block_kasseta_y5_config: Dictionary
|
||||
var temperature_um: Dictionary
|
||||
var control_results: Dictionary
|
||||
var power_result: Dictionary
|
||||
var self_name: String
|
||||
var state: int = STATE_MACHINE.INIT
|
||||
var current_litera: int
|
||||
@@ -262,18 +60,17 @@ class TestPRD extends Node:
|
||||
var flag_fs_status_ok: bool = false
|
||||
var flag_si_fs_input: bool = false
|
||||
var flag_si_fs_output: bool = false
|
||||
var flag_in_control: bool = false
|
||||
var unit_prd: Object
|
||||
var power_amplify: Array
|
||||
var power_result: Dictionary
|
||||
#var control_label: Label
|
||||
var control_timer: Timer = Timer.new()
|
||||
var ems_6666_timer: Timer = Timer.new()
|
||||
var machine_timer: Timer = Timer.new()
|
||||
var cc: int = 0
|
||||
var cmd_array: Array
|
||||
|
||||
signal control_is_over()
|
||||
signal update_progress(progress_value: float)
|
||||
signal update_max_value_progress(max_progress_value: int)
|
||||
var cc: int = 0
|
||||
var cmd_array: Array
|
||||
|
||||
var progress_value: float:
|
||||
set(v):
|
||||
@@ -281,13 +78,25 @@ class TestPRD extends Node:
|
||||
progress_value = v
|
||||
call_deferred('emit_signal', 'update_progress', v)
|
||||
|
||||
var ecms: Dictionary
|
||||
var power_for_litera: Dictionary
|
||||
|
||||
var ecms: Dictionary ## Словарь помеховых воздействий
|
||||
|
||||
## Инициализация аргуметнов
|
||||
func _init(init_data: Dictionary, cmd_array_from_prd: Array) -> void:
|
||||
unit_prd = init_data['unit_prd']
|
||||
cmd_array = cmd_array_from_prd
|
||||
_load_configuration()
|
||||
_initialize_ray_mapping()
|
||||
_initialize_power_structure()
|
||||
|
||||
|
||||
func _initialize_power_structure() -> void:
|
||||
power_for_litera = {}
|
||||
for litera in range(1, 8):
|
||||
power_for_litera[litera] = {}
|
||||
for ray_type in RAY_TYPES:
|
||||
power_for_litera[litera][ray_type] = []
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -296,20 +105,84 @@ class TestPRD extends Node:
|
||||
setup_timer()
|
||||
|
||||
|
||||
func _get_ray_key(machine_state: int) -> String:
|
||||
return _ray_state_mapping.get(machine_state, "")
|
||||
|
||||
|
||||
func _load_configuration() -> void:
|
||||
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
|
||||
_parse_config_data()
|
||||
else:
|
||||
push_error("Failed to parse JSON config: " + json.get_error_message())
|
||||
else:
|
||||
push_error("Failed to load config file: " + CONFIG_PATH)
|
||||
|
||||
|
||||
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", []))
|
||||
|
||||
|
||||
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 _initialize_ray_mapping() -> void:
|
||||
_ray_state_mapping = {
|
||||
STATE_MACHINE.UG_SET_RAY_0: "RAY_m5",
|
||||
STATE_MACHINE.UG_SET_RAY_1: "RAY_5",
|
||||
STATE_MACHINE.UG_SET_RAY_2: "RAY_15",
|
||||
STATE_MACHINE.UG_SET_RAY_3: "RAY_25",
|
||||
STATE_MACHINE.UG_SET_RAY_4: "RAY_35",
|
||||
STATE_MACHINE.UG_SET_RAY_5: "RAY_45",
|
||||
}
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
## Пакеты от ЯУ-07
|
||||
func on_data_received(unit_pribor: Object) -> void:
|
||||
if not flag_in_control: return
|
||||
var status: PackedByteArray = unit_pribor.status
|
||||
socket_status_ems_g(status)
|
||||
block_kasseta_y5_config = check_block_kasseta_y5(status, block_kasseta_y5_config)
|
||||
block_ip_config = check_block_ip(status, block_ip_config)
|
||||
temperature_um = check_temperature_um(status)
|
||||
if machine_timer.is_stopped():
|
||||
return
|
||||
|
||||
var status: PackedByteArray = unit_pribor.status
|
||||
block_kasseta_y5_config = check_block_kasseta_y5(status, block_kasseta_y5_config)
|
||||
block_ip_config = check_block_ip(status, block_ip_config)
|
||||
control_results.temperature = check_temperature_um(status, power_amplify)
|
||||
socket_status_ems_g(status)
|
||||
_process_dkm_status(status)
|
||||
if current_litera != 0:
|
||||
var tek_litera: Dictionary = power_for_litera[current_litera]
|
||||
@@ -318,30 +191,55 @@ class TestPRD extends Node:
|
||||
tek_litera[_get_ray_key(state)] = power_um_ukp(status, current_litera, tek_litera[_get_ray_key(state)])
|
||||
power_for_litera[current_litera] = tek_litera
|
||||
|
||||
var ems_input_1: int
|
||||
var ems_input_2: int
|
||||
var ems_input_lit_1: int
|
||||
var ems_output_1: int
|
||||
var ems_output_2: int
|
||||
var ems_output_lit_1: int
|
||||
|
||||
# Методы для работы с DataIndices из JSON
|
||||
func _get_data_index(key: String) -> int:
|
||||
return data_indices.get(key, -1)
|
||||
|
||||
func socket_status_ems_g(packet_form_yau_07: PackedByteArray) -> void:
|
||||
if self_name in ['1н', '2н', '3н', '4н']:
|
||||
ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 9)) != 0
|
||||
ems_input_2 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 10)) != 0
|
||||
if self_name in ['1в', '2в', '3в', '4в']:
|
||||
ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 11)) != 0
|
||||
ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 12)) != 0
|
||||
if self_name in ['1к', '2к', '3к', '4к']:
|
||||
ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 13)) != 0
|
||||
ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 14)) != 0
|
||||
ems_input_lit_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 8)) != 0
|
||||
|
||||
ems_output_1 = (packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD')) & (1 << 4)) != 0
|
||||
ems_output_2 = (packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD')) & (1 << 5)) != 0
|
||||
ems_output_lit_1 = (packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD')) & (1 << 3)) != 0
|
||||
|
||||
var number_socket_input: int
|
||||
if current_litera >= 1 and current_litera <= 7:
|
||||
number_socket_input = current_litera + 7
|
||||
|
||||
var in_blank: int = packet_form_yau_07.decode_u16(DataIndices.IN_BLANK_PRD)
|
||||
var in_blank: int = packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD'))
|
||||
flag_si_fs_input = (in_blank & (1 << number_socket_input)) != 0 ## Флаг СИ от ФС входа в ЭМС-Г для текущей литеры
|
||||
|
||||
var number_socket_output: int
|
||||
number_socket_output = 4 if current_litera in [2, 4, 6] else 3 if current_litera == 1 else 5
|
||||
|
||||
var out_blank: int = packet_form_yau_07.decode_u16(DataIndices.OUT_BLANK_PRD)
|
||||
var out_blank: int = packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD'))
|
||||
flag_si_fs_output = (out_blank & (1 << number_socket_output)) != 0 ## Флаг Модуляции УМ ЭМС-Г для текущей литеры
|
||||
|
||||
|
||||
## Пакеты от MP550Service
|
||||
func on_fs_update_state(packet_type_7: Dictionary, fs_mapping: Dictionary) -> void:
|
||||
var fs_key: String = FS_KEYS.get(current_litera, '')
|
||||
var fs_key: String = fs_keys.get(str(current_litera), '')
|
||||
if fs_key.is_empty():
|
||||
return
|
||||
|
||||
var fs_result := {fs_key: 0}
|
||||
fs_result = on_fs_state(packet_type_7, fs_mapping, fs_result)
|
||||
fs_result = on_fs_state(packet_type_7, fs_mapping, fs_result, fs_rules)
|
||||
control_results[fs_key] = fs_result[fs_key]
|
||||
flag_fs_status_ok = control_results[fs_key] == 1
|
||||
|
||||
@@ -349,16 +247,20 @@ class TestPRD extends Node:
|
||||
func state_control_machine() -> void:
|
||||
match state:
|
||||
STATE_MACHINE.INIT:
|
||||
print("Start control for %s device %s litera" % [self_name, current_litera])
|
||||
_handle_init_state()
|
||||
STATE_MACHINE.FS_TURN_ON:
|
||||
_handle_fs_turn_on_state()
|
||||
state = STATE_MACHINE.FS_WORK
|
||||
STATE_MACHINE.FS_WORK:
|
||||
for key in ecms.keys():
|
||||
pass
|
||||
#print([fs_parameters, current_litera])
|
||||
#print('ecms: %s %s' % [ecms[key].kni, ecms[key].params.freq])
|
||||
if ecms.size() and flag_fs_status_ok:
|
||||
var flag_ecm: bool = false
|
||||
for key in ecms:
|
||||
var params = ecms[key].params.freq
|
||||
if fs_parameters[current_litera].freq == params:
|
||||
var kni = ecms[key].kni
|
||||
if pribor_config[self_name].angle == kni:
|
||||
flag_ecm = true
|
||||
if flag_ecm and flag_fs_status_ok:
|
||||
ems_6666_timer.start()
|
||||
_handle_fs_work_state()
|
||||
STATE_MACHINE.CHEK_KASSETA_Y5:
|
||||
@@ -394,6 +296,8 @@ class TestPRD extends Node:
|
||||
state = STATE_MACHINE.IN_EMS_STOP
|
||||
elif unit_prd.isa_ports[addr] & 0x07 == 6:
|
||||
state = STATE_MACHINE.UG_SET_RAY_0
|
||||
if current_litera == 1:
|
||||
state = STATE_MACHINE.UG_SET_RAY_5
|
||||
|
||||
STATE_MACHINE.UG_SET_RAY_0:
|
||||
if flag_si_fs_input and not flag_write_isa:
|
||||
@@ -430,7 +334,7 @@ class TestPRD extends Node:
|
||||
state = STATE_MACHINE.STOP_CONTROL
|
||||
STATE_MACHINE.STOP_CONTROL:
|
||||
_handle_stop_control_state()
|
||||
## В машине состояний вызов изменения состояния контроля
|
||||
## В машине состояний вызов изменения состояния прогресс бара контроля
|
||||
progressbar_status()
|
||||
|
||||
|
||||
@@ -537,10 +441,10 @@ class TestPRD extends Node:
|
||||
signaller.conn(signaller.start_contol_device, Callable(self, '_on_start_contol_device'))
|
||||
interfer.connect('interfer_resized', Callable(self, 'on_interfer_resized'))
|
||||
unit_prd.connect('data_received', Callable(self, 'on_data_received'))
|
||||
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))
|
||||
|
||||
var mode_signals = ['режим_работа', 'режим_журнал', 'режим_эмс', 'режим_настройки']
|
||||
for signal_name in mode_signals:
|
||||
signaller.connect(signal_name, Callable(self, 'on_mode_changed').bind(false))
|
||||
signaller.connect('режим_контроль', Callable(self, 'on_mode_changed').bind(true))
|
||||
|
||||
|
||||
@@ -556,47 +460,58 @@ class TestPRD extends Node:
|
||||
|
||||
func _determine_self_name() -> void:
|
||||
cc = 0
|
||||
state = STATE_MACHINE.INIT
|
||||
state = STATE_MACHINE.get("INIT", 0)
|
||||
var current_unit = unit_prd.name
|
||||
var parts = current_unit.split('-')
|
||||
self_name = parts[-1]
|
||||
if self_name == '1н' or self_name == '2н' or self_name == '3н' or self_name == '4н':
|
||||
|
||||
var device_type: String = _get_device_type()
|
||||
if device_type.is_empty():
|
||||
return
|
||||
|
||||
var device_config = device_constants.get(device_type, {})
|
||||
var device_data_config = device_configs.get(device_type, {})
|
||||
|
||||
# Загружаем конфигурацию устройства
|
||||
constants = device_config.get("constants", {})
|
||||
pribor_config = device_config.get("pribor_config", {})
|
||||
|
||||
# Конвертируем fs_params ключи в int
|
||||
var raw_fs_params = device_config.get("fs_params", {})
|
||||
fs_parameters = {}
|
||||
for key in raw_fs_params:
|
||||
fs_parameters[int(key)] = raw_fs_params[key]
|
||||
|
||||
# Загружаем конфигурации блоков
|
||||
block_ip_config = _load_block_config(device_data_config.get("block_ip", {}), "block_ip")
|
||||
block_kasseta_y5_config = _load_block_config(device_data_config.get("block_kasseta", {}), "block_kasseta")
|
||||
control_results = device_data_config.get("control_results", {})
|
||||
current_litera = device_config.get("start_litera", 0)
|
||||
|
||||
progress_value = 0
|
||||
call_deferred('emit_signal', 'update_max_value_progress', 20)
|
||||
constants = DEVICE_CONSTANT.PRD_N.CONSTANTS
|
||||
pribor_config = DEVICE_CONSTANT.PRD_N.PRIBOR_CONFIG
|
||||
fs_parameters = DEVICE_CONSTANT.PRD_N.FS_PARAMS
|
||||
block_ip_config = block_ip_config_n
|
||||
block_kasseta_y5_config = block_kasseta_y5_prd_config_n
|
||||
control_results = control_results_n
|
||||
current_litera = DEVICE_CONSTANT.PRD_N.START_LITERA
|
||||
if self_name == '1в' or self_name == '2в' or self_name == '3в' or self_name == '4в':
|
||||
progress_value = 0
|
||||
call_deferred('emit_signal', 'update_max_value_progress', 20)
|
||||
constants = DEVICE_CONSTANT.PRD_V.CONSTANTS
|
||||
pribor_config = DEVICE_CONSTANT.PRD_V.PRIBOR_CONFIG
|
||||
fs_parameters = DEVICE_CONSTANT.PRD_V.FS_PARAMS
|
||||
block_ip_config = block_ip_config_v
|
||||
block_kasseta_y5_config = block_kasseta_y5_prd_config_v
|
||||
control_results = control_results_v
|
||||
current_litera = DEVICE_CONSTANT.PRD_V.START_LITERA
|
||||
if self_name == '1к' or self_name == '2к' or self_name == '3к' or self_name == '4к':
|
||||
progress_value = 0
|
||||
call_deferred('emit_signal', 'update_max_value_progress', 30)
|
||||
constants = DEVICE_CONSTANT.PRD_K.CONSTANTS
|
||||
pribor_config = DEVICE_CONSTANT.PRD_K.PRIBOR_CONFIG
|
||||
fs_parameters = DEVICE_CONSTANT.PRD_K.FS_PARAMS
|
||||
block_ip_config = block_ip_config_k
|
||||
block_kasseta_y5_config = block_kasseta_y5_prd_config_n
|
||||
control_results = control_results_k
|
||||
current_litera = DEVICE_CONSTANT.PRD_K.START_LITERA
|
||||
call_deferred('emit_signal', 'update_max_value_progress', device_config.get("progress_max", 20))
|
||||
|
||||
|
||||
func _load_block_config(config, config_type: String) -> Dictionary:
|
||||
if config is String and config == "base":
|
||||
return base_configs.get(config_type, {}).duplicate(true)
|
||||
elif config is Dictionary:
|
||||
return config.duplicate(true)
|
||||
return {}
|
||||
|
||||
|
||||
func _get_device_type() -> String:
|
||||
if self_name.ends_with('н'): return 'PRD_N'
|
||||
elif self_name.ends_with('в'): return 'PRD_V'
|
||||
elif self_name.ends_with('к'): return 'PRD_K'
|
||||
return ''
|
||||
|
||||
|
||||
func setup_timer() -> void:
|
||||
add_child(control_timer)
|
||||
control_timer.timeout.connect(on_stop_control)
|
||||
control_timer.one_shot = true
|
||||
control_timer.wait_time = constants.TIMER_DELAY
|
||||
control_timer.wait_time = constants.get("TIMER_DELAY", 10.0)
|
||||
|
||||
add_child(ems_6666_timer)
|
||||
ems_6666_timer.timeout.connect(_on_ems_6666_timer)
|
||||
@@ -607,14 +522,14 @@ class TestPRD extends Node:
|
||||
|
||||
|
||||
func on_mode_changed(in_tree: bool) -> void:
|
||||
if not in_tree:
|
||||
flag_in_control = in_tree
|
||||
if not in_tree: ## TODO: Дополнительная проверка если контроль идет, если нет, то смысла вызывать нет
|
||||
progress_value = 0
|
||||
machine_timer.stop()
|
||||
state = STATE_MACHINE.INIT
|
||||
_handle_fs_turn_off_state()
|
||||
#prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]])
|
||||
else:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
func _process_dkm_status(status: PackedByteArray) -> void:
|
||||
@@ -646,7 +561,7 @@ class TestPRD extends Node:
|
||||
|
||||
|
||||
func _get_current_fs_key() -> String:
|
||||
return FS_KEYS.get(current_litera, '')
|
||||
return fs_keys.get(str(current_litera), '')
|
||||
|
||||
|
||||
static func _get_dkm_bit_for_current_fs(litera: int, constants_dic: Dictionary) -> int:
|
||||
@@ -661,17 +576,6 @@ class TestPRD extends Node:
|
||||
_: return -1
|
||||
|
||||
|
||||
static func _get_ray_key(machine_state: int) -> String:
|
||||
match machine_state:
|
||||
STATE_MACHINE.UG_SET_RAY_0: return RAY_m5
|
||||
STATE_MACHINE.UG_SET_RAY_1: return RAY_5
|
||||
STATE_MACHINE.UG_SET_RAY_2: return RAY_15
|
||||
STATE_MACHINE.UG_SET_RAY_3: return RAY_25
|
||||
STATE_MACHINE.UG_SET_RAY_4: return RAY_35
|
||||
STATE_MACHINE.UG_SET_RAY_5: return RAY_45
|
||||
_: return ''
|
||||
|
||||
|
||||
func on_stop_control() -> void:
|
||||
_handle_fs_turn_off_state()
|
||||
state = STATE_MACHINE.FS_TURN_OFF
|
||||
@@ -722,7 +626,7 @@ class TestPRD extends Node:
|
||||
params.width,
|
||||
sectors[litera - 1] if litera == 1 else sectors[litera - 5] if litera > 5 else sectors[litera - 4] if litera > 3 else sectors[litera - 2]
|
||||
])
|
||||
signaller.emit_signal('emit_changed', mode)
|
||||
#signaller.emit_signal('emit_changed', mode)
|
||||
signaller.emit_signal('interfer_init', interfer_name, fs_arr, power_um)
|
||||
|
||||
|
||||
@@ -749,8 +653,8 @@ class TestPRD extends Node:
|
||||
return y5_config
|
||||
|
||||
|
||||
## Проверка температур УМ от УКП
|
||||
static func check_temperature_um(status_prd: PackedByteArray, power_amplifier: Array) -> bool:
|
||||
## Мониторинг температуры
|
||||
static func check_temperature_um(status_prd: PackedByteArray) -> Dictionary:
|
||||
const Constants: Dictionary = {
|
||||
'CONST_MIN_TEMP': -25,
|
||||
'MAXIMUM_CODE_ADC': 3796,
|
||||
@@ -758,41 +662,28 @@ class TestPRD extends Node:
|
||||
'TEMPERATURE_UKP_1': 47,
|
||||
'TEMPERATURE_UKP_2': 79,
|
||||
}
|
||||
const arr_um: Array = ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6', 'um_7', 'um_8', 'um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14', 'um_15', 'um_16']
|
||||
const TEMP: float = 115.0 / (Constants.MAXIMUM_CODE_ADC - Constants.MINIMUM_CODE_AD)
|
||||
var return_dic_temp: Dictionary
|
||||
var ukp1_online: int = (status_prd[0] >> 2) & 1
|
||||
var ukp2_online = (status_prd[0] >> 3) & 1
|
||||
var all_temp_is_ok: bool = true
|
||||
|
||||
if ukp1_online:
|
||||
var tmp_1: int
|
||||
var temperature_ukp_1: int
|
||||
for i_temp in 6:
|
||||
for i_temp in 8:
|
||||
temperature_ukp_1 = status_prd.decode_u16(Constants.TEMPERATURE_UKP_1 + 2 * i_temp)
|
||||
tmp_1 = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3)
|
||||
#power_amplifier[i_temp].value1 = tmp_1
|
||||
if tmp_1>70:
|
||||
all_temp_is_ok = false
|
||||
return_dic_temp[arr_um[i_temp]] = tmp_1
|
||||
|
||||
if power_amplifier.size() > 12: # Темпуратура от УМ литеры 1
|
||||
temperature_ukp_1 = status_prd.decode_u16(Constants.TEMPERATURE_UKP_1 + 2 * 7)
|
||||
tmp_1 = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3)
|
||||
#power_amplifier[6].value1 = tmp_1
|
||||
if tmp_1>70:
|
||||
all_temp_is_ok = false
|
||||
|
||||
if ukp2_online:
|
||||
for i_temp in 6:
|
||||
for i_temp in 8:
|
||||
var temperature_ukp_2: int = status_prd.decode_u16(Constants.TEMPERATURE_UKP_2 + 2 * i_temp)
|
||||
var tmp_2: int = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3)
|
||||
if power_amplifier.size() > 12:
|
||||
#power_amplifier[i_temp+7].value1 = tmp_2
|
||||
if tmp_2>70:
|
||||
all_temp_is_ok = false
|
||||
else:
|
||||
#power_amplifier[i_temp+6].value1 = tmp_2
|
||||
if tmp_2>70:
|
||||
all_temp_is_ok = false
|
||||
return all_temp_is_ok
|
||||
return_dic_temp[arr_um[i_temp+8]] = tmp_2
|
||||
|
||||
return return_dic_temp
|
||||
|
||||
|
||||
## Проверка ДКМ
|
||||
@@ -821,24 +712,13 @@ class TestPRD extends Node:
|
||||
|
||||
|
||||
##
|
||||
static func on_fs_state(packet_type_7: Dictionary, fs_mapping: Dictionary, fs_results: Dictionary) -> Dictionary:
|
||||
var 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': 27}
|
||||
]
|
||||
|
||||
static func on_fs_state(packet_type_7: Dictionary, fs_mapping: Dictionary, fs_results: Dictionary, fs_rules_config: Array) -> Dictionary:
|
||||
var updated_results := fs_results.duplicate()
|
||||
for fs_num in packet_type_7:
|
||||
if not (fs_num in fs_mapping and fs_mapping[fs_num]['condition']):
|
||||
continue
|
||||
var fs_data = packet_type_7[fs_num]
|
||||
for rule_key in FS_RULES.size():
|
||||
var rule: Dictionary = FS_RULES[rule_key]
|
||||
for rule in fs_rules_config:
|
||||
if _should_apply_rule(fs_num, rule, updated_results):
|
||||
updated_results[rule.key] = fs_data.isg
|
||||
break
|
||||
@@ -973,13 +853,13 @@ class TestPRD extends Node:
|
||||
if arr_litera.size() != 3:
|
||||
um_names = [
|
||||
['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'],
|
||||
['um_7', 'um_8', 'um_9', 'um_10', 'um_11', 'um_12']
|
||||
['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14']
|
||||
]
|
||||
else:
|
||||
um_names = [
|
||||
['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'],
|
||||
['um_8', 'um_9', 'um_10', 'um_11', 'um_12', 'um_13'],
|
||||
['um_7'] # Особый случай для третьего элемента
|
||||
['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'],
|
||||
['um_8']
|
||||
]
|
||||
|
||||
for litera_index in arr_litera.size():
|
||||
|
||||
Reference in New Issue
Block a user