Pada malam Ramadhan yang barokah ini saya akan menjelaskan mengenai bagaimana cara mengontrol suhu suatu alat pemanas menggunakan PID, alat ini sebenarnya bertujuan untuk memanaskan lilin untuk batik jadi harus berada di suhu 70 derajat celcius, maka dari itu supaya stabil digunakanlah PID, pada contoh ini tidak menggunakan ziegler nicols untuk menentukan nilai P, I dan D namun langsung memasukkan nilai secara manual P, I dan D nya. berikut penjelasan gambarnya.
a. Minimum System
b. Rangkaian Control Pemanas
*note = karena menggunakan elemen pemanas, maka ganti LAMP dengan ujung elemen pemanas, dan ganti 220v dengan Step Down trafo CT, masukkan 35v AC ke input TRIAC X3-2 dan satunya lagi 35v AC ke ujung elemen pemanas, kemudian ujung elemen pemanas lainnya masukkan ke output X3-1
c. Sensor Suhu LM35
d. Program Bascom AVR
$regfile = "m8def.dat"
$crystal = 12000000
'==========================
Config Lcdpin = Pin , E = Portd.6 , Rs = Portd.7 ,
Config Lcdpin = Pin , Db4 = Portd.2 , Db5 = Portd.3 , Db6 = Portd.4 , Db7 = Portd.5
Config Lcd = 16 * 2
'setting pwm
Config Timer1 = Pwm , Pwm = 8 , Prescale = 64 , Compare A Pwm = Clear Down
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Ddrd.0 = 1
Cls
Cursor Off
Dim Dataadc As Word
Dim V As Single
Dim X As String * 5 ' Setpoint
Dim Pv As Single ' Process Value
Dim Cv As Single ' PID output
Dim Kp As Single
Dim Ki As Single
Dim Kd As Single
Dim Setpoint As Single
Dim P As Single
Dim Pi As Single
Dim Pid As Single
Dim I As Single
Dim D As Single
Dim Error As Single
Dim Errorx As Single
Dim Sum_err As Single
Start Adc
Kp = .85 ' Proportional factor
Ki = .67 ' Integration factor
Kd = .15 ' derrivative factor
$crystal = 12000000
'==========================
Config Lcdpin = Pin , E = Portd.6 , Rs = Portd.7 ,
Config Lcdpin = Pin , Db4 = Portd.2 , Db5 = Portd.3 , Db6 = Portd.4 , Db7 = Portd.5
Config Lcd = 16 * 2
'setting pwm
Config Timer1 = Pwm , Pwm = 8 , Prescale = 64 , Compare A Pwm = Clear Down
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Ddrd.0 = 1
Cls
Cursor Off
Dim Dataadc As Word
Dim V As Single
Dim X As String * 5 ' Setpoint
Dim Pv As Single ' Process Value
Dim Cv As Single ' PID output
Dim Kp As Single
Dim Ki As Single
Dim Kd As Single
Dim Setpoint As Single
Dim P As Single
Dim Pi As Single
Dim Pid As Single
Dim I As Single
Dim D As Single
Dim Error As Single
Dim Errorx As Single
Dim Sum_err As Single
Start Adc
Kp = .85 ' Proportional factor
Ki = .67 ' Integration factor
Kd = .15 ' derrivative factor
Setpoint = 70
Do
Dataadc = Getadc(5)
V = Dataadc * 5
V = V / 1023
Pv = V * 100
X = Fusing(pv , "#.##")
Error = Setpoint - Pv
P = Error * Kp
Sum_err = Error + Errorx
I = Ki * Sum_err
D = Error - Errorx
Pi = P + I
Pid = Pi + D
Pwm1a = Pid
Upperline
Lcd "Suhu = " ; X
Lowerline
Lcd "PWM = " ; Pid
Waitms 200
Errorx = Error
Loop
Do
Dataadc = Getadc(5)
V = Dataadc * 5
V = V / 1023
Pv = V * 100
X = Fusing(pv , "#.##")
Error = Setpoint - Pv
P = Error * Kp
Sum_err = Error + Errorx
I = Ki * Sum_err
D = Error - Errorx
Pi = P + I
Pid = Pi + D
Pwm1a = Pid
Upperline
Lcd "Suhu = " ; X
Lowerline
Lcd "PWM = " ; Pid
Waitms 200
Errorx = Error
Loop
No comments:
Post a Comment