I have a temperature probe feeding my emoncms instance with values. What I am looking to do is create a display showing
maximum & minimum values. Which is where I get stuck! I modified the "average" subroutine in process_model.php to
create two new processes. But then when I go to the input screen, I don't appear able to use them as it sequentially passes the output of one process to the next.
So please help! Any fiendishly simple or dastardly complex ideas are welcome!
M
Re: Daily Min / Max Values
Hi,
I'm afraid I couldn't come up with a fiendishly simple way of doing this, so you'll have to settle for a complex one!
WARNING! This breaks the sequentiality by NOT passing on the previous value!
First of all, you'll have to edit the /Models/process_model.php and add some arrays within the get_process_list() function:
In my case the highest $list[] number was 22 (I've added other processes) so I added the above starting at 23.
Then at the end of the same file add the following functions:
To use this you will need to know the feed id of the feed you want the minimum of. Once you have this, goto the input process list and add a new entry of 'Calculate Daily Min for Feed ID' then enter the feed id. Then add an entry with 'Log to feed daily' and create a new feed.
This new feed will have only one entry per day (for midnight) that has the minimum value for that day.
Same process for Maximum.
New functions for Hourly, Monthly and Yearly can be added with a $duration type of H, M or Y. If you want other ranges, adjust the function get_start_and_end_times().
I have used the built in MySQL functions MIN() and MAX() for the calculations, other functions are available: http://dev.mysql.com/doc/refman/5.6/en/group-by-functions.html
I hope this all makes sense!
Ian
--
Re: Daily Min / Max Values
I've not tried this, but my thinking is:
If your Nanode base (presumably you have one or an equivalent with some intelligence) gets the internet time from http://emoncms.org/time/ it knows when a day starts. It sees the temperatures as they go past, so it should be trivial to check for max and min and inject those into the data stream, and reset them at midnight (or whenever takes your fancy!). Your emoncms will see the extreme recorded up until that instant, which is pretty much how any min/max display works.
Re: Daily Min / Max Values
Ian, Many thanks for your brilliant help on this! I've installed it and its working.
Robert, thanks for your suggestion too. I suppose my thoughts were to do any "calculation" in one place so I hadn't thought of doing it on the nanode!