ДКМ от ДОУ доработан
This commit is contained in:
@@ -7,13 +7,13 @@ var past_pribor: int
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
|
||||
Network.connect('port_fs_opened_1', _on_fs_status_1.bind(Constants.STATE_VAL.GOOD))
|
||||
Network.connect('port_fs_closed_1', _on_fs_status_1.bind(Constants.STATE_VAL.ERROR))
|
||||
|
||||
Network.connect('port_fs_closed_1', _on_fs_status_1.bind(Constants.STATE_VAL.NONE))
|
||||
|
||||
Network.connect('port_fs_opened_2', _on_fs_status_2.bind(Constants.STATE_VAL.GOOD))
|
||||
Network.connect('port_fs_closed_2', _on_fs_status_2.bind(Constants.STATE_VAL.ERROR))
|
||||
|
||||
Network.connect('port_fs_closed_2', _on_fs_status_2.bind(Constants.STATE_VAL.NONE))
|
||||
|
||||
self.add_child(timer)
|
||||
timer.connect('timeout', Callable(self, '_on_timer').bind(Network.unit))
|
||||
timer.start(1)
|
||||
@@ -34,7 +34,14 @@ func _ready() -> void:
|
||||
$soc_P2/IP9_50,
|
||||
$soc_P2/IP12_50,
|
||||
|
||||
$soc_y5/IP5_25]
|
||||
$soc_y5/IP5_25,
|
||||
|
||||
$Kasseta_FS/ref_A3,
|
||||
$Kasseta_FS/ref_A1,
|
||||
$Kasseta_FS/ref_A2,
|
||||
$Kasseta_FS/ref_A4,
|
||||
$Kasseta_FS/Block_FS_PRD_K,
|
||||
$Kasseta_FS/FS_PRD_K]
|
||||
count_cell = len(node_cell_ind)
|
||||
|
||||
|
||||
@@ -58,45 +65,56 @@ func _status_cell(status):
|
||||
var dkm: int = status.decode_u8(Constants.DataIndices.DKM)
|
||||
$DKM.text = str(dkm)
|
||||
# status_board
|
||||
for i in range(1, count_cell-8):
|
||||
for i in range(1, 5):
|
||||
if ((status_board >> (i-1)) & 0x1) == 1:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.GOOD
|
||||
else:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.ERROR
|
||||
|
||||
|
||||
#dkm
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_H:
|
||||
$soc_DKM/DKM_2.state = 1 if (dkm >> 1) & 0x1 else 3
|
||||
$soc_DKM/DKM_2.state = (dkm >> 1) & 0x1
|
||||
$soc_DKM/DKM_3.state = (dkm >> 2) & 0x1
|
||||
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
|
||||
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
|
||||
$soc_DKM/DKM_2.state = (dkm >> 3) & 0x1
|
||||
$soc_DKM/DKM_3.state = (dkm >> 4) & 0x1
|
||||
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
|
||||
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
$soc_DKM/DKM_1.state = (dkm >> 0) & 0x1
|
||||
$soc_DKM/DKM_2.state = (dkm >> 5) & 0x1
|
||||
$soc_DKM/DKM_3.state = (dkm >> 6) & 0x1
|
||||
|
||||
$Kasseta_FS/Block_FS_PRD_K.state = $soc_DKM/DKM_1.state
|
||||
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
|
||||
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
|
||||
|
||||
#dry_contact
|
||||
if (node_cell_ind[2].state == Constants.STATE_VAL.GOOD):
|
||||
for i in range(5, count_cell):
|
||||
for i in range(5, 13):
|
||||
if ((dry_contact >> (i-5)) & 0x1) == 0:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.GOOD
|
||||
else:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.ERROR
|
||||
else:
|
||||
for i in range(5, count_cell):
|
||||
for i in range(5, 13):
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.NONE
|
||||
|
||||
|
||||
func _status_prd():
|
||||
var status: int = 0
|
||||
for i in range(count_cell-3):
|
||||
for i in range(10):
|
||||
status += 1 if (node_cell_ind[i].state == Constants.STATE_VAL.GOOD) else 0
|
||||
for i in range(12, count_cell-2):
|
||||
status += 1 if (node_cell_ind[i].state == Constants.STATE_VAL.GOOD) else 0
|
||||
status += 1 if (node_cell_ind[count_cell-1].state == Constants.STATE_VAL.GOOD) else 0
|
||||
|
||||
if (Constants.CURRENT_MODE == Constants.MODE.PRD_K):
|
||||
status += 1 if (node_cell_ind[count_cell-3].state == Constants.STATE_VAL.GOOD) else 0
|
||||
status += 1 if (node_cell_ind[count_cell-2].state == Constants.STATE_VAL.GOOD) else 0
|
||||
status += 1 if (node_cell_ind[10].state == Constants.STATE_VAL.GOOD) else 0
|
||||
status += 1 if (node_cell_ind[11].state == Constants.STATE_VAL.GOOD) else 0
|
||||
status += 1 if (node_cell_ind[12].state == Constants.STATE_VAL.GOOD) else 0
|
||||
status += 1 if (node_cell_ind[17].state == Constants.STATE_VAL.GOOD) else 0
|
||||
status += 1 if (node_cell_ind[18].state == Constants.STATE_VAL.GOOD) else 0
|
||||
if (status == count_cell):
|
||||
$lbl_control.text = 'Прибор исправен'
|
||||
$lbl_control.modulate = Color.AQUAMARINE
|
||||
@@ -104,7 +122,7 @@ func _status_prd():
|
||||
$lbl_control.text = 'Прибор неисправен'
|
||||
$lbl_control.modulate = Color.CRIMSON
|
||||
else:
|
||||
if (status == count_cell-2):
|
||||
if (status == count_cell-5):
|
||||
$lbl_control.text = 'Прибор исправен'
|
||||
$lbl_control.modulate = Color.AQUAMARINE
|
||||
else:
|
||||
@@ -141,12 +159,12 @@ func _draw_control_panel_prd(pribor):
|
||||
$soc_P1/MAA_2.rname = 'А23'
|
||||
# Кассета П-2
|
||||
$soc_P2.visible = false
|
||||
|
||||
|
||||
# ДКМ
|
||||
$soc_DKM/DKM_1.visible = false
|
||||
$soc_DKM/DKM_2.fname = 'ДКМ2'
|
||||
$soc_DKM/DKM_3.fname = 'ДКМ3'
|
||||
|
||||
|
||||
elif pribor == Constants.MODE.PRD_B:
|
||||
# Кассета У5
|
||||
$soc_y5/IP5_25.rname = 'А24'
|
||||
@@ -216,4 +234,3 @@ func _on_fs_status_1(_name_port, status_fs_1):
|
||||
|
||||
func _on_fs_status_2(_name_port, status_fs_2):
|
||||
$Kasseta_FS/ref_A2.state = status_fs_2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user