Group Details Private

administrators

 
  • phildunlap

    Good catches, Fox!

    Hi HSAcontrols, welcome to the forum!

    I think Fox may have set you on the right path for where the calculation may be going wrong. The only think I have to add is that the black question mark diamond is indeed a NaN value being rendered. I'd perhaps have to see a screenshot to be sure, but that's what it sounds like.

    I tested the script incrementally and only towards the end of the calculation does this error occur, maybe a problem with the division & square root being to small?

    NaN is a very infectious value. If one of the point values you're looping over is NaN, then doing any mathematical operation on it or with it will also produce NaN. You could check with an if(!isNaN(value_i)) {} around the calculations for DiffSquared and sumDiffSquared

    posted in Scripting general Discussion read more
  • Jared Wiltshire

    OK, use /rest/v2/full-event-detectors instead, this API is newer and allows you to link handlers to the event detector in one hit (set the handlerXids property to an array of handler XIDs, if it is null it will not update the linked handlers).

    Now onto your main question, you will have to link the event detector to the data point id. You set the sourceId property to the data point's id. I know this is weird, it really shouldn't be like this as everything else uses xids, I will try and get this changed.

    The JSON to POST to the endpoint will look like

    {
        "detectorType" : "MULTISTATE_STATE",
        "sourceId" : 995,
        "rtnApplicable" : true,
        "alarmLevel" : "CRITICAL",
        "sourceTypeName" : "DATA_POINT",
        "handlerXids" : [ ],
        "duration" : {
          "periods" : 5,
          "type" : "MINUTES"
        },
        "state" : 5,
        "detectorType" : "MULTISTATE_STATE",
        "name" : "PCS3 Has Faulted"
    }
    

    posted in User help read more
  • phildunlap

    Thanks for taking a second look, reporting your experience, and the kind words!

    posted in User help read more
  • phildunlap

    cwangv

    that may well be the cause of your issue. Due to polling delay, the data will not come in at exact 15 minutes intervals.

    Not so! Mango is somewhat deceptive in terms or recorded timestamps in polls, which is why we discourage collecting highly time-precise data directly via Mango.

    Mango will schedule a poll for a data source at a certain time, and all data will report that timestamp for the poll, even if the poll took quite some time to run. That's not true for every type of data source, since some transmit the timestamps with the data, but for protocols like BACnet and Modbus all points sampled in the poll will have the poll as the timestamp of the value.

    The problem is somewhat more readily evident even with those sources now, since "Quantize" became an option on all data sources, which will align the period along the millisecond boundary of the polling period, so it is easy to collect data with these timestamps.

    cbyrne

    Hi @phildunlap, thanks for the info, however I think this way of calculating deltas is flawed for anyone doing metered readings. These happen at regular intervals like above and currently the delta value for an hour does not show the user their usage for one hour and this is the critical issue.

    I can see your argument. I will raise it with others and see their perspective. The reason the ending timestamp is exclusive is that otherwise values on the period boundary could be counted twice in separate periods, causing the sum, average, and integral to have issues when comparing to the whole period. But, as you are noting, the delta has that behavior.

    Ofsetting by 1 ms does not cure the problem as it forces the last reading in the period into the next period so it still gets missed.

    Offsetting the values by 1 ms backward would solve the display issue of those rollups, I would expect. Or one could offset the period 1 ms forward if not using the datebar and truncate is false.

    Similarly, would you consider adding a last_value-first value to the mango statistics object?

    There already are the values Start, First, and Last in terms of values. They are formally defined here: https://help.infiniteautomation.com/mango-rollups-and-statistics

    posted in User help read more
  • Jared Wiltshire

    @fleh said in Bug with amcharts(?): Preview works but page view does not:

    I actually wanted to emphasize how much I appreciate your forum support. Many help pages are really good and the coverage with video tutorials is excellent to get an overview.

    Thanks!

    @fleh said in Bug with amcharts(?): Preview works but page view does not:

    I spent quite a bit of time on issues already which where incomplete or missed critical info. For example, the help pages for egauge, egauge datapoint, Environment Canada Data Point, ""Environment Canada"", M Bus, and M Bus datapoint simply went AWOL..

    I will check up on those. I am not sure that the Environment Canada DS is still supported, it is a very niche data source that can easily be replaced with a HTTP data source.

    @fleh said in Bug with amcharts(?): Preview works but page view does not:

    Thanks for the user module @Jared-Wiltshire! It does not work when copying it into a new page for me, but I'll go through it line-by-line to see what its purpose is. Have a nice weekend, y'all!

    It doesn't go directly into the page markup, you save it into a .js file and reference it from UI Settings -
    https://help.infiniteautomation.com/getting-started-with-a-user-module

    Basically it defines a new component, then you use the component inside your page. e.g.

    <my-chart point-values="pointvalues"></my-chart>
    

    posted in Mango feedback read more
  • phildunlap

    To the stack trace involving,

    Caused by: org.h2.jdbc.JdbcSQLException: File corrupted while reading record: "index not found 93". Possible solution: use the recovery tool [90030-180]

    I would advise restoring a database backup. See this these resources for ways of doing that:
    https://help.infiniteautomation.com/how-to-restore-a-h2-database-backup
    https://forum.infiniteautomation.com/topic/2748/how-to-restore-a-database-backup

    To the stack trace involving,

    Caused by: java.net.BindException: Address already in use

    This usually means that Mango is already running on that port, but it could also mean that another application is running and has bound that port. The solution if Mango is already running is to access the Mango that is running, and if another application has bound it you can change the port Mango binds to in the Mango/overrides/properties/env.properties file.

    posted in MangoES Hardware read more
  • Jared Wiltshire

    @chio You could also use your favorite scripting language to create the event detectors via the REST API.

    posted in User help read more
  • phildunlap

    This thread was my last go at simplest mass event detector creation, by leveraging watchlists: https://forum.infiniteautomation.com/topic/3708/a-script-jsonemport-example

    posted in User help read more
  • Jared Wiltshire

    @chio This is one area which is lacking at the moment, we have been discussing this recently in fact. We will probably be adding the ability to import / export the event detectors via CSV soon.

    In the meantime, the easiest way to bulk edit them would be to use the JSON import/export (Under Administration - Home - Configuration import/export). Use a script or tool to modify the JSON and re-import.

    posted in User help read more