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.

Script change object range values
#1
Hi,

I would like to dynamically change the min and max values of objects (Visualization parameters), how can I do this with a script ? I need to change a temperature range if we are using cooling or heating mode (cooling min 23°C, max 28°C / heating min 15°C, max 25°C), can I modify a group of objects by using tags ?

Thanks,
idhe
Reply
#2
(07.04.2021, 08:17)idhe Wrote: Hi,

I would like to dynamically change the min and max values of objects (Visualization parameters), how can I do this with a script ? I need to change a temperature range if we are using cooling or heating mode (cooling min 23°C, max 28°C / heating min 15°C, max 25°C), can I modify a group of objects by using tags ?

Thanks,
idhe



I don't know if that parameter can be modified by code ... I did it with a script per event with a 1-byte object. In visu assign a button to increase and another to decrease. This script can be assigned more thermostats by assigning it different values to execute the event. So I would only use a script

Code:
--Cool(1)/heat(0) mode status object
Mode = '3/1/1'

--Setpoint temperature object
Temp = '3/1/2'

--Setpoint temperature status object
Sttemp = '3/1/3'

--Cold minimum value
ColdMin = 23

--Cold maximum value
ColdMax = 28

--Heat minimum value
HeatMin = 15

--Heat maximum value
HeatMax = 25

----------------------------------------------------------
value = event.getvalue()

if grp.getvalue(Mode) then
  Min = ColdMin
  Max = ColdMax
  else
  Min = HeatMin
  Max = HeatMax
  end
 

if value == 1 and grp.getvalue(Sttemp)>Min then
grp.write(Temp, grp.getvalue(Sttemp) - 0.5)
  elseif
    value == 2 and grp.getvalue(Sttemp)<Max then
grp.write(Temp, grp.getvalue(Sttemp) + 0.5)
end
Reply
#3
The script solution is more robust. While it's possible to change min/max values via DB queries you will still have to reload visualization for changes to take effect.
Reply
#4
(07.04.2021, 15:19)admin Wrote: The script solution is more robust. While it's possible to change min/max values via DB queries you will still have to reload visualization for changes to take effect.

Thanks, have you an example ? It's not a problem if I have to reload visualization for changes to take effect.
Reply
#5
Ok thanks admin, I found the solution in the lua doc : https://openrb.com/docs/lua.htm#grp.create
Reply
#6
(13.04.2021, 13:59)idhe Wrote: Ok thanks admin, I found the solution in the lua doc : https://openrb.com/docs/lua.htm#grp.create

Hi,

Can you share the solution please ?

I need that also.

Regards
Reply
#7
See this: https://forum.logicmachine.net/showthread.php?tid=2374
Reply


Forum Jump: