diff --git a/project.godot b/project.godot index 31c3bfb2..348f45aa 100644 --- a/project.godot +++ b/project.godot @@ -84,6 +84,7 @@ gdscript/warnings/integer_division=0 window/size/viewport_width=1600 window/size/viewport_height=1200 +window/size/mode=3 window/subwindows/embed_subwindows=false window/stretch/mode="canvas_items" window/dpi/allow_hidpi=false diff --git a/scenes/pribor-prd-k/kasseta-fs-kd.tscn b/scenes/pribor-prd-k/kasseta-fs-kd.tscn index dd269f65..9bab5bf2 100644 --- a/scenes/pribor-prd-k/kasseta-fs-kd.tscn +++ b/scenes/pribor-prd-k/kasseta-fs-kd.tscn @@ -22,7 +22,7 @@ offset_left = 5.0 offset_top = 7.0 offset_right = 303.0 offset_bottom = 33.0 -text = "Кассета" +text = "Кассета ФС-КД" horizontal_alignment = 1 vertical_alignment = 1 @@ -31,23 +31,23 @@ offset_left = 5.0 offset_top = 33.0 offset_right = 55.0 offset_bottom = 183.0 -fname = "Модуль ФС" -rname = "A1" +fname = "Блок ФС-1" +rname = "A4" [node name="ref_A3" parent="." instance=ExtResource("3_kqnvt")] offset_left = 55.0 offset_top = 33.0 offset_right = 105.0 offset_bottom = 183.0 -fname = "Блок ФС-1" -rname = "A4" +fname = "Модуль ФС" +rname = "A1" [node name="ref_A4" parent="." instance=ExtResource("3_kqnvt")] offset_left = 105.0 offset_top = 33.0 offset_right = 155.0 offset_bottom = 183.0 -fname = "Модуль ФС" +fname = "Блок ФС-2" rname = "A2" [node name="ref_A6" parent="." instance=ExtResource("3_kqnvt")] @@ -55,7 +55,7 @@ offset_left = 155.0 offset_top = 33.0 offset_right = 205.0 offset_bottom = 183.0 -fname = "Блок ФС-6" +fname = "Модуль ФС" rname = "A5" [node name="ref_A5" parent="." instance=ExtResource("3_kqnvt")] @@ -71,5 +71,5 @@ offset_left = 255.0 offset_top = 33.0 offset_right = 305.0 offset_bottom = 183.0 -fname = "Блок ФС-2" +fname = "Блок ФС-6" rname = "A6" diff --git a/scenes/pribor-prd-k/pribor-prd-k.tscn b/scenes/pribor-prd-k/pribor-prd-k.tscn index 8dfe8643..ca1858b7 100644 --- a/scenes/pribor-prd-k/pribor-prd-k.tscn +++ b/scenes/pribor-prd-k/pribor-prd-k.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=11 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://6m053dpg2lbh" path="res://scenes/контроль/прибор.gd" id="1_ufjwe"] +[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="Script" uid="uid://dow4nqi6hbak8" path="res://scenes/контроль/кассета-у-5.gd" id="3_wip3a"] @@ -18,7 +18,7 @@ offset_left = 15.0 offset_top = 30.0 offset_right = 15.0 offset_bottom = 30.0 -script = ExtResource("1_ufjwe") +script = ExtResource("1_tpdyp") [node name="kasseta_u5" parent="." instance=ExtResource("2_tb85r")] layout_mode = 0 @@ -36,7 +36,7 @@ offset_top = 907.0 offset_right = 652.0 offset_bottom = 949.0 fname = "MAA2000" -rname = "A27" +rname = "A28" [node name="dou2_A7" parent="." instance=ExtResource("1_8dmgr")] layout_mode = 0 @@ -54,7 +54,7 @@ offset_top = 907.0 offset_right = 175.0 offset_bottom = 949.0 fname = "MAA2000" -rname = "A28" +rname = "A27" [node name="dou2_A8" parent="." instance=ExtResource("1_8dmgr")] layout_mode = 0 @@ -95,12 +95,6 @@ offset_left = 485.0 offset_top = 242.0 offset_right = 652.0 offset_bottom = 337.0 -value0 = 28.0 -value1 = 70.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -114,12 +108,6 @@ offset_left = 485.0 offset_top = 337.0 offset_right = 652.0 offset_bottom = 432.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -133,12 +121,6 @@ offset_left = 485.0 offset_top = 432.0 offset_right = 652.0 offset_bottom = 527.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -152,12 +134,6 @@ offset_left = 485.0 offset_top = 527.0 offset_right = 652.0 offset_bottom = 622.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -171,12 +147,6 @@ offset_left = 485.0 offset_top = 622.0 offset_right = 652.0 offset_bottom = 717.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -190,12 +160,6 @@ offset_left = 485.0 offset_top = 717.0 offset_right = 652.0 offset_bottom = 812.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -209,12 +173,6 @@ offset_left = 485.0 offset_top = 812.0 offset_right = 652.0 offset_bottom = 907.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -228,12 +186,6 @@ offset_left = 8.0 offset_top = 242.0 offset_right = 175.0 offset_bottom = 337.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -247,12 +199,6 @@ offset_left = 8.0 offset_top = 337.0 offset_right = 173.0 offset_bottom = 432.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -266,12 +212,6 @@ offset_left = 8.0 offset_top = 432.0 offset_right = 175.0 offset_bottom = 527.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -285,12 +225,6 @@ offset_left = 8.0 offset_top = 527.0 offset_right = 175.0 offset_bottom = 622.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -304,12 +238,6 @@ offset_left = 8.0 offset_top = 622.0 offset_right = 175.0 offset_bottom = 717.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -323,12 +251,6 @@ offset_left = 8.0 offset_top = 717.0 offset_right = 175.0 offset_bottom = 812.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -363,8 +285,8 @@ offset_left = 9.0 offset_top = 33.0 offset_right = 59.0 offset_bottom = 183.0 -fname = "ИП12-50" -rname = "A26" +fname = "ИП9-50" +rname = "A23" [node name="ref_A23" parent="kasseta_p_1" instance=ExtResource("8_la5yt")] offset_left = 59.0 @@ -379,8 +301,8 @@ offset_left = 109.0 offset_top = 33.0 offset_right = 159.0 offset_bottom = 183.0 -fname = "ИП9-50" -rname = "A23" +fname = "ИП12-50" +rname = "A26" [node name="lbl_fname" type="Label" parent="kasseta_p_1"] self_modulate = Color(1, 1, 1, 0.62) diff --git a/scenes/pribor-prd-k/pribor_prd_k.gd b/scenes/pribor-prd-k/pribor_prd_k.gd new file mode 100644 index 00000000..0a10721e --- /dev/null +++ b/scenes/pribor-prd-k/pribor_prd_k.gd @@ -0,0 +1,32 @@ +@tool +extends "res://scenes/контроль/прибор.gd" + +enum STATE_VAL { + NONE = 0, + GOOD = 1, + ERROR = 2 } + + +func _ready() -> void: + pass + #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(): + $utm80_A9.state = STATE_VAL.NONE + $um1535_A10.state = STATE_VAL.NONE + $um1535_A11.state = STATE_VAL.NONE + $um1535_A12.state = STATE_VAL.NONE + $um1535_A13.state = STATE_VAL.NONE + $um1535_A14.state = STATE_VAL.NONE + $um1535_A15.state = STATE_VAL.NONE + $um1535_A16.state = STATE_VAL.NONE + $um1535_A17.state = STATE_VAL.NONE + $um1535_A18.state = STATE_VAL.NONE + $um1535_A19.state = STATE_VAL.NONE + $um1535_A20.state = STATE_VAL.NONE + $um1535_A21.state = STATE_VAL.NONE diff --git a/scenes/pribor-prd-k/pribor_prd_k.gd.uid b/scenes/pribor-prd-k/pribor_prd_k.gd.uid new file mode 100644 index 00000000..3493cb8b --- /dev/null +++ b/scenes/pribor-prd-k/pribor_prd_k.gd.uid @@ -0,0 +1 @@ +uid://cwvikiygf8b1m diff --git a/scenes/pribor-prd-n/kasseta-fs-nd.tscn b/scenes/pribor-prd-n/kasseta-fs-nd.tscn index 1af690cf..b69f57e5 100644 --- a/scenes/pribor-prd-n/kasseta-fs-nd.tscn +++ b/scenes/pribor-prd-n/kasseta-fs-nd.tscn @@ -22,7 +22,7 @@ offset_left = 5.0 offset_top = 7.0 offset_right = 303.0 offset_bottom = 33.0 -text = "Кассета" +text = "Кассета ФС-ВД" horizontal_alignment = 1 vertical_alignment = 1 @@ -31,16 +31,16 @@ offset_left = 55.0 offset_top = 32.0 offset_right = 105.0 offset_bottom = 182.0 -fname = "Модуль ФС" -rname = "A1" +fname = "Блок ФС-3" +rname = "A3" [node name="ref_A3" parent="." instance=ExtResource("2_mkgdh")] offset_left = 105.0 offset_top = 32.0 offset_right = 155.0 offset_bottom = 182.0 -fname = "Блок ФС-3" -rname = "A3" +fname = "Модуль ФС" +rname = "A1" [node name="ref_A4" parent="." instance=ExtResource("2_mkgdh")] offset_left = 155.0 diff --git a/scenes/pribor-prd-n/pribor-prd-n.tscn b/scenes/pribor-prd-n/pribor-prd-n.tscn index 718c3386..1e23a7ec 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.tscn +++ b/scenes/pribor-prd-n/pribor-prd-n.tscn @@ -1,13 +1,38 @@ -[gd_scene load_steps=9 format=3 uid="uid://dnuexoef2nnv5"] +[gd_scene load_steps=14 format=3 uid="uid://dnuexoef2nnv5"] -[ext_resource type="Script" uid="uid://6m053dpg2lbh" path="res://scenes/контроль/прибор.gd" id="1_mcea3"] -[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"] -[ext_resource type="Script" uid="uid://dow4nqi6hbak8" path="res://scenes/контроль/кассета-у-5.gd" id="5_hne5j"] -[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_b1cob"] -[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_dqc3e"] -[ext_resource type="PackedScene" uid="uid://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="8_u7eqo"] +[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://dow4nqi6hbak8" path="res://scenes/контроль/кассета-у-5.gd" id="5_1wf07"] +[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_b5wvk"] +[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_eoqf2"] +[ext_resource type="PackedScene" uid="uid://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="8_sia5h"] +[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="9_k1x0o"] +[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="10_7dcjd"] +[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="11_ius1v"] + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_bnnv3"] + +[sub_resource type="SpriteFrames" id="SpriteFrames_xkifg"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("9_k1x0o") +}, { +"duration": 1.0, +"texture": ExtResource("10_7dcjd") +}, { +"duration": 1.0, +"texture": ExtResource("11_ius1v") +}, { +"duration": 1.0, +"texture": null +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] [node name="pribor_prd_n" type="Control"] layout_mode = 3 @@ -16,27 +41,9 @@ offset_left = 15.0 offset_top = 30.0 offset_right = 15.0 offset_bottom = 30.0 -script = ExtResource("1_mcea3") +script = ExtResource("1_bnnv3") -[node name="maa2000_A22" parent="." instance=ExtResource("2_lpj3d")] -layout_mode = 2 -offset_left = 485.0 -offset_top = 877.0 -offset_right = 652.0 -offset_bottom = 949.0 -fname = "MAA2000" -rname = "A22" - -[node name="dou2_A5" parent="." instance=ExtResource("2_lpj3d")] -layout_mode = 2 -offset_left = 485.0 -offset_top = 812.0 -offset_right = 652.0 -offset_bottom = 877.0 -fname = "ДОУ-2" -rname = "A5" - -[node name="maa2000_A23" parent="." instance=ExtResource("2_lpj3d")] +[node name="maa2000_A23" parent="." instance=ExtResource("2_is25t")] layout_mode = 2 offset_left = 8.0 offset_top = 877.0 @@ -45,7 +52,25 @@ offset_bottom = 949.0 fname = "MAA2000" rname = "A23" -[node name="dou2_A6" parent="." instance=ExtResource("2_lpj3d")] +[node name="maa2000_A22" parent="." instance=ExtResource("2_is25t")] +layout_mode = 2 +offset_left = 485.0 +offset_top = 877.0 +offset_right = 652.0 +offset_bottom = 949.0 +fname = "MAA2000" +rname = "A22" + +[node name="dou2_A5" parent="." instance=ExtResource("2_is25t")] +layout_mode = 2 +offset_left = 485.0 +offset_top = 812.0 +offset_right = 652.0 +offset_bottom = 877.0 +fname = "ДОУ-2" +rname = "A5" + +[node name="dou2_A6" parent="." instance=ExtResource("2_is25t")] layout_mode = 2 offset_left = 8.0 offset_top = 812.0 @@ -60,7 +85,7 @@ offset_left = 175.0 offset_top = 812.0 offset_right = 485.0 offset_bottom = 949.0 -texture = ExtResource("4_i1no5") +texture = ExtResource("3_meukj") patch_margin_left = 16 patch_margin_top = 16 patch_margin_right = 16 @@ -78,13 +103,13 @@ text = "Панель horizontal_alignment = 1 vertical_alignment = 1 -[node name="kasseta_U5" parent="." instance=ExtResource("5_ej152")] +[node name="kasseta_U5" parent="." instance=ExtResource("4_xkifg")] layout_mode = 0 offset_left = 175.0 offset_top = 242.0 offset_right = 485.0 offset_bottom = 432.0 -script = ExtResource("5_hne5j") +script = ExtResource("5_1wf07") fname = "Кассета У5" [node name="kasseta_FS_ND" type="NinePatchRect" parent="."] @@ -93,12 +118,12 @@ offset_left = 175.0 offset_top = 432.0 offset_right = 485.0 offset_bottom = 622.0 -texture = ExtResource("4_i1no5") +texture = ExtResource("3_meukj") patch_margin_left = 16 patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 -script = ExtResource("6_b1cob") +script = ExtResource("6_b5wvk") fname = "Кассета ФС-НД" metadata/Fname = "" @@ -113,23 +138,23 @@ text = "Кассета ФС-НД" horizontal_alignment = 1 vertical_alignment = 1 -[node name="ref_A2" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +[node name="ref_A3" parent="kasseta_FS_ND" instance=ExtResource("7_eoqf2")] offset_left = 55.0 offset_top = 32.0 offset_right = 105.0 offset_bottom = 182.0 -fname = "Модуль ФС" -rname = "A1" +fname = "Блок ФС-3" +rname = "A3" -[node name="ref_A3" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +[node name="ref_A1" parent="kasseta_FS_ND" instance=ExtResource("7_eoqf2")] offset_left = 105.0 offset_top = 32.0 offset_right = 155.0 offset_bottom = 182.0 -fname = "Блок ФС-2" -rname = "A3" +fname = "Модуль ФС" +rname = "A1" -[node name="ref_A4" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +[node name="ref_A2" parent="kasseta_FS_ND" instance=ExtResource("7_eoqf2")] offset_left = 155.0 offset_top = 32.0 offset_right = 205.0 @@ -137,12 +162,12 @@ offset_bottom = 182.0 fname = "Модуль ФС" rname = "A2" -[node name="ref_A6" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +[node name="ref_A4" parent="kasseta_FS_ND" instance=ExtResource("7_eoqf2")] offset_left = 205.0 offset_top = 32.0 offset_right = 255.0 offset_bottom = 182.0 -fname = "Блок ФС-3" +fname = "Блок ФС-2" rname = "A4" [node name="kasseta_P_1" type="NinePatchRect" parent="."] @@ -151,23 +176,23 @@ offset_left = 175.0 offset_top = 622.0 offset_right = 485.0 offset_bottom = 812.0 -texture = ExtResource("4_i1no5") +texture = ExtResource("3_meukj") patch_margin_left = 16 patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 -script = ExtResource("6_b1cob") +script = ExtResource("6_b5wvk") fname = "Кассета П-1" -[node name="ref_A26" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] +[node name="ref_A21" parent="kasseta_P_1" instance=ExtResource("7_eoqf2")] offset_left = 9.0 offset_top = 33.0 offset_right = 59.0 offset_bottom = 183.0 -fname = "ИП9-50" -rname = "A19" +fname = "ИП12-50" +rname = "A21" -[node name="ref_A23" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] +[node name="ref_A20" parent="kasseta_P_1" instance=ExtResource("7_eoqf2")] offset_left = 59.0 offset_top = 33.0 offset_right = 109.0 @@ -175,13 +200,13 @@ offset_bottom = 183.0 fname = "ИП9-50" rname = "A20" -[node name="ref_A24" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] +[node name="ref_A19" parent="kasseta_P_1" instance=ExtResource("7_eoqf2")] offset_left = 109.0 offset_top = 33.0 offset_right = 159.0 offset_bottom = 183.0 -fname = "ИП12-50" -rname = "A21" +fname = "ИП9-50" +rname = "A19" [node name="lbl_fname" type="Label" parent="kasseta_P_1"] self_modulate = Color(1, 1, 1, 0.62) @@ -194,16 +219,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_sia5h")] 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 +232,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_sia5h")] 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 +245,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_sia5h")] 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,16 +258,12 @@ 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_sia5h")] layout_mode = 0 offset_left = 485.0 offset_top = 527.0 offset_right = 652.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) @@ -262,16 +271,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_sia5h")] 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 +284,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_sia5h")] 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 +297,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_sia5h")] 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 +310,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_sia5h")] 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 +323,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_sia5h")] 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 +336,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_sia5h")] 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 +349,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_sia5h")] 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,19 +362,87 @@ 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_sia5h")] 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) name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A18" + +[node name="Monitoring_panel" type="Panel" parent="."] +layout_mode = 0 +theme_override_styles/panel = SubResource("StyleBoxTexture_bnnv3") + +[node name="in_fs_1" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(454, 577) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_xkifg") + +[node name="in_fs_1" type="Label" parent="Monitoring_panel/in_fs_1"] +offset_left = -15.1667 +offset_top = 14.0 +offset_right = 14.8333 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "In FS 1" +horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true + +[node name="in_fs_2" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(207, 577) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_xkifg") + +[node name="in_fs_2" type="Label" parent="Monitoring_panel/in_fs_2"] +offset_left = -15.1667 +offset_top = 14.0 +offset_right = 14.8333 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "In FS 2" +horizontal_alignment = 1 + +[node name="out_ems_1" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(454, 465) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_xkifg") + +[node name="Out_ems_1" type="Label" parent="Monitoring_panel/out_ems_1"] +anchors_preset = -1 +anchor_left = 0.0185185 +anchor_right = 0.0185185 +anchor_bottom = 0.555556 +offset_left = -18.5 +offset_top = 14.0 +offset_right = 17.5 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "Out +ems 1" +horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true + +[node name="out_ems_2" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(207, 465) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_xkifg") + +[node name="Out_ems_1" type="Label" parent="Monitoring_panel/out_ems_2"] +offset_left = -15.1667 +offset_top = 14.0 +offset_right = 14.8333 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "Out +ems 2" +horizontal_alignment = 1 diff --git a/scenes/pribor-prd-n/pribor_prd_n.gd b/scenes/pribor-prd-n/pribor_prd_n.gd new file mode 100644 index 00000000..6f822dd7 --- /dev/null +++ b/scenes/pribor-prd-n/pribor_prd_n.gd @@ -0,0 +1,186 @@ +@tool +extends "res://scenes/контроль/прибор.gd" + +const IN_BLANK_PRD: int = 1 +const OUT_BLANK_PRD: int = 13 +const CI_2_OT_FS: int = 9 +const CI_3_OT_FS: int = 10 +const CI_2_B_UF: int = 1 +const CI_3_B_UF: int = 2 +const POWER_UKP_1: int = 31 +const POWER_UKP_2: int = 63 + +var timer_03: Timer = Timer.new() +var count_packet_1:int = 0 +var power_array_1: Array = [] +var count_packet_2:int = 0 +var power_array_2: Array = [] + +enum STATE_VAL { + NONE = 0, + GOOD = 1, + ERROR = 2 } + + +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() + self.add_child(timer_03) + timer_03.connect('timeout', Callable(self, 'on_timer_03')) + #on_timer_03(unit_key) + + +func set_default_state() -> void: + for group in get_tree().get_nodes_in_group('power_amplifier'): + group.state = STATE_VAL.NONE + + +func on_line_changed(unit_prd: Object) -> void: + if not unit_prd.online: + set_default_state() + + +func on_data_received(unit_prd: Object) -> void: + if not is_inside_tree(): + return + + check_block_ip(unit_prd.status) + check_temperature_um(unit_prd.status) + + ## Контроль ЭМС + #_process_ems_data(unit_prd) + + var in_blank: int = unit_prd.status.decode_u16(IN_BLANK_PRD) + var out_blank: int = unit_prd.status.decode_u16(OUT_BLANK_PRD) + + $Monitoring_panel/in_fs_1.frame = (in_blank >> CI_2_OT_FS) & 1 + $Monitoring_panel/in_fs_2.frame = (in_blank >> CI_3_OT_FS) & 1 + + $Monitoring_panel/out_ems_1.frame = (out_blank >> CI_2_B_UF) & 1 + $Monitoring_panel/out_ems_2.frame = (out_blank >> CI_3_B_UF) & 1 + + ## Мощность УМ от УКП 1 + if (in_blank >> CI_2_OT_FS) & 1: + const bit_dkm_1: int = 1 + check_dkm(unit_prd.status, bit_dkm_1) + + var arr_power_ukp_1: Array = [] + + if (unit_prd.status[0] >> 2) & 1: + for i_power in range(6): + var power_ukp_1 = unit_prd.status.decode_u16(POWER_UKP_1 + 2 * i_power) + arr_power_ukp_1.append(power_ukp_1) + + if count_packet_1 == 0: + power_array_1 = arr_power_ukp_1 + else: + for i in arr_power_ukp_1.size(): + if arr_power_ukp_1[i] > power_array_1[i]: + power_array_1[i] = arr_power_ukp_1[i] + + var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') + for i in 6: + power_amplifier[i].value1 = '%d' % power_array_1[i] + + count_packet_1 += 1 + + ## Мощность УМ от УКП 2 + if (in_blank >> CI_3_OT_FS) & 1: + const bit_dkm_2: int = 2 + check_dkm(unit_prd.status, bit_dkm_2) + + var arr_power_ukp_2: Array = [] + + if (unit_prd.status[0] >> 2) & 1: + for i_power in range(6): + var power_ukp_2 = unit_prd.status.decode_u16(POWER_UKP_2 + 2 * i_power) + arr_power_ukp_2.append(power_ukp_2) + + if count_packet_2 == 0: + power_array_2 = arr_power_ukp_2 + else: + for i in arr_power_ukp_2.size(): + if arr_power_ukp_2[i] > power_array_2[i]: + power_array_2[i] = arr_power_ukp_2[i] + + var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') + for i in 6: + power_amplifier[i+6].value1 = '%d' % power_array_2[i] + + count_packet_2 += 1 + + +## Проверка касет П1 и ИП МА2000 +func check_block_ip(status_prd: PackedByteArray) -> void : + var ug_online: bool = (status_prd[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 = status_prd[BYTE_DRY_CONTACT] >> BIT_MAA2000_1 & 1 + var maa2000_2 = status_prd[BYTE_DRY_CONTACT] >> BIT_MAA2000_2 & 1 + var ip9_50_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP9_50_1 & 1 + var ip9_50_2 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP9_50_2 & 1 + var ip12_50_1 = status_prd[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_A20.state = STATE_VAL.ERROR if ip9_50_1 else STATE_VAL.GOOD + $kasseta_P_1/ref_A21.state = STATE_VAL.ERROR if ip9_50_2 else STATE_VAL.GOOD + $kasseta_P_1/ref_A19.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_A19.state = STATE_VAL.NONE + $kasseta_P_1/ref_A20.state = STATE_VAL.NONE + $kasseta_P_1/ref_A21.state = STATE_VAL.NONE + + +## Проверка температур УМ от УКП +func check_temperature_um(status_prd: PackedByteArray) -> void: + 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 = (status_prd[0] >> 2) & 1 + if ukp1_online: + for i_temp in range(6): + var temperature_ukp_1: int = status_prd.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 = (status_prd[0] >> 3) & 1 + if ukp2_online: + for i_temp in range(6): + var temperature_ukp_2: int = status_prd.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 + + +## Проверка ДКМ +func check_dkm(status_prd: PackedByteArray, bit_dkm: int) -> void: + const DKM: int = 28 + + var status_dkm = status_prd[DKM] >> bit_dkm & 1 + + if bit_dkm == 1: + $dou2_A5.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + $kasseta_FS_ND/ref_A4.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + elif bit_dkm == 2: + $dou2_A6.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + $kasseta_FS_ND/ref_A3.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + + +#func on_timer_03(unit_name): + #print(unit_name) diff --git a/scenes/pribor-prd-n/pribor_prd_n.gd.uid b/scenes/pribor-prd-n/pribor_prd_n.gd.uid new file mode 100644 index 00000000..b3c223e6 --- /dev/null +++ b/scenes/pribor-prd-n/pribor_prd_n.gd.uid @@ -0,0 +1 @@ +uid://cto2r4ipew65m diff --git a/scenes/pribor-prd-v/pribor-prd-v.tscn b/scenes/pribor-prd-v/pribor-prd-v.tscn index 31a0b302..fa342304 100644 --- a/scenes/pribor-prd-v/pribor-prd-v.tscn +++ b/scenes/pribor-prd-v/pribor-prd-v.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=3 uid="uid://cvskpe1ti3p45"] +[gd_scene load_steps=15 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"] @@ -9,8 +9,33 @@ [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://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="7_e22c6"] +[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="10_4e87c"] +[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="11_g8fvp"] +[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="12_gsby4"] -[node name="pribor_prd_n" type="Control"] +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_vxfkm"] + +[sub_resource type="SpriteFrames" id="SpriteFrames_s5gcy"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("10_4e87c") +}, { +"duration": 1.0, +"texture": ExtResource("11_g8fvp") +}, { +"duration": 1.0, +"texture": ExtResource("12_gsby4") +}, { +"duration": 1.0, +"texture": null +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[node name="pribor_prd_v" type="Control"] layout_mode = 3 anchors_preset = 0 offset_left = 15.0 @@ -110,7 +135,7 @@ patch_margin_bottom = 16 script = ExtResource("6_os4mt") fname = "Кассета П-1В" -[node name="ref_A26" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] +[node name="ref_A19" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] offset_left = 9.0 offset_top = 33.0 offset_right = 59.0 @@ -118,7 +143,7 @@ offset_bottom = 183.0 fname = "ИП9-50" rname = "A19" -[node name="ref_A23" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] +[node name="ref_A20" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] offset_left = 59.0 offset_top = 33.0 offset_right = 109.0 @@ -126,7 +151,7 @@ offset_bottom = 183.0 fname = "ИП9-50" rname = "A20" -[node name="ref_A24" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] +[node name="ref_A21" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] offset_left = 109.0 offset_top = 33.0 offset_right = 159.0 @@ -145,16 +170,12 @@ text = "Кассета П-1В" horizontal_alignment = 1 vertical_alignment = 1 -[node name="um1535_A7" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A7" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 485.0 offset_top = 242.0 offset_right = 652.0 offset_bottom = 337.0 -value0 = 91.0 -value1 = 22.0 -max_value0 = 100.0 -max_value1 = 100.0 step0 = 1.0 step1 = 1.0 value_name0 = "°C" @@ -164,18 +185,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A7" -[node name="um1535_A8" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A8" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 485.0 offset_top = 337.0 offset_right = 652.0 offset_bottom = 432.0 -value0 = 91.0 -value1 = 22.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) @@ -183,18 +198,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A8" -[node name="um1535_A9" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A9" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 485.0 offset_top = 432.0 offset_right = 652.0 offset_bottom = 527.0 -value0 = 91.0 -value1 = 22.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) @@ -202,18 +211,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A9" -[node name="um1535_A10" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 485.0 offset_top = 527.0 offset_right = 652.0 offset_bottom = 622.0 -value0 = 91.0 -value1 = 22.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) @@ -221,18 +224,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A10" -[node name="um1535_A11" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 485.0 offset_top = 622.0 offset_right = 652.0 offset_bottom = 717.0 -value0 = 91.0 -value1 = 22.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) @@ -240,18 +237,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A11" -[node name="um1535_A12" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 485.0 offset_top = 717.0 offset_right = 652.0 offset_bottom = 812.0 -value0 = 91.0 -value1 = 22.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) @@ -259,18 +250,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A12" -[node name="um1535_A13" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 8.0 offset_top = 242.0 offset_right = 175.0 offset_bottom = 337.0 -value0 = 91.0 -value1 = 33.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) @@ -278,18 +263,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A13" -[node name="um1535_A14" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 8.0 offset_top = 337.0 offset_right = 175.0 offset_bottom = 432.0 -value0 = 91.0 -value1 = 33.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) @@ -297,18 +276,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A14" -[node name="um1535_A15" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 8.0 offset_top = 432.0 offset_right = 175.0 offset_bottom = 527.0 -value0 = 91.0 -value1 = 33.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) @@ -316,18 +289,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A15" -[node name="um1535_A16" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 8.0 offset_top = 527.0 offset_right = 175.0 offset_bottom = 622.0 -value0 = 91.0 -value1 = 33.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) @@ -335,18 +302,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A16" -[node name="um1535_A17" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 8.0 offset_top = 622.0 offset_right = 175.0 offset_bottom = 717.0 -value0 = 91.0 -value1 = 33.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) @@ -354,21 +315,87 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A17" -[node name="um1535_A18" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 8.0 offset_top = 717.0 offset_right = 175.0 offset_bottom = 812.0 -value0 = 91.0 -value1 = 33.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) name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A18" + +[node name="Monitoring_panel" type="Panel" parent="."] +layout_mode = 0 +theme_override_styles/panel = SubResource("StyleBoxTexture_vxfkm") + +[node name="in_fs_1" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(454, 577) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_s5gcy") + +[node name="in_fs_1" type="Label" parent="Monitoring_panel/in_fs_1"] +offset_left = -15.1667 +offset_top = 14.0 +offset_right = 14.8333 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "In FS 1" +horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true + +[node name="in_fs_2" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(207, 577) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_s5gcy") + +[node name="in_fs_2" type="Label" parent="Monitoring_panel/in_fs_2"] +offset_left = -15.1667 +offset_top = 14.0 +offset_right = 14.8333 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "In FS 2" +horizontal_alignment = 1 + +[node name="out_ems_1" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(454, 465) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_s5gcy") + +[node name="Out_ems_1" type="Label" parent="Monitoring_panel/out_ems_1"] +anchors_preset = -1 +anchor_left = 0.0185185 +anchor_right = 0.0185185 +anchor_bottom = 0.555556 +offset_left = -18.5 +offset_top = 14.0 +offset_right = 17.5 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "Out +ems 1" +horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true + +[node name="out_ems_2" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(207, 465) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_s5gcy") + +[node name="Out_ems_1" type="Label" parent="Monitoring_panel/out_ems_2"] +offset_left = -15.1667 +offset_top = 14.0 +offset_right = 14.8333 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "Out +ems 2" +horizontal_alignment = 1 diff --git a/scenes/pribor-prd-v/pribor_prd_v.gd b/scenes/pribor-prd-v/pribor_prd_v.gd index 5fcc0fdb..76a70d2b 100644 --- a/scenes/pribor-prd-v/pribor_prd_v.gd +++ b/scenes/pribor-prd-v/pribor_prd_v.gd @@ -1,44 +1,257 @@ +@tool extends "res://scenes/контроль/прибор.gd" +const IN_BLANK_PRD: int = 1 +const OUT_BLANK_PRD: int = 13 +const CI_4_OT_FS: int = 11 +const CI_5_OT_FS: int = 12 +const CI_4_B_UF: int = 1 +const CI_5_B_UF: int = 2 +const POWER_UKP_1: int = 31 +const POWER_UKP_2: int = 63 +const bit_dkm_3: int = 3 +const bit_dkm_4: int = 4 + +var count_packet_1:int = 0 +var power_array_1: Array = [] +var count_packet_2:int = 0 +var power_array_2: Array = [] +var currecnt_unit: String + enum STATE_VAL { NONE = 0, GOOD = 1, ERROR = 2 } -# Called when the node enters the scene tree for the first time. +var control_timer: Timer = Timer.new() +var flag_control: bool = false + + func _ready() -> void: + signaller.conn(signaller.fs_update_state, Callable(self, 'on_fs_update_state')) var unit_key = settings.get_unit_key(get_meta('unit_name')[0]) var unit_prd = network.units[unit_key] + currecnt_unit = unit_prd.name unit_prd.connect('data_received', Callable(self, 'on_data_received')) unit_prd.connect('line_changed', Callable(self, 'on_line_changed')) set_default_state() + self.add_child(control_timer) + control_timer.connect('timeout', Callable(self, 'on_stop_control')) + _on_control_fs(true) + control_timer.one_shot = true + control_timer.wait_time = 2.0 + control_timer.start() -func set_default_state(): - $um1535_A7.state = STATE_VAL.NONE - $um1535_A8.state = STATE_VAL.NONE - $um1535_A9.state = STATE_VAL.NONE - $um1535_A10.state = STATE_VAL.NONE - $um1535_A11.state = STATE_VAL.NONE - $um1535_A12.state = STATE_VAL.NONE - $um1535_A13.state = STATE_VAL.NONE - $um1535_A14.state = STATE_VAL.NONE - $um1535_A15.state = STATE_VAL.NONE - $um1535_A16.state = STATE_VAL.NONE - $um1535_A17.state = STATE_VAL.NONE - $um1535_A18.state = STATE_VAL.NONE +func set_default_state() -> void: + $kasseta_P_1/ref_A19.state = STATE_VAL.NONE + $kasseta_P_1/ref_A20.state = STATE_VAL.NONE + $kasseta_P_1/ref_A21.state = STATE_VAL.NONE + $maa2000_A23.state = STATE_VAL.NONE + $maa2000_A22.state = STATE_VAL.NONE + + for group in get_tree().get_nodes_in_group('power_amplifier'): + group.state = STATE_VAL.NONE -func on_line_changed(unit_prd): +func on_line_changed(unit_prd: Object) -> void: if not unit_prd.online: set_default_state() -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 ug_online = (unit_prd.status[0] >> 1) & 1 +# Основной процесс по принятию и обработки пакетов +func on_data_received(unit_prd: Object) -> void: + if not is_inside_tree(): + return + + check_block_ip(unit_prd.status) + check_temperature_um(unit_prd.status) + + # Обработка данных ЭМС + _process_ems_data(unit_prd.status) + + # Обработка мощности от УКП + _process_ukp_power(unit_prd.status) + + +## Проверка касет П1 и ИП МА2000 +func check_block_ip(status_prd: PackedByteArray) -> void: + var ug_online: bool = (status_prd[0] >> 1) & 1 if ug_online: - pass + 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 = status_prd[BYTE_DRY_CONTACT] >> BIT_MAA2000_1 & 1 + var maa2000_2 = status_prd[BYTE_DRY_CONTACT] >> BIT_MAA2000_2 & 1 + var ip9_50_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP9_50_1 & 1 + var ip9_50_2 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP9_50_2 & 1 + var ip12_50_1 = status_prd[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_A19.state = STATE_VAL.ERROR if ip9_50_1 else STATE_VAL.GOOD + $kasseta_P_1/ref_A20.state = STATE_VAL.ERROR if ip9_50_2 else STATE_VAL.GOOD + $kasseta_P_1/ref_A21.state = STATE_VAL.ERROR if ip12_50_1 else STATE_VAL.GOOD else: - pass + $maa2000_A23.state = STATE_VAL.NONE + $maa2000_A22.state = STATE_VAL.NONE + $kasseta_P_1/ref_A19.state = STATE_VAL.NONE + $kasseta_P_1/ref_A20.state = STATE_VAL.NONE + $kasseta_P_1/ref_A21.state = STATE_VAL.NONE + + +## Проверка температур УМ от УКП +func check_temperature_um(status_prd: PackedByteArray) -> void: + const TEMP_CONSTANTS = { + "min_temp": -25, + "max_code": 3796, + "min_code": 2660, + "temp_factor": 115.0 / (3796 - 2660), + "offset": 3 # Корректировка температуры + } + 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 = (status_prd[0] >> 2) & 1 + if ukp1_online: + for i_temp in range(6): + var temperature_ukp_1: int = status_prd.decode_u16(TEMPERATURE_UKP_1 + 2 * i_temp) + var tmp_1: int = round(TEMP_CONSTANTS['min_temp'] + (TEMP_CONSTANTS['max_code'] - temperature_ukp_1) * TEMP_CONSTANTS['temp_factor'] + TEMP_CONSTANTS['offset']) + power_amplifier[i_temp].value0 = tmp_1 + + var ukp2_online = (status_prd[0] >> 3) & 1 + if ukp2_online: + for i_temp in range(6): + var temperature_ukp_2: int = status_prd.decode_u16(TEMPERATURE_UKP_2 + 2 * i_temp) + var tmp_2: int = round(TEMP_CONSTANTS['min_temp'] + (TEMP_CONSTANTS['max_code'] - temperature_ukp_2) * TEMP_CONSTANTS['temp_factor'] + TEMP_CONSTANTS['offset']) + power_amplifier[i_temp+6].value0 = tmp_2 + + +## Проверка ДКМ +func check_dkm(status_prd: PackedByteArray, bit_dkm: int) -> void: + const DKM: int = 28 + var status_dkm = status_prd[DKM] >> bit_dkm & 1 + if bit_dkm == bit_dkm_3: + $dou4_A5.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + $kasseta_FS_VD/ref_A6.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + elif bit_dkm == bit_dkm_4: + $dou5_A6.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + $kasseta_FS_VD/ref_A2.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + + +# Обрабатывает данные ЭМС и обновляет UI панели +func _process_ems_data(status: PackedByteArray) -> void: + ## Контроль ЭМС + var in_blank: int = status.decode_u16(IN_BLANK_PRD) + var out_blank: int = status.decode_u16(OUT_BLANK_PRD) + + # Обновление фреймов для входных сигналов + $Monitoring_panel/in_fs_1.frame = (in_blank >> CI_4_OT_FS) & 1 + $Monitoring_panel/in_fs_2.frame = (in_blank >> CI_5_OT_FS) & 1 + + # Обновление фреймов для выходных сигналов ЭМС + $Monitoring_panel/out_ems_1.frame = (out_blank >> CI_4_B_UF) & 1 + $Monitoring_panel/out_ems_2.frame = (out_blank >> CI_5_B_UF) & 1 + + +func _process_ukp_power(status: PackedByteArray) -> void: + #var in_blank: int = status.decode_u16(IN_BLANK_PRD) + ## Мощность УМ от УКП 1 + if flag_control: + check_dkm(status, bit_dkm_3) + + ## Мощность УМ от УКП 1 + var arr_power_ukp_1: Array = [] + + if (status[0] >> 2) & 1: + for i_power in range(6): + var power_ukp_1 = status.decode_u16(POWER_UKP_1 + 2 * i_power) + arr_power_ukp_1.append(power_ukp_1) + + if count_packet_1 == 0: + power_array_1 = arr_power_ukp_1 + else: + for i in arr_power_ukp_1.size(): + if arr_power_ukp_1[i] > power_array_1[i]: + power_array_1[i] = arr_power_ukp_1[i] + + var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') + for i in 6: + power_amplifier[i].value1 = '%d' % power_array_1[i] + power_amplifier[i].state = STATE_VAL.GOOD if power_array_1[i] > 40 else STATE_VAL.ERROR + count_packet_1 += 1 + + ## Мощность УМ от УКП 2 + check_dkm(status, bit_dkm_4) + + ## Мощность УМ от УКП 2 + const bit_dkm_2: int = 2 + check_dkm(status, bit_dkm_2) + + var arr_power_ukp_2: Array = [] + + if (status[0] >> 2) & 1: + for i_power in range(6): + var power_ukp_2 = status.decode_u16(POWER_UKP_2 + 2 * i_power) + arr_power_ukp_2.append(power_ukp_2) + + if count_packet_2 == 0: + power_array_2 = arr_power_ukp_2 + else: + for i in arr_power_ukp_2.size(): + if arr_power_ukp_2[i] > power_array_2[i]: + power_array_2[i] = arr_power_ukp_2[i] + + for i in 6: + power_amplifier[i+6].value1 = '%d' % power_array_2[i] + power_amplifier[i+6].state = STATE_VAL.GOOD if power_array_2[i] > 40 else STATE_VAL.ERROR + + count_packet_2 += 1 + + +func _on_control_fs(mode: bool) -> void: + var interfer_name: String + var fs_arr: Array + if mode: + flag_control = true + interfer_name = 'k1' + fs_arr = [[90.0, 2450.0, 1500.0, 23]] + else: + flag_control = false + interfer_name = 'off' + fs_arr = [[90.0, 2450.0, 1500.0, 23]] + print('interfer_init: ', interfer_name, fs_arr) + signaller.emit_signal('interfer_init', interfer_name, fs_arr) + + +func on_stop_control() -> void: + _on_control_fs(false) + print('stop timer') + + +func on_fs_update_state(packet_type_7: Dictionary): + var parts = currecnt_unit.split('-') + var last_part = parts[-1] # Прибор + for fs in packet_type_7: + if fs == 12 and last_part == '1в': + $kasseta_FS_VD/ref_A3.state = STATE_VAL.GOOD if packet_type_7[fs].isg == 1 else STATE_VAL.ERROR if packet_type_7[fs].isg == 0 else STATE_VAL.NONE + if fs == 13 and last_part == '4в': + $kasseta_FS_VD/ref_A3.state = STATE_VAL.GOOD if packet_type_7[fs].isg == 1 else STATE_VAL.ERROR if packet_type_7[fs].isg == 0 else STATE_VAL.NONE + if fs == 14 and last_part == '3в': + $kasseta_FS_VD/ref_A3.state = STATE_VAL.GOOD if packet_type_7[fs].isg == 1 else STATE_VAL.ERROR if packet_type_7[fs].isg == 0 else STATE_VAL.NONE + if fs == 15 and last_part == '2в': + $kasseta_FS_VD/ref_A3.state = STATE_VAL.GOOD if packet_type_7[fs].isg == 1 else STATE_VAL.ERROR if packet_type_7[fs].isg == 0 else STATE_VAL.NONE + + if fs == 16 and last_part == '1в': + $kasseta_FS_VD/ref_A4.state = STATE_VAL.GOOD if packet_type_7[fs].isg == 1 else STATE_VAL.ERROR if packet_type_7[fs].isg == 0 else STATE_VAL.NONE + if fs == 17 and last_part == '4в': + $kasseta_FS_VD/ref_A4.state = STATE_VAL.GOOD if packet_type_7[fs].isg == 1 else STATE_VAL.ERROR if packet_type_7[fs].isg == 0 else STATE_VAL.NONE + if fs == 18 and last_part == '3в': + $kasseta_FS_VD/ref_A4.state = STATE_VAL.GOOD if packet_type_7[fs].isg == 1 else STATE_VAL.ERROR if packet_type_7[fs].isg == 0 else STATE_VAL.NONE + if fs == 19 and last_part == '2в': + $kasseta_FS_VD/ref_A4.state = STATE_VAL.GOOD if packet_type_7[fs].isg == 1 else STATE_VAL.ERROR if packet_type_7[fs].isg == 0 else STATE_VAL.NONE diff --git a/scenes/pribor-uyep/sch3-view.gd b/scenes/pribor-uyep/sch3-view.gd index 3346f3a3..59891f3e 100644 --- a/scenes/pribor-uyep/sch3-view.gd +++ b/scenes/pribor-uyep/sch3-view.gd @@ -17,7 +17,7 @@ extends 'res://scenes/контроль/элемент-я.gd' var regs_input: = {} ## Регистры входные var regs_holding: = {} ## Регистры хранения var switches_sync: = false ## Флаг. Если установлен, то можно переключать - +var external_ctl: = false ## Флаг внешнего управления func on_error(msg, unit_sch3): if unit_sch3.online: @@ -42,7 +42,7 @@ func on_line_changed_sch3(unit_sch3): func on_settings_changed(): - var external_ctl = ProjectSettings.get_setting('application/config/Внешнее управление', false) + external_ctl = ProjectSettings.get_setting('application/config/Внешнее управление', false) if not external_ctl: return var items = get_tree().get_nodes_in_group('bits_items_switch') @@ -77,8 +77,7 @@ func _enter_tree() -> void: unit_sch3.regs_input_count = regs_input_count unit_sch3.request_period = request_period unit_sch3.reconnect_period = reconnect_period - unit_sch3.connect('read', on_read.bind(unit_sch3)) - unit_sch3.connect('read_input', on_input) + unit_sch3.connect('read_input', on_input.bind(unit_sch3)) unit_sch3.connect('error', on_error.bind(unit_sch3)) unit_sch3.connect('line_changed', on_line_changed_sch3) @@ -98,40 +97,16 @@ func _exit_tree() -> void: if Engine.is_editor_hint(): return var unit_key = settings.get_unit_key(unit_name) var unit_sch3 = network.units[unit_key] - unit_sch3.disconnect('read', on_read.bind(unit_sch3)) unit_sch3.disconnect('read_input', on_input.bind(unit_sch3)) + external_ctl = ProjectSettings.get_setting('application/config/Внешнее управление', false) unit_sch3.disconnect('error', on_error) unit_sch3.disconnect('line_changed', on_line_changed_sch3) -## Вызывается по сигналу "приняты данные чтения регистров хранения"[br] -## [param base_addr] - Начальный адрес регистров.[br] -## [param data] - Массив значений прочитанных из регистров. -func on_read(base_addr: int, data: Array, unit_sch3): - if (base_addr != base_holding_address) or (data.size() < regs_holding_count): - return - for i in data.size(): - regs_holding[base_addr + i] = data[i] - # Разрешить работу выключателей только когда прочитано их реальное состояние - if not switches_sync: - switches_sync = true - for item in get_tree().get_nodes_in_group('bits_items_switch'): - var bits = item.get_meta('bits') - var byte0: int = bits[0] # Адрес регистра - var bit0: int = bits[1] # Индекс бита - var byte1: int = bits[2] # Адрес регистра - var bit1: int = bits[3] # Индекс бита - var val0: bool = regs_holding[byte0] & (1 << bit0) > 0 - item.button_pressed = val0 - item.disabled = false - regs_holding[byte1] = tools.set_bit(regs_holding[byte1], bit1, not val0) - unit_sch3.push_write_holding(regs_holding) - - ## Вызывается по сигналу "приняты данные чтения регистров входов".[br] ## [param base_addr] - Начальный адрес регистров.[br] ## [param data] - Массив значений прочитанных из регистров.[br] -func on_input(base_addr: int, data: Array): +func on_input(base_addr: int, data: Array, unit_sch3): if !is_inside_tree(): return if (base_addr != base_input_address) or (data.size() < regs_input_count): @@ -143,6 +118,29 @@ func on_input(base_addr: int, data: Array): var items = get_tree().get_nodes_in_group('bits_items_good') for i in data.size(): regs_input[base_addr + i] = data[i] + # Разрешить работу выключателей только когда прочитано их реальное состояние + if not switches_sync: + regs_holding[0] = regs_input[0] + regs_holding[1] = regs_input[1] + for i in 16: + regs_holding[2] = tools.set_bit(regs_holding[0], i, not ((regs_holding[0] >> i) & 1)) + regs_holding[3] = tools.set_bit(regs_holding[1], i, not ((regs_holding[1] >> i) & 1)) + if not external_ctl: + if regs_holding.has(0) and regs_holding.has(2): + regs_holding[0] = regs_holding[0] | 1 + regs_holding[2] = regs_holding[2] & 0xffe + switches_sync = true + for item in get_tree().get_nodes_in_group('bits_items_switch'): + var bits = item.get_meta('bits') + var byte0: int = bits[0] # Адрес регистра + var bit0: int = bits[1] # Индекс бита + var byte1: int = bits[2] # Адрес регистра + var bit1: int = bits[3] # Индекс бита + var val0: bool = regs_holding[byte0] & (1 << bit0) > 0 + item.set_pressed_no_signal(val0) + item.disabled = false + regs_holding[byte1] = tools.set_bit(regs_holding[byte1], bit1, not val0) + unit_sch3.push_write_holding(regs_holding) # Таблица 3.15, Регистр PowerState $margin/vbox/grid1/lbl_freq.text = '%d' % (regs_input[4] & 0x1ff) $margin/vbox/grid1/lbl_freq.self_modulate = Color.WHITE diff --git a/scenes/pribor-uyep/sch3.tscn b/scenes/pribor-uyep/sch3.tscn index f74e0949..a175a03f 100644 --- a/scenes/pribor-uyep/sch3.tscn +++ b/scenes/pribor-uyep/sch3.tscn @@ -142,6 +142,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания УФ" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 0, 2, 0] @@ -171,6 +172,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания РТР" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 1, 2, 1] @@ -199,6 +201,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания ПРД-Н.1" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 2, 2, 2] @@ -228,6 +231,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания ПРД-Н.2" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 3, 2, 3] @@ -257,6 +261,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания ПРД-Н.3" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 4, 2, 4] @@ -286,6 +291,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания ПРД-Н.4" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 5, 2, 5] @@ -315,6 +321,7 @@ material = SubResource("ShaderMaterial_vdwfd") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания ПРД-В.1" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 6, 2, 6] @@ -344,6 +351,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания ПРД-В.2" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 7, 2, 7] @@ -373,6 +381,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания ПРД-В.3" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 8, 2, 8] @@ -402,6 +411,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания ПРД-В.4" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 9, 2, 9] @@ -431,6 +441,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания ПРД-К.1" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 10, 2, 10] @@ -460,6 +471,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания ПРД-К.2" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 11, 2, 11] @@ -489,6 +501,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания ПРД-К.3" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [1, 0, 3, 0] @@ -518,6 +531,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания ПРД-К.4" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [1, 1, 3, 1] diff --git a/scenes/контроль/блок-а.tscn b/scenes/контроль/блок-а.tscn index 896525f4..37af25a1 100644 --- a/scenes/контроль/блок-а.tscn +++ b/scenes/контроль/блок-а.tscn @@ -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"] diff --git a/scenes/контроль/кассета-п-2.tscn b/scenes/контроль/кассета-п-2.tscn index bfa08355..077b080d 100644 --- a/scenes/контроль/кассета-п-2.tscn +++ b/scenes/контроль/кассета-п-2.tscn @@ -19,16 +19,16 @@ offset_left = 10.0 offset_top = 30.0 offset_right = 60.0 offset_bottom = 180.0 -fname = "ИП12-50" -rname = "A25" +fname = "ИП9-50" +rname = "A22" [node name="ref_A23" parent="." instance=ExtResource("3_4a27g")] offset_left = 60.0 offset_top = 30.0 offset_right = 110.0 offset_bottom = 180.0 -fname = "ИП9-50" -rname = "A22" +fname = "ИП12-50" +rname = "A25" [node name="lbl_fname" type="Label" parent="."] self_modulate = Color(1, 1, 1, 0.62) diff --git a/scenes/контроль/кассета-у-5-к.tscn b/scenes/контроль/кассета-у-5-к.tscn index 5f117cce..19d0607d 100644 --- a/scenes/контроль/кассета-у-5-к.tscn +++ b/scenes/контроль/кассета-у-5-к.tscn @@ -21,11 +21,11 @@ offset_left = 5.0 offset_top = 7.0 offset_right = 305.0 offset_bottom = 35.0 -text = "Кассета" +text = "Кассета У5" horizontal_alignment = 1 vertical_alignment = 1 -[node name="ref_A31" parent="." instance=ExtResource("3_wtlpi")] +[node name="ref_A24" parent="." instance=ExtResource("3_wtlpi")] offset_left = 5.0 offset_top = 32.0 offset_right = 55.0 @@ -33,7 +33,7 @@ offset_bottom = 182.0 fname = "ИП5-25" rname = "A31" -[node name="ref_A37" parent="." instance=ExtResource("3_wtlpi")] +[node name="ref_A30" parent="." instance=ExtResource("3_wtlpi")] offset_left = 55.0 offset_top = 32.0 offset_right = 105.0 @@ -41,7 +41,7 @@ offset_bottom = 182.0 fname = "ЯУ-07Б" rname = "A37" -[node name="ref_A33" parent="." instance=ExtResource("3_wtlpi")] +[node name="ref_A26" parent="." instance=ExtResource("3_wtlpi")] offset_left = 105.0 offset_top = 32.0 offset_right = 155.0 @@ -49,7 +49,7 @@ offset_bottom = 182.0 fname = "ЭМС-Г" rname = "A33" -[node name="ref_A34" parent="." instance=ExtResource("3_wtlpi")] +[node name="ref_A27" parent="." instance=ExtResource("3_wtlpi")] offset_left = 155.0 offset_top = 32.0 offset_right = 205.0 @@ -57,18 +57,18 @@ offset_bottom = 182.0 fname = "УГ" rname = "A34" -[node name="ref_A35" parent="." instance=ExtResource("3_wtlpi")] +[node name="ref_A28" parent="." instance=ExtResource("3_wtlpi")] offset_left = 205.0 offset_top = 32.0 offset_right = 255.0 offset_bottom = 182.0 fname = "УКП" -rname = "A36" +rname = "A35" -[node name="ref_A36" parent="." instance=ExtResource("3_wtlpi")] +[node name="ref_A29" parent="." instance=ExtResource("3_wtlpi")] offset_left = 254.0 offset_top = 32.0 offset_right = 304.0 offset_bottom = 182.0 fname = "УКП" -rname = "A35" +rname = "A36" diff --git a/scenes/контроль/кассета-у-5-нв.tscn b/scenes/контроль/кассета-у-5-нв.tscn index d1ed6ce7..21c75f48 100644 --- a/scenes/контроль/кассета-у-5-нв.tscn +++ b/scenes/контроль/кассета-у-5-нв.tscn @@ -21,11 +21,11 @@ offset_left = 5.0 offset_top = 7.0 offset_right = 305.0 offset_bottom = 35.0 -text = "Кассета" +text = "Кассета У5" horizontal_alignment = 1 vertical_alignment = 1 -[node name="ref_A31" parent="." instance=ExtResource("3_picsk")] +[node name="ref_A24" parent="." instance=ExtResource("3_picsk")] offset_left = 5.0 offset_top = 32.0 offset_right = 55.0 @@ -33,7 +33,7 @@ offset_bottom = 182.0 fname = "ИП5-25" rname = "A24" -[node name="ref_A37" parent="." instance=ExtResource("3_picsk")] +[node name="ref_A30" parent="." instance=ExtResource("3_picsk")] offset_left = 55.0 offset_top = 32.0 offset_right = 105.0 @@ -41,7 +41,7 @@ offset_bottom = 182.0 fname = "ЯУ-07Б" rname = "A30" -[node name="ref_A33" parent="." instance=ExtResource("3_picsk")] +[node name="ref_A26" parent="." instance=ExtResource("3_picsk")] offset_left = 105.0 offset_top = 32.0 offset_right = 155.0 @@ -49,7 +49,7 @@ offset_bottom = 182.0 fname = "ЭМС-Г" rname = "A26" -[node name="ref_A34" parent="." instance=ExtResource("3_picsk")] +[node name="ref_A27" parent="." instance=ExtResource("3_picsk")] offset_left = 155.0 offset_top = 32.0 offset_right = 205.0 @@ -57,18 +57,18 @@ offset_bottom = 182.0 fname = "УГ" rname = "A27" -[node name="ref_A35" parent="." instance=ExtResource("3_picsk")] +[node name="ref_A28" parent="." instance=ExtResource("3_picsk")] offset_left = 205.0 offset_top = 32.0 offset_right = 255.0 offset_bottom = 182.0 fname = "УКП" -rname = "A29" +rname = "A28" -[node name="ref_A36" parent="." instance=ExtResource("3_picsk")] +[node name="ref_A29" parent="." instance=ExtResource("3_picsk")] offset_left = 254.0 offset_top = 32.0 offset_right = 304.0 offset_bottom = 182.0 fname = "УКП" -rname = "A28" +rname = "A29" diff --git a/scenes/контроль/кассета-у-5.gd b/scenes/контроль/кассета-у-5.gd index bf45fa16..252cc41f 100644 --- a/scenes/контроль/кассета-у-5.gd +++ b/scenes/контроль/кассета-у-5.gd @@ -1,3 +1,4 @@ +@tool extends "res://scenes/контроль/кассета.gd" enum STATE_VAL { @@ -15,12 +16,12 @@ func _ready() -> void: func set_default_state(): - $ref_A37.state = STATE_VAL.ERROR - $ref_A31.state = STATE_VAL.NONE - $ref_A33.state = STATE_VAL.NONE - $ref_A34.state = STATE_VAL.NONE - $ref_A35.state = STATE_VAL.NONE - $ref_A36.state = STATE_VAL.NONE + $ref_A30.state = STATE_VAL.ERROR # ЯУ-07Б + $ref_A24.state = STATE_VAL.NONE # ИП5-25 + $ref_A26.state = STATE_VAL.NONE # ЭМС-Г + $ref_A27.state = STATE_VAL.NONE # УГ + $ref_A28.state = STATE_VAL.NONE # УКП + $ref_A29.state = STATE_VAL.NONE # УКП func on_line_changed(unit_prd): @@ -29,16 +30,19 @@ func on_line_changed(unit_prd): func on_data_received(unit_prd): - $ref_A37.state = STATE_VAL.GOOD + $ref_A30.state = STATE_VAL.GOOD var ems_online = unit_prd.status[0] & 1 var bit_load = 4 var ems_load = (unit_prd.status[0] >> bit_load) & 1 var ug_online = (unit_prd.status[0] >> 1) & 1 - $ref_A33.state = STATE_VAL.GOOD if ems_online and ems_load else STATE_VAL.ERROR - $ref_A34.state = STATE_VAL.GOOD if ug_online else STATE_VAL.ERROR - $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 + $ref_A26.state = STATE_VAL.GOOD if ems_online and ems_load else STATE_VAL.ERROR + $ref_A27.state = STATE_VAL.GOOD if ug_online else STATE_VAL.ERROR + $ref_A28.state = STATE_VAL.GOOD if (unit_prd.status[0] >> 2) & 1 else STATE_VAL.ERROR + $ref_A29.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_A24.state = STATE_VAL.ERROR if ip5_25 else STATE_VAL.GOOD else: - $ref_A31.state = STATE_VAL.NONE + $ref_A24.state = STATE_VAL.NONE diff --git a/scenes/контроль/элемент-в.tscn b/scenes/контроль/элемент-в.tscn index 702b757d..f0ab41b9 100644 --- a/scenes/контроль/элемент-в.tscn +++ b/scenes/контроль/элемент-в.tscn @@ -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 = "Ячейка" diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index b7724323..1d07491d 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -304,7 +304,7 @@ func on_button_pressed(btn_this, btn_others) -> void: for btn_other in btn_others: btn_other.set_pressed(btn_this == btn_other) var interfer_name: String = btn_this.get_meta('rfi_name') for key in fs_selected.keys(): - fs_arr.append(get_fs_param(key)) + fs_arr.append(prd.get_fs_param(key)) signaller.emit_signal('interfer_init', interfer_name, fs_arr) @@ -461,15 +461,6 @@ func set_ecm_btns_state(value: bool): set_btns_disabled(value, btn) -func get_fs_param(index: int) -> Array: - var freq = (prd.FS_FREQ[index / 4][2]) - var sector = (prd.FS_SECTORS[index % 4][0] + prd.FS_SECTORS[index % 4][1])/2 - 45.0 - if sector < 0: - sector += 360.0 - var width = prd.FS_FREQ[index / 4][1] - prd.FS_FREQ[index / 4][0] - return [sector, freq, width, index] - - func on_fs_selected(ecm): var fs_index_arr: Array = [] prd.get_fs_index(ecm, fs_index_arr) @@ -499,7 +490,7 @@ func on_interfer_prinuditelno (prenuditelno_sectors, btns): for key in prenuditelno_sectors: var sectors = [] for sector in prenuditelno_sectors[key]: - sectors.append(get_fs_param(sector)) + sectors.append(prd.get_fs_param(sector)) signaller.emit_signal('interfer_init', key, sectors) update_fs_colors() for btn in btns: diff --git a/scenes/работа/работа.tscn b/scenes/работа/работа.tscn index 442c2dcd..1b179b14 100644 --- a/scenes/работа/работа.tscn +++ b/scenes/работа/работа.tscn @@ -288,6 +288,6 @@ texture_pressed = ExtResource("13_ggrwd") [connection signal="drag_continue" from="." to="." method="_on_drag_continue"] [connection signal="toggled" from="btn_view" to="." method="on_button_view_toggled"] [connection signal="toggled" from="chk_auto" to="." method="on_value_changed"] -[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate_toggled"] [connection signal="toggled" from="btn_activate" to="." method="on_btn_activate"] +[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate_toggled"] [connection signal="toggled" from="btn_center" to="." method="on_btn_center_toggled"] diff --git a/scripts/interfer.gd b/scripts/interfer.gd index b7bb8480..f69836d3 100644 --- a/scripts/interfer.gd +++ b/scripts/interfer.gd @@ -59,8 +59,8 @@ class Interfer: if krp != INTERFER_OFF: data_to_json['kni'] = kni data_to_json['powp'] = powp # TODO: Необходимо добавить управление мощностью - data_to_json['get'] = [] data_to_json['params'] = params + data_to_json['get'] = get_params var pac = JSON.stringify(data_to_json).to_utf8_buffer() return pac diff --git a/scripts/prd.gd b/scripts/prd.gd index 151df547..8d4e3261 100644 --- a/scripts/prd.gd +++ b/scripts/prd.gd @@ -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 ## Словарь с приборами ПРД @@ -282,6 +282,15 @@ func _ready() -> void: unit_caps.connect('data_received', Callable(self, 'on_data_capsrpb_received')) +func get_fs_param(index: int) -> Array: + var freq = (FS_FREQ[index / 4][2]) + var sector = (FS_SECTORS[index % 4][0] + FS_SECTORS[index % 4][1])/2 - 45.0 + if sector < 0: + sector += 360.0 + var width = FS_FREQ[index / 4][1] - FS_FREQ[index / 4][0] + return [sector, freq, width, index] + + ## Функция возвращает массив с индексами модулей ФС для выбранной помехи func get_fs_index(ecm, fs_index_arr): var sector: int @@ -309,19 +318,12 @@ func update_fs_state(ecms): get_fs_index(ecm, fs_ids) for fs_index in fs_ids: var fs = fs_dict[fs_index] - fs.set_modulation(ecm.modulation) fs.set_um_code(ecm.um) for prd_module in prd_dict.values(): ## Отправка команды на исполнение в ПРД if prd_module.state != PrdState.WORK: continue if not prd_module.unit_yau07.online: continue var um_data_array: Array = [] for fs in prd_module.fs_dic.values(): - var dev_mode = prd_module.yemsg_board.get_dev_mode(fs.index) - var fs_state = 2 - if fs.modulation: - fs_state = 3 - if (dev_mode != fs_state) or (fs_state == 3): - fs.emit_signal('update_modulation') if not prd_module.ug_online: continue if prd_module.set_ug_state: fs.set_um_data(um_data_array, prd_module.unit_yau07) @@ -346,7 +348,7 @@ func on_data_capsrpb_received(unit0: capsrpb.CapsRpb): if unit0.json_dic['ts'] != 7: return if not unit0.json_dic.has('msfs'): return - var msfs = unit.json_dic['msfs'] + var msfs = unit0.json_dic['msfs'] for fs in msfs: if fs is Dictionary: if not fs.has('nmfs'): diff --git a/scripts/sch3.gd b/scripts/sch3.gd index abedfbf2..acb767d3 100644 --- a/scripts/sch3.gd +++ b/scripts/sch3.gd @@ -70,11 +70,6 @@ class Sch3 extends unit.Unit: mbc.request_read_input(base_input_address, regs_input_count) cmd_state = CmdState.WAIT tx_tick = tick - step_fsm = Sch3Fsm.READ_HOLDING - elif step_fsm == Sch3Fsm.READ_HOLDING: - mbc.request_read(base_holding_address, regs_holding_count) - cmd_state = CmdState.WAIT - tx_tick = tick step_fsm = Sch3Fsm.WRITE elif step_fsm == Sch3Fsm.CONNECT: try_disconnect()