• 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

    Multistate from analog ranges

    Scheduled Pinned Locked Moved User help
    5 Posts 2 Posters 1.6k Views 2 Watching
    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 Offline
      Pikey4
      last edited by

      Hi all,
      Perhaps this has been covered previously but I could not find. Or perhaps this question could help others also.....

      I am trying to create a multistate data point from different ranges of values from an analog point. These could be pressures, flows, power, temp and so on.

      Example:

      Analog Data Point is <1 = 1
      Analog Data Point is between 1-1.5 = 2
      Analog Data Point is between 1.5-2.5 = 3
      etc.

      From which I can generate pie charts. Still wrapping my head around meta data points so assistance appreciated.

      Thanks In advance.

      Mango Core version: 3.5.6
      Mango API module version: 3.5.2
      MangoUi module version: 3.5.5
      Platform: 10.14 MacOS Mojave
      Chrome: Version 70.0.3538.110 (64-bit)

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

        Hi Pikey4,

        I think you may be able to achieve this using a range text renderer for the sake of the pie chart! But, a meta point will enable it to behave as a proper multistate point everywhere. That'd be having the source point in context updating context, with a script like,

        if( p.value < 1 )
          return 1;
        else if( p.value < 1.5 )
          return 2;
        else if( p.value < 2.5 )
          return 3;
        //etc
        return -1;
        
        1 Reply Last reply Reply Quote 0
        • P Offline
          Pikey4
          last edited by

          Thanks Phillip,

          The first part of this seems to work ok but the:

          ****else if( p.value < 1.5 )
            return 2;
          else if( p.value < 2.5 )
            return 3;
          //etc
          return -1;****
          

          Doesn't seem to return anything. do I need to specify the range between for the additional point states aft 1 ?

          between 1 - 1.5 ??

          Also does the return -1;
          have any meaning. What does this represent?

          Thanks.

          Mango Core version: 3.5.6
          Mango API module version: 3.5.2
          MangoUi module version: 3.5.5
          Platform: 10.14 MacOS Mojave
          Chrome: Version 70.0.3538.110 (64-bit)

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

            I'm not sure what you mean it doesn't return anything. This is in a multistate meta point with a numeric point in its context, yes? I don't think I messed that logic up...

            We don't need to specify the range explicitly in each if statement because they are evaluated sequentially and if it were in that range the value would have returned from the earlier return statement.

            The return -1 was to say something else because your ranges were not exhaustive of the possibilities and not returning anything will be interpreted as an implicit return null; which would cast to a zero value for multistate.

            1 Reply Last reply Reply Quote 0
            • P Offline
              Pikey4
              last edited by

              Thanks Phil,

              Your logic was sound.

              I was trying to set this remotely over a very slow connection I wonder if that was the problem??

              Went to site and deleted the point and started again, everything worked fine.

              Cheers!

              Mango Core version: 3.5.6
              Mango API module version: 3.5.2
              MangoUi module version: 3.5.5
              Platform: 10.14 MacOS Mojave
              Chrome: Version 70.0.3538.110 (64-bit)

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