--- title: "Interval Calculations" slug: "interval-expressions" updated: 2025-07-16T14:07:04Z published: 2025-07-16T14:07:04Z canonical: "docs.bazefield.com/interval-expressions" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.bazefield.com/llms.txt > Use this file to discover all available pages before exploring further. # Interval Calculations ## Overview **Interval Calculations** are a type of **Calculated Point** in Bazefield that compute values at fixed time intervals using the **Bazefield Calculation Service**. These calculations are ideal for generating **time-based KPIs**, summaries, and performance metrics that are stored for historical analysis and reporting. --- ## Key Characteristics - **Scheduled Execution**: The calculation runs at regular intervals (e.g., every 5 or 15 minutes). - **Expression-Based Logic**: Uses arithmetic, built-in functions, and references to other points. - **Recalculable**: Logic can be updated and recalculated at any time, over any time period. - **Long-Term Storage**: Results are saved to the **Bazefield IMATIS database** or an **external database** like PostgreSQL. > [!WARNING] > Interval Calculations provide enough functionality for most KPIs but if more complexity is required for the use case, a [Calculation Model](/product/docs/calculation-models) may be a better fit. --- ## Examples ### ℹ️ Average Active Power (5-minute interval) A point named **ActivePowerAvg** is configured for a Wind Turbine model as follows: - **Point Type**: `CALCULATED_POINT` - **Script Type**: `Interval_Calculation` - **Expression**: `([@ActivePower]) == 0 ? Double.NaN : TagTimeAvg([@ActivePower]:[Double.NaN])` - **Interval**: `300 seconds` (5 minutes) - **SaveAtIntervalStart**: `True` (to log the output timestamp at the beginning of the interval) - **Data Template**: `IMATIS` (interval data should be stored in the Bazefield IMATIS database) This configuration will output NaN if there are no raw ActivePower values in the last 5 minutes, and the time-weighted average of the raw ActivePower values in the last 5 minutes otherwise. ![](https://cdn.document360.io/a0786c0f-b171-4b24-8860-c32eb7ef2738/Images/Documentation/image(219).png?sv=2026-02-06&spr=https&st=2026-11-06T20%3A45%3A47Z&se=2026-11-06T21%3A45%3A47Z&sr=c&sp=r&sig=FY6U8lCPAlKaX2RtEWMyv%2FU4FGIvWrH%2BDKURVDaX4vs%3D) ### ℹ️ Energy Produced in Last 5 minutes A point named **TotalEnergyProduced.5m** is configured for a Wind Turbine model as follows: - **Point Type**: `CALCULATED_POINT` - **Script Type**: `Interval_Calculation` - **Expression**: `{TagTimeAvg([@ActivePower]:[Double.NaN])/12}` - **Interval**: `300 seconds` (5 minutes) - **SaveAtIntervalStart**: `True` (to log the output timestamp at the beginning of the interval) - **Data Template**: `IMATIS` (interval data should be stored in the Bazefield IMATIS database) This configuration will compute the time-weighted average of the raw ActivePower values in the last 5 minutes, then divide by 12 to convert from kW to kWh (there are 12 5-minute periods in 1 hour). This is an estimation but a rather accurate one. ![](https://cdn.document360.io/a0786c0f-b171-4b24-8860-c32eb7ef2738/Images/Documentation/image(221).png?sv=2026-02-06&spr=https&st=2026-11-06T20%3A45%3A47Z&se=2026-11-06T21%3A45%3A47Z&sr=c&sp=r&sig=FY6U8lCPAlKaX2RtEWMyv%2FU4FGIvWrH%2BDKURVDaX4vs%3D) ### ℹ️ Turbine Capacity Factor A point named **Capacity** is configured for a Wind Turbine model as follows: - **Point Type**: `CALCULATED_POINT` - **Script Type**: `Interval_Calculation` - **Expression**: `{100 * Max(TagLast([@ActivePowerAvg]:[Double.NaN]), 0) / GetAttribute(“ratedPower”)}` - **Interval**: `300 seconds` (5 minutes) - **SaveAtIntervalStart**: `True` (to log the output timestamp at the beginning of the interval) - **Data Template**: `IMATIS` (interval data should be stored in the Bazefield IMATIS database) This configuration build on the ActivePowerAvg point by retrieving its last value (setting it to 0 if it is negative), then dividing this by the Turbine’s ratedPower attribute. Finally, this value is multiplied by 100 to get a percent Capacity Factor. ![](https://cdn.document360.io/a0786c0f-b171-4b24-8860-c32eb7ef2738/Images/Documentation/image(222).png?sv=2026-02-06&spr=https&st=2026-11-06T20%3A45%3A47Z&se=2026-11-06T21%3A45%3A47Z&sr=c&sp=r&sig=FY6U8lCPAlKaX2RtEWMyv%2FU4FGIvWrH%2BDKURVDaX4vs%3D) --- ## Key Benefits ✔️ **Historical Insight**: Enables trend analysis and long-term performance tracking. ✔️ **Custom KPIs**: Tailor calculations to your operational goals. ✔️ **Database Integration**: Store results in the Bazefield database or external systems for BI/reporting. ✔️ **Scalable**: Apply across fleets, technologies, and vendors. --- ## When to Use Interval Calculations Use Interval Calculations when: - You need **aggregated values** over time (e.g., averages, totals). - You want to **store regularly-spaced results** for dashboards, reports, or compliance. - Real-time updates are **not required** for the use case.