• 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

    [SOLVED] correct point var name for scripts...

    Scripting general Discussion
    2
    11
    3.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.
    • danD
      dan
      last edited by

      Hey Guys, to set a data point which I've rendered to be say MANUAL and AUTO do I use that with ' ' inside the script or just 0 or 1 for on / off or true and false?

      if(p36.value == 'MANUAL')

      if(p36.value == MANUAL)

      if(p36.value == 1)

      if(p36.value == 0)

      same for p36.set(1) or p36.set('AUTO') ?

      The script seems to just not change anything on the live system.

      Attachment: download link

      1 Reply Last reply Reply Quote 0
      • JoelHaggarJ
        JoelHaggar
        last edited by

        Try true or false

        if(p36.value == 'MANUAL') 
        
        if(p36.value == MANUAL) 
        
        if(p36.value == true) 
        
        if(p36.value == false) 
        
        same for p36.set(true) or p36.set(true)
        
        1 Reply Last reply Reply Quote 0
        • danD
          dan
          last edited by

          ok I'll try that thanks, could you just confirm the cron operation for scripts..

          Does the cron time execute the script say each minute for example then the script stop at the end of the script and it won't run again for another minute?

          Just trying to get this script to run at a more regular interval and I don't think cron will support that.

          Cheers

          1 Reply Last reply Reply Quote 0
          • JoelHaggarJ
            JoelHaggar
            last edited by

            Yes the CRON pattern will run the script once at the time or times determined by the CRON.

            1 Reply Last reply Reply Quote 0
            • danD
              dan
              last edited by

              Sorry for all the questions, is there a simple function within the scripting to either send an alert/email or raise an event from which I can then send an email from?

              Cheers
              Dan

              1 Reply Last reply Reply Quote 0
              • JoelHaggarJ
                JoelHaggar
                last edited by

                No, you would have to do that via a data point, event detector and event handler.

                1 Reply Last reply Reply Quote 0
                • danD
                  dan
                  last edited by

                  cool, thanks for that.

                  I'm not getting any debugging info in this script each time it runs (each minute)

                  apart from:-

                  
                  
                  administrator@water:~$ tail -f logs/scripting-10.log
                  INFO  2014-08-08 13:59:58,063 - Data source started
                  
                  

                  I've tried having it in either trace or debug mode inside the script editing screen. I'm not sure it's even running the cron job, nothing in ma.log relating to it being triggered apart from the source restarting when I hit save..

                  
                  
                  INFO  2014-08-08 13:59:57,969 (com.serotonin.m2m2.rt.RuntimeManager.stopDataSource:322) - Data source 'Tank Automation' stopped
                  INFO  2014-08-08 13:59:58,068 (com.serotonin.m2m2.rt.RuntimeManager.initializeDataSource:290) - Data source 'Tank Automation' initialized
                  INFO  2014-08-08 13:59:58,069 (com.serotonin.m2m2.rt.RuntimeManager.initializeDataSource:295) - Data source 'Tank Automation' took 14.278909ms to start
                  
                  
                  
                  1 Reply Last reply Reply Quote 0
                  • danD
                    dan
                    last edited by

                    This is the latest version of the script on the system, it just doesn't seem to be running at all. There are no more entries in the logs nor any errors, I have it in debug Log Level also.

                    
                    // check if in auto mode AND tank level below 5000L AND pump not running
                    if ((p31.value == 'AUTO') && (p7.value < 5000) && (p11.value == 'STOP')) {
                    // open north solenoid
                    p24.set('OPEN');
                    // close southern solenoid
                    p22.set('CLOSED');
                    // close western solenoid
                    p28.set('CLOSED');
                    // start pump
                    p11.set('RUN');
                    }
                    
                    // check if in auto mode AND tank level above 22700L AND pump running AND northern solenoid OPEN
                    if((p31.value == 'AUTO') && (p7.value > 22700) && (p11.value == 'RUN') && (p24.value == 'OPEN')) {
                    // stop pump
                    p11.set('STOP');
                    // close northern solenoid
                    p24.set('CLOSED');
                    }
                    
                    
                    
                    // check if in auto mode at Driveway Tank AND tank level below 5000L AND pump not running
                    else if((p36.value == 'AUTO') && (p23.value < 16000) && (p11.value == 'STOP')) {
                    // open southern solenoid
                    p22.set('OPEN');
                    // close northern solenoid
                    p24.set('CLOSED');
                    // close western solenoid
                    p28.set('CLOSED');
                    // start pump
                    p11.set('RUN');
                    }
                    
                    // check if in auto mode at Driveway Tank AND tank level above 22700L AND pump running AND southern solenoid OPEN
                    if((p36.value == 'AUTO') && (p23.value > p38.value) && (p11.value == 'RUN') && (p22.value == 'OPEN')) {
                    // stop pump
                    p11.set('STOP');
                    // close southern solenoid
                    p22.set('CLOSED');
                    }
                    
                    

                    I'm just going through and updating the fill points and low points to be dynamic from settable data points, but still the script doesn't appear to be running?

                    1 Reply Last reply Reply Quote 0
                    • danD
                      dan
                      last edited by

                      I've been looking through logs etc, it's like the cron scripts aren't even running at all.

                      Nothing appears in the logs apart from

                      
                      INFO  2014-08-08 22:09:06,934 - Data source started
                      
                      

                      That kind of thing. Nothing more.

                      Is there somewhere I need to maybe set the path to the systems cron bin? Or is it using a java version of cron?

                      Mango appears to be running as root, should that be ok?

                      The timing for every minute just seems to be ignored and the cron job never appears to run?

                      Cheers
                      Dan

                      1 Reply Last reply Reply Quote 0
                      • danD
                        dan
                        last edited by

                        SOLVED!!

                        I mucked around with this for a few hours and found if I changed all the labelled set points from say 'AUTO' and 'MANUAL' to just true and false it now works, brilliantly!!

                        Thanks Joel and team for all your assistance!

                        Although I do still notice nothing in the trace log for the script other than the Data source started line.

                        Cheers
                        Dan

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