举例:
IF IsWeb() == 1 THEN
ELSE
IF COD_start_meas.PV == 0 THEN
sys_time = StrTime($Curtime,1)
COD_run_log = "待机[Ready]"
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
COD_run_log = ""
ENDIF
IF COD_start_meas.PV == 1 THEN
sys_time = StrTime($Curtime,1)
COD_run_log = "粗虚运就绪[Ground]"
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
COD_run_log = ""
ENDIF
IF COD_start_meas.PV == 2 THEN
sys_time = StrTime($Curtime,1)
COD_run_log = "清洗[Clean]"
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
COD_run_log = ""
ENDIF
IF COD_start_meas.PV == 4 THEN
sys_time = StrTime($Curtime,1)
COD_run_log = "校正[Calib.]"
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
COD_run_log = "誉颤"
IF COD_meas_flag.PV == 1THEN
COD_meas_flag.PV = 0
sys_meas_flag.PV = 0
COD_cal_flag.PV =1
sys_run_log = "COD启动测量后进入校正状态,触发开启..."
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
sys_run_log = ""
#sys_active_T.Start()//开启触发定时器
ENDIF
ENDIF
IF COD_start_meas.PV == 8 THEN
sys_time = StrTime($Curtime,1)
COD_run_log = "启动岩梁[Start]"
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
COD_run_log = ""
ENDIF
IF COD_start_meas.PV == 32 THEN
sys_time = StrTime($Curtime,1)
COD_run_log = "测量[meas.]"
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
COD_run_log = ""
sys_meas_time.DESC = StrTime($Curtime,1)//系统启动测量时间
sys_run_log = "测量时间缓存..."
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
sys_run_log = ""
ENDIF
IF COD_start_meas.PV == 64 &&COD_meas_flag.PV == 1 THEN
sys_time = StrTime($Curtime,1)
COD_run_log = "排空[Empty]"
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
COD_run_log = ""
sys_run_log = "COD测量结束, " + IntToStr(PLC_start_sampl.PV,10) + "号取样口数据打包存入报表..."
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
sys_run_log = ""
IF PLC_start_sampl.PV ==1 THEN
COD1_db.PV = COD_VALUE.PV
sys_meas_time1.DESC = sys_meas_time.DESC
IF ( point2_flag.PV || point3_flag.PV || point4_flag.PV ) == 0 THEN
sys_run_log = "系统循环测量周期定时器开启..."
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
sys_run_log = ""
#sys_interval_T.Start()//系统循环测量周期定时器开启
ELSE
sys_run_log = "CODmax测量间隔定时器开启..."
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
sys_run_log = ""
#point_interval_T.Start()//CODmax测量间隔定时器开启
ENDIF
//ELSE
//COD1_db.PV = 0
ENDIF
IF PLC_start_sampl.PV ==2 THEN
COD2_db.PV = COD_VALUE.PV
sys_meas_time2.DESC = sys_meas_time.DESC
IF ( point3_flag.PV || point4_flag.PV ) == 0 THEN
sys_run_log = "系统循环测量周期定时器开启..."
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
sys_run_log = ""
#sys_interval_T.Start()//系统循环测量周期定时器开启
ELSE
sys_run_log = "CODmax测量间隔定时器开启..."
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
sys_run_log = ""
#point_interval_T.Start()//CODmax测量间隔定时器开启
ENDIF
//ELSE
//COD2_db.PV = 0
ENDIF
IF PLC_start_sampl.PV ==3 THEN
COD3_db.PV = COD_VALUE.PV
sys_meas_time3.DESC = sys_meas_time.DESC
IF point4_flag.PV == 0 THEN
sys_run_log = "系统循环测量周期定时器开启..."
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
sys_run_log = ""
#sys_interval_T.Start()//系统循环测量周期定时器开启
ELSE
sys_run_log = "CODmax测量间隔定时器开启..."
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
sys_run_log = ""
#point_interval_T.Start()//CODmax测量间隔定时器开启
ENDIF
//ELSE
//COD3_db.PV = 0
ENDIF
IF PLC_start_sampl.PV ==4 THEN
COD4_db.PV = COD_VALUE.PV
sys_meas_time4.DESC = sys_meas_time.DESC
sys_run_log = "系统循环测量周期定时器开启..."
SQLInsert(ConnectID,"dlhb_sys_log","sys_info")
sys_run_log = ""
#sys_interval_T.Start()//系统循环测量周期定时器开启
//ELSE
//COD4_db.PV = 0
ENDIF
IF sys_meas_flag.PV == 1 THEN
sys_meas_log.DESC = IntToStr(PLC_start_sampl.PV,10) + "号取样口自动测量"
ENDIF
IF sys_meas_flag.PV == 2 THEN
sys_meas_log.DESC = IntToStr(PLC_start_sampl.PV,10) + "号取样口手动测量"
ENDIF
SQLInsert(ConnectID,"dlhb_meas_group","meas_group")
sys_meas_log.DESC = ""
COD_meas_flag.PV = 0
sys_meas_flag.PV = 0
ENDIF
ENDIF
力控里的仔配虚脚本程序念燃是 类vc的脚本,例如 if endif ; for。。。;swich/.、。。等脚本!PLC里的不卖迅是脚本,只是梯形图!!!
两个完全不是一回事!
你说的应该是上位机可以通过脚本代替PLC完成监控设备的功能,但是一般都不这样做,因为不够稳定,一旦上位机死机或者崩溃有可能导致设备故障。。。。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)