TDengine/test/cases/18-StreamProcessing/20-UseCase/test_idmp_pv.py

45 lines
1.6 KiB
Python

from test_idmp_tobacco import IdmpScene
import os
class TestIdmpPhotovoltaic:
def test_pv(self):
"""IDMP: photovoltaic scenario
1. Test the analysis generated by AI recommendations, create a Stream, and verify the correctness of the stream.
2. Test different trigger types:
1. Sliding window: Calculate aggregates over an m-hour period every n minutes.
2. Event window: Starts from the start_condition and ends at the stop_condition for a field.
3. Session window: No data reported for more than n minutes.
4. Count window: Collect data n times consecutively.
3. Different types of aggregate functions:
1. AVG: Average value
2. LAST: Latest value
3. SUM: Summation
4. MAX: Maximum value
Refer: https://taosdata.feishu.cn/wiki/Zkb2wNkHDihARVkGHYEcbNhmnxb#share-Ygqld907hoMESmx04GBcRlaVnZz
Catalog:
- Streams:UseCases
Since: v3.3.7.0
Labels: common,ci
Jira: TD-36783
History:
- 2025-7-18 zyyang90 Created
"""
pv = IdmpScene()
pv.init(
"photovoltaic",
"idmp_sample_pv",
"idmp",
os.path.join(os.path.dirname(__file__), 'pv_data', 'idmp_sample_pv'),
os.path.join(os.path.dirname(__file__), 'pv_data', 'idmp', 'vstb.sql'),
os.path.join(os.path.dirname(__file__), 'pv_data', 'idmp', 'vtb.sql'),
os.path.join(os.path.dirname(__file__), 'pv_data', 'idmp', 'stream.json'),
)
# pv.stream_ids = [1, 2, 3, 4, 5, 6, 7]
pv.run()