Forecasting Wind Power Generation with TDgpt

Joel Brass

March 25, 2025 /

Forecasting renewable energy generation is becoming a key factor in ensuring the stable operation of power grids. With the rapid growth of wind and solar power, fluctuations in generation caused by weather changes pose significant challenges for grid dispatching. Real-time forecasting allows the grid to proactively deploy energy storage systems or start up gas-fired power plants, helping prevent sudden blackouts.  The economic benefits of this technology are also substantial. Adjusting thermal power output based on forecast renewable generation can greatly reduce coal waste. In the power market, generation companies can use forecasts of both output and electricity prices to optimize trading strategies—for example, scheduling energy storage discharge during peak solar generation periods to maximize profits.

Technological advancements are driving the industry’s shift toward intelligent transformation. Current mainstream approaches analyze meteorological data and historical generation patterns to build dynamic forecasting models, while cloud-based systems enable real-time optimization of dispatch strategies. For example, some companies have significantly improved forecasting accuracy by integrating cloud cover monitoring with terrain data. Additionally, the coordinated application of hybrid wind-solar power systems and energy storage technologies further enhances the stability of renewable energy sources.

Forecasting technology has become a key enabler for renewable energy to compete in the market. By predicting generation capacity and market supply and demand in advance, companies can optimize their mid- to long-term trading strategies while enhancing their responsiveness in the spot market. This technological advancement is accelerating the transition of power systems from reliance on traditional energy sources to a smarter and more efficient model.

This article provides a guide for quickly setting up a TDgpt test environment using Docker Compose. Based on this environment and real-world data, it walks through the complete process of day-ahead wind power forecasting at a 15-minute resolution.

What Is TDgpt?

TDgpt is an intelligent agent built into TDengine for time-series data analysis. Leveraging TDengine’s time-series query capabilities, it provides advanced analysis functions—such as time-series forecasting and anomaly detection—through SQL, with the ability to dynamically extend and switch analysis tasks at runtime. By integrating prebuilt time-series foundation models, large language models, machine learning, and traditional algorithms, TDgpt enables engineers to deploy time-series forecasting and anomaly detection models within 10 minutes. This reduces the development and maintenance costs of time-series analysis models by at least 80%.

Learn more about TDgpt.

Prepare the Demo Dataset

We use the a wind farm from the publicly available UTSD dataset as the source for our forecasting algorithm, aiming to predict power generation for each 15-minute interval over the next day based on historical data. The dataset has a sampling frequency of 4 seconds, but it does not include units or timestamps. For demonstration purposes, timestamps were generated in reverse starting from 2025-01-01 00:00:00 based on the data frequency. The data was then downsampled by aggregating it into 15-minute intervals and stored in the data file accordingly.

This data file is located in the demo_data directory of the TDgpt-demo repository. The following procedure shows how to import the data into TDengine and complete the demonstration. The dataset is described as follows:

DimensionValueDescription
Records16439/
Time range2024-07-12 18:15:00 to 2024-12-30 23:45:00TDtsfm_1 was trained on the first 70% of the original dataset with a 4-second resolution. Since the forecast targets are based on data downsampled to 15-minute intervals, TDtsfm_1 has not seen the characteristics of this aggregated data during training. This setup serves as a test of the model’s ability to generalize and make accurate predictions on previously unseen data.
Maximum28900.40/
Minimum-247.50  The original dataset contains 1021 negative values. Although the exact cause is unknown, these values are retained as noise data to test the algorithm’s robustness against such anomalies.
Average9847.24/

Preparing the Demo Environment

Prerequisites

The demo is run in Docker and does not require a specific operating system. However, the following are required to use Docker Compose::

  1. Git
  2. Docker Engine: v20.10+
  3. Docker Compose: v2.20+

The demo contains three Docker containers (TDengine, TDgpt, and Grafana) and shell scripts that generate forecasting or anomaly detection results.

Procedure

  1. Clone the demo repository and make the script file executable:

    git clone https://github.com/taosdata/TDgpt-demo
    cd TDgpt-demo
    chmod 775 analyse.sh
  2. Navigate to the directory containing the docker-compose.yml file and run the following command to start the integrated demo environment with TDengine, TDgpt, and Grafana:

    docker-compose up -d
  3. Wait 10 seconds and then register the anode to TDengine:

    docker exec -it tdengine taos -s "create anode 'tdgpt:6090'"
  4. Initialize the data for the test environment:

    docker cp analyse.sh tdengine:/var/lib/taos
    docker cp demo_data tdengine:/var/lib/taos
    docker exec -it tdengine taos -s "source /var/lib/taos/demo_data/init_wind_power.sql"

