13.02.2021, 14:56
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:
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?
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?