I have calculated Hrs in Last month . output is in timestamp & now i want to use this 744 in other calulation . Like if we substract this with other PI tag it gives output as below . how should i can directly substract from 744?


image.png

image_1.png

  • Hi NitinRajput

    you can use INT('time range') to convert a timestamp to a number.

    for example, Int((Bom('*')-Bom('*-1mo')))

    the UOM of the result is seconds.

    divide by 3600 to convert the UOM to hours:

    Int((Bom('*')-Bom('*-1mo')))/3600

     

    Best Regards

    Runpu

  • I was always disappointed that then-OSIsoft did not make their own Asset Analytics UOM-aware. I often stated that (timestamp2 - timestamp1) should not return a scalar number, but rather should return a number with a UOM of seconds. Instead it is left to each person to do this on their own.

    That said, I would suggest using:

     

    Name: DeltaSeconds

    Expression: Convert(Variable2 - Variable1, "s")

     

    Name: DeltaHours

    Expression: Convert(DeltaSeconds, "h")

     

    The first convert really does not convert but simply assigns a UOM.