【正文】
圖521 等待狀態(tài) wait state圖522 向三樓上行狀態(tài) up to floor3 state圖523到達三樓等待 stop to floor3 and wait state圖524 向二樓下行狀態(tài) down to floor2 state圖525 到達二樓等待 stop to floor2 and wait state圖526 向五樓上行狀態(tài) up to floor5 state圖527 到達五樓等待。電梯下行至一樓停止,開門。電梯上行至五樓后停止,電梯開門,處于等待狀態(tài),如圖527。電梯下行至二樓后停止,電梯開門,處于等待狀態(tài),如圖525。電梯上行至三樓后停止,電梯開門,處于等待狀態(tài),如圖523。下面針對以上幾種狀態(tài)對系統(tǒng)進行測試。 i=i+1。 ==1 then =0。endifif p_down[0]==6 amp。amp。 ==1 then =0。endifif p_down[0]==5 amp。amp。 ==1 then =0。endifif p_down[0]==5 amp。amp。 ==1 then =0。endifif p_down[0]==6 amp。amp。 ==1 then =0。endifif p_down[0]==3 amp。amp。 ==1 then =0。endifif p_down[0]==3 amp。amp。 ==1 then =0。endifif p_down[0]==8 amp。amp。 ==1 then =0。endifif p_down[0]==1 amp。amp。endwhile(8)deldown( )自定義函數(shù)//Function name: deldown//Parameters: int i=0。endifwhile i=5 do p_up[i]=p_up[i+1]。amp。 ==1 then =0。endifif p_up[0]==16 amp。amp。 ==1 then =0。endifif p_up[0]==5 amp。amp。 ==1 then =0。endifif p_up[0]==4 amp。amp。 ==1 then =0。endifif p_up[0]==14 amp。amp。 ==1 then =0。endifif p_up[0]==3 amp。amp。 ==1 then =0。endifif p_up[0]==2 amp。amp。 ==1 then =0。endifif p_up[0]==12 amp。amp。 ==1 then =0。///信號燈熄滅控制if p_up[0]==1 amp。endwhileRETURN mini。 t0 then mini=t。 endif if tmini amp。while i=5 do if p_down[i]0 then t=p_down[i]+10。int t=0。endwhileRETURN max。 endif if tmax then max=t。while i=5 do if p_up[i]10 then t=p_up[i]10。 int t=0。 endif i=i+1。 p_down[i]=l。 i=10。 l=(p_down[i]+10) then uptable(p_down[i]+10)。 endif if p_down[i]0 amp。 i=10。amp。while i=5 do if l==p_down[i] then i=10。int j=0。 endif i=i+1。 p_up[i]=l。 i=10。 l=(p_up[i]10) then downtable(p_up[i]10)。 endif if p_up[i]=10 amp。 i=10。amp。while i=5 do if l==p_up[i] then i=10。int j=0。 ==1 then =。 stop==0 amp。endifif down_dir==1 amp。amp。amp。=0。 ==6 then=1。 =6 amp。endifif =6 amp。=0。amp。amp。=0。 ==5 then=1。 =6 amp。endifif =6 amp。=0。amp。amp。=0。 ==4 then=1。 =6 amp。endifif =6 amp。=0。amp。amp。=0。 ==3 then=1。 =6 amp。endifif =6 amp。=0。amp。amp。=0。 ==2 then=1。 =6 amp。endifif =6 amp。=0。amp。amp。=0。 ==1 then=1。 =6 amp。endifif =6 amp。=0。amp。amp。=。amp。amp。amp。=+1。amp。amp。amp。=。amp。amp。amp。=+1。amp。amp。amp。=。amp。amp。amp。=+1。amp。amp。amp。=。amp。amp。amp。=+1。amp。amp。amp。=。amp。amp。amp。=+1。amp。amp。amp。=。amp。amp。amp。=+1。amp。amp。amp。 temp=0。amp。 temp_door=0。amp。 deldown()。 temp_door=1。amp。 delup()。 temp_door=1。amp。else wait=0。 up_dir=0。amp。else down_dir=0。amp。else up_dir=0。amp。 else if then uptable()。 else if then uptable()。 else if then downtable()。 then uptable()。 down_mini()0 || down_mini()==0 amp。 else if down_mini() amp。 then a=10+。 endif if down_mini() || down_mini()==0 amp。amp。 else if up_max() then downtable()。 endif if up_max() then a=10+。amp。 if then =1。 if then =1。 if then =1。 if then =1。 if then =1。 if then =1。 if then =1。 if then =1。 if then =1。 if then =1。 if then =1。 if then =1。 if then =1。 if then =1。 if then =1。 if then =1。amp。 =0。 =0。 =0。endifif ==500 then =6。 =0。 =0。 =1。 =0。 =0。 =0。endifif ==300 then =4。 =0。 =0。 =1。 =0。 =0。 =0。endifif ==100 then =2。 =0。 =0。 =1。down6。down5。down4。down3。down2。down1。down0。up6。up5。up4。up3。up2。up1。up0。stop=0。up_dir=0。levle_temp=0。=0。=0。=0。=0。=0。=0。=1。=1。演示程序中的變量與PLC程序中的I/O點,變量及中間繼電器對應(yīng)關(guān)系如表51所示。圖51 操作界面 operation interface界面左側(cè)為電梯轎箱及各樓層廳門,中間為轎箱內(nèi)操作面板,右側(cè)為各樓層的感應(yīng)器指示燈以及上行表和下行表內(nèi)容的觀察區(qū)。這兩套上位機組態(tài)的界面完全相同。RealInfo已經(jīng)在工程實踐中經(jīng)過長期的考驗,已經(jīng)廣泛應(yīng)用于石油、化工、半導(dǎo)體、汽車、電力、機械、冶金、交通、樓宇自動化、食品、醫(yī)藥、環(huán)保等多個行業(yè)和領(lǐng)域的工業(yè)自動化、過程控制、管理監(jiān)測、工業(yè)現(xiàn)場監(jiān)視、遠程監(jiān)視/遠程診斷、企業(yè)管理/資源計劃等系統(tǒng)。數(shù)據(jù)管理就是根據(jù)用戶的需要,對數(shù)據(jù)進行更深層次的加工,如量程變換、報警、統(tǒng)計、分析等。具體的說,數(shù)據(jù)通訊就是:1)從現(xiàn)場獲取數(shù)據(jù)并將它們加工成可利用形式的基本功能。使用紫金橋系統(tǒng),可以方便地構(gòu)造適應(yīng)自己需要的“數(shù)據(jù)采集系統(tǒng)”,在任何需要的時候把生產(chǎn)現(xiàn)場的信息實時地傳送到控制室,并且通過局域網(wǎng)和Internet,可以在任何地方訪問實時和歷史生產(chǎn)數(shù)據(jù),及時了解、評價生產(chǎn)情況和操作水平。PLC程序就此完畢。本模塊梯形圖如圖437和438所示。其結(jié)構(gòu)很簡單,就是通過兩個指針V4和V5的移動和傳送數(shù)據(jù)來完成的。當電梯運行至某一目標樓層時,[ = D100 KXX]中的某一個會被觸發(fā)(包括經(jīng)過加10處理過的上行反響呼叫信號),此時如果這一樓層的某一個按鈕指示燈處于被記憶狀態(tài),那么這個觸點就會連同被觸發(fā)的[ = D100 KXX]以及平層信號(X34)構(gòu)成一個通路,從而觸發(fā)一個將此被記憶的指示燈復(fù)位的RST指令,從而達到了按鈕指示燈熄滅的功能。當上升表的首單元D100等于某一個樓層信號時,即表示當前轎箱將要到達目標樓層,將開始一系列減速、平層和門控程序,這時D100中的樓層任務(wù)數(shù)據(jù)已經(jīng)完成,應(yīng)該將其刪除,并依次將其后的樓層任務(wù)數(shù)據(jù)想前提升一位。圖435 查詢上行表最大值子程序梯形圖 ladder chart of find max value in uptable subprogram module圖436 查詢下行表最小值子程序梯形圖 ladder chart of find mini value in downtable subprogram module 上行表已完成信號消除子程序模塊本模塊完成電梯轎箱到站之后,上行表中已完成的任務(wù)數(shù)據(jù)的刪除以及被記憶的按鈕指示燈的熄滅功能。最后將D5與D3進行比較,如果D5小于D3(D5等于0除外),則用D5的內(nèi)容覆蓋D3的內(nèi)容,然后將指針V3加1,直到將表中所有的數(shù)據(jù)查詢一遍后,D3的內(nèi)容便是當前下行表中的最小值了。在出現(xiàn)反響呼叫信號時,需要判斷呼叫信號是否小于小行表中的最小任務(wù)數(shù)據(jù),如果小于最小任務(wù)數(shù)據(jù),則需要將其做減10標記處理后再存入下行表;如果大于最小任務(wù)數(shù)據(jù),則直接將其存入上行表即可。本模塊梯形圖如圖435所示。本模塊初始化先將上行表的第一個表單元的內(nèi)容存入D2中,開始執(zhí)行后,先D100V2的內(nèi)容存入D4中(V2為指針,初值為0),然后進一步判斷當前讀取的表單元數(shù)據(jù)是否是經(jīng)過加10標記處理過的反向呼叫信號,如果是,將其做減10還原處理,并存入D4中。圖433 下行表排隊子程序模塊(1) ladder chart of downtable taxis subprogram module (1)圖434 下行表排隊子程序模塊(2) ladder chart of downtable taxis subprogram module (2) 查詢上行表最大值子程序模塊本模塊是為電梯響應(yīng)和處理上升過程中的反響呼叫信號提供服務(wù)的。圖431 上行表排隊子程序模塊梯形圖(1) ladder chart of uptable taxis subprogram module (1)圖432 上行表排隊子程序模塊(2) ladder chart of uptable taxis subprogram module (2) 下行表排隊子程序模塊本模塊的程序結(jié)構(gòu)與上行表排隊子程序模塊類似,不同點在于本模塊的排序方式為升序排序方式。首先要對反向呼叫信號做減10處理,將其還原為普通的呼叫信號,然后通過比較指令判斷D200是否大于這個反向呼叫信號,如果大于,則需要將這個反響呼叫信號發(fā)往下行表中;如果不大于,則可直接將D200插入到V0所指的表單元中。第四個監(jiān)控觸點[ D200 D100V0][ D100V0 K10]如果被觸發(fā),說明找到了表中大于D200的樓層信號,并且這個信號不是經(jīng)過加10處理的反向呼叫信號,可直接將D200插入到V0所指的表單元,并將其后的表單員中的數(shù)據(jù)一次向后移動一位,完成這一系列操作后,返回主程序。它們分別監(jiān)控D100V0是否與D200相等,是否等于0或者D100是否大于D100V0。首先,呼叫信號通過D200進入子程序。圖4216 子程序調(diào)用環(huán)節(jié)梯形圖 ladder chart of subprogram c