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 thermostat with LogicMachine
#1
Hi,
as you know on example section there is script to realise 30 PID Thermostats. As you can see PID is 1 byte but I should manage the histeresy in 1 bit. 2 point valve on/off.

Have you idea to modify the PID script?

Thank you very much.

Claudio
Reply
#2
Hi Claudio,

You can put a event based script on the 1 byte output and write a bit output to another object

Code:
1234567891011121314
output = event.getvalue() if output > 0 then    -- Get value of object to avoid write true on each 1-100 value    bitvalue = grp.getvalue('yourbitobject')    if bitvalue == false then       grp.write('yourbitobject', true)    end else    -- Get value of object to avoid write false on each 0 value    bitvalue = grp.getvalue('yourbitobject')    if bitvalue == true then       grp.write('yourbitobject', false)    end end

BR,

Erwin van der Zwart
Reply
#3
Maybe the solution is the PWM controller? For example when your value is 50% and time T is e.g. 1hour your valve will be switched on for 30minutes and switched off for 30minutes. It will be better for the relay because you will have less switching.
Reply
#4
Or you can just modify setoutput function to send boolean true when value >= 10, false otherwise:

Code:
1234567891011121314151617
function PID:setoutput()   local t, value   self.output = math.max(self.output, self.params.min)   self.output = math.min(self.output, self.params.max)   value = math.floor(self.output) >= 10   t = type(self.params.output)   if t == 'string' then     grp.write(self.params.output, value, dt.bool)   elseif t == 'table' then     for _, output in ipairs(self.params.output) do       grp.write(output, value, dt.bool)     end   end end
Reply
#5
Thank you very much for your effort.
Reply
#6
How can I use this script for individually controlling a few zones? Could somebody prepare some little example?
Reply
#7
You can either create a new script for each zone, or several instances per script.
Code:
12345678910
if not p1 then   p1 = PID:init({ ... }) end if not p2 then   p2 = PID:init({ ... }) end p1:run() p2:run()
Reply
#8
How can I stop this thermostat?
http://openrb.com/example-pid-thermostat-with-lm2/
Reply
#9
You can set manual parameter to a group address. Setting this group to true will disable the PID algorithm.
Reply
#10
I have an on/off output, and this works ok. But is it possible to get the output to work like, with 10% gain, it will have 1 min on, and 9 min off. with 60% gain, 6 min on, and 4 min off?
i hope you understand what im meaning..

Today its like attached picture. 
But the water haeating system will then have a warm floor when on, and cold when off. is it possible to have the thermostat work in cycles?

Attached Files Thumbnail(s)
   
Reply
#11
Use this script (resident, sleep time = 5 seconds) to convert 0..100% value to slow PWM (proportional on/off). Change input/output objects and period time as needed.

Code:
123456789101112
input = '1/1/1' -- proportional value input (0..100%) object output = '1/1/2' -- on/off output object period = 10 * 60 -- 10 minutes in seconds date = os.date('*t') seconds = date.hour * 3600 + date.min * 60 + date.sec curr = seconds % period perc = math.floor(curr / period * 100) state = grp.getvalue(input) > perc grp.checkwrite(output, state)
Reply
#12
Hi again!

then i changed my residential script back to basic, as shown here: http://openrb.com/example-pid-thermostat-with-lm2/
add another residential script, as described above.

I cannot get any output for 1 byte scaled object. it shows 0% even if the setpoint is 5 degrees higher than current value.
if i change the scaled object to 50%, the output will change from '0' to '1'. so the last script should be ok.
please take a look at the attached pictures, and tell me where i went wrong...

Attached Files Thumbnail(s)
           
Reply
#13
You need to change the PID user library back to the original version and do full resident script restart via disable/enable, otherwise new library code won't load.
Reply
#14
Yeay. did a backup, rebooted. When started up, 16 of my OV - PID adresses was gone. run the backup, still missing. what happened? is this a fault in LM? all the values was 0%. do they need to be changed for remembering?

Actually, several group addresses, who i have changed name on, is missing???
Reply
#15
Looks like microSD card in your LM became read-only. You need to replace it with a new one an run recovery procedure. See more info here: http://openrb.com/reflash-logicmachine3-...-software/
Reply
#16
(09.10.2018, 11:23)admin Wrote: Looks like microSD card in your LM became read-only. You need to replace it with a new one an run recovery procedure. See more info here: http://openrb.com/reflash-logicmachine3-...-software/

What is recommended size?
Reply
#17
(09.10.2018, 12:30)Bobby Wrote:
(09.10.2018, 11:23)admin Wrote: Looks like microSD card in your LM became read-only. You need to replace it with a new one an run recovery procedure. See more info here: http://openrb.com/reflash-logicmachine3-...-software/

What is recommended size?

It is up to you, we use from 4GB and up.
------------------------------
Ctrl+F5
Reply
#18
Changed the SD card, everything is ok again. thanx!
Reply


Forum Jump: