Logic Machine Forum
Maximum Value - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Maximum Value (/showthread.php?tid=2513)



Maximum Value - Tee_Trinker - 13.03.2020

Hey ... I need another tip please.
I want to record the maximum value of the wind speed and then the date and time. That I can display it in visualization. tried FB Editor but couldn't do it.
The wind value comes every 10 seconds and is a 09.2 byte.
Does anyone have a tip on how I can do this?


RE: Maximum Value - Tokatubs - 13.03.2020

(13.03.2020, 20:10)Tee_Trinker Wrote: Hey ... I need another tip please.
I want to record the maximum value of the wind speed and then the date and time. That I can display it in visualization. tried FB Editor but couldn't do it.
The wind value comes every 10 seconds and is a 09.2 byte.
Does anyone have a tip on how I can do this?
You only want the maximum value and show this in visu. Is it just to see the maximum that has been before or whats the use?
Why not use trend?


RE: Maximum Value - Tee_Trinker - 13.03.2020

the Maximum ever...the fastest wind speed.
if i use the trend it is difficult to see the absolute maximum


RE: Maximum Value - Erwin van der Zwart - 15.03.2020

Hi,

Just.make 2 extra (virtual) objects (1x 2 byte and 1x 250 byte) and put this event script on your windspeed object.
Code:
if event.getvalue() > grp.getvalue('32/1/1') then
   grp.update('32/1/1', event.getvalue())
   grp.update('32/1/2', os.date('%A %d %B %H:%M'))
end
You should also be able to put these 2 object values to a widget with the widget creator in the Touch visu.

BR,

Erwin


RE: Maximum Value - Tee_Trinker - 15.03.2020

Hey it works.....Thank you!!!!!


RE: Maximum Value - Tokatubs - 16.03.2020

Tried this, created 2 new virtual but getting this error?

   


RE: Maximum Value - admin - 16.03.2020

There is missing apostrophe after /3 on line 2, it should be '32/1/3'


RE: Maximum Value - AlexLV - 16.03.2020

Hi, is this working with 09.001 Temperature type objects??

I added this example to my boiler's temperature group, and nothing going on...

Also added this code and manually changed temp value, but nothing changed, log was not written. Shoud I change something for 09.001 type??

if value then
value1 = grp.getvalue('20/2/2') -- this is 09.001 type
log(value1)
grp.update('40/1/1', value1)
end

Alex


RE: Maximum Value - admin - 16.03.2020

Copy the script as is and only change group addresses without changing anything else. Exact data type does not matter as long as it is numeric.


RE: Maximum Value - AlexLV - 16.03.2020

If I add this script to other temperature group - it works. But I add this to my boiler's group - not working. To this group data is written from OneWire senesor connected to OneWire port.

If I manually trying change data in this group - and after this open OneWire setting - i see instead of group number 20/3/2 just number 41730 and invalid group address. Can it be linked somehow??


RE: Maximum Value - Daniel - 17.03.2020

Try clearing browser cache and check if you still see the 41730


RE: Maximum Value - admin - 17.03.2020

The code inside "if" won't execute because value variable is never defined in your code:
Code:
if value then
value1 = grp.getvalue('20/2/2') -- this is 09.001 type
log(value1)
grp.update('40/1/1', value1)
end



RE: Maximum Value - AlexLV - 17.03.2020

(17.03.2020, 09:03)admin Wrote: The code inside "if" won't execute because value variable is never defined in your code:
Code:
if value then
value1 = grp.getvalue('20/2/2') -- this is 09.001 type
log(value1)
grp.update('40/1/1', value1)
end


admin, yes now I know now mistake in my example, but I mean that for my group with 09.001 type your example not working. To this group I save data from 1-wire sensor.. Why it could be??

Code:
if event.getvalue() > grp.getvalue('40/1/1') then
   grp.update('40/1/1', event.getvalue())
   grp.update('40/1/2', os.date('%A %d %B %H:%M'))
end

Finally found problem - group was not created correctly - group number Smile Now all working Smile


RE: Maximum Value - Daniel - 17.03.2020

This script is different then the one you posted earlier, what are you trying to achieve?


RE: Maximum Value - AlexLV - 17.03.2020

Daniel,

thank you, all is working now. I thought that problem connected with temperature data type. But I simply mistaken in group creation. Now all is working, and I am also still learning myself.


RE: Maximum Value - Tee_Trinker - 24.03.2020

(17.03.2020, 16:49)AlexLV Wrote: Daniel,

thank you, all is working now. I thought that problem connected with temperature data type. But I simply mistaken in group creation. Now all is working, and I am also still learning myself.

Hey Guys,

I've done that for my outside temperature now. Works also great, but only the maximum temperatures.

What do I have to change in the script to get the minimum temperatures?

 I am also still learning myself  Angel


RE: Maximum Value - admin - 24.03.2020

Change comparison sign from > to <


RE: Maximum Value - Tee_Trinker - 24.03.2020

(24.03.2020, 16:51)admin Wrote: Change comparison sign from > to <

it doesnt work


if event.getvalue('0/2/3') < grp.getvalue('32/1/64') then
  grp.update('32/1/64', event.getvalue('0/2/3'))
  grp.update('32/1/65', os.date('%d.%m.%Y | %H:%M'))
end


RE: Maximum Value - admin - 24.03.2020

What is the current value of 32/1/64? If you have just created this object then it's probably 0 which is probably lower than the outside temperature. Write some large value like 100 there and check if script starts working.


RE: Maximum Value - Tee_Trinker - 24.03.2020

(24.03.2020, 18:44)admin Wrote: What is the current value of 32/1/64? If you have just created this object then it's probably 0 which is probably lower than the outside temperature. Write some large value like 100 there and check if script starts working.

now it works.
I manually set the outside temperature to 30 and then to -30.
After that I got the 32/1/64 (2byte virtual object) back to 0, and then it changed automatically.

Thanks!!!