<aside> đź’ˇ For the activity you need a variable from the machine (or from a sensor) that is

a) always available

b) changes when the activity changes

</aside>

<aside> đź’ˇ Examples for Activity

Activity example 1.json

Activity example 2.json

</aside>


  1. Decide on what raw-data the activity shall be logically dependent. This data shall come from an MQTT-IN node! (not directly from S7, etc.)

    Machine Property Hint on activity
    has rotating cylinders when cylinders are rotating, the machine is active (activity = 1) (when all cylinder are rotating?)
    the machine has an engine when the engine is turned on/reaches a minimal power, the machine is activated.
    the machine measures the feeding rate A feeding rate over 0 implies the machines activity
    some kind of glider/rider movement is measured by a sensor If the distance between sensor and glider/rider changes over a specific threshold, the machine is active.
    Mean Output over timeinterval x If machines produces a /count at least every x Seconds (x seconds = cycle time) than the machine can be interpreted as active

    <aside> đź’ˇ Feel free to add other logics you used in practice!

    </aside>

    There are several other options, as each machine is a bit different and gives individual information through sensors, S7 or WAGO, etc.

  2. From the value you have chosen, you need to map this value on 1 and 0 (for the activity) using a function. Also boolean values have to be mapped!

    Untitled

    //from a boolean value as input
    msg.payload = msg.payload.LA_T_START ? 1 : 0;
    return msg;
    
    //or 
    
    //when the pace is 0, the activity shall be 0 as well. 
    //else activity shall be 1
    var acti; 
    
    if (msg.payload.Geschw_mm_sec == 0) {
        acti = msg.payload.Geschw_mm_sec; 
    }
    else{
        acti = 1;
    }
    
    msg.payload = {
    
    "timestamp_ms": Date.now(),
    "activity": acti,
    
    };
    
    return msg;
    
  3. After this calculation you just need to give the message the “activity”-topic and send it out via MQTT

    Untitled