Walkthrough: run hours per week¶
This walkthrough calculates how many hours a piece of equipment runs each week. It uses three Tools in order: create a Condition for when the equipment is running, create weekly Capsules, then total the running time in each Capsule. Each step creates a Calculated Item for the next step to use. You need Write access to an Analysis and a Signal that indicates when the equipment runs. In this example, the equipment runs while the Signal is above 5 kW.
1. When it runs: Value Search¶
Value Search makes a Condition with a Capsule for each time the Signal is above the value.
- In the Tools tab, choose Value Search. Add the Signal to the Details Pane, or find it by name in the form.
- Name it
Running. - Under Signal to search, choose the Signal. Choose the Operator
>, and give the Value5and the unitkW. - Fill the Maximum capsule duration, for example
1and the unit days. Choose a time longer than the longest time the equipment runs without stopping: a Capsule longer than it is dropped, and a run that is dropped isn't counted in the hours. Step 3 needs the Condition to have a Maximum Duration, which this gives it. - Click Execute.
The Formula it writes is $signal.valueSearch(1d, isGreaterThan(5 kW)).
2. The weeks: Periodic Condition¶
Periodic Condition makes a Condition with a Capsule for each week.
- Choose Periodic Condition. Name it
Every Week. - Choose the Duration
Weekly, and the Start of the week that your weeks start on, such as Monday. - Check the Time zone: the weeks start at midnight in it, also in the week the clocks change, which is an hour shorter or longer.
- Click Execute.
The Formula it writes is weeks('Monday', 'Europe/Zurich'), for example. Leave out a Maximum Duration: a Periodic Condition has the one its period needs, so that step 3 doesn't ask for one.
3. The hours in each week: Signal from Condition¶
Signal from Condition makes a Signal with one Sample for each week.
- Choose Signal from Condition. Name it
Run Hours per Week. - Choose
Runningas the Signal or Condition. Its Summary statistics become those of a Condition: choose Total Duration. - Choose Convert time units to
Hours. - Choose
Every Weekas the Bounding condition. Leave its Maximum capsule duration empty. - Choose to Place each Sample at the
Startof its Capsule, and the Interpolation MethodStep. Each week's hours are then the Sample at the start of the week, held until the next week. - Click Execute.
The Formula it writes is $condition.aggregate(totalDuration('h'), $bounding, startKey()).toStep().
What you get¶
Run Hours per Week is a Calculated Signal in hours, in the Details Pane. Draw it in the trend with a Display Range of several weeks to see a step for each week. Its value in a week is the time Running has Capsules in it, so a run that crosses midnight on Sunday counts in each week for the part of it in that week.
- A week with no Capsule of
Runningin it has no Sample, not a zero. - The week in progress has a Sample too, from the data so far. It is Uncertain Data, and so is the Sample of any earlier week that is within the Uncertainty of its inputs, until their data is certain.
Each Item is an ordinary Calculated Item: ƒ on its row in the Details Pane opens the Formula editor with the Formula its Tool wrote, which you can change. See Formulas and Calculated Items.
Changing the example¶
- For the hours per day, choose Daily in step 2. For per month, Monthly.
- For the number of times it started in each week, choose Count in step 3: it counts the Capsules of
Runningthat overlap the week.