# Calculate Yearly Running Duration

## Recommended Posts

We have a user at our facility that would like to calculate an annual running duration of a flowrate when it exceeds a certain value. They are wanting to use this to show where the process total is in relation to the annual required number of hours for this flow.

We have created the condition that identifies when the signal meets the required flow.  We have been able to create a signal showing the current annual total and a formula to show how many hours are still required for the year to meet the minimum.

The user would like a signal that trends upwards over time as the total time that the condition is met.

For example, on Jan 1st, the running total for the signal is 0.  If the condition is met for 10 hours that day, on Jan 2, the signal would be 10, while Jan 1st remains 0.  If the condition is met on Jan 2nd for 12 hours, Jan 3rd should be 22, while Jan 1st and 2nd keep their 9 and 10 respectively.

Is there a way to do this in SEEQ?

##### Share on other sites

Hi Brian,

you can use the timesince() function for this:

`years('CET').timesince(1h, \$uptime.inverse())`

The example above creates a signal representing the running amount of hours for each year putting a sample every 1 hour. The last parameter specifies that periods where the uptime condition is not met are excluded from the calculation. In the follwowing screenshot you can see the signal is only increasing if a capsule for my uptime condition exists, otherwise the value does not change.

Furthermore the value will be reset to 0 at January 1st every year:

Regards,

Thorsten