Use logical judgment to calculate equipment working time

Forum Home Forums Understanding the Software Using Formulas Use logical judgment to calculate equipment working time

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #13861
    grhsc
    Participant

    Can this function be implemented using formulas or other methods?

    Channel 105 is the power of the motor. When the power < 1kw, we think the motor is stop , and when it > 1kw, we think it is working.

    Through this logic, can the working hours of the motor be calculated that day?

    thank you

    #13865
    Mikhail
    Moderator

    Hello,
    The related answer is here
    If the motor change its state not too often, you can check it every minute and add a channel value if it is on.

    #13871
    grhsc
    Participant

    Hi Mikhail, that answer doesn’t seem relevant and I don’t understand C#’s syntax, so could you help me further?

    Assume that the motor current is channel 100, and channel 108 is used to save the running status

    when the current > 2, it is running, 108=1
    Expressed in python , it should be like this

    while True:
    if channel100 > 2 : channel108 += 1
    time.sleep(60)

    What should I fill in the formula box?

    #13872
    grhsc
    Participant

    I tried some based on the answers on the forum and it seems like this

    Val(100)>5.0?Val(108)+1:Val(108)

    but not correct

    When my data (108)type is int, the data only shows 1 and 0
    When the data type is double, its cumulative value is very strange, probably 9 or 10 each time.

    #13873
    Mikhail
    Moderator

    Hi,
    Something like (not tested)

    public double CountTime()
    {
      return Val(101) > 0 ? Val() + 1 : Val();
    }

    101 – channel that stores the machine state
    Then use this formula in a channel of the Calculated type: EveryMin(() => CountTime())

    #13895
    grhsc
    Participant

    thank you, it works

    #13896
    Mikhail
    Moderator

    Good. This is a common task that many people ask.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.