摘 要:為了實現對現場生產過程的精確控制,PLC閉環控制系統在工業生產中正得到越來越廣泛的應用,闡述PLC實現PID控制的3種常用方式,分析閉環控制系統中PID數字控制器的原理,結合西門子7-200 PLC詳細介紹PID指令使用和輸入/輸出變量轉換的方法,為7-200 PLC在PID閉環控制系統中的應用提供一整套解決方案,最后以工業生產中常見的溫度控制為背景,給出一個編程實例,對PID在工業控制中的應用很有參考價值。
關鍵詞:可編程控制器;閉環控制系統;PID控制器;PID指令
Application of 7-200 PLC in PID Closed Loop Control ystem
QIANG Baomin,XIAO heng
(he econd Artillery Engineering College,Xi′an,71002,China)
Abstract:In order to control the production process accurately,PLC closed loop control system is widely used in industrial productionhe article mainly describes three usual manners by using PLC to realize PID control,analyses the principle of PID digital controller in the closed loop control system,detailedly introduces how to use the PID instruction and how to convert the input-output variable according to the iemens 7-200 PLC,provides an integrated project for the application of 7-200 PLC in PID closed loop control system,in the end,it gives a program example about temperature control in industrial production,it is a good reference for the use ofPID in the industrial control system
Keywords:PLC;closed loop control system;PID controller;PID instruction
1 引 言
在工業生產中,常需要用閉環控制方式來控制溫度、壓力、流量等連續變化的模擬量,無論是使用模擬量控制器的模擬控制系統還是使用計算機(包括PLC)的數字控制系統,PID控制都得到了廣泛應用。 PID控制器是比例-積分-微分控制(Proportional-Integral-Derivative)的簡稱,其優點是不需要精確的控制系統數學模型,有較強的靈活性和適應性,而且PID控制器的結構典型、程序設計簡單、工程上易于實現、參數調整方便。本文以西門子公司7-200 PLC為例介紹PLC在PID閉環控制系統中的應用。
2 PLC實現PID控制的方式
用PLC對模擬量進行PID控制大致有如下幾種方法:
(1) 使用PID過程控制模塊:
這種模塊的PID控制程序是PLC廠家設計的,并放在模塊中,用戶使用時只需要設置一些參數,使用起來非常方便。
(2) 使用PID功能指令:
它是用于PID控制的子程序,與模擬量輸入/輸出模塊一起使用,可以得到類似于使用PID過程控制的效果,但價格便宜得多。如7-200的PID指令。
(3) 用自編的程序實現PID閉環控制:
在沒有PID過程控制模塊和功能指令的情況下,仍希望采用某種改進的PID控制算法,此時用戶需要自己編制PID控制程序。
本文以西門子7-200 PLC為例,說明PID控制的原理及PLC的PID功能指令的使用及控制功能的實現。
3 PLC PID控制器的實現
31 PID控制器的數字化
PLC的PID控制器的設計是以連續的PID控制規律為基礎,將其數字化,寫成離散形式的PID方程,再根據離散方程進行控制程序的設計。
在連續系統中,典型的PID閉環控制系統如圖1所示。圖1中sp(t)是給定值;pv(t)為反饋量;c(t)為系統的輸出量,PID控制器的輸入/輸出關系如式(1)所示: