• 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

    Mango still not recognizing kWh

    User help
    4
    5
    2.3k
    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.
    • sjobbeS
      sjobbe
      last edited by

      How come kWh is not recognized? I would think this is one of the most used units in Mango applications.

      kW/h is recognized but it is not the same: kiloWatts per hour and kiloWatt hours not the same.

      1 Reply Last reply Reply Quote 0
      • M
        mihairosu
        last edited by

        The unit of Watts already contains time (Joules/second) so kW/h is most definitely a typo. It should be kWh.

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

          I am not so sure that it is a typo, mihairosu. I think sjobbe's interpretation is correct. I see no such kWh in javax.measure.unit and I believe it will try to parse operations in constructing a unit. It really is thinking in terms of kilowatts per hour when you type kW/h. You can just keep adding divisors! Like, kW/h/g is kilowatts per gram-hour. This stuff is in javax.measure.unit, not our code. We can, however, create custom labels.

          To get a kWh unit, what needs to be done is add:
          public static final Unit<Energy> kWh = SI.JOULE.times(3600000);
          and
          localFormat.label(kWh, "kWh");
          to the obvious places in com.serotonin.m2m2.util.UnitUtil.java and recompile

          I suspect this is something we'll want to have for everyone, so I have made a github issue for it.
          https://github.com/infiniteautomation/ma-core-public/issues/597

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

            The other solution is to not use the unit as the suffix. If you are not relying on the "convert for display" option then you can use the suffix property of the Text Renderer to set a suffix of " kWh" for display purposes. Be sure to uncheck the "Use unit as suffix" box!

            Edit: Just an edit not to bump, but to Pedro's point kWh --> kW*h

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

              Meanwhile, you could type kW*h into the unit field. It is then displayed as kW·h. I use it all the time in the integral field since it is more useful than the default kW·s.

              However, if Mango considers kW/h to be an alias for kWh, that should definitely be corrected, as it could cause undetected incorrect numerical conversion issues. In fact, just today I was thinking of writing a function that used kW/s, so the possibility that someone may use kW/h is not out of the question.

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