Your demo environment has now been created. To remove the environment if it is no longer needed, run the following command:

docker-compose down

Running the Demo

  1. Open your browser and go to http://localhost:3000, then log in to Grafana using the default username and password: admin / admin.

  2. After logging in successfully, navigate to “Home → Dashboards”, then import the wind_power_forecast.json file to load the preconfigured dashboard.

  3. After importing, select the “wind_power_forecast” dashboard. This panel is preconfigured to display the actual values along with forecast results from TDtsfm_1 and HoltWinters. At this point, only the data curve for the actual values is visible.

  4. Run analyse.sh to begin forecasting. First try forecasting with TDtsfm:

    docker exec -it tdengine /var/lib/taos/analyse.sh --type forecast --db tdgpt_demo --table wind_power --stable single_val --algorithm tdtsfm_1 --params "fc_rows=96,wncheck=0" --start "2024-07-12" --window 30d --step 1d

    The shell script mentioned above starts from the specified time point (2024-07-12), using data from the previous month as input to predict power generation for the next day at 15-minute intervals (a total of 96 data points) using the TDtsfm_1 algorithm. This process continues until it reaches the last record in the wind_power table, with all prediction results written into the wind_power_tdtsfm_1_result table.

    Before running another forecast, the script will create or remove the results table. During execution, the console will continuously display output in daily increments, showing results like the following:

    Processing window: 2024-09-04 00:00:00 → 2024-10-04 00:00:00
    Welcome to the TDengine Command Line Interface, Client Version:3.3.6.0
    Copyright (c) 2023 by TDengine, all rights reserved.
    
    taos> INSERT INTO tdgpt_demo.wind_power_tdtsfm_1_result SELECT _frowts, forecast(val, 'algorithm=tdtsfm_1,fc_rows=96,wncheck=0')
                   FROM tdgpt_demo.wind_power
                    WHERE ts >= '2024-09-04 00:00:00' AND ts < '2024-10-04 00:00:00'
    Insert OK, 96 row(s) affected (0.264995s)
  5. In the Grafana dashboard, set the refresh interval to 5 seconds to dynamically display the yellow curve representing the prediction results. This allows for a clear visual comparison with the actual values. For better clarity, hold the Command key (on Mac) or the Windows key (on Windows) and click on the “Real” and “TDtsfm_1” legends in the bottom left corner to display only these two curves.

  6. Now forecast using Holt-Winters:

    docker exec -it tdengine /var/lib/taos/analyse.sh --type forecast --db tdgpt_demo --table wind_power --stable single_val --algorithm holtwinters --params "rows=96,period=96,wncheck=0,trend=add,seasonal=add" --start "2024-07-12" --window 30d --step 1d

From the prediction results, we can see that TDtsfm_1 significantly outperforms the traditional statistical method Holt-Winters in terms of accuracy. Beyond prediction precision, a major drawback of the Holt-Winters algorithm is its heavy reliance on meticulous parameter tuning. Without careful adjustment, it is prone to frequent anomalies in the predicted values, such as the spikes and dips shown in the figure below.

By using the mouse to select a specific time range, we can zoom in and examine the fine-grained comparison between the predicted results and the actual values over that period.

You can also experiment with other algorithms or models to find the one that best fits your specific scenario.

Conclusion

In this article, we demonstrated the complete process of using TDgpt for wind power generation forecasting. As shown, building time-series data analysis with TDgpt allows for seamless integration with applications through SQL, and results can be visualized using Grafana. This greatly reduces the cost of developing and applying time-series forecasting and anomaly detection solutions.

In terms of forecasting performance, the Transformer-based pre-trained model TDtsfm_1 demonstrates significantly better results than the Holt-Winters model on the dataset used. However, compared to the results achieved in electricity demand forecasting using TDgpt, the overall prediction accuracy in this wind power forecasting scenario is lower. This is partly because TDtsfm_1 was trained on the original wind_power dataset with 4-second resolution rather than the downsampled data, which means the model may not have fully captured the characteristics of the aggregated data, leading to reduced forecasting accuracy. Additionally, wind power generation is highly dependent on weather conditions, and the absence of weather forecast data further limits prediction performance.

  • Joel Brass
    Joel Brass

    Joel Brass is a Solutions Architect at TDengine, bringing extensive experience in real-time data processing, time-series analytics, and full-stack development. With a 20 year background in software engineering and a deep focus on scalable applications and solutions, Joel has worked on a range of projects spanning joke databases, IoT, self-driving vehicles, and work management platforms. Prior to joining TDengine, Joel worked in Advisory Services for Enterprise customers of Atlassian and the Systems Engineering team at Waymo. He is currently based in the San Francisco Bay Area.