Page 1 of 1

Lua Scripts questions for PID implementation

Posted: Thursday 17 July 2014 15:34
by philou
Hi all,

I'am trying to create a scritp to implement the famous PID thermostat controller for heaters and today I'am encountering 2 different issues:

1/ this kind of script needs to be able to switch On/Off on a timing smaller than a minute.

For example if the calculation define a heating period of 1 minute and 50 seconds, how could I control these 50 seconds ? I could do some rounding to maximise the periods to 30 seconds by saying for example if the timing returned is below 30 seconds then I execute it he minute and if it is after 30 seconds then I execute it the minute after.

But by doing that I am loosing a lot in precision and I would have at least a precision of 15 seconds which could be done by having a script called each 30 seconds instead of each minute of having some kind of Sleep method, then I could loop in my script.


2/ My temperature configuration is currently hardcoded in the script and I have not find any way to control it by the UI directly do you have any idea how I could do that from the UI ?

Thanks

Re: Lua Scripts questions for PID implementation

Posted: Friday 18 July 2014 10:28
by philou
Hi Again,

So I have partially solve my issues at least the Issue 1 by creating a fake device which switch every 15 seconds, so when it switch off I move it back to On and my script is call every 15 seconds. I could have set it to a smaller but it generate thousand of logs, which brings me to a new question:

Is there a way to not log state changes for a specific device ?

And my issue 2 about setting the temperature is still valid if somebody has an idea, then it could be great !

Thanks

Re: Lua Scripts questions for PID implementation

Posted: Friday 11 December 2015 19:45
by Thomasdc
does someone has a good workind scrip with PID implementation? (For controlling my heating)

Re: Lua Scripts questions for PID implementation

Posted: Saturday 12 December 2015 19:26
by jannl
I suppose you used google?

https://www.google.nl/webhp?sourceid=ch ... #q=pid+lua

Propably not going to be easy.

Re: Lua Scripts questions for PID implementation

Posted: Monday 14 December 2015 12:37
by Thomasdc