|
@@ -52,27 +52,12 @@ class Trace_pusher:
|
|
|
for i in range(8):
|
|
|
self.drawing_speed.append(self.data_s7.make_point(f'L{i+1}拉速'))
|
|
|
|
|
|
+ # 5号机
|
|
|
if self.hostsend_flag:
|
|
|
- # self.billet_position = [
|
|
|
- # Through_state_continues3(data_s7.make_point('集群限位L1_1[3]'), data_s7.make_point('集群限位L1_1[4]'), data_s7.make_point('集群限位L1_1[5]')),
|
|
|
- # Through_state_continues3(data_s7.make_point('集群限位L2_1[3]'), data_s7.make_point('集群限位L2_1[4]'), data_s7.make_point('集群限位L2_1[5]')),
|
|
|
- # Through_state_continues3(data_s7.make_point('集群限位L3_1[3]'), data_s7.make_point('集群限位L3_1[4]'), data_s7.make_point('集群限位L3_1[5]')),
|
|
|
- # Through_state_continues3(data_s7.make_point('集群限位L4_1[3]'), data_s7.make_point('集群限位L4_1[4]'), data_s7.make_point('集群限位L4_1[5]')),
|
|
|
- # Through_state_continues3(data_s7.make_point('集群限位L5_1[3]'), data_s7.make_point('集群限位L5_1[4]'), data_s7.make_point('集群限位L5_1[5]')),
|
|
|
- # Through_state_continues3(data_s7.make_point('集群限位L6_1[3]'), data_s7.make_point('集群限位L6_1[4]'), data_s7.make_point('集群限位L6_1[5]')),
|
|
|
- # Through_state_separation2(data_s7.make_point('集群限位L7_1[4]'), data_s7.make_point('集群限位L7_1[5]')),
|
|
|
- # Through_state_continues3(data_s7.make_point('集群限位L8_1[3]'), data_s7.make_point('集群限位L8_1[4]'), data_s7.make_point('集群限位L8_1[5]'))
|
|
|
- # ]
|
|
|
- # self.billet_out_sig = [
|
|
|
- # data_s7.make_point('集群限位L1_2[1]'),
|
|
|
- # data_s7.make_point('集群限位L2_2[1]'),
|
|
|
- # data_s7.make_point('集群限位L3_2[1]'),
|
|
|
- # data_s7.make_point('集群限位L4_2[1]'),
|
|
|
- # data_s7.make_point('集群限位L5_2[1]'),
|
|
|
- # data_s7.make_point('集群限位L6_2[1]'),
|
|
|
- # data_s7.make_point('集群限位L7_2[1]'),
|
|
|
- # data_s7.make_point('集群限位L8_2[1]')
|
|
|
- # ]
|
|
|
+ # 拉速积分得到长度
|
|
|
+ self.integration_total = [0] * 8
|
|
|
+ self.integration_lock = threading.Lock()
|
|
|
+ self.billet_out_sig = [self.data_s7.make_point(f"L{i+1}拉速", Integration_speed_mpmin) for i in range(8)]
|
|
|
self.billet_position = [
|
|
|
self.data_s7.make_point('L1切割信号[1]'),
|
|
|
self.data_s7.make_point('L2切割信号[1]'),
|
|
@@ -83,16 +68,7 @@ class Trace_pusher:
|
|
|
self.data_s7.make_point('L7切割信号[1]'),
|
|
|
self.data_s7.make_point('L8切割信号[1]')
|
|
|
]
|
|
|
- self.billet_out_sig = [
|
|
|
- self.data_s7.make_point('L1切割信号[0]'),
|
|
|
- self.data_s7.make_point('L2切割信号[0]'),
|
|
|
- self.data_s7.make_point('L3切割信号[0]'),
|
|
|
- self.data_s7.make_point('L4切割信号[0]'),
|
|
|
- self.data_s7.make_point('L5切割信号[0]'),
|
|
|
- self.data_s7.make_point('L6切割信号[0]'),
|
|
|
- self.data_s7.make_point('L7切割信号[0]'),
|
|
|
- self.data_s7.make_point('L8切割信号[0]')
|
|
|
- ]
|
|
|
+ # 6号机
|
|
|
else:
|
|
|
self.billet_position = [
|
|
|
self.data_s7.make_point('L1坯头位置'),
|
|
@@ -127,7 +103,7 @@ class Trace_pusher:
|
|
|
self.data_s7.make_point('热送挡板[4]'),
|
|
|
self.data_s7.make_point('热送挡板[5]'),
|
|
|
self.data_s7.make_point('热送挡板[6]'),
|
|
|
- self.data_s7.make_point('热送挡板[7]'),
|
|
|
+ self.data_s7.make_point('热送挡板[7]')
|
|
|
]
|
|
|
|
|
|
if self.hostmove_flag:
|
|
@@ -137,16 +113,21 @@ class Trace_pusher:
|
|
|
self.hostmove_sig.set_excite_action(lambda: self.billet_to_stack("步进冷床", self.get_billet('right')))
|
|
|
|
|
|
for i in range(8):
|
|
|
- # 坯子出现
|
|
|
self.billet_position[i].allow_update(False)
|
|
|
self.billet_position[i].set_state(False)
|
|
|
+ # 6号机
|
|
|
if not self.hostsend_flag:
|
|
|
+ # 正常情况进入跟踪
|
|
|
self.billet_position[i].set_convertor(lambda data: 12000 < data < 20000)
|
|
|
self.billet_position[i].set_excite_action(lambda i=i: self.billet_out_action(i))
|
|
|
self.billet_position[i].set_reset_action(lambda i=i: self.billet_in_buffer_action(i))
|
|
|
+ # 5号机
|
|
|
else:
|
|
|
- self.billet_position[i].set_excite_action(lambda i=i: self.billet_in_buffer_action(i))
|
|
|
+ # 拉速补充钢坯
|
|
|
+ self.billet_out_sig[i].set_convertor(lambda data, i=i: round(data*1000) >= self.integration_total[i] + self.length_cutting[i].data)
|
|
|
self.billet_out_sig[i].set_excite_action(lambda i=i: self.billet_out_action(i))
|
|
|
+ # 正常情况进入跟踪
|
|
|
+ self.billet_position[i].set_excite_action(lambda i=i: self.billet_in_buffer_action(i))
|
|
|
self.billet_position[i].allow_update()
|
|
|
# 挡板抬起
|
|
|
self.barrier[i].allow_update(False)
|
|
@@ -155,7 +136,7 @@ class Trace_pusher:
|
|
|
self.barrier[i].set_excite_action(lambda i=i: self.barrier_up_action(i))
|
|
|
self.barrier[i].set_reset_action(lambda i=i: self.barrier_down_action(i))
|
|
|
self.barrier[i].allow_update()
|
|
|
- # 直轧挡板抬起
|
|
|
+ # 5号机直轧挡板抬起
|
|
|
if self.hostsend_flag:
|
|
|
self.hostsend_barrier[i].allow_update(False)
|
|
|
self.hostsend_barrier[i].set_state(False)
|
|
@@ -165,23 +146,39 @@ class Trace_pusher:
|
|
|
self.hostsend_barrier[i].allow_update()
|
|
|
|
|
|
def billet_out_action(self, i):
|
|
|
- # [坯号, 炉次信息, 定尺, 拉速, 开切时间, 停切时间]
|
|
|
billetNo = self.current_heatNo + '0' + str(i+1) + '99'
|
|
|
sizing = self.length_cutting[i].data
|
|
|
speed = self.drawing_speed[i].data
|
|
|
+ # 积分的钢坯长度的累计
|
|
|
+ with self.integration_lock:
|
|
|
+ if self.strands_cutting[i]:
|
|
|
+ return None
|
|
|
+ self.integration_total[i] += sizing
|
|
|
+
|
|
|
+ # [坯号, 炉次信息, 定尺, 拉速, 开切时间, 停切时间]
|
|
|
self.billet_out[i] = [billetNo, self.current_heatData, sizing, speed, time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), '']
|
|
|
|
|
|
+ # 等待20s,若无开切信号,即为漏坯
|
|
|
+ start_time = time.time()
|
|
|
+ while time.time() - start_time < 20:
|
|
|
+ if self.strands_cutting[i]:
|
|
|
+ return None
|
|
|
+ time.sleep(0.5)
|
|
|
+ self.billet_in_buffer_action(i)
|
|
|
+
|
|
|
def billet_in_buffer_action(self, i):
|
|
|
+ time.sleep(1)
|
|
|
with self.locks[i]:
|
|
|
if self.strands_cutting[i]:
|
|
|
+ time.sleep(10)
|
|
|
self.logger.info(f"[TRACE]{i+1}流新增钢坯存储")
|
|
|
self.strands_buffer[i] = self.strands_cutting[i]
|
|
|
self.strands_cutting[i] = []
|
|
|
elif self.billet_out[i]:
|
|
|
- self.logger.info(f"[TRACE]{i+1}流开切漏钢,算法补入")
|
|
|
+ self.logger.info(f"[TRACE]{i+1}流无已经开切的钢坯,算法补入")
|
|
|
self.strands_buffer[i] = self.billet_out[i]
|
|
|
else:
|
|
|
- self.logger.info(f"[TRACE]{i+1}流开切漏钢,但未检测到可补入钢坯的信息")
|
|
|
+ self.logger.info(f"[TRACE]{i+1}流无已经开切的钢坯,但未检测到可补入的钢坯信息")
|
|
|
self.billet_out[i] = []
|
|
|
|
|
|
if self.barrier[i].state and self.barrier_checker[i] == False:
|
|
@@ -296,24 +293,6 @@ class Trace_pusher:
|
|
|
|
|
|
if count == 0:
|
|
|
dst[0].extend(billets)
|
|
|
- # elif count == 3 and (len(billets) >= 4 or len(dst[count-1]) >= 4):
|
|
|
- # self.logger.error(f"组坯异常!")
|
|
|
- # flag = False
|
|
|
- # for j in dst:
|
|
|
- # if len(j) < 4:
|
|
|
- # flag = True
|
|
|
- # dst.remove(j)
|
|
|
- # break
|
|
|
- # if flag:
|
|
|
- # dst.append(billets)
|
|
|
- # else:
|
|
|
- # dst.remove(dst[0])
|
|
|
- # dst.append(billets)
|
|
|
- # count -= 1
|
|
|
- # elif count == 3 and len(dst[count-1]) + len(billets) > 4:
|
|
|
- # self.logger.error(f"组坯异常!")
|
|
|
- # dst[count-1].extend(billets)
|
|
|
- # count -= 1
|
|
|
elif count == 3 and (len(billets) >= 4 or len(dst[count-1]) >= 4 or len(dst[count-1]) + len(billets) > 4):
|
|
|
self.logger.error(f"组坯异常!")
|
|
|
dst.remove(dst[0])
|
|
@@ -372,6 +351,10 @@ class Trace_pusher:
|
|
|
self.logger.warning(f"{i+1}流对已经离开的钢坯补充停切时间,无效")
|
|
|
|
|
|
else:
|
|
|
+ with self.integration_lock:
|
|
|
+ self.billet_out_sig[i].data = 0
|
|
|
+ self.integration_total[i] = 0
|
|
|
+
|
|
|
if self.strands_cutting[i]:
|
|
|
self.logger.warning(f"{i+1}流有钢坯开切冲突")
|
|
|
self.strands_cutting[i] = data
|
|
@@ -414,6 +397,8 @@ class Trace_pusher:
|
|
|
if len(src[i]) >= 4:
|
|
|
tmp = [j[0] for j in src.pop(i)]
|
|
|
src.append([])
|
|
|
+ if tmp[0].startswith('0'):
|
|
|
+ return []
|
|
|
return tmp
|
|
|
|
|
|
return []
|