• P
    psysak

    I have a Mango ES on which the RS485 port has disappeared. I've tried refreshing and restarting etc. Any advice? This mango seems to be acting odd because I had to delete the /mango/work directory before I could view data sources.

    posted in User help read more
  • P
    psysak

    Aaannd for anyone else who finds this, as Joel stated, delete the /mango/work directory, all is well

    posted in User help read more
  • P
    psysak

    I have this issue as well right now for some reason on an ES

    posted in User help read more
  • P
    psysak

    I'm starting to get it man :)

    posted in User help read more
  • P
    psysak

    I'm just trying to picture this whole thing in my head. I guess what I'm trying to figure out right now is just what object type is pvd, what properties it has and what methods it contains. This isn't for anything other than trying to understand it.

    posted in User help read more
  • P
    psysak

    Hey Phil, so that I can start to understand this myself, I'm creating an instance of a variable which exists in this context right?

    I want to see what the current value of the point is so I'm trying to do print(pvd) but that prints out com.infiniteautomation.nosql.MangoNoSqlPointValueDao@10a2b86. If I look at that I'm led to think that the declaration you mention before is, well as the name suggests, proxy for the current database type that the system is running. So the object I created is actually a DAO for the MAngoNoSQLPoint type. To try to figure out how I can print the current value of this point I am now going to go poke around on github to see if I can't figure out what parameters and functions this NoSQL type supports.

    Am I on the right track?

    By the way it works, the scripting point type that I write the result to has correct values I think.

    posted in User help read more
  • P
    psysak

    Thanks man! Really appreciate the help, I'm learning JavaScript by jumping in the deep end :)

    posted in User help read more
  • P
    psysak

    Hey hey, I'm looking for an explanation for this wording in the Contextual help for the Scripting data source

    Finally, scripts in the scripting data source maintain their context states for the lifecycle of the data source runtime.
    

    I understand this to mean that if I create a variable using var it should stick around in that script until the mango is reset. This is what I did

    var EG_1_Last;
    
    EPoint_I.set(EG_1.value - EG_1_Last);
    
    EG_1_Last = EG_1.value;
    

    EG_1_Last however is reinitialized each time the script runs where I was hoping that it would maintain the value from the last run.

    posted in User help read more
  • P
    psysak

    Forgot to add that the values the mango is calculating don't even seem to make sense. If this is running every 5 minutes I would expect that it's either going to be correct or double what I expect. What's weird also is that it's wrong a few times in a row and then it's correct, then wrong, then correct again...

    posted in User help read more
  • P
    psysak

    Hey hey. This is something which has been driving me insane lately, I've tried all sorts of different things and it always seems incorrect.

    I have a Mango ES which is polling a device over MODBUS every 10 seconds. It reads an accumulated pulse count from this device. I log the accumulated pulse count every 5 minutes. I have a meta point which then is attempting to calculate the delta in the last 5 mins. This delta calculation has been triggered on both Cron and on logged event, both yield the same thing. The deltas which the mango calculates range from bang on to way off and I can't figure out why.

    Included is a spreadsheet, 6 hours of data from my mango. The column "Mango Delta" is the delta which the mango has calculated. The column "Mango Raw Value" is the MODBUS point raw value which I am reading from the mango with its associated timestamp. The column "Excel Delta" is just "cell2 - cell1" done in Excel. I have another system which I am sending the raw data to which confirms for me that the deltas I get from Mango are whacked.

    [0_1512483170534_Weird Delta.xlsx](Uploading 100%)

    Also included is my meta point script. "pulse" is the raw pulse value from the MODBUS device, pulsefactor is not used in this script and the entire thing is triggered every 5 mins based on CRON.

    // Calculate the interval value since last logging (5 mins)
    // This script should only trigger when pulse is logged, which is set to 5 min
    // Pulsefactor is used to calculate the actual consumed amount
    // where pulsefactor is the meters pulse weight
    
    // Local variables section
    // Control what parts of this script run
    weight = false;     // If true this script will apply pulse rate
    interval = true;   // If true this script will calculate interval data
    hydro = false;      // If true this is a calculation for electricity 
    
    // To protect against calculating zeros, check the values of the factor variables
    if(weight) {
        if(pulsefactor.value <= 0) {
            pfactor = 1;
            tfactor = 1;
        } else {
            pfactor = pulsefactor.value;
            if(hydro){
                tfactor = 12;
            } else {
                tfactor = 1;
            }
        }
    } else {
        pfactor = 1;
        tfactor = 1;
    }
    
    if (interval) {
        // If a value requires compensation for rollover (ex 65535) enter here
        rollover = 0;
        
        // If the value rolled over and the rollover value was entered then calculate 
        // the interval data using the rollover value
        if((pulse.past(MINUTE, 5).minimumValue > pulse.value) && (rollover > 0)) {
            return((rollover - pulse.past(MINUTE, 5).minimumValue + pulse.value) * pfactor * tfactor);
         
        // In the case that the rollover value was not specified but the value still
        // rolled over just return the current reading (error present)
        } else if((pulse.past(MINUTE, 5).minimumValue > pulse.value) && (rollover = 0)) {
            return(pulse.value  * pfactor * tfactor);
        
        // Normally we do this, which is to return the delta over the last 5 mins
        } else {
            return(pulse.past(MINUTE, 5).delta  * pfactor * tfactor);
        }
    } else {
        return(pulse.value  * pfactor * tfactor);
    }
    
    

    I don't know if there's a bug here or what the case may be but I just need some guidance on what is going on and whether this will work or not.

    posted in User help read more

Looks like your connection to Mango Automation Forum was lost, please wait while we try to reconnect.