《基于MCGS组态软件设计的四层电梯程序.docx》由会员分享,可在线阅读,更多相关《基于MCGS组态软件设计的四层电梯程序.docx(3页珍藏版)》请在三一办公上搜索。
1、基于MCGS组态软件设计的四层电梯程序*轿内指示灯* inlamp1=(inbutton1 or inlamp1) and not left1 inlamp2=(inbutton2 or inlamp2) and not left2 inlamp3=(inbutton3 or inlamp3) and not left3 inlamp4=(inbutton4 or inlamp4) and not left4 *轿外指示灯* outlamp1=(outbutton1 or outlamp1) and not left1) outlamp2=(outbutton2 or outlamp2) an
2、d (not left2 or (leftup and not leftdown) outlamp3=(outbutton3 or outlamp3) and (not left2 or (leftup and not leftdown) outlamp4=(outbutton4 or outlamp4) and (not left3 or (leftup and not leftdown) outlamp5=(outbutton5 or outlamp5) and (not left3 or (leftup and not leftdown) outlamp6=(outbutton6 or
3、outlamp6) and not left4) *定向程序 上行* leftup=(outlamp2 or outlamp3 or inlamp2) and not left2) or (outlamp4 or outlamp5 or inlamp3) and not left3) or (outlamp6 or inlamp4) and not left4 and not leftdown *定向程序 下行* leftdown=(outlamp4 or outlamp5 or inlamp3) and not left3) or (outlamp2 or outlamp3 or inlam
4、p2) and not left2) or (outlamp1 or inlamp1) and not left1 and not leftup *平层自动开门设置*策略1 *开关门控制;手动开门* if openbutton and not closebutton and not upmotor and not downmotor and not stateopen then dooropen=1 if (outbutton1 or inbutton1) and left1 and not closebutton and not upmotor and not downmotor and n
5、ot stateopen then dooropen=1 if (outbutton2 or outbutton3 or inbutton2) and left2 and not closebutton and not upmotor and not downmotor and not stateopen then dooropen=1 if (outbutton4 or outbutton5 or inbutton3) and left3 and not closebutton and not upmotor and not downmotor and not stateopen then
6、dooropen=1 if (outbutton6 or inbutton4) and left4 and not closebutton and not upmotor and not downmotor and not stateopen then dooropen=1 if doorclose or stateopen then dooropen=0 if (closebutton or closedoordelay) and not openbutton and not dooropen and not stateclose then doorclose=1 if openbutton
7、 or stateclose then doorclose=0:closedoordelay=0 endif *行吊电机正反转* upmotor= leftup and not dooropen and stateclose downmotor= leftdown and not dooropen and stateclose if upmotor then 高度=高度-1 if downmotor then 高度=高度+1 left1=(高度=30):left2=(高度=20):left3=(高度=10):left4=(高度=0): if 高度=30 then leftnum=1 if 高度=20 then leftnum=2 if 高度=10 then leftnum=3 if 高度=0 then leftnum=4 *门电机正反转* if dooropen then 门值=门值-1 if doorclose then 门值=门值+1 stateopen=(门值=0):stateclose=(门值=20)