• 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

    Is there a limit on # points in context memory

    Scripting general Discussion
    2
    6
    1.8k
    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
      Phillip Weeks
      last edited by

      Is there some limit on the # on points I can reference in a script. My script works fine with 10, 20 or 30 points but does not seem to run with 200 points? Is there some limit to cause a problem?

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

        Hi Phillip,

        No, there's no arbitrary limit. There may be a practical limit depending on what you're doing. Also, it may require some patience. If you've got a long running loop, you can set the loop counter out to a point and see where you're at.

        You didn't really describe its failure. Can you post the script and describe the issue?

        1 Reply Last reply Reply Quote 0
        • P
          Phillip Weeks
          last edited by Phillip Weeks

          It is a long script true.. The verify works and is sluggish in the execution but goes through the all points in simulation. When for real it does not seem to run because it should disable a flag to turn it off and this never gets disabled when the point count is 200. This is the script.
          if (RunScripting.value){
          RunScripting.set(false);
          print("Run Started");
          var minimumDataInterval = 300000; //5* 60 seconds

          var periodBegin = new Date(2017, 7, 14);
          periodBegin.setHours(0);
          periodBegin.setMinutes(0);
          periodBegin.setSeconds(0);
          periodBegin.setMilliseconds(0);
          
          var periodEnd = new Date(2017, 7, 15);
          periodEnd.setHours(12);
          periodEnd.setMinutes(0);
          periodEnd.setSeconds(0);
          periodEnd.setMilliseconds(0);
          
          for (var i = 1; i < 217; i+=1) {
             var pointcount =0;
              var values = eval('P' + i + '.pointValuesBetween( periodBegin, periodEnd );');
              print("found values between "+ periodBegin.toString() + " " + periodEnd.toString() + "  : "+ values.length);
              for(var k = 0; k < values.length-2; k+=1) {
                  
                  var val1 = values[k];
                  var val2 = values[k+1];
                  var diff = val2.time - val1.time;
                // print("Point time: " + diff.toString()) ;
                 var newDataTime = val1.time + minimumDataInterval;
                 
              	while( newDataTime < val2.time) {
              		
              		    var newVal = parseInt(val1.value) + (parseInt(val2.value) - parseInt(val1.value)) * (newDataTime - val1.time) / (val2.time - val1.time);
              		    newVal = parseInt(newVal);
              		    
              			eval('P' + i + '.set( newVal, newDataTime );');
              			newDataTime += minimumDataInterval;
              		    pointcount +=1;
              			 
              		}
              		
              	}
              print("Points Added" + pointcount);	
              }
              
          }
          

          and its output in simulation
          Setting point Script_Flag to false @07/09/2017 12:35:44
          Run Started
          found values between Mon Aug 14 2017 00:00:00 GMT-0300 (ADT) Tue Aug 15 2017 12:00:00 GMT-0300 (ADT) : 272
          Setting point UNIT-101-CW to 3004.0 @14/08/2017 10:25:00
          Setting point UNIT-101-CW to 3004.0 @14/08/2017 10:30:00
          Setting point UNIT-101-CW to 3004.0 @14/08/2017 10:35:00
          .....

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

            Unless Mango crashed, it probably is working. You may want to have something like RuntimeManager.disableDataSource("this-data-source-xid"); at the end of the script and instead of doing prints, set that string to an alphanumeric point and watch it change.

            Is your script set to "Saves historic"?

            My expectation would be that it's doing a lot of backdate posting, and that's taking time. You could try increasing the "Delay for writing backate batches (ms)" in the NoSQL settings on the /system_settings.shtm page.

            1 Reply Last reply Reply Quote 0
            • P
              Phillip Weeks
              last edited by

              Yes Historic is enabled and I did increase the backdate posting.. so far no change..
              I will take another look at this later Phil but I have got it to work correctly with a lesser number of points so its something.. Thanks Ill post my results.

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

                Okay. You may want to hit the /rest/v1/threads?stackDepth=30&asFile=true endpoint if you think it is stuck, then email it to me and I'll let you know.

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