This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

PID Problem
#1
Hello guys,

I'm trying to create a PID controller. I need to have 12 controllers - 1 P, 1 PI and 10 PID with D gain values ranging from 0.1 to 1. P and PI controllers has to have P gain according to 6K, and PI controller I gain has to be according to 150min, so (6K/150min). Here is my script:

Code:
local P_value     =     6
local I_value     =     150
local kp     =     1/P_value
local ki    =     (kp/(I_value*60))*100

if not P then
 
P = PID:init({
    current         =     'RTC05_Current_Temperature',
    setpoint         =     'RTC05_Setpoint_Temperature_Status',
    output             =     'BD_P_Output',
    kp                     =     kp,
    ki                     =     0,
    kd                     =     0
})
 
end

P:run()

if not PI then

PI = PID:init({
    current         =     'RTC05_Current_Temperature',
    setpoint         =     'RTC05_Setpoint_Temperature_Status',
    output             =     'BD_PI_Output',
    kp                     =     kp,
    ki                     =     ki,
    kd                     =     0
})
 
end

PI:run()

if not PID then
 
for i = 1, 10, 1 do
 
PID = PID:init({
    current         =     'RTC05_Current_Temperature',
    setpoint         =     'RTC05_Setpoint_Temperature_Status',
    output             =     'BD_PID' .. i .. '_Output',
    kp                     =     kp,
    ki                     =     ki,
    kd                     =     0.1 * i
})

PID:run() 
   
end
 
end

What I end up getting on P and PI controller outputs is 0, and on PID outputs I don't get anything with current setpoint being 24C while current temperature is 22.5C, so it's not correct. My resident script sleep time is 10sec, I have added PID algorithm in library so the problem is not coming from there. What is going on here? What am I missing?
Reply


Messages In This Thread
PID Problem - by MantasJ - 13.02.2021, 14:56
RE: PID Problem - by MantasJ - 13.02.2021, 16:11
RE: PID Problem - by admin - 15.02.2021, 10:30
RE: PID Problem - by MantasJ - 15.02.2021, 12:07
RE: PID Problem - by admin - 15.02.2021, 12:25
RE: PID Problem - by MantasJ - 15.02.2021, 12:41
RE: PID Problem - by admin - 15.02.2021, 14:06

Forum Jump: