#-*- coding:utf-8 _*- cvsPath = '/home/opt/data/201804/IOTF81927_RunDataEntity_201804.csv' count = 0 #def secondScreen (currentStateRecord,lastStateRecord): # if(currentStateRecord != lastStateRecord): # #goto someone function # return ; #def lastStateRecordArrayFunc(currentStateRecord): #---------Parameter definition,start---------# lastStateRecord lastRowdata = None currantStateRecord compoundParameterList = [] #--------Parameter definition,end------------# #------------Context awareness function start-------------# def contextAwareness(): global currantStateRecord,lastStateRecord print(currantStateRecord,lastStateRecord) #----------------Using count == 2 instead of count == 1 is because the files read here contain field properties.---------------------# if count == 2 and currantStateRecord != None: print('this is currantStateRecord:',currantStateRecord,'this two statue is',float(rowItems[49]) == currantStateRecord) lastStateRecord = currantStateRecord else: if float(currantStateRecord) - float(lastStateRecord) > 2 or float(currantStateRecord) - float(lastStateRecord) < 0 and float(currantStateRecord) - float(lastStateRecord) > -8: print('this is lastStateRecord:',lastStateRecord,'this two statue is',float(rowItems[49]) == lastStateRecord) else: print('this is currantStateRecord:',currantStateRecord,'this two statue is',float(rowItems[49]) == currantStateRecord) lastStateRecord = currantStateRecord #------------Context awareness function end---------------# with open(cvsPath) as csvObject: for rowPer in csvObject: #----------------------------------------------------------The first floor,start-----------------------------------------------------------# count += 1 rowItems = rowPer.split(',',-1) #----------------------------------------------------------The first stage,start----------------------------------------------------------# try: float(rowItems[22]) except Exception , err: if(count == 1): continue else: print('the problem have') else: print('num:',count,rowItems[22]) #斜率电压大于7500一定在升温(可以配合电压差这一复合变量进一步确定) if float(rowItems[22]) > 7500: # print('this is :shengwen',rowItems[49],'this two statue is',float(rowItems[49]) == 1 ) currantStateRecord = 1 contextAwareness() continue elif float(rowItems[22]) <= -80: #斜率电压小于80且当前电压还大于0 if float(rowItems[12]) != 0: # print('this is :tuihuo',rowItems[49],'this two statue is',float(rowItems[49]) == 7 ) currantStateRecord = 7 contextAwareness() continue #---------------------function chuli elif float(rowItems[12]) == 0: #斜率电压小于80且当前电压以降为0 #float(rowItems[8]) > 15000 and float(rowItems[13]) > 10;退火后开炉前加入氩气冷却时间段(除晶体掉入干锅的情况,次时间段重量一般为40到50Kg) if float(rowItems[8]) > 15000 and float(rowItems[13]) > 10: # print('this is lengque',rowItems[49],'this two statue is',float(rowItems[49]) == 8 ) currantStateRecord = 8 contextAwareness() continue #斜率电压小于80且当前电压以降为0 #float(rowItems[13]) < 0.1 and float(rowItems[13]) > 0;退火后加入氩气冷却前时间段,此时高真空一般为大于-2次方状态 elif float(rowItems[13]) < 0.1 and float(rowItems[13]) > 0: # print('this is lengque',rowItems[49],'this two statue is',float(rowItems[49]) == 8 ) currantStateRecord = 8 contextAwareness() continue #斜率电压小于80且当前电压以降为0 #float(rowItems[14]) > 0(在晶体没有到入干锅情况下,如果标尺位由正变为了负,则表明晶体已从提拉杆上取下) elif float(rowItems[14]) > 0: # print('this is daiji',rowItems[49],'this two statue is',float(rowItems[49]) == 0 ) currantStateRecord = 0 contextAwareness() continue #斜率电压小于80且当前电压以降为0 #开路状态不好确定(瞬时状态,大约持续几分钟) else: # print('this is kailu',rowItems[49],'this two statue is',float(rowItems[49]) == 9 ) currantStateRecord = 9 contextAwareness() continue elif float(rowItems[22]) > -20 and float(rowItems[22]) < 0: #生长期开始时电子秤复位为0,正式开始计量晶体重量 #斜率电压在-20到0之间一定放肩和生长期,有生长量无转速一定为生长正常期(此阶段为生长的前中后期) if float(rowItems[15]) > 0 and float(rowItems[46]) == 0: # print('this is :shengzhang',rowItems[49],'this two statue is',float(rowItems[49]) == 5) currantStateRecord = 5 contextAwareness() continue #---------------The growth is sometimes negative, so 'rowItems[15]) == 0' is removed. #无生长量、无转速、有提拉、晶体重量在20以内也为生长期(生长大前期) elif float(rowItems[46]) == 0 and float(rowItems[8]) >= 0 and float(rowItems[8]) <= 20 and float(rowItems[21] > 0): # print('this is :shengzhang',rowItems[49],'this two statue is',float(rowItems[49]) == 5) currantStateRecord = 5 contextAwareness() continue #无生长量、有提拉、有旋转一般为放肩 elif float(rowItems[15]) == 0 and float(rowItems[46]) > 0 and float(rowItems[21] > 0): # print('this is fangjian',rowItems[49],'this two statue is',float(rowItems[49]) == 4 ) currantStateRecord = 4 contextAwareness() continue #---------------------------------------------------------The second stage,start-----------------------------------------------------------# #以下状态在电压为0时进行识别(有时为1需要进一步确认) if float(rowItems[12]) <= 1: #此处和上面识别冷却状态的一部分相同(可以删除) if float(rowItems[8]) > 15000 and float(rowItems[13]) > 10: # print('this is lengque',rowItems[49],'this two statue is',float(rowItems[49]) == 8 ) currantStateRecord = 8 contextAwareness() continue #其他状况为待机(需要进一步确认查看是否可以增加控制器参数作为标识) else: # print('this is daiji',rowItems[49],'this two statue is',float(rowItems[49]) == 0 ) currantStateRecord = 0 contextAwareness() continue #以下部分识别引晶和烤籽晶阶段(目前识别准确度不高,需要进一步优化) elif float(rowItems[21]) > 5: # print('this is yinjing',rowItems[49],'this two statue is',float(rowItems[49]) == 3 ) currantStateRecord = 3 contextAwareness() continue else: try: float(rowItems[49]) except Exception ,err: # print('this is kaozijing',rowItems[49],'this two statue is',False) currantStateRecord = 2 contextAwareness() else: # print('this is kaozijing',rowItems[49],'this two statue is',float(rowItems[49]) == 2) currantStateRecord = 2 contextAwareness() continue #------------Compound parameter,start-------------# # if count == 1: # continue # else: #------------Compound parameter,end---------------# lastRowdata = rowPer #-------------------------------------------------------------The first floor, end--------------------------------------------------------# #-------------------------------------------------------------The second floor, end--------------------------------------------------------# print(count)
浙公网安备 33010602011771号