我自己用s7-200編寫了一段PID程序來控制空壓機的壓力。大家?guī)臀铱纯茨懿荒軐崿F(xiàn)壓力穩(wěn)定
網(wǎng)絡(luò)1 pV當(dāng)前采樣值
LD SM0.0
LPS
MOVW AIW0, VW2180
CALL SBR_4:SBR4, &VB2180, VW2092
AW< VW2092, +6400
MOVW +6400, VW2092
LRD
AW> VW2092, +32000
MOVW +32000, VW2092
LRD
ITD VW2092, VD2996
LRD
DTR VD2996, VD2996
LRD
-R 6400.0, VD2996
LRD
/R 25600.0, VD2996
LPP
MOVR VD2996, VD3100
網(wǎng)絡(luò)2 SV 設(shè)定值
LD SM0.0
MOVD VD4104, AC2
*D +1000, AC2
ITD AC2, VD2996
DTR VD2996, VD2996
/R 2500.0, VD2996
MOVR VD2996, VD3104
網(wǎng)絡(luò)3 輸出
LD SM0.0
PID VB3100, 0
MOVR VD3108, AC0
*R 25600.0, AC0
+R 6400.0, AC0
ROUND AC0, AC0
DTI AC0, VW4108
網(wǎng)絡(luò)4 12 P Gain(增益)
LD SM0.0
ITD VW4112, VD2996
DTR VD2996, VD2996
/R 100.0, VD2996
MOVR VD2996, VD3112
網(wǎng)絡(luò)5 16 Sample Time(采樣時間):
LD SM0.0
ITD VW4116, VD2996
DTR VD2996, VD2996
/R 10.0, VD2996
MOVR VD2996, VD3116
網(wǎng)絡(luò)6 20 I Integral Time(積分時間)
LD SM0.0
ITD VW4120, VD2996
DTR VD2996, VD2996
/R 600.0, VD2996
MOVR VD2996, VD3120
網(wǎng)絡(luò)7 24 D Derivative Time(微分時間):
LD SM0.0
ITD VW4124, VD2996
DTR VD2996, VD2996
/R 600.0, VD2996
MOVR VD2996, VD3124
網(wǎng)絡(luò) 8結(jié)束
LD SM0.0
CRET