Первый этап контроля ИП

This commit is contained in:
Maxim
2025-06-18 12:37:53 +03:00
parent 46ee559ebb
commit dcbc81c685
8 changed files with 121 additions and 81 deletions

View File

@@ -0,0 +1,78 @@
@tool
extends "res://scenes/контроль/прибор.gd"
enum STATE_VAL {
NONE = 0,
GOOD = 1,
ERROR = 2 }
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var unit_key = settings.get_unit_key(get_meta('unit_name')[0])
var unit_prd = network.units[unit_key]
unit_prd.connect('data_received', Callable(self, 'on_data_received'))
unit_prd.connect('line_changed', Callable(self, 'on_line_changed'))
set_default_state()
func set_default_state():
for group in get_tree().get_nodes_in_group('power_amplifier'):
group.state = STATE_VAL.NONE
func on_line_changed(unit_prd):
if not unit_prd.online:
set_default_state()
func on_data_received(unit_prd):
## Касета П1
var ug_online = (unit_prd.status[0] >> 1) & 1
if ug_online:
const BYTE_DRY_CONTACT: int = 27
const BIT_MAA2000_1: int = 0
const BIT_MAA2000_2: int = 1
const BIT_IP9_50_1: int = 2
const BIT_IP9_50_2: int = 3
const BIT_IP12_50_1: int = 4
var maa2000_1 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_MAA2000_1 & 1
var maa2000_2 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_MAA2000_2 & 1
var ip9_50_1 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_IP9_50_1 & 1
var ip9_50_2 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_IP9_50_2 & 1
var ip12_50_1 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_IP12_50_1 & 1
$maa2000_A23.state = STATE_VAL.ERROR if maa2000_1 else STATE_VAL.GOOD
$maa2000_A22.state = STATE_VAL.ERROR if maa2000_2 else STATE_VAL.GOOD
$kasseta_P_1/ref_A26.state = STATE_VAL.ERROR if ip9_50_1 else STATE_VAL.GOOD
$kasseta_P_1/ref_A23.state = STATE_VAL.ERROR if ip9_50_2 else STATE_VAL.GOOD
$kasseta_P_1/ref_A24.state = STATE_VAL.ERROR if ip12_50_1 else STATE_VAL.GOOD
else:
$maa2000_A23.state = STATE_VAL.NONE
$maa2000_A22.state = STATE_VAL.NONE
$kasseta_P_1/ref_A26.state = STATE_VAL.NONE
$kasseta_P_1/ref_A23.state = STATE_VAL.NONE
$kasseta_P_1/ref_A24.state = STATE_VAL.NONE
## Температуры УМ
const CONST_MIN_TEMP: int = -25
const MAXIMUM_CODE_ADC: int = 3796
const MINIMUM_CODE_AD: int = 2660
const TEMP: float = 115.0 / (MAXIMUM_CODE_ADC - MINIMUM_CODE_AD)
const TEMPERATURE_UKP_1: int = 47
const TEMPERATURE_UKP_2: int = 79
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
var ukp1_online: int = (unit_prd.status[0] >> 2) & 1
if ukp1_online:
for i_temp in range(6):
var temperature_ukp_1: int = unit_prd.status.decode_u16(TEMPERATURE_UKP_1 + 2 * i_temp)
var tmp_1: int = round(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3)
power_amplifier[i_temp].value0 = tmp_1
var ukp2_online = (unit_prd.status[0] >> 3) & 1
if ukp2_online:
for i_temp in range(6):
var temperature_ukp_2: int = unit_prd.status.decode_u16(TEMPERATURE_UKP_2 + 2 * i_temp)
var tmp_2: int = round(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3)
power_amplifier[i_temp+6].value0 = tmp_2

View File

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

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=9 format=3 uid="uid://dnuexoef2nnv5"]
[ext_resource type="Script" uid="uid://6m053dpg2lbh" path="res://scenes/контроль/прибор.gd" id="1_mcea3"]
[ext_resource type="Script" uid="uid://cto2r4ipew65m" path="res://scenes/pribor-prd-n/pribor-prd-n.gd" id="1_td743"]
[ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_lpj3d"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_i1no5"]
[ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="5_ej152"]
@@ -16,7 +16,16 @@ offset_left = 15.0
offset_top = 30.0
offset_right = 15.0
offset_bottom = 30.0
script = ExtResource("1_mcea3")
script = ExtResource("1_td743")
[node name="maa2000_A23" parent="." instance=ExtResource("2_lpj3d")]
layout_mode = 2
offset_left = 8.0
offset_top = 877.0
offset_right = 175.0
offset_bottom = 949.0
fname = "MAA2000"
rname = "A23"
[node name="maa2000_A22" parent="." instance=ExtResource("2_lpj3d")]
layout_mode = 2
@@ -36,15 +45,6 @@ offset_bottom = 877.0
fname = "ДОУ-2"
rname = "A5"
[node name="maa2000_A23" parent="." instance=ExtResource("2_lpj3d")]
layout_mode = 2
offset_left = 8.0
offset_top = 877.0
offset_right = 175.0
offset_bottom = 949.0
fname = "MAA2000"
rname = "A23"
[node name="dou2_A6" parent="." instance=ExtResource("2_lpj3d")]
layout_mode = 2
offset_left = 8.0
@@ -194,16 +194,12 @@ text = "Кассета П-1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="um1535_A7" parent="." instance=ExtResource("8_u7eqo")]
[node name="um1535_A7" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 485.0
offset_top = 242.0
offset_right = 652.0
offset_bottom = 337.0
value0 = 27.0
value1 = 56.0
max_value0 = 100.0
max_value1 = 100.0
value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
@@ -211,16 +207,12 @@ name_min_size1 = Vector2i(35, 20)
fname = "УМ1535А"
rname = "A7"
[node name="um1535_A8" parent="." instance=ExtResource("8_u7eqo")]
[node name="um1535_A8" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 485.0
offset_top = 337.0
offset_right = 652.0
offset_bottom = 432.0
value0 = 27.0
value1 = 56.0
max_value0 = 100.0
max_value1 = 100.0
value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
@@ -228,16 +220,12 @@ name_min_size1 = Vector2i(35, 20)
fname = "УМ1535А"
rname = "A8"
[node name="um1535_A9" parent="." instance=ExtResource("8_u7eqo")]
[node name="um1535_A9" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 485.0
offset_top = 432.0
offset_right = 652.0
offset_bottom = 527.0
value0 = 27.0
value1 = 56.0
max_value0 = 100.0
max_value1 = 100.0
value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
@@ -245,7 +233,7 @@ name_min_size1 = Vector2i(35, 20)
fname = "УМ1535А"
rname = "A9"
[node name="um1535_A10" parent="." instance=ExtResource("8_u7eqo")]
[node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 485.0
offset_top = 527.0
@@ -262,16 +250,12 @@ name_min_size1 = Vector2i(35, 20)
fname = "УМ1535А"
rname = "A10"
[node name="um1535_A11" parent="." instance=ExtResource("8_u7eqo")]
[node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 485.0
offset_top = 622.0
offset_right = 652.0
offset_bottom = 717.0
value0 = 27.0
value1 = 56.0
max_value0 = 100.0
max_value1 = 100.0
value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
@@ -279,16 +263,12 @@ name_min_size1 = Vector2i(35, 20)
fname = "УМ1535А"
rname = "A11"
[node name="um1535_A12" parent="." instance=ExtResource("8_u7eqo")]
[node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 485.0
offset_top = 717.0
offset_right = 652.0
offset_bottom = 812.0
value0 = 27.0
value1 = 56.0
max_value0 = 100.0
max_value1 = 100.0
value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
@@ -296,18 +276,12 @@ name_min_size1 = Vector2i(35, 20)
fname = "УМ1535А"
rname = "A12"
[node name="um1535_A13" parent="." instance=ExtResource("8_u7eqo")]
[node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 8.0
offset_top = 242.0
offset_right = 175.0
offset_bottom = 337.0
value0 = 27.0
value1 = 56.0
max_value0 = 100.0
max_value1 = 100.0
step0 = 1.0
step1 = 1.0
value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
@@ -315,16 +289,12 @@ name_min_size1 = Vector2i(35, 20)
fname = "УМ1535А"
rname = "A13"
[node name="um1535_A14" parent="." instance=ExtResource("8_u7eqo")]
[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 8.0
offset_top = 337.0
offset_right = 175.0
offset_bottom = 432.0
value0 = 27.0
value1 = 56.0
max_value0 = 100.0
max_value1 = 100.0
value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
@@ -332,16 +302,12 @@ name_min_size1 = Vector2i(35, 20)
fname = "УМ1535А"
rname = "A14"
[node name="um1535_A15" parent="." instance=ExtResource("8_u7eqo")]
[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 8.0
offset_top = 432.0
offset_right = 175.0
offset_bottom = 527.0
value0 = 27.0
value1 = 56.0
max_value0 = 100.0
max_value1 = 100.0
value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
@@ -349,16 +315,12 @@ name_min_size1 = Vector2i(35, 20)
fname = "УМ1535А"
rname = "A15"
[node name="um1535_A16" parent="." instance=ExtResource("8_u7eqo")]
[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 8.0
offset_top = 527.0
offset_right = 175.0
offset_bottom = 622.0
value0 = 27.0
value1 = 56.0
max_value0 = 100.0
max_value1 = 100.0
value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
@@ -366,16 +328,12 @@ name_min_size1 = Vector2i(35, 20)
fname = "УМ1535А"
rname = "A16"
[node name="um1535_A17" parent="." instance=ExtResource("8_u7eqo")]
[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 8.0
offset_top = 622.0
offset_right = 175.0
offset_bottom = 717.0
value0 = 27.0
value1 = 56.0
max_value0 = 100.0
max_value1 = 100.0
value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
@@ -383,16 +341,12 @@ name_min_size1 = Vector2i(35, 20)
fname = "УМ1535А"
rname = "A17"
[node name="um1535_A18" parent="." instance=ExtResource("8_u7eqo")]
[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 8.0
offset_top = 717.0
offset_right = 175.0
offset_bottom = 812.0
value0 = 27.0
value1 = 56.0
max_value0 = 100.0
max_value1 = 100.0
value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)

View File

@@ -1,3 +1,4 @@
@tool
extends "res://scenes/контроль/прибор.gd"
enum STATE_VAL {
@@ -35,8 +36,8 @@ func on_line_changed(unit_prd):
func on_data_received(unit_prd):
var ukp1_online = (unit_prd.status[0] >> 2) & 1
var ukp2_online = (unit_prd.status[0] >> 3) & 1
var _ukp1_online = (unit_prd.status[0] >> 2) & 1
var _ukp2_online = (unit_prd.status[0] >> 3) & 1
var ug_online = (unit_prd.status[0] >> 1) & 1
if ug_online:
pass

View File

@@ -219,7 +219,7 @@ vertical_alignment = 1
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 6
theme_override_font_sizes/font_size = 22
theme_override_font_sizes/font_size = 18
horizontal_alignment = 2
vertical_alignment = 1
@@ -231,10 +231,12 @@ size_flags_vertical = 6
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
max_value = 100.0
[node name="indicator1" parent="margin/vbox/grid1" instance=ExtResource("5_3i5am")]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
max_value = 3000.0
[connection signal="pressed" from="button" to="." method="_on_button_pressed"]

View File

@@ -1,3 +1,4 @@
@tool
extends "res://scenes/контроль/кассета.gd"
enum STATE_VAL {
@@ -39,6 +40,9 @@ func on_data_received(unit_prd):
$ref_A35.state = STATE_VAL.GOOD if (unit_prd.status[0] >> 2) & 1 else STATE_VAL.ERROR
$ref_A36.state = STATE_VAL.GOOD if (unit_prd.status[0] >> 3) & 1 else STATE_VAL.ERROR
if ug_online:
$ref_A31.state = STATE_VAL.GOOD if (unit_prd.status[27] >> 7) & 1 else STATE_VAL.ERROR
var byte_dry_contact: int = 27
var bit_ip5_25: int = 7
var ip5_25 = unit_prd.status[byte_dry_contact] >> bit_ip5_25 & 1
$ref_A31.state = STATE_VAL.ERROR if ip5_25 else STATE_VAL.GOOD
else:
$ref_A31.state = STATE_VAL.NONE

View File

@@ -89,7 +89,7 @@ layout_mode = 0
offset_top = 8.0
offset_right = 50.0
offset_bottom = 34.0
theme_override_font_sizes/font_size = 22
theme_override_font_sizes/font_size = 18
text = "A1"
horizontal_alignment = 1
vertical_alignment = 1
@@ -97,9 +97,9 @@ vertical_alignment = 1
[node name="lbl_fname" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 0
offset_top = 111.0
offset_top = 119.0
offset_right = 84.0
offset_bottom = 161.0
offset_bottom = 169.0
rotation = -1.5708
theme_override_font_sizes/font_size = 17
text = "Ячейка"

View File

@@ -53,7 +53,7 @@ const PRD_NAMES: Array = [
'уарэп-яу07-4в',
'уарэп-яу07-4к', ]
## Соответствие модулей ФС их нахождуению в приборе ПРД и номеру от КАПС РПБ
## Соответствие модулей ФС их нахождению в приборе ПРД и номеру от КАПС РПБ
const FS_PRD: Dictionary = {
0: ['уарэп-яу07-1к', 17],
1: ['уарэп-яу07-4к', 65],
@@ -79,10 +79,10 @@ const FS_PRD: Dictionary = {
21: ['уарэп-яу07-4к', 70],
22: ['уарэп-яу07-3к', 54],
23: ['уарэп-яу07-2к', 38],
24: ['уарэп-яу07-1к', 31],
25: ['уарэп-яу07-4к', 87],
26: ['уарэп-яу07-3к', 63],
27: ['уарэп-яу07-2к', 47], }
24: ['уарэп-яу07-1к', 23],
25: ['уарэп-яу07-4к', 71],
26: ['уарэп-яу07-3к', 55],
27: ['уарэп-яу07-2к', 39], }
var fs_dict: Dictionary ## Словарь с модулями ФС
var prd_dict: Dictionary ## Словарь с приборами ПРД