Logic Machine Forum
Script change object range values - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Script change object range values (/showthread.php?tid=3289)



Script change object range values - idhe - 07.04.2021

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


RE: Script change object range values - davidchispas - 07.04.2021

(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



RE: Script change object range values - admin - 07.04.2021

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.


RE: Script change object range values - idhe - 07.04.2021

(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.


RE: Script change object range values - idhe - 13.04.2021

Ok thanks admin, I found the solution in the lua doc : https://openrb.com/docs/lua.htm#grp.create


RE: Script change object range values - savaskorkmaz - 02.11.2021

(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


RE: Script change object range values - admin - 02.11.2021

See this: https://forum.logicmachine.net/showthread.php?tid=2374