После отладки, добавление индикации состояний эмс ячеек

This commit is contained in:
TotMaxim
2025-11-12 20:47:35 +03:00
parent 2980aa9f15
commit 87e360e1a9
10 changed files with 323 additions and 90 deletions

View File

@@ -18,9 +18,23 @@ func _ready() -> void:
for temp in power_amplifier:
temp.value1 = -70
unit_prd_k.connect('control_is_over', Callable(self, 'on_press_device'))
#unit_prd_k.power_amplify = power_amplifier
on_press_device()
func _process(delta: float) -> void:
set_frame($input_0, unit_prd_k.ems_input_1)
set_frame($input_1, unit_prd_k.ems_input_2)
set_frame($input_2, unit_prd_k.ems_input_lit_1)
set_frame($output_0, unit_prd_k.ems_output_1)
set_frame($output_1, unit_prd_k.ems_output_2)
set_frame($output_2, unit_prd_k.ems_output_lit_1)
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
func start_control() -> void:
set_default_state()
find_labels(self)

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://m5s87q7m66lj"]
[gd_scene load_steps=15 format=3 uid="uid://m5s87q7m66lj"]
[ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="1_8dmgr"]
[ext_resource type="Script" uid="uid://cwvikiygf8b1m" path="res://scenes/pribor-prd-k/pribor-prd-k.gd" id="1_tpdyp"]
@@ -9,6 +9,30 @@
[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="7_xpa2n"]
[ext_resource type="PackedScene" uid="uid://dq31j24gv5vi4" path="res://scenes/контроль/кассета-п-2.tscn" id="8_6fdp7"]
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="8_la5yt"]
[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="10_c7lv8"]
[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="11_wd1vi"]
[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="12_bjebg"]
[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="13_kc77u"]
[sub_resource type="SpriteFrames" id="SpriteFrames_di0aa"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("10_c7lv8")
}, {
"duration": 1.0,
"texture": ExtResource("11_wd1vi")
}, {
"duration": 1.0,
"texture": ExtResource("12_bjebg")
}, {
"duration": 1.0,
"texture": ExtResource("13_kc77u")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[node name="pribor_prd_k" type="Control"]
layout_mode = 3
@@ -322,3 +346,42 @@ offset_bottom = 1003.0
text = "Прибор ПРД- неисправен"
horizontal_alignment = 1
metadata/_edit_lock_ = true
[node name="input_0" type="AnimatedSprite2D" parent="."]
position = Vector2(234, 177)
sprite_frames = SubResource("SpriteFrames_di0aa")
[node name="Label" type="Label" parent="input_0"]
offset_left = -38.0
offset_top = 16.0
offset_right = 30.0
offset_bottom = 35.0
text = "Вход ЕМС"
[node name="input_1" type="AnimatedSprite2D" parent="."]
position = Vector2(277, 177)
sprite_frames = SubResource("SpriteFrames_di0aa")
[node name="input_2" type="AnimatedSprite2D" parent="."]
position = Vector2(188, 177)
sprite_frames = SubResource("SpriteFrames_di0aa")
[node name="output_0" type="AnimatedSprite2D" parent="."]
position = Vector2(421, 177)
sprite_frames = SubResource("SpriteFrames_di0aa")
[node name="Label" type="Label" parent="output_0"]
offset_left = -40.0
offset_top = 14.0
offset_right = 36.0
offset_bottom = 33.0
text = "Модуляция"
metadata/_edit_use_anchors_ = true
[node name="output_1" type="AnimatedSprite2D" parent="."]
position = Vector2(462, 177)
sprite_frames = SubResource("SpriteFrames_di0aa")
[node name="output_2" type="AnimatedSprite2D" parent="."]
position = Vector2(383, 177)
sprite_frames = SubResource("SpriteFrames_di0aa")

View File

@@ -18,9 +18,20 @@ func _ready() -> void:
for temp in power_amplifier:
temp.value1 = -70
unit_prd_n.connect('control_is_over', Callable(self, 'on_press_device'))
#unit_prd_n.power_amplify = power_amplifier
on_press_device()
func _process(delta: float) -> void:
set_frame($input_0, unit_prd_n.ems_input_1)
set_frame($input_1, unit_prd_n.ems_input_2)
set_frame($output_0, unit_prd_n.ems_output_1)
set_frame($output_1, unit_prd_n.ems_output_2)
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
func start_control() -> void:
set_default_state()
find_labels(self)

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=3 uid="uid://dnuexoef2nnv5"]
[gd_scene load_steps=13 format=3 uid="uid://dnuexoef2nnv5"]
[ext_resource type="Script" uid="uid://cto2r4ipew65m" path="res://scenes/pribor-prd-n/pribor-prd-n.gd" id="1_bnnv3"]
[ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_is25t"]
@@ -7,6 +7,30 @@
[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_b5wvk"]
[ext_resource type="PackedScene" uid="uid://bcyxqni7gxvtq" path="res://scenes/контроль/блок-в.tscn" id="7_bnnv3"]
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_eoqf2"]
[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="8_bnnv3"]
[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="9_is25t"]
[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="10_meukj"]
[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="11_xkifg"]
[sub_resource type="SpriteFrames" id="SpriteFrames_1wf07"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("8_bnnv3")
}, {
"duration": 1.0,
"texture": ExtResource("9_is25t")
}, {
"duration": 1.0,
"texture": ExtResource("10_meukj")
}, {
"duration": 1.0,
"texture": ExtResource("11_xkifg")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[node name="pribor_prd_n" type="Control"]
layout_mode = 3
@@ -350,3 +374,33 @@ offset_right = 649.0
offset_bottom = 1003.0
horizontal_alignment = 1
metadata/_edit_lock_ = true
[node name="input_0" type="AnimatedSprite2D" parent="."]
position = Vector2(234, 177)
sprite_frames = SubResource("SpriteFrames_1wf07")
[node name="Label" type="Label" parent="input_0"]
offset_left = -15.0
offset_top = 15.0
offset_right = 53.0
offset_bottom = 34.0
text = "Вход ЕМС"
[node name="input_1" type="AnimatedSprite2D" parent="."]
position = Vector2(277, 177)
sprite_frames = SubResource("SpriteFrames_1wf07")
[node name="output_0" type="AnimatedSprite2D" parent="."]
position = Vector2(381, 177)
sprite_frames = SubResource("SpriteFrames_1wf07")
[node name="Label" type="Label" parent="output_0"]
offset_left = -19.0
offset_top = 14.0
offset_right = 57.0
offset_bottom = 33.0
text = "Модуляция"
[node name="output_1" type="AnimatedSprite2D" parent="."]
position = Vector2(422, 177)
sprite_frames = SubResource("SpriteFrames_1wf07")

View File

@@ -21,6 +21,18 @@ func _ready() -> void:
on_press_device()
func _process(_delta: float) -> void:
if Engine.is_editor_hint():
return
set_frame($input_0, unit_prd_v.ems_input_1)
set_frame($input_1, unit_prd_v.ems_input_2)
set_frame($output_0, unit_prd_v.ems_output_1)
set_frame($output_1, unit_prd_v.ems_output_2)
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
func start_control() -> void:
set_default_state()
find_labels(self)
@@ -64,6 +76,53 @@ static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifi
i_powapm.state = status
## Проверка температур УМ от УКП
static func check_temperature_um(status_prd: PackedByteArray, power_amplifier: Array) -> bool:
if power_amplifier.size() < 1: return false
const Constants: Dictionary = {
'CONST_MIN_TEMP': -25,
'MAXIMUM_CODE_ADC': 3796,
'MINIMUM_CODE_AD': 2660,
'TEMPERATURE_UKP_1': 47,
'TEMPERATURE_UKP_2': 79,
}
const TEMP: float = 115.0 / (Constants.MAXIMUM_CODE_ADC - Constants.MINIMUM_CODE_AD)
var ukp1_online: int = (status_prd[0] >> 2) & 1
var ukp2_online = (status_prd[0] >> 3) & 1
var all_temp_is_ok: bool = true
if ukp1_online:
var tmp_1: int
var temperature_ukp_1: int
for i_temp in 6:
temperature_ukp_1 = status_prd.decode_u16(Constants.TEMPERATURE_UKP_1 + 2 * i_temp)
tmp_1 = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3)
power_amplifier[i_temp].value1 = tmp_1
if tmp_1>70:
all_temp_is_ok = false
if power_amplifier.size() > 12: # Темпуратура от УМ литеры 1
temperature_ukp_1 = status_prd.decode_u16(Constants.TEMPERATURE_UKP_1 + 2 * 7)
tmp_1 = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3)
power_amplifier[6].value1 = tmp_1
if tmp_1>70:
all_temp_is_ok = false
if ukp2_online:
for i_temp in 6:
var temperature_ukp_2: int = status_prd.decode_u16(Constants.TEMPERATURE_UKP_2 + 2 * i_temp)
var tmp_2: int = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3)
if power_amplifier.size() > 12:
power_amplifier[i_temp+7].value1 = tmp_2
if tmp_2>70:
all_temp_is_ok = false
else:
power_amplifier[i_temp+6].value1 = tmp_2
if tmp_2>70:
all_temp_is_ok = false
return all_temp_is_ok
func on_press_device() -> void:
var nodes_y5: Array = get_tree().get_nodes_in_group('y-5')
var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply')

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://cvskpe1ti3p45"]
[gd_scene load_steps=14 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"]
@@ -8,6 +8,30 @@
[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_os4mt"]
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_38u2b"]
[ext_resource type="PackedScene" uid="uid://bcyxqni7gxvtq" path="res://scenes/контроль/блок-в.tscn" id="8_4e87c"]
[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="9_4e87c"]
[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="10_g8fvp"]
[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="11_gsby4"]
[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="12_vxfkm"]
[sub_resource type="SpriteFrames" id="SpriteFrames_s5gcy"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("9_4e87c")
}, {
"duration": 1.0,
"texture": ExtResource("10_g8fvp")
}, {
"duration": 1.0,
"texture": ExtResource("11_gsby4")
}, {
"duration": 1.0,
"texture": ExtResource("12_vxfkm")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[node name="pribor_prd_v" type="Control"]
layout_mode = 3
@@ -299,3 +323,33 @@ offset_right = 649.0
offset_bottom = 1003.0
horizontal_alignment = 1
metadata/_edit_lock_ = true
[node name="input_0" type="AnimatedSprite2D" parent="."]
position = Vector2(234, 177)
sprite_frames = SubResource("SpriteFrames_s5gcy")
[node name="Label" type="Label" parent="input_0"]
offset_left = -15.0
offset_top = 15.0
offset_right = 53.0
offset_bottom = 34.0
text = "Вход ЕМС"
[node name="input_1" type="AnimatedSprite2D" parent="."]
position = Vector2(277, 177)
sprite_frames = SubResource("SpriteFrames_s5gcy")
[node name="output_0" type="AnimatedSprite2D" parent="."]
position = Vector2(381, 177)
sprite_frames = SubResource("SpriteFrames_s5gcy")
[node name="Label" type="Label" parent="output_0"]
offset_left = -19.0
offset_top = 14.0
offset_right = 57.0
offset_bottom = 33.0
text = "Модуляция"
[node name="output_1" type="AnimatedSprite2D" parent="."]
position = Vector2(422, 177)
sprite_frames = SubResource("SpriteFrames_s5gcy")

View File

@@ -368,12 +368,12 @@ func _process(delta) -> void:
_queue.erase(tile.i)
req.request_completed.connect(_response.bind(req, tile))
#if req.request(tile.url) != OK:
#tile.t = now
#remove_child(req)
#req.queue_free()
#_req_count -= 1
# push_error('запрос \"%s\" не отправлен' % tile.url) TODO: For Deugs
if req.request(tile.url) != OK:
tile.t = now
remove_child(req)
req.queue_free()
_req_count -= 1
push_error('запрос \"%s\" не отправлен' % tile.url) #TODO: For Deugs
if _queue.is_empty():
emit_signal('load_completed')

View File

@@ -675,4 +675,3 @@ func set_th_emit(th: threats.Threat, ecm: Interfer):
return
else:
th.emit_state = 1

View File

@@ -263,17 +263,16 @@ class TestPRD extends Node:
var flag_si_fs_input: bool = false
var flag_si_fs_output: bool = false
var unit_prd: Object
var power_amplify: Array
var power_result: Dictionary
#var control_label: Label
var control_timer: Timer = Timer.new()
var ems_6666_timer: Timer = Timer.new()
var machine_timer: Timer = Timer.new()
var cc: int = 0
var cmd_array: Array
signal control_is_over()
signal update_progress(progress_value: float)
signal update_max_value_progress(max_progress_value: int)
var cc: int = 0
var cmd_array: Array
var progress_value: float:
set(v):
@@ -302,14 +301,14 @@ class TestPRD extends Node:
## Пакеты от ЯУ-07
func on_data_received(unit_pribor: Object) -> void:
var status: PackedByteArray = unit_pribor.status
socket_status_ems_g(status)
if machine_timer.is_stopped():
return
var status: PackedByteArray = unit_pribor.status
block_kasseta_y5_config = check_block_kasseta_y5(status, block_kasseta_y5_config)
block_ip_config = check_block_ip(status, block_ip_config)
control_results.temperature = check_temperature_um(status, power_amplify)
socket_status_ems_g(status)
_process_dkm_status(status)
if current_litera != 0:
var tek_litera: Dictionary = power_for_litera[current_litera]
@@ -318,8 +317,29 @@ class TestPRD extends Node:
tek_litera[_get_ray_key(state)] = power_um_ukp(status, current_litera, tek_litera[_get_ray_key(state)])
power_for_litera[current_litera] = tek_litera
var ems_input_1: int
var ems_input_2: int
var ems_input_lit_1: int
var ems_output_1: int
var ems_output_2: int
var ems_output_lit_1: int
func socket_status_ems_g(packet_form_yau_07: PackedByteArray) -> void:
if self_name in ['', '', '', '']:
ems_input_1 = (packet_form_yau_07.decode_u16(DataIndices.IN_BLANK_PRD) & (1 << 9)) != 0
ems_input_2 = (packet_form_yau_07.decode_u16(DataIndices.IN_BLANK_PRD) & (1 << 10)) != 0
if self_name in ['', '', '', '']:
ems_input_1 = (packet_form_yau_07.decode_u16(DataIndices.IN_BLANK_PRD) & (1 << 11)) != 0
ems_input_1 = (packet_form_yau_07.decode_u16(DataIndices.IN_BLANK_PRD) & (1 << 12)) != 0
if self_name in ['', '', '', '']:
ems_input_1 = (packet_form_yau_07.decode_u16(DataIndices.IN_BLANK_PRD) & (1 << 13)) != 0
ems_input_1 = (packet_form_yau_07.decode_u16(DataIndices.IN_BLANK_PRD) & (1 << 14)) != 0
ems_input_lit_1 = (packet_form_yau_07.decode_u16(DataIndices.IN_BLANK_PRD) & (1 << 8)) != 0
ems_output_1 = (packet_form_yau_07.decode_u16(DataIndices.OUT_BLANK_PRD) & (1 << 4)) != 0
ems_output_2 = (packet_form_yau_07.decode_u16(DataIndices.OUT_BLANK_PRD) & (1 << 5)) != 0
ems_output_lit_1 = (packet_form_yau_07.decode_u16(DataIndices.OUT_BLANK_PRD) & (1 << 3)) != 0
var number_socket_input: int
if current_litera >= 1 and current_litera <= 7:
number_socket_input = current_litera + 7
@@ -327,6 +347,8 @@ class TestPRD extends Node:
var in_blank: int = packet_form_yau_07.decode_u16(DataIndices.IN_BLANK_PRD)
flag_si_fs_input = (in_blank & (1 << number_socket_input)) != 0 ## Флаг СИ от ФС входа в ЭМС-Г для текущей литеры
var number_socket_output: int
number_socket_output = 4 if current_litera in [2, 4, 6] else 3 if current_litera == 1 else 5
@@ -354,11 +376,14 @@ class TestPRD extends Node:
_handle_fs_turn_on_state()
state = STATE_MACHINE.FS_WORK
STATE_MACHINE.FS_WORK:
for key in ecms.keys():
pass
#print([fs_parameters, current_litera])
#print('ecms: %s %s' % [ecms[key].kni, ecms[key].params.freq])
if ecms.size() and flag_fs_status_ok:
var flag_ecm: bool = false
for key in ecms:
var params = ecms[key].params.freq
if fs_parameters[current_litera].freq == params:
var kni = ecms[key].kni
if pribor_config[self_name].angle == kni:
flag_ecm = true
if flag_ecm and flag_fs_status_ok:
ems_6666_timer.start()
_handle_fs_work_state()
STATE_MACHINE.CHEK_KASSETA_Y5:
@@ -607,7 +632,7 @@ class TestPRD extends Node:
func on_mode_changed(in_tree: bool) -> void:
if not in_tree:
if not in_tree: ## TODO: Дополнительная проверка если контроль идет, если нет, то смысла вызывать нет
progress_value = 0
machine_timer.stop()
state = STATE_MACHINE.INIT
@@ -722,7 +747,7 @@ class TestPRD extends Node:
params.width,
sectors[litera - 1] if litera == 1 else sectors[litera - 5] if litera > 5 else sectors[litera - 4] if litera > 3 else sectors[litera - 2]
])
signaller.emit_signal('emit_changed', mode)
#signaller.emit_signal('emit_changed', mode)
signaller.emit_signal('interfer_init', interfer_name, fs_arr, power_um)
@@ -749,52 +774,6 @@ class TestPRD extends Node:
return y5_config
## Проверка температур УМ от УКП
static func check_temperature_um(status_prd: PackedByteArray, power_amplifier: Array) -> bool:
const Constants: Dictionary = {
'CONST_MIN_TEMP': -25,
'MAXIMUM_CODE_ADC': 3796,
'MINIMUM_CODE_AD': 2660,
'TEMPERATURE_UKP_1': 47,
'TEMPERATURE_UKP_2': 79,
}
const TEMP: float = 115.0 / (Constants.MAXIMUM_CODE_ADC - Constants.MINIMUM_CODE_AD)
var ukp1_online: int = (status_prd[0] >> 2) & 1
var ukp2_online = (status_prd[0] >> 3) & 1
var all_temp_is_ok: bool = true
if ukp1_online:
var tmp_1: int
var temperature_ukp_1: int
for i_temp in 6:
temperature_ukp_1 = status_prd.decode_u16(Constants.TEMPERATURE_UKP_1 + 2 * i_temp)
tmp_1 = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3)
#power_amplifier[i_temp].value1 = tmp_1
if tmp_1>70:
all_temp_is_ok = false
if power_amplifier.size() > 12: # Темпуратура от УМ литеры 1
temperature_ukp_1 = status_prd.decode_u16(Constants.TEMPERATURE_UKP_1 + 2 * 7)
tmp_1 = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3)
#power_amplifier[6].value1 = tmp_1
if tmp_1>70:
all_temp_is_ok = false
if ukp2_online:
for i_temp in 6:
var temperature_ukp_2: int = status_prd.decode_u16(Constants.TEMPERATURE_UKP_2 + 2 * i_temp)
var tmp_2: int = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3)
if power_amplifier.size() > 12:
#power_amplifier[i_temp+7].value1 = tmp_2
if tmp_2>70:
all_temp_is_ok = false
else:
#power_amplifier[i_temp+6].value1 = tmp_2
if tmp_2>70:
all_temp_is_ok = false
return all_temp_is_ok
## Проверка ДКМ
static func check_dkm(status_prd: PackedByteArray, bit_dkm: int) -> bool:
var dkm: int = 28