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.
12.09.2016, 15:03 (This post was last modified: 12.09.2016, 15:06 by Erwin van der Zwart.)
Hi Claudio,
You can put a event based script on the 1 byte output and write a bit output to another object
Code:
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
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.
Or you can just modify setoutput function to send boolean true when value >= 10, false otherwise:
Code:
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
07.10.2018, 17:28 (This post was last modified: 07.10.2018, 17:33 by Bobby.)
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?
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:
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)
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...
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.
09.10.2018, 08:39 (This post was last modified: 09.10.2018, 08:40 by Bobby.)
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???
(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/
(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/