From 858f38e8cd4adbda0cc340d60a2ef49bdce1a28f Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Thu, 29 May 2025 10:29:40 +0300 Subject: [PATCH 01/20] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20get=5Ffs=5Fparam=20=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D1=81=D0=B5=D0=BD=D0=B0=20=D0=B2=20prd.gd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/работа/работа.gd | 13 ++----------- scripts/prd.gd | 9 +++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index 75123d47..c0e23f17 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -311,7 +311,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) @@ -468,15 +468,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) @@ -506,7 +497,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/scripts/prd.gd b/scripts/prd.gd index 7809ffd4..51f58cca 100644 --- a/scripts/prd.gd +++ b/scripts/prd.gd @@ -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 From dcbc81c685a12b574ce23d277e4a71fceda91347 Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 18 Jun 2025 12:37:53 +0300 Subject: [PATCH 02/20] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D1=8B=D0=B9=20?= =?UTF-8?q?=D1=8D=D1=82=D0=B0=D0=BF=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=98=D0=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-n/pribor-prd-n.gd | 78 +++++++++++++++++++++ scenes/pribor-prd-n/pribor-prd-n.gd.uid | 1 + scenes/pribor-prd-n/pribor-prd-n.tscn | 92 +++++++------------------ scenes/pribor-prd-v/pribor_prd_v.gd | 5 +- scenes/контроль/блок-а.tscn | 4 +- scenes/контроль/кассета-у-5.gd | 6 +- scenes/контроль/элемент-в.tscn | 6 +- scripts/prd.gd | 10 +-- 8 files changed, 121 insertions(+), 81 deletions(-) create mode 100644 scenes/pribor-prd-n/pribor-prd-n.gd create mode 100644 scenes/pribor-prd-n/pribor-prd-n.gd.uid 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..f5169abe --- /dev/null +++ b/scenes/pribor-prd-n/pribor-prd-n.gd @@ -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 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-n/pribor-prd-n.tscn b/scenes/pribor-prd-n/pribor-prd-n.tscn index 718c3386..42d66e3e 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.tscn +++ b/scenes/pribor-prd-n/pribor-prd-n.tscn @@ -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) diff --git a/scenes/pribor-prd-v/pribor_prd_v.gd b/scenes/pribor-prd-v/pribor_prd_v.gd index 5fcc0fdb..c919ba1f 100644 --- a/scenes/pribor-prd-v/pribor_prd_v.gd +++ b/scenes/pribor-prd-v/pribor_prd_v.gd @@ -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 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/контроль/кассета-у-5.gd b/scenes/контроль/кассета-у-5.gd index bf45fa16..c31de483 100644 --- a/scenes/контроль/кассета-у-5.gd +++ b/scenes/контроль/кассета-у-5.gd @@ -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 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/scripts/prd.gd b/scripts/prd.gd index 3627094a..98751d3a 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 ## Словарь с приборами ПРД From e077ebacb5c59de7a240b0f5c604845cadc8e143 Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 18 Jun 2025 12:51:42 +0300 Subject: [PATCH 03/20] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D1=8B=D0=B9=20?= =?UTF-8?q?=D1=8D=D1=82=D0=B0=D0=BF=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=98=D0=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-n/pribor-prd-n.gd | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scenes/pribor-prd-n/pribor-prd-n.gd b/scenes/pribor-prd-n/pribor-prd-n.gd index f5169abe..074d17f5 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.gd +++ b/scenes/pribor-prd-n/pribor-prd-n.gd @@ -26,7 +26,11 @@ func on_line_changed(unit_prd): func on_data_received(unit_prd): - ## Касета П1 + var tree = get_tree() + if not tree: + return + + ## Касета П1 и ИП МА2000 var ug_online = (unit_prd.status[0] >> 1) & 1 if ug_online: const BYTE_DRY_CONTACT: int = 27 @@ -76,3 +80,14 @@ func on_data_received(unit_prd): 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 + + ## ДКМ + const DKM: int = 28 + const bit_dkm_1: int = 1 + const bit_dkm_2: int = 2 + + var status_dkm_1 = unit_prd.status[DKM] >> bit_dkm_1 & 1 + var status_dkm_2 = unit_prd.status[DKM] >> bit_dkm_2 & 1 + + $dou2_A5.state = STATE_VAL.GOOD if status_dkm_1 else STATE_VAL.ERROR + $dou2_A6.state = STATE_VAL.GOOD if status_dkm_2 else STATE_VAL.ERROR From 8bc3989334cf34481d5bc57c47f88cb91b2c9909 Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 18 Jun 2025 13:50:13 +0300 Subject: [PATCH 04/20] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=83=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D1=8F=D1=86=D0=B8?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=A3=D0=9C=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20?= =?UTF-8?q?=D0=AD=D0=9C=D0=A1-=D0=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/prd.gd | 7 ------- 1 file changed, 7 deletions(-) diff --git a/scripts/prd.gd b/scripts/prd.gd index 98751d3a..733fee09 100644 --- a/scripts/prd.gd +++ b/scripts/prd.gd @@ -318,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) From d850f49e65662615e42f1be5fef34065ad8a70b4 Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 18 Jun 2025 23:19:10 +0300 Subject: [PATCH 05/20] =?UTF-8?q?=D0=9F=D0=BE=D0=BB=D1=83=D1=87=D0=B0?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE=D1=89=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B5=D0=B9=20=D0=BE=D1=82=20=D0=A3=D0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-k/pribor-prd-k.tscn | 4 +- scenes/pribor-prd-k/pribor_prd_k.gd | 182 ++++++++++++++++++ scenes/pribor-prd-k/pribor_prd_k.gd.uid | 1 + scenes/pribor-prd-n/pribor-prd-n.gd | 150 ++++++++++++--- .../{pribor-prd-n.tscn => pribor_prd_n.tscn} | 135 +++++++++++-- scenes/контроль/кассета-у-5-к.tscn | 12 +- scenes/контроль/кассета-у-5-нв.tscn | 16 +- scenes/контроль/кассета-у-5.gd | 26 +-- 8 files changed, 445 insertions(+), 81 deletions(-) create mode 100644 scenes/pribor-prd-k/pribor_prd_k.gd create mode 100644 scenes/pribor-prd-k/pribor_prd_k.gd.uid rename scenes/pribor-prd-n/{pribor-prd-n.tscn => pribor_prd_n.tscn} (73%) diff --git a/scenes/pribor-prd-k/pribor-prd-k.tscn b/scenes/pribor-prd-k/pribor-prd-k.tscn index 8dfe8643..610e343b 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 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..34fef099 --- /dev/null +++ b/scenes/pribor-prd-k/pribor_prd_k.gd @@ -0,0 +1,182 @@ +@tool +extends "res://scenes/контроль/прибор.gd" +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): + if not unit_prd.online: + set_default_state() + + +func on_data_received(unit_prd: Object): + var tree = get_tree() + if not tree: + return + + check_block_ip(unit_prd.status) + check_temperature_um(unit_prd.status) + + ## Контроль ЭМС + 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 + + 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) + const POWER_UKP_1: int = 31 + 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) + const POWER_UKP_2: int = 63 + 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-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/pribor-prd-n.gd b/scenes/pribor-prd-n/pribor-prd-n.gd index 074d17f5..2d589c3e 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.gd +++ b/scenes/pribor-prd-n/pribor-prd-n.gd @@ -1,37 +1,116 @@ @tool extends "res://scenes/контроль/прибор.gd" +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 } -# 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() + self.add_child(timer_03) + timer_03.connect('timeout', Callable(self, 'on_timer_03')) + #on_timer_03(unit_key) -func set_default_state(): +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): +func on_line_changed(unit_prd: Object): if not unit_prd.online: set_default_state() -func on_data_received(unit_prd): - var tree = get_tree() - if not tree: +func on_data_received(unit_prd: Object): + if get_tree() == null: return - ## Касета П1 и ИП МА2000 - var ug_online = (unit_prd.status[0] >> 1) & 1 + check_block_ip(unit_prd.status) + check_temperature_um(unit_prd.status) + + ## Контроль ЭМС + 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 + + 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) + const POWER_UKP_1: int = 31 + 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) + const POWER_UKP_2: int = 63 + 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 @@ -40,25 +119,27 @@ func on_data_received(unit_prd): 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 + 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_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 + $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_A26.state = STATE_VAL.NONE - $kasseta_P_1/ref_A23.state = STATE_VAL.NONE - $kasseta_P_1/ref_A24.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 @@ -67,27 +148,34 @@ func on_data_received(unit_prd): 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 + var ukp1_online: int = (status_prd[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 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 = (unit_prd.status[0] >> 3) & 1 + var ukp2_online = (status_prd[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 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 - const bit_dkm_1: int = 1 - const bit_dkm_2: int = 2 - var status_dkm_1 = unit_prd.status[DKM] >> bit_dkm_1 & 1 - var status_dkm_2 = unit_prd.status[DKM] >> bit_dkm_2 & 1 + var status_dkm = status_prd[DKM] >> bit_dkm & 1 - $dou2_A5.state = STATE_VAL.GOOD if status_dkm_1 else STATE_VAL.ERROR - $dou2_A6.state = STATE_VAL.GOOD if status_dkm_2 else STATE_VAL.ERROR + 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.tscn b/scenes/pribor-prd-n/pribor_prd_n.tscn similarity index 73% rename from scenes/pribor-prd-n/pribor-prd-n.tscn rename to scenes/pribor-prd-n/pribor_prd_n.tscn index 42d66e3e..ca863ab6 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.tscn +++ b/scenes/pribor-prd-n/pribor_prd_n.tscn @@ -1,4 +1,4 @@ -[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://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"] @@ -8,6 +8,31 @@ [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="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="9_bnnv3"] +[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="10_is25t"] +[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="11_meukj"] + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_bnnv3"] + +[sub_resource type="SpriteFrames" id="SpriteFrames_xkifg"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("9_bnnv3") +}, { +"duration": 1.0, +"texture": ExtResource("10_is25t") +}, { +"duration": 1.0, +"texture": ExtResource("11_meukj") +}, { +"duration": 1.0, +"texture": null +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] [node name="pribor_prd_n" type="Control"] layout_mode = 3 @@ -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_dqc3e")] 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_dqc3e")] 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_dqc3e")] 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_dqc3e")] 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="."] @@ -159,15 +184,15 @@ patch_margin_bottom = 16 script = ExtResource("6_b1cob") 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_dqc3e")] 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_dqc3e")] 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_dqc3e")] 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) @@ -239,10 +264,6 @@ 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) @@ -353,3 +374,75 @@ 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/контроль/кассета-у-5-к.tscn b/scenes/контроль/кассета-у-5-к.tscn index 5f117cce..f5277798 100644 --- a/scenes/контроль/кассета-у-5-к.tscn +++ b/scenes/контроль/кассета-у-5-к.tscn @@ -25,7 +25,7 @@ text = "Кассета" 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,7 +57,7 @@ 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 @@ -65,7 +65,7 @@ offset_bottom = 182.0 fname = "УКП" rname = "A36" -[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 diff --git a/scenes/контроль/кассета-у-5-нв.tscn b/scenes/контроль/кассета-у-5-нв.tscn index d1ed6ce7..c79ec097 100644 --- a/scenes/контроль/кассета-у-5-нв.tscn +++ b/scenes/контроль/кассета-у-5-нв.tscn @@ -25,7 +25,7 @@ text = "Кассета" 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 c31de483..252cc41f 100644 --- a/scenes/контроль/кассета-у-5.gd +++ b/scenes/контроль/кассета-у-5.gd @@ -16,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): @@ -30,19 +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: 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 + $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 From cd46491a1fd2566a02b1db716022c7e8bff27cfe Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 20 Jun 2025 13:44:18 +0300 Subject: [PATCH 06/20] =?UTF-8?q?=D0=9E=D1=82=D0=BB=D0=B0=D0=B4=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D0=B0=D1=81=D1=82=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-k/kasseta-fs-kd.tscn | 16 +- scenes/pribor-prd-k/pribor-prd-k.tscn | 90 +-------- scenes/pribor-prd-k/pribor_prd_k.gd | 190 ++---------------- scenes/pribor-prd-n/kasseta-fs-nd.tscn | 10 +- .../{pribor_prd_n.tscn => pribor-prd-n.tscn} | 90 ++++----- .../{pribor-prd-n.gd => pribor_prd_n.gd} | 23 ++- ...ribor-prd-n.gd.uid => pribor_prd_n.gd.uid} | 0 scenes/pribor-prd-v/pribor-prd-v.tscn | 70 ------- scenes/контроль/кассета-п-2.tscn | 8 +- scenes/контроль/кассета-у-5-к.tscn | 6 +- scenes/контроль/кассета-у-5-нв.tscn | 2 +- scripts/sch3.gd | 2 +- 12 files changed, 107 insertions(+), 400 deletions(-) rename scenes/pribor-prd-n/{pribor_prd_n.tscn => pribor-prd-n.tscn} (86%) rename scenes/pribor-prd-n/{pribor-prd-n.gd => pribor_prd_n.gd} (95%) rename scenes/pribor-prd-n/{pribor-prd-n.gd.uid => pribor_prd_n.gd.uid} (100%) 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 610e343b..ca1858b7 100644 --- a/scenes/pribor-prd-k/pribor-prd-k.tscn +++ b/scenes/pribor-prd-k/pribor-prd-k.tscn @@ -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 index 34fef099..0a10721e 100644 --- a/scenes/pribor-prd-k/pribor_prd_k.gd +++ b/scenes/pribor-prd-k/pribor_prd_k.gd @@ -1,10 +1,5 @@ @tool extends "res://scenes/контроль/прибор.gd" -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, @@ -13,170 +8,25 @@ enum STATE_VAL { 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) + 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() -> void: - for group in get_tree().get_nodes_in_group('power_amplifier'): - group.state = STATE_VAL.NONE - - -func on_line_changed(unit_prd: Object): - if not unit_prd.online: - set_default_state() - - -func on_data_received(unit_prd: Object): - var tree = get_tree() - if not tree: - return - - check_block_ip(unit_prd.status) - check_temperature_um(unit_prd.status) - - ## Контроль ЭМС - 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 - - 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) - const POWER_UKP_1: int = 31 - 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) - const POWER_UKP_2: int = 63 - 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) +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-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 similarity index 86% rename from scenes/pribor-prd-n/pribor_prd_n.tscn rename to scenes/pribor-prd-n/pribor-prd-n.tscn index ca863ab6..1e23a7ec 100644 --- a/scenes/pribor-prd-n/pribor_prd_n.tscn +++ b/scenes/pribor-prd-n/pribor-prd-n.tscn @@ -1,16 +1,16 @@ [gd_scene load_steps=14 format=3 uid="uid://dnuexoef2nnv5"] -[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"] -[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="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="9_bnnv3"] -[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="10_is25t"] -[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="11_meukj"] +[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"] @@ -18,13 +18,13 @@ animations = [{ "frames": [{ "duration": 1.0, -"texture": ExtResource("9_bnnv3") +"texture": ExtResource("9_k1x0o") }, { "duration": 1.0, -"texture": ExtResource("10_is25t") +"texture": ExtResource("10_7dcjd") }, { "duration": 1.0, -"texture": ExtResource("11_meukj") +"texture": ExtResource("11_ius1v") }, { "duration": 1.0, "texture": null @@ -41,9 +41,9 @@ offset_left = 15.0 offset_top = 30.0 offset_right = 15.0 offset_bottom = 30.0 -script = ExtResource("1_td743") +script = ExtResource("1_bnnv3") -[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 @@ -52,7 +52,7 @@ offset_bottom = 949.0 fname = "MAA2000" rname = "A23" -[node name="maa2000_A22" 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 @@ -61,7 +61,7 @@ offset_bottom = 949.0 fname = "MAA2000" rname = "A22" -[node name="dou2_A5" parent="." instance=ExtResource("2_lpj3d")] +[node name="dou2_A5" parent="." instance=ExtResource("2_is25t")] layout_mode = 2 offset_left = 485.0 offset_top = 812.0 @@ -70,7 +70,7 @@ offset_bottom = 877.0 fname = "ДОУ-2" rname = "A5" -[node name="dou2_A6" parent="." instance=ExtResource("2_lpj3d")] +[node name="dou2_A6" parent="." instance=ExtResource("2_is25t")] layout_mode = 2 offset_left = 8.0 offset_top = 812.0 @@ -85,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 @@ -103,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="."] @@ -118,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 = "" @@ -138,7 +138,7 @@ text = "Кассета ФС-НД" horizontal_alignment = 1 vertical_alignment = 1 -[node name="ref_A3" 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 @@ -146,7 +146,7 @@ offset_bottom = 182.0 fname = "Блок ФС-3" rname = "A3" -[node name="ref_A1" 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 @@ -154,7 +154,7 @@ offset_bottom = 182.0 fname = "Модуль ФС" rname = "A1" -[node name="ref_A2" 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 @@ -162,7 +162,7 @@ offset_bottom = 182.0 fname = "Модуль ФС" rname = "A2" -[node name="ref_A4" 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 @@ -176,15 +176,15 @@ 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_A21" 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 @@ -192,7 +192,7 @@ offset_bottom = 183.0 fname = "ИП12-50" rname = "A21" -[node name="ref_A20" 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 @@ -200,7 +200,7 @@ offset_bottom = 183.0 fname = "ИП9-50" rname = "A20" -[node name="ref_A19" 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 @@ -219,7 +219,7 @@ text = "Кассета П-1" horizontal_alignment = 1 vertical_alignment = 1 -[node name="um1535_A7" parent="." groups=["power_amplifier"] 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 @@ -232,7 +232,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A7" -[node name="um1535_A8" parent="." groups=["power_amplifier"] 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 @@ -245,7 +245,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A8" -[node name="um1535_A9" parent="." groups=["power_amplifier"] 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 @@ -258,7 +258,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A9" -[node name="um1535_A10" parent="." groups=["power_amplifier"] 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 @@ -271,7 +271,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A10" -[node name="um1535_A11" parent="." groups=["power_amplifier"] 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 @@ -284,7 +284,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A11" -[node name="um1535_A12" parent="." groups=["power_amplifier"] 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 @@ -297,7 +297,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A12" -[node name="um1535_A13" parent="." groups=["power_amplifier"] 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 @@ -310,7 +310,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A13" -[node name="um1535_A14" parent="." groups=["power_amplifier"] 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 @@ -323,7 +323,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A14" -[node name="um1535_A15" parent="." groups=["power_amplifier"] 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 @@ -336,7 +336,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A15" -[node name="um1535_A16" parent="." groups=["power_amplifier"] 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 @@ -349,7 +349,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A16" -[node name="um1535_A17" parent="." groups=["power_amplifier"] 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 @@ -362,7 +362,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A17" -[node name="um1535_A18" parent="." groups=["power_amplifier"] 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 diff --git a/scenes/pribor-prd-n/pribor-prd-n.gd b/scenes/pribor-prd-n/pribor_prd_n.gd similarity index 95% rename from scenes/pribor-prd-n/pribor-prd-n.gd rename to scenes/pribor-prd-n/pribor_prd_n.gd index 2d589c3e..89f87754 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.gd +++ b/scenes/pribor-prd-n/pribor_prd_n.gd @@ -1,5 +1,15 @@ @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 = [] @@ -34,19 +44,14 @@ func on_line_changed(unit_prd: Object): func on_data_received(unit_prd: Object): - if get_tree() == null: + if not is_inside_tree(): return check_block_ip(unit_prd.status) check_temperature_um(unit_prd.status) ## Контроль ЭМС - 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 + #_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) @@ -61,7 +66,7 @@ func on_data_received(unit_prd: Object): if (in_blank >> CI_2_OT_FS) & 1: const bit_dkm_1: int = 1 check_dkm(unit_prd.status, bit_dkm_1) - const POWER_UKP_1: int = 31 + var arr_power_ukp_1: Array = [] if (unit_prd.status[0] >> 2) & 1: @@ -86,7 +91,7 @@ func on_data_received(unit_prd: Object): if (in_blank >> CI_3_OT_FS) & 1: const bit_dkm_2: int = 2 check_dkm(unit_prd.status, bit_dkm_2) - const POWER_UKP_2: int = 63 + var arr_power_ukp_2: Array = [] if (unit_prd.status[0] >> 2) & 1: diff --git a/scenes/pribor-prd-n/pribor-prd-n.gd.uid b/scenes/pribor-prd-n/pribor_prd_n.gd.uid similarity index 100% rename from scenes/pribor-prd-n/pribor-prd-n.gd.uid rename to scenes/pribor-prd-n/pribor_prd_n.gd.uid diff --git a/scenes/pribor-prd-v/pribor-prd-v.tscn b/scenes/pribor-prd-v/pribor-prd-v.tscn index 31a0b302..b6b22cba 100644 --- a/scenes/pribor-prd-v/pribor-prd-v.tscn +++ b/scenes/pribor-prd-v/pribor-prd-v.tscn @@ -151,10 +151,6 @@ 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" @@ -170,12 +166,6 @@ 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) @@ -189,12 +179,6 @@ 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) @@ -208,12 +192,6 @@ 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) @@ -227,12 +205,6 @@ 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) @@ -246,12 +218,6 @@ 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) @@ -265,12 +231,6 @@ 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) @@ -284,12 +244,6 @@ 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) @@ -303,12 +257,6 @@ 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) @@ -322,12 +270,6 @@ 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) @@ -341,12 +283,6 @@ 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) @@ -360,12 +296,6 @@ 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) 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 f5277798..19d0607d 100644 --- a/scenes/контроль/кассета-у-5-к.tscn +++ b/scenes/контроль/кассета-у-5-к.tscn @@ -21,7 +21,7 @@ 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 @@ -63,7 +63,7 @@ offset_top = 32.0 offset_right = 255.0 offset_bottom = 182.0 fname = "УКП" -rname = "A36" +rname = "A35" [node name="ref_A29" parent="." instance=ExtResource("3_wtlpi")] offset_left = 254.0 @@ -71,4 +71,4 @@ 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 c79ec097..21c75f48 100644 --- a/scenes/контроль/кассета-у-5-нв.tscn +++ b/scenes/контроль/кассета-у-5-нв.tscn @@ -21,7 +21,7 @@ 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 diff --git a/scripts/sch3.gd b/scripts/sch3.gd index abedfbf2..eb13478e 100644 --- a/scripts/sch3.gd +++ b/scripts/sch3.gd @@ -78,7 +78,7 @@ class Sch3 extends unit.Unit: step_fsm = Sch3Fsm.WRITE elif step_fsm == Sch3Fsm.CONNECT: try_disconnect() - try_connect() + #try_connect() mbc.request_read_input(base_input_address, regs_input_count) cmd_state = CmdState.WAIT tx_tick = tick From ffd22b59f46189a7dadf5e62bb0d7cd280b4af6b Mon Sep 17 00:00:00 2001 From: Maxim Date: Tue, 24 Jun 2025 14:25:42 +0300 Subject: [PATCH 07/20] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=9F=D0=A0=D0=94-=D0=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-n/pribor-prd-n.tscn | 1 + scenes/pribor-prd-n/pribor_prd_n.gd | 4 +- scenes/pribor-prd-v/pribor-prd-v.tscn | 130 +++++++++++++++++++++---- scenes/pribor-prd-v/pribor_prd_v.gd | 131 +++++++++++++++++++++----- 4 files changed, 226 insertions(+), 40 deletions(-) diff --git a/scenes/pribor-prd-n/pribor-prd-n.tscn b/scenes/pribor-prd-n/pribor-prd-n.tscn index 1e23a7ec..f97936e4 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.tscn +++ b/scenes/pribor-prd-n/pribor-prd-n.tscn @@ -376,6 +376,7 @@ fname = "УМ1535А" rname = "A18" [node name="Monitoring_panel" type="Panel" parent="."] +visible = false layout_mode = 0 theme_override_styles/panel = SubResource("StyleBoxTexture_bnnv3") diff --git a/scenes/pribor-prd-n/pribor_prd_n.gd b/scenes/pribor-prd-n/pribor_prd_n.gd index 89f87754..6f822dd7 100644 --- a/scenes/pribor-prd-n/pribor_prd_n.gd +++ b/scenes/pribor-prd-n/pribor_prd_n.gd @@ -38,12 +38,12 @@ func set_default_state() -> void: group.state = STATE_VAL.NONE -func on_line_changed(unit_prd: Object): +func on_line_changed(unit_prd: Object) -> void: if not unit_prd.online: set_default_state() -func on_data_received(unit_prd: Object): +func on_data_received(unit_prd: Object) -> void: if not is_inside_tree(): return diff --git a/scenes/pribor-prd-v/pribor-prd-v.tscn b/scenes/pribor-prd-v/pribor-prd-v.tscn index b6b22cba..a86227fe 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,7 +170,7 @@ 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 @@ -160,7 +185,7 @@ 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 @@ -173,7 +198,7 @@ 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 @@ -186,7 +211,7 @@ 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 @@ -199,7 +224,7 @@ 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 @@ -212,7 +237,7 @@ 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 @@ -225,7 +250,7 @@ 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 @@ -238,7 +263,7 @@ 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 @@ -251,7 +276,7 @@ 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 @@ -264,7 +289,7 @@ 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 @@ -277,7 +302,7 @@ 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 @@ -290,7 +315,7 @@ 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 @@ -302,3 +327,74 @@ name_min_size0 = Vector2i(35, 20) name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A18" + +[node name="Monitoring_panel" type="Panel" parent="."] +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 c919ba1f..7a947355 100644 --- a/scenes/pribor-prd-v/pribor_prd_v.gd +++ b/scenes/pribor-prd-v/pribor_prd_v.gd @@ -1,12 +1,28 @@ @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 = [] + 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] @@ -15,31 +31,104 @@ func _ready() -> void: set_default_state() -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: + 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) + + ## Контроль ЭМС + 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_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 + + ## Мощность УМ от УКП 1 + if (in_blank >> CI_4_OT_FS) & 1: + check_dkm(unit_prd.status, bit_dkm_3) + + ## Мощность УМ от УКП 2 + if (in_blank >> CI_5_OT_FS) & 1: + check_dkm(unit_prd.status, bit_dkm_4) + + +## Проверка касет П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 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 == 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 From 5c9c31b4c86731f736f5d30b7ecdc134ee600936 Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 27 Jun 2025 01:58:31 +0300 Subject: [PATCH 08/20] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0,=20=D0=BE=D1=82=D0=BB=D0=B0=D0=B4=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=A93,=20=D1=83=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC=D0=B0?= =?UTF-8?q?=20=D1=81=D0=B0=D0=BC=D0=BE=D0=BE=D1=82=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=82=D1=80=D0=BE=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project.godot | 1 + scenes/pribor-prd-v/pribor-prd-v.tscn | 1 + scenes/pribor-uyep/sch3-view.gd | 9 +++++++-- scenes/pribor-uyep/sch3.tscn | 14 ++++++++++++++ scripts/sch3.gd | 2 +- 5 files changed, 24 insertions(+), 3 deletions(-) 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-v/pribor-prd-v.tscn b/scenes/pribor-prd-v/pribor-prd-v.tscn index a86227fe..fa342304 100644 --- a/scenes/pribor-prd-v/pribor-prd-v.tscn +++ b/scenes/pribor-prd-v/pribor-prd-v.tscn @@ -329,6 +329,7 @@ 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"] diff --git a/scenes/pribor-uyep/sch3-view.gd b/scenes/pribor-uyep/sch3-view.gd index 3346f3a3..9fe56547 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') @@ -100,6 +100,7 @@ func _exit_tree() -> void: 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) @@ -114,6 +115,10 @@ func on_read(base_addr: int, data: Array, unit_sch3): regs_holding[base_addr + i] = data[i] # Разрешить работу выключателей только когда прочитано их реальное состояние if not switches_sync: + 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') 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/scripts/sch3.gd b/scripts/sch3.gd index eb13478e..abedfbf2 100644 --- a/scripts/sch3.gd +++ b/scripts/sch3.gd @@ -78,7 +78,7 @@ class Sch3 extends unit.Unit: step_fsm = Sch3Fsm.WRITE elif step_fsm == Sch3Fsm.CONNECT: try_disconnect() - #try_connect() + try_connect() mbc.request_read_input(base_input_address, regs_input_count) cmd_state = CmdState.WAIT tx_tick = tick From 800549c6fc85d1a88986158d3f1d577b8f360cf1 Mon Sep 17 00:00:00 2001 From: Maxim Name Date: Fri, 27 Jun 2025 03:58:37 +0300 Subject: [PATCH 09/20] =?UTF-8?q?=D0=9E=D1=82=D0=BB=D0=B0=D0=B4=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BF=D0=B0=D0=BA=D0=B5=D1=82=D0=B0=20=D1=82=D0=B8?= =?UTF-8?q?=D0=BF-7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-n/pribor-prd-n.tscn | 1 - scenes/pribor-prd-v/pribor_prd_v.gd | 59 +++++++++++++++++++++++++++ scenes/pribor-uyep/sch3.tscn | 11 ----- scripts/prd.gd | 2 +- 4 files changed, 60 insertions(+), 13 deletions(-) diff --git a/scenes/pribor-prd-n/pribor-prd-n.tscn b/scenes/pribor-prd-n/pribor-prd-n.tscn index f97936e4..1e23a7ec 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.tscn +++ b/scenes/pribor-prd-n/pribor-prd-n.tscn @@ -376,7 +376,6 @@ fname = "УМ1535А" rname = "A18" [node name="Monitoring_panel" type="Panel" parent="."] -visible = false layout_mode = 0 theme_override_styles/panel = SubResource("StyleBoxTexture_bnnv3") diff --git a/scenes/pribor-prd-v/pribor_prd_v.gd b/scenes/pribor-prd-v/pribor_prd_v.gd index 7a947355..22753d57 100644 --- a/scenes/pribor-prd-v/pribor_prd_v.gd +++ b/scenes/pribor-prd-v/pribor_prd_v.gd @@ -29,6 +29,7 @@ func _ready() -> void: unit_prd.connect('data_received', Callable(self, 'on_data_received')) unit_prd.connect('line_changed', Callable(self, 'on_line_changed')) set_default_state() + _on_control_fs(true) func set_default_state() -> void: @@ -62,10 +63,55 @@ func on_data_received(unit_prd: Object) -> void: if (in_blank >> CI_4_OT_FS) & 1: check_dkm(unit_prd.status, bit_dkm_3) + ## Мощность УМ от УКП 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_5_OT_FS) & 1: check_dkm(unit_prd.status, bit_dkm_4) + ## Мощность УМ от УКП 2 + 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 + #_on_control_fs(false) + ## Проверка касет П1 и ИП МА2000 func check_block_ip(status_prd: PackedByteArray) -> void : @@ -132,3 +178,16 @@ func check_dkm(status_prd: PackedByteArray, bit_dkm: int) -> void: 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 + + +func _on_control_fs(mode: bool): + var interfer_name: String + var fs_arr: Array + if mode: + interfer_name = 'srnm2' + fs_arr = [[90.0, 2450.0, 1500.0, 23]] + else: + 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) diff --git a/scenes/pribor-uyep/sch3.tscn b/scenes/pribor-uyep/sch3.tscn index a175a03f..2905b587 100644 --- a/scenes/pribor-uyep/sch3.tscn +++ b/scenes/pribor-uyep/sch3.tscn @@ -136,17 +136,6 @@ theme_override_font_sizes/font_size = 17 text = "УФ" vertical_alignment = 1 -[node name="switch0" type="CheckButton" parent="margin/vbox/table" groups=["bits_items_switch", "c111"]] -editor_description = "Питание УФ" -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] - [node name="state1" type="TextureRect" parent="margin/vbox/table" groups=["bits_items_good"]] custom_minimum_size = Vector2(24, 24) layout_mode = 2 diff --git a/scripts/prd.gd b/scripts/prd.gd index 733fee09..8d4e3261 100644 --- a/scripts/prd.gd +++ b/scripts/prd.gd @@ -348,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'): From 36a502c0fd48044347d16626acb0db9a71d90d07 Mon Sep 17 00:00:00 2001 From: Maxim Date: Thu, 3 Jul 2025 11:04:40 +0300 Subject: [PATCH 10/20] =?UTF-8?q?=D0=9E=D1=82=D0=BB=D0=B0=D0=B4=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=9F=D0=A0=D0=94.=20=D0=94=D0=BE=D0=B1=D0=B0=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D1=83=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=D0=BC=20=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BE=D0=BC=20=D1=84=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-v/pribor_prd_v.gd | 169 ++++++++++++++++------------ 1 file changed, 100 insertions(+), 69 deletions(-) diff --git a/scenes/pribor-prd-v/pribor_prd_v.gd b/scenes/pribor-prd-v/pribor_prd_v.gd index 22753d57..5a87062e 100644 --- a/scenes/pribor-prd-v/pribor_prd_v.gd +++ b/scenes/pribor-prd-v/pribor_prd_v.gd @@ -22,6 +22,8 @@ enum STATE_VAL { GOOD = 1, ERROR = 2 } +var timer_03: Timer = Timer.new() + func _ready() -> void: var unit_key = settings.get_unit_key(get_meta('unit_name')[0]) @@ -29,7 +31,12 @@ func _ready() -> void: 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')) + timer_03.one_shot = true + timer_03.wait_time = 4.0 _on_control_fs(true) + timer_03.start() func set_default_state() -> void: @@ -49,72 +56,15 @@ func on_data_received(unit_prd: Object) -> void: check_block_ip(unit_prd.status) check_temperature_um(unit_prd.status) - ## Контроль ЭМС - var in_blank: int = unit_prd.status.decode_u16(IN_BLANK_PRD) - var out_blank: int = unit_prd.status.decode_u16(OUT_BLANK_PRD) + # Обработка данных ЭМС + _process_ems_data(unit_prd.status) - $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 - - ## Мощность УМ от УКП 1 - if (in_blank >> CI_4_OT_FS) & 1: - check_dkm(unit_prd.status, bit_dkm_3) - - ## Мощность УМ от УКП 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_5_OT_FS) & 1: - check_dkm(unit_prd.status, bit_dkm_4) - - ## Мощность УМ от УКП 2 - 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 - #_on_control_fs(false) + # Обработка мощности от УКП + _process_ukp_power(unit_prd.status) ## Проверка касет П1 и ИП МА2000 -func check_block_ip(status_prd: PackedByteArray) -> void : +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 @@ -145,10 +95,13 @@ func check_block_ip(status_prd: PackedByteArray) -> void : ## Проверка температур УМ от УКП 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 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') @@ -157,14 +110,14 @@ func check_temperature_um(status_prd: PackedByteArray) -> void: 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) + 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(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3) + 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 @@ -180,7 +133,79 @@ func check_dkm(status_prd: PackedByteArray, bit_dkm: int) -> void: $kasseta_FS_VD/ref_A2.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR -func _on_control_fs(mode: bool): +# Обрабатывает данные ЭМС и обновляет 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 (in_blank >> CI_4_OT_FS) & 1: + 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 + if (in_blank >> CI_5_OT_FS) & 1: + 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] + + 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] + 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: @@ -191,3 +216,9 @@ func _on_control_fs(mode: bool): 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_timer_03() -> void: + _on_control_fs(false) + print('stop timer') + pass From 06458c3da8a04592212b916c04970ee58d85edf5 Mon Sep 17 00:00:00 2001 From: Maxim Name Date: Fri, 27 Jun 2025 07:49:04 +0300 Subject: [PATCH 11/20] =?UTF-8?q?=D0=A0=D0=B0=D1=81=D0=BF=D0=B0=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2=D0=BA=D0=B0=20=D0=BF=D0=B0=D0=BA=D0=B5=D1=82=D0=B0?= =?UTF-8?q?=20=D1=82=D0=B8=D0=BF-7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-v/pribor_prd_v.gd | 10 ++++++++-- scripts/prd.gd | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scenes/pribor-prd-v/pribor_prd_v.gd b/scenes/pribor-prd-v/pribor_prd_v.gd index 5a87062e..e179b5f9 100644 --- a/scenes/pribor-prd-v/pribor_prd_v.gd +++ b/scenes/pribor-prd-v/pribor_prd_v.gd @@ -26,6 +26,7 @@ var timer_03: Timer = Timer.new() 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] unit_prd.connect('data_received', Callable(self, 'on_data_received')) @@ -34,7 +35,7 @@ func _ready() -> void: self.add_child(timer_03) timer_03.connect('timeout', Callable(self, 'on_timer_03')) timer_03.one_shot = true - timer_03.wait_time = 4.0 + timer_03.wait_time = 5.0 _on_control_fs(true) timer_03.start() @@ -221,4 +222,9 @@ func _on_control_fs(mode: bool) -> void: func on_timer_03() -> void: _on_control_fs(false) print('stop timer') - pass + + +func on_fs_update_state(packet_type_7: Dictionary): + for fs in packet_type_7: + if packet_type_7[fs].isg == 1: + print([packet_type_7[fs].index, packet_type_7[fs].isg]) diff --git a/scripts/prd.gd b/scripts/prd.gd index 8d4e3261..2141471c 100644 --- a/scripts/prd.gd +++ b/scripts/prd.gd @@ -347,7 +347,7 @@ func on_data_capsrpb_received(unit0: capsrpb.CapsRpb): if not unit0.json_dic.has('ts'): return if unit0.json_dic['ts'] != 7: return if not unit0.json_dic.has('msfs'): return - + var msfs = unit0.json_dic['msfs'] for fs in msfs: if fs is Dictionary: From 897ea6a13ddbf5bb7aa052961a875b96224c9ac5 Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Wed, 2 Jul 2025 11:22:31 +0300 Subject: [PATCH 12/20] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=A1=D0=BE=D1=81=D1=82=D0=BE=D1=8F?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B8=D0=B1=D0=BE=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE=D0=BB?= =?UTF-8?q?=D0=B5=20=D0=A93=20=D0=BF=D0=BE=20=D1=83=D0=BC=D0=BE=D0=BB?= =?UTF-8?q?=D1=87=D0=B0=D0=BD=D0=B8=D1=8E=20=D0=B2=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-uyep/sch3.tscn | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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] From 2ade939e88237ef1e17c34b380b7753bd4e7cb70 Mon Sep 17 00:00:00 2001 From: Maxim Name Date: Thu, 3 Jul 2025 18:48:20 +0300 Subject: [PATCH 13/20] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=20=D0=BC?= =?UTF-8?q?=D0=B5=D1=80=D0=B4=D0=B6=D0=B5=D0=BC=20=D1=81=20=D0=9F=D0=B0?= =?UTF-8?q?=D1=88=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-v/pribor_prd_v.gd | 50 +++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/scenes/pribor-prd-v/pribor_prd_v.gd b/scenes/pribor-prd-v/pribor_prd_v.gd index e179b5f9..36ea912e 100644 --- a/scenes/pribor-prd-v/pribor_prd_v.gd +++ b/scenes/pribor-prd-v/pribor_prd_v.gd @@ -16,6 +16,7 @@ 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, @@ -23,21 +24,20 @@ enum STATE_VAL { ERROR = 2 } var timer_03: Timer = Timer.new() +var fl_fs_1: bool = false +var fl_fs_2: 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(timer_03) timer_03.connect('timeout', Callable(self, 'on_timer_03')) - timer_03.one_shot = true - timer_03.wait_time = 5.0 - _on_control_fs(true) - timer_03.start() func set_default_state() -> void: @@ -50,6 +50,7 @@ func on_line_changed(unit_prd: Object) -> void: set_default_state() +# Основной процесс по принятию и обработки пакетов func on_data_received(unit_prd: Object) -> void: if not is_inside_tree(): return @@ -150,9 +151,9 @@ func _process_ems_data(status: PackedByteArray) -> void: func _process_ukp_power(status: PackedByteArray) -> void: - var in_blank: int = status.decode_u16(IN_BLANK_PRD) + #var in_blank: int = status.decode_u16(IN_BLANK_PRD) ## Мощность УМ от УКП 1 - if (in_blank >> CI_4_OT_FS) & 1: + if fl_fs_1: check_dkm(status, bit_dkm_3) ## Мощность УМ от УКП 1 @@ -177,7 +178,7 @@ func _process_ukp_power(status: PackedByteArray) -> void: count_packet_1 += 1 ## Мощность УМ от УКП 2 - if (in_blank >> CI_5_OT_FS) & 1: + if fl_fs_2: check_dkm(status, bit_dkm_4) ## Мощность УМ от УКП 2 @@ -221,10 +222,41 @@ func _on_control_fs(mode: bool) -> void: func on_timer_03() -> void: _on_control_fs(false) + fl_fs_1 = false + fl_fs_2 = 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 packet_type_7[fs].isg == 1: - print([packet_type_7[fs].index, packet_type_7[fs].isg]) + 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 packet_type_7[fs].isg == 1: + if not fl_fs_1: + timer_03.one_shot = true + timer_03.wait_time = 0.5 + _on_control_fs(true) + timer_03.start() + fl_fs_1 = true + 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 packet_type_7[fs].isg == 1: + fl_fs_1 = true + 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 packet_type_7[fs].isg == 1: + fl_fs_2 = true + 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 + From 6a26e2561998124fc4b29ef27ac16aa610d0af24 Mon Sep 17 00:00:00 2001 From: Maxim Name Date: Thu, 3 Jul 2025 19:35:09 +0300 Subject: [PATCH 14/20] =?UTF-8?q?=D0=BE=D1=82=D0=BB=D0=B0=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D1=8C=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B4-=D0=B2=20=D1=81=20=D0=B2=D0=BA=D0=BB=D1=8E?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC/=D0=BE=D1=82=D0=BA=D0=BB?= =?UTF-8?q?=D1=8E=D1=87=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC=20=D1=84=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-v/pribor_prd_v.gd | 36 +++++++++++------------------ scripts/interfer.gd | 4 +--- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/scenes/pribor-prd-v/pribor_prd_v.gd b/scenes/pribor-prd-v/pribor_prd_v.gd index 36ea912e..51fd9514 100644 --- a/scenes/pribor-prd-v/pribor_prd_v.gd +++ b/scenes/pribor-prd-v/pribor_prd_v.gd @@ -23,9 +23,8 @@ enum STATE_VAL { GOOD = 1, ERROR = 2 } -var timer_03: Timer = Timer.new() -var fl_fs_1: bool = false -var fl_fs_2: bool = false +var control_timer: Timer = Timer.new() +var flag_control: bool = false func _ready() -> void: @@ -36,8 +35,12 @@ func _ready() -> void: 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')) + 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() -> void: @@ -153,7 +156,7 @@ func _process_ems_data(status: PackedByteArray) -> void: func _process_ukp_power(status: PackedByteArray) -> void: #var in_blank: int = status.decode_u16(IN_BLANK_PRD) ## Мощность УМ от УКП 1 - if fl_fs_1: + if flag_control: check_dkm(status, bit_dkm_3) ## Мощность УМ от УКП 1 @@ -177,8 +180,7 @@ func _process_ukp_power(status: PackedByteArray) -> void: power_amplifier[i].state = STATE_VAL.GOOD if power_array_1[i] > 40 else STATE_VAL.ERROR count_packet_1 += 1 - ## Мощность УМ от УКП 2 - if fl_fs_2: + ## Мощность УМ от УКП 2 check_dkm(status, bit_dkm_4) ## Мощность УМ от УКП 2 @@ -199,7 +201,6 @@ func _process_ukp_power(status: PackedByteArray) -> void: 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] power_amplifier[i+6].state = STATE_VAL.GOOD if power_array_2[i] > 40 else STATE_VAL.ERROR @@ -211,19 +212,19 @@ func _on_control_fs(mode: bool) -> void: var interfer_name: String var fs_arr: Array if mode: + flag_control = true interfer_name = 'srnm2' 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_timer_03() -> void: +func on_stop_control() -> void: _on_control_fs(false) - fl_fs_1 = false - fl_fs_2 = false print('stop timer') @@ -233,17 +234,8 @@ func on_fs_update_state(packet_type_7: Dictionary): 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 packet_type_7[fs].isg == 1: - if not fl_fs_1: - timer_03.one_shot = true - timer_03.wait_time = 0.5 - _on_control_fs(true) - timer_03.start() - fl_fs_1 = true 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 packet_type_7[fs].isg == 1: - fl_fs_1 = true 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в': @@ -251,8 +243,6 @@ func on_fs_update_state(packet_type_7: Dictionary): 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 packet_type_7[fs].isg == 1: - fl_fs_2 = true 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в': diff --git a/scripts/interfer.gd b/scripts/interfer.gd index 5366e905..f69836d3 100644 --- a/scripts/interfer.gd +++ b/scripts/interfer.gd @@ -56,13 +56,11 @@ class Interfer: data_to_json['ss'] = msg_num data_to_json['ispp'] = ispp data_to_json['krp'] = krp - if get_params.size() < 1: - get_params.append('soc_temp') - data_to_json['get'] = get_params if krp != INTERFER_OFF: data_to_json['kni'] = kni data_to_json['powp'] = powp # TODO: Необходимо добавить управление мощностью data_to_json['params'] = params + data_to_json['get'] = get_params var pac = JSON.stringify(data_to_json).to_utf8_buffer() return pac From 5eb0b338d5b76f5f16d1dc81e2f534336145b52d Mon Sep 17 00:00:00 2001 From: Maxim Name Date: Thu, 3 Jul 2025 22:26:17 +0300 Subject: [PATCH 15/20] =?UTF-8?q?=D0=B4=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0=20=D1=81=D0=BE=D1=81=D1=82=D0=BE=D1=8F=D0=BD?= =?UTF-8?q?=D0=B8=D0=B9=20=D0=98=D0=9F=20=D0=BF=D1=80=D0=B8=20=D0=BE=D1=82?= =?UTF-8?q?=D1=81=D1=83=D1=82=D1=81=D1=82=D0=B2=D0=B8=D0=B8=20=D1=8F=D1=83?= =?UTF-8?q?-07?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-v/pribor_prd_v.gd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scenes/pribor-prd-v/pribor_prd_v.gd b/scenes/pribor-prd-v/pribor_prd_v.gd index 51fd9514..01f9134a 100644 --- a/scenes/pribor-prd-v/pribor_prd_v.gd +++ b/scenes/pribor-prd-v/pribor_prd_v.gd @@ -44,6 +44,12 @@ func _ready() -> void: 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 @@ -213,7 +219,7 @@ func _on_control_fs(mode: bool) -> void: var fs_arr: Array if mode: flag_control = true - interfer_name = 'srnm2' + interfer_name = 'k1' fs_arr = [[90.0, 2450.0, 1500.0, 23]] else: flag_control = false From b367a92e0f9978528aaf521e7b34bacdcc1fbcb1 Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Fri, 4 Jul 2025 10:01:40 +0300 Subject: [PATCH 16/20] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5?= =?UTF-8?q?=D1=82=D1=80=D0=B0=20get=20=D0=B2=20=D0=BF=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D1=83=20=D0=BF=D0=BE=D0=BC=D0=B5?= =?UTF-8?q?=D1=85=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/работа/работа.tscn | 2 +- scripts/interfer.gd | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) 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..30fd250d 100644 --- a/scripts/interfer.gd +++ b/scripts/interfer.gd @@ -59,7 +59,9 @@ class Interfer: if krp != INTERFER_OFF: data_to_json['kni'] = kni data_to_json['powp'] = powp # TODO: Необходимо добавить управление мощностью - data_to_json['get'] = [] + if get_params.size() < 1: + get_params.append('soc_temp') + data_to_json['get'] = get_params data_to_json['params'] = params var pac = JSON.stringify(data_to_json).to_utf8_buffer() return pac From 388db24fc62d96e21f630d3ec6b10033d59851a5 Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Fri, 4 Jul 2025 10:02:46 +0300 Subject: [PATCH 17/20] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5?= =?UTF-8?q?=D1=82=D1=80=D0=B0=20get=20=D0=B2=20=D0=BF=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D1=83=20=D0=BF=D0=BE=D0=BC=D0=B5?= =?UTF-8?q?=D1=85=D0=B8=20=D0=B2=20=D1=80=D0=B5=D0=B6=D0=B8=D0=BC=D0=B5=20?= =?UTF-8?q?off=20=D0=B2=20=D1=82=D0=BE=D0=BC=20=D1=87=D0=B8=D1=81=D0=BB?= =?UTF-8?q?=D0=B5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/interfer.gd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/interfer.gd b/scripts/interfer.gd index 30fd250d..5366e905 100644 --- a/scripts/interfer.gd +++ b/scripts/interfer.gd @@ -56,12 +56,12 @@ class Interfer: data_to_json['ss'] = msg_num data_to_json['ispp'] = ispp data_to_json['krp'] = krp + if get_params.size() < 1: + get_params.append('soc_temp') + data_to_json['get'] = get_params if krp != INTERFER_OFF: data_to_json['kni'] = kni data_to_json['powp'] = powp # TODO: Необходимо добавить управление мощностью - if get_params.size() < 1: - get_params.append('soc_temp') - data_to_json['get'] = get_params data_to_json['params'] = params var pac = JSON.stringify(data_to_json).to_utf8_buffer() return pac From 0e303abf197659e910f6205ec810c3138646f2ab Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Fri, 4 Jul 2025 13:46:17 +0300 Subject: [PATCH 18/20] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=A93=20=D0=A7=D1=82=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=81=D0=BE=D1=81=D1=82=D0=BE=D1=8F=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=B8=D0=B7=20=D0=B8=D0=BD=D0=BF=D1=83=D1=82=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B3=D0=B8=D1=81=D1=82=D1=80=D0=BE=D0=B2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-uyep/sch3-view.gd | 43 ++++++++++++++------------------- scripts/sch3.gd | 5 ---- 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/scenes/pribor-uyep/sch3-view.gd b/scenes/pribor-uyep/sch3-view.gd index 9fe56547..1f5a4d91 100644 --- a/scenes/pribor-uyep/sch3-view.gd +++ b/scenes/pribor-uyep/sch3-view.gd @@ -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,23 +97,34 @@ 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] +## Вызывается по сигналу "приняты данные чтения регистров входов".[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): +## [param data] - Массив значений прочитанных из регистров.[br] +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): + return + # "Для контроля состояния управляющего элемента подачи электроэнергии на приборы ..." + # "Для контроля подачи электроэнергии на приборы ..." + # Таблицы 3.13 и 3.14. Ecли значения соответствующих битов в этих + # регистрах равны, то "исправно". + var items = get_tree().get_nodes_in_group('bits_items_good') for i in data.size(): - regs_holding[base_addr + i] = data[i] + 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 @@ -131,23 +141,6 @@ func on_read(base_addr: int, data: Array, unit_sch3): 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): - if !is_inside_tree(): - return - if (base_addr != base_input_address) or (data.size() < regs_input_count): - return - # "Для контроля состояния управляющего элемента подачи электроэнергии на приборы ..." - # "Для контроля подачи электроэнергии на приборы ..." - # Таблицы 3.13 и 3.14. Ecли значения соответствующих битов в этих - # регистрах равны, то "исправно". - var items = get_tree().get_nodes_in_group('bits_items_good') - for i in data.size(): - regs_input[base_addr + i] = data[i] # Таблица 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/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() From 72dd8240a2d47a3efe49efed01c919714e0ecf5b Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Fri, 4 Jul 2025 14:35:55 +0300 Subject: [PATCH 19/20] =?UTF-8?q?=D0=A0=D0=B5=D0=B3=D1=80=D0=B5=D1=81?= =?UTF-8?q?=D1=81=D0=B8=D1=8F.=20=D0=92=D0=BE=D0=B7=D0=B2=D1=80=D0=B0?= =?UTF-8?q?=D1=82=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8=20=D1=83=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=B8?= =?UTF-8?q?=D1=82=D0=B0=D0=BD=D0=B8=D0=B5=D0=BC=20=D0=A3=D0=A4=20=D0=B2=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D0=B5=20=D0=A93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-v/pribor_prd_v.gd | 5 ++--- scenes/pribor-uyep/sch3-view.gd | 3 ++- scenes/pribor-uyep/sch3.tscn | 11 +++++++++++ scripts/prd.gd | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/scenes/pribor-prd-v/pribor_prd_v.gd b/scenes/pribor-prd-v/pribor_prd_v.gd index 01f9134a..76a70d2b 100644 --- a/scenes/pribor-prd-v/pribor_prd_v.gd +++ b/scenes/pribor-prd-v/pribor_prd_v.gd @@ -49,7 +49,7 @@ func set_default_state() -> void: $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 @@ -246,7 +246,7 @@ func on_fs_update_state(packet_type_7: Dictionary): $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в': @@ -255,4 +255,3 @@ func on_fs_update_state(packet_type_7: Dictionary): $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 1f5a4d91..665e6a65 100644 --- a/scenes/pribor-uyep/sch3-view.gd +++ b/scenes/pribor-uyep/sch3-view.gd @@ -64,6 +64,7 @@ func on_toggled_switch(val: bool, meta: Array, unit_sch3): regs_holding[on_addr] = tools.set_bit(regs_holding[on_addr], on_bit, val) regs_holding[off_addr] = tools.set_bit(regs_holding[off_addr], off_bit, not val) unit_sch3.push_write_holding(regs_holding) + print_debug(regs_holding) func _enter_tree() -> void: @@ -137,7 +138,7 @@ func on_input(base_addr: int, data: Array, unit_sch3): var byte1: int = bits[2] # Адрес регистра var bit1: int = bits[3] # Индекс бита var val0: bool = regs_holding[byte0] & (1 << bit0) > 0 - item.button_pressed = val0 + 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) diff --git a/scenes/pribor-uyep/sch3.tscn b/scenes/pribor-uyep/sch3.tscn index 2905b587..a175a03f 100644 --- a/scenes/pribor-uyep/sch3.tscn +++ b/scenes/pribor-uyep/sch3.tscn @@ -136,6 +136,17 @@ theme_override_font_sizes/font_size = 17 text = "УФ" vertical_alignment = 1 +[node name="switch0" type="CheckButton" parent="margin/vbox/table" groups=["bits_items_switch", "c111"]] +editor_description = "Питание УФ" +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] + [node name="state1" type="TextureRect" parent="margin/vbox/table" groups=["bits_items_good"]] custom_minimum_size = Vector2(24, 24) layout_mode = 2 diff --git a/scripts/prd.gd b/scripts/prd.gd index 2141471c..8d4e3261 100644 --- a/scripts/prd.gd +++ b/scripts/prd.gd @@ -347,7 +347,7 @@ func on_data_capsrpb_received(unit0: capsrpb.CapsRpb): if not unit0.json_dic.has('ts'): return if unit0.json_dic['ts'] != 7: return if not unit0.json_dic.has('msfs'): return - + var msfs = unit0.json_dic['msfs'] for fs in msfs: if fs is Dictionary: From 5bb1e24c7a6285c1210cc545ce2830bbaa5053e3 Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Fri, 4 Jul 2025 14:41:43 +0300 Subject: [PATCH 20/20] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5.=20=D0=A3=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=20=D0=BB=D0=B8=D1=88=D0=BD=D0=B8=D0=B9=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=D0=BD=D1=82.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-uyep/sch3-view.gd | 1 - 1 file changed, 1 deletion(-) diff --git a/scenes/pribor-uyep/sch3-view.gd b/scenes/pribor-uyep/sch3-view.gd index 665e6a65..59891f3e 100644 --- a/scenes/pribor-uyep/sch3-view.gd +++ b/scenes/pribor-uyep/sch3-view.gd @@ -64,7 +64,6 @@ func on_toggled_switch(val: bool, meta: Array, unit_sch3): regs_holding[on_addr] = tools.set_bit(regs_holding[on_addr], on_bit, val) regs_holding[off_addr] = tools.set_bit(regs_holding[off_addr], off_bit, not val) unit_sch3.push_write_holding(regs_holding) - print_debug(regs_holding) func _enter_tree() -> void: