system.tag.queryTagCalculations on a discontinuous time range

I have these OEE tags, and we are running a straight, and continues time range with the tag history calculator to get the OEE of a machine.

However, the machines that run only one shift, always have poor OEE as they aren't running the other two shifts.

I would need to calculate the On Durations across multiple 1st shifts (IE across distinct and discontinuous time ranges) to get a more accurate OEE.

My gut says that i will have to use scripting and java calendar lib to chunk up the time and use the queryTagCalculations in some for loop to calculate the numbers for OEE. I just wanted to check and see if there was a easier way

Historian architectures are terrible for applying a hard condition (like multiple time spans) to data retrieval or calculation because you cannot use a WHERE clause.

Consider switching to wide table storage approach that includes the condition as a column.

Or loop to retrieve each shift from the historian separately.

If your shifts are fixed time wise, you could do a custom property on the view for each shift, then use scripting to combine the datasets for display. Checking for valid scheduled run times on the combine.

Otherwise you will have to do as you say and script the actual calls and combine.