• Recent
    • Tags
    • Popular
    • Register
    • Login

    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 Mango 5 Documentation Website

    Converting "units"

    User help
    2
    3
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      psysak
      last edited by

      I'm curious about the "Convert unit for display" idea in the system. Is it somehow possible to define a custom conversion? For example I read a running pulse count and would like to see a weighted interval reading from it. The pieces in the system seem to be there, a running pulse total with the Delta rollup applied to it then multiplied by the weight would be exactly what I need. For reporting purposes it is easy enough to just export the Delta results and multiply by the weight directly in the Excel spreadsheet, especially if the pulse weight is a variable I can export into the report.

      1 Reply Last reply Reply Quote 0
      • phildunlapP
        phildunlap
        last edited by phildunlap

        Hi psysak,

        It is possible currently, but it would be a bit of a hack and may have unintended consequences. We have talked about adding support for unit definitions as a system setting, but it's never been a high priority.

        Currently you would have to add unit labels / aliases from a scripting environment, like,

        var newUnit = javax.measure.unit.Unit.ONE.times(15); //our new unit is fifteen quanta
        com.serotonin.m2m2.util.UnitUtil.addLabel(newUnit, "fift");
        

        Which, after running, should let you use the unit 'fift' to indicate the source value should be divided by 15 for display. Some examples are in the class referenced:

        https://github.com/infiniteautomation/ma-core-public/blob/main/Core/src/com/serotonin/m2m2/util/UnitUtil.java

        The drawback is that your point will fail validation in a system that had not run this unit addition (like that system, every time it starts), which could cause problems I have not foreseen. So, try at your own risk! Edit: Although if you modify the class and place it as an override, it will load instead of the provided UnitUtil class. You could also try adding them in a set point handler on the system startup event. /edit

        The proper way to do it would be to write the new units into that class, or for us to provide a hook that loads in your units when Mango is starting. But, as I said, this has not jostled to the front of the priority queue.

        1 Reply Last reply Reply Quote 0
        • P
          psysak
          last edited by

          Woooow... I shall stick to my current META script way :)

          Thanks!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post