Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Best way to compare a previous time period on the same data point.


  • There may be an obvious answer to this question, but I am trying to display a trend of values by comparing two different time ranges on the same data point (i.e. today versus yesterday, or this month versus last month, etc.). I can successfully create a meta data point with scripting that gathers the info on the same point's previous time period, setup logging, create a history, and accomplish my task, but for efficiencies sake, this history data already exists in the system, and creating a meta data point for the same history data, from a previous period, creates a whole new point with it's own history, which adds to the database size. Is there a way to create a meta or script data point that just queries, and returns the history period I am asking for, without creating the redundant data history on the same point a I mentioned earlier? Thanks.


  • Hi Ray,

    Have you played with the Meta point's "Generate History" function?

    Or, perhaps your meaning is a way to create something you can query to simply do that analysis on demand? The answer is no to this. You cannot create a meta point that is "queryable" and will compute and return the data in the period. You can either,

    1. Store those values in the meta point, which is definitely the right decision if you'll be querying them regularly. From an efficiency standpoint, it's much more difficult to recompute a month of meta data than reading a 500kB file (back of the hand calculation for a 5 minute average type point) based on maybe 30MB of data.

    or...

    1. Do this analysis in the page that would be requesting the meta point's values, by instead requesting the values of the points you wish to do the analysis of.

    It sounds like you're doing some kind of rollup? If so, I wouldn't expect the size concerns to be anything significant until you get on annual time scales. How dense is the data?

    Perhaps you can say more about the computation you're trying to do, and data that you'd like to have available?


  • Hi Phil,

    Sorry for the late reply. I think you answered my question. I have been using meta points, and have been generating history on those points. It just seems like I am storing the same history values twice in some cases when talking about the same data point (i.e. todays values versus yesterdays values), and was looking for a query to run on the fly on the existing data point history, that could be associated with a meta point. I will continue with What I have been doing and storing those values in a meta point.
    You may be able to help with a particular meta script though. How would I compare each days total kWh in the current month & year to the same days and month from last year?


  • What kind of source point? An accumulator or a power reading?

    Assuming something simple like a point that only has the day's kWh value, you could do....

    var yearAgo = new Date();
    yearAgo.setYear(yearAgo.getYear() - 1);
    var yearAgoValueTime = p.pointValueBefore( yearAgo.getTime() );
    return p.value - yearAgoValueTime.value;
    

  • Hi Phil,

    These are all kWh that I've calculated from kW's, and stored them per hour. So I would need to roll up and sum each days worth of kWh's over the course of a month exactly one year ago. I hope that makes sense.


  • Do you need this stored in the database or can you do the rollups in the UI or reports. In both the Mango Dashboards and the Excel reports Mango has really good rollup functions so you can easily display the 1 month sum of your kWh values.


  • Hi Joel,

    I should be able to do the rollup in the UI (DGLux5). Basically looking to display current months worth of data along side the same month from last year.


  • I think if you just keep 2 + years of data in Mango you should be able to do those time quires in DGLux.


  • Thanks Joel. I need to adjust my purge settings 2 years on all my points. What's the easiest way to do that without having to open each point and change them individually?


  • You should only need to do that on the System Settings page under the Purge settings.

    By default all the data sources and points use the system purge settings. You can override this on a data source or data point level if you want.


  • Thanks Joel, I did set that to 2 years on the System Purge settings, I guess I was expecting the individual points to reflect the new purge value, when looking at their settings. No big deal either way, as long as the system wide setting takes care of it.


  • As long as the check box for "over ride purge settings" isn't checked you are fine.


  • Awesome, Thanks.