Getting a machine's speed while running

Trying to figure out how I can get from historian the average speed of our machines while running from a script and return it over a Web Dev page.

We have a simple tag that tracks speed with historian enabled. However when I run a query on this it gives me more or less the attained average over X period including 0s. So if the machine ran an average of 400 RPM for 12 hours and was off 12 hours I can only get 200RPM average in a 24 hour period from historian queries. I want that 400 avg it was running when it was actually running.

I can’t seem to figure out how to build they query to give me what I’m looking for is it even possible to do this from historian scripts?

If you have a machine running tag along with the speed I would pull both with a query, then loop the dataset building a new dataset where machine running=1

1 Like

We do track a running state 1 or 0. That was an approach I thought of in theory but was not sure how to execute in practice. How can I mix two historian tags in the same dataset?

Right now I’m using queryTagHistory. Is there a different method I should use that could bring back timestamp, bpm, and runstate?

paths is a list.
so you just add more to the list and it will return them in wide format.

tagpaths = ['path\to\tag1','path\to\tag2']
retDS = system.tag.queryTagHistory(paths=tagpaths,returnSize=returnSizeVar)

Also it isn't a good idea to use names for variables like dataSet.

you are correct in general using reserved keywords or types is not ideal. But I copy pasted from their documentation so :man_shrugging:t2: lol

2 Likes