Just wondering why my processbook won't accept this formula? minval(tagavg('tag1','*-12h','*','30m'),'*-12h','*')- details below

I needed to create a calculation to determine the value of the lowest 30 minute average period within a 12 hour period- Chat GPT spat this out.

I have done plenty of tagmin and tagavg calcs in the past but never used the '30m' part to break the data up into sections. If anyone could shed light on why it won't accept this it would be much appreciated, or suggest an alternative way that I might be able to create this calculation please? Thank you!

Parents
  • There is no "minVal" function! You would want to use TagMin() to get the minimum value or a time range or Min() to get the values within an array. I do not believe what you are trying to do is possible using Processbook calculations, but if you have a tag that has the 30 minute average you could use that and then take the minimum. If you want to avoid using a tag as your interval might change, you could use array functions within PI AF to perform this. I'd recommend using a tag for performance reasons.

Reply
  • There is no "minVal" function! You would want to use TagMin() to get the minimum value or a time range or Min() to get the values within an array. I do not believe what you are trying to do is possible using Processbook calculations, but if you have a tag that has the 30 minute average you could use that and then take the minimum. If you want to avoid using a tag as your interval might change, you could use array functions within PI AF to perform this. I'd recommend using a tag for performance reasons.

Children
  • Thank you! I didn't have much faith in Chat GPT lol!

    If I were to go through the painful process of writing 24 calculations such as tagavg('tag1','*-12.5h','*-12h'), then tagavg('tag1','*-12h','*-11.5h') (i.e. one for each of the 30m increments for the whole 12 hours, to cycle at 6am/pm (12 hour shifts), could I then/how would I string them together to find the lowest one? Like using tagmin or something?

    On that note can you use tag calculation datasets (as below) within calculations, or only the full tag calculation (e.g. tagavg('tag1','*-12h','*-11.5h'))? Thank you!
    image.png