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.

Multiple PID
#1
Goodmorning everyone.
I have a problem I can not make more PID function simultaneously.
Can someone help me. Thank you
Reply
#2
Like this:
Code:
if not p1 then
  p1 = PID:init({
    current = '1/1/1',
    setpoint = '1/1/2',
    output = '1/1/3'
  })

  p2 = PID:init({
    current = '2/1/1',
    setpoint = '2/1/2',
    output = '2/1/3'
  })
end

p1:run()
p2:run()
Reply
#3
Hi,

Try this (see attachments)

BR,

Erwin

Attached Files
.lua   PID modified version 1.1 Resident Script.lua (Size: 13.05 KB / Downloads: 47)
.lua   PID modified version 1.1 User Lib.lua (Size: 5.99 KB / Downloads: 33)
Reply
#4
good morning, thanks for the kind risposta.ma I can not upload the files you sent me. Can you help me.
Reply
#5
Hi,

The files are not export/import format but manualy created.

Just open them with a text editor (notepad++ or wordpad or something) and create a user lib called 'pid' and a resident script and past the content manualy to them.

BR,

Erwin
Reply
#6
thank you so much
Reply
#7
still one last question. To slow down a bit the speed of PID how they work the following values? :
     kp = grp.getvalue ('3/3/105'),
     ki = grp.getvalue ('3/3/106'),
     kd = grp.getvalue ('3/3/107'),
Thanks again for your valuable contribution.
Reply
#8
Hi,

This is project / system configuration related, i would start with 0.3 for all and from there fine tune between 0 to 1 if you need to reduce overshoot or need more agresive loops.

BR,

Erwin
Reply


Forum Jump: