Merge branch 'main' into merge/mainto3.0
This commit is contained in:
commit
e28c3cb6d5
|
@ -7,36 +7,24 @@ Power BI is a business analytics tool provided by Microsoft. By configuring the
|
|||
|
||||
## Prerequisites
|
||||
|
||||
Install and run Power BI Desktop software (if not installed, please download the latest version for Windows OS 32/64 bit from its official address).
|
||||
- TDengine 3.3.4.0 and above version is installed and running normally (both Enterprise and Community versions are available).
|
||||
- taosAdapter is running normally, refer to [taosAdapter Reference](../../../tdengine-reference/components/taosadapter/).
|
||||
- Install and run Power BI Desktop software (if not installed, please download the latest version for Windows OS 32/64 bit from its official address).
|
||||
- Download the latest Windows OS X64 client driver from the TDengine official website and install it on the machine running Power BI. After successful installation, the TDengine driver can be seen in the "ODBC Data Sources (32-bit)" or "ODBC Data Sources (64-bit)" management tool.
|
||||
|
||||
## Install ODBC Driver
|
||||
## Configure Data Source
|
||||
|
||||
Download the latest Windows OS X64 client driver from the TDengine official website and install it on the machine running Power BI. After successful installation, the TDengine driver can be seen in the "ODBC Data Sources (32-bit)" or "ODBC Data Sources (64-bit)" management tool.
|
||||
**Step 1**, Search and open the [ODBC Data Source (64 bit)] management tool in the Start menu of the Windows operating system and configure it, refer to [Install ODBC Driver](../../../tdengine-reference/client-libraries/odbc/#Installation).
|
||||
|
||||
**Step 2**, Open Power BI and log in, click [Home] -> [Get Data] -> [Other] -> [ODBC] -> [Connect], add data source.
|
||||
|
||||
## Configure ODBC Data Source
|
||||
**Step 3**, Select the data source name just created, such as [MyTDengine], if you need to enter SQL, you can click the [Advanced options] tab, in the expanded dialog box enter the SQL statement. Click the [OK] button to connect to the configured data source.
|
||||
|
||||
The steps to configure the ODBC data source are as follows.
|
||||
**Step 4**, Enter the [Navigator], you can browse the corresponding database's tables/views and load data.
|
||||
|
||||
Step 1, search and open "ODBC Data Sources (32-bit)" or "ODBC Data Sources (64-bit)" management tool from the Windows start menu.
|
||||
Step 2, click the "User DSN" tab → "Add" button, enter the "Create New Data Source" dialog box.
|
||||
Step 3, in the list of "Select the driver you want to install for this data source" choose "TDengine", click the "Finish" button, enter the TDengine ODBC data source configuration page. Fill in the necessary information as follows.
|
||||
## Data Analysis
|
||||
|
||||
- DSN: Data source name, required, such as "MyTDengine".
|
||||
- Connection Type: Check the "WebSocket" checkbox.
|
||||
- URL: ODBC data source URL, required, such as `http://127.0.0.1:6041`.
|
||||
- Database: Indicates the database to connect to, optional, such as "test".
|
||||
- Username: Enter username, if not filled, default is "root".
|
||||
- Password: Enter user password, if not filled, default is "taosdata".
|
||||
|
||||
Step 4, click the "Test Connection" button, test the connection situation, if successfully connected, it will prompt "Successfully connected to `http://127.0.0.1:6041`".
|
||||
Step 5, click the "OK" button, to save the configuration and exit.
|
||||
|
||||
## Import TDengine Data into Power BI
|
||||
|
||||
The steps to import TDengine data into Power BI are as follows:
|
||||
Step 1, open Power BI and log in, click "Home" → "Get Data" → "Other" → "ODBC" → "Connect", add data source.
|
||||
Step 2, select the data source name just created, such as "MyTDengine", if you need to enter SQL, you can click the "Advanced options" tab, in the expanded dialog box enter the SQL statement. Click the "OK" button to connect to the configured data source.
|
||||
Step 3, enter the "Navigator", you can browse the corresponding database's tables/views and load data.
|
||||
### Instructions for use
|
||||
|
||||
To fully leverage Power BI's advantages in analyzing data from TDengine, users need to first understand core concepts such as dimensions, metrics, window split queries, data split queries, time-series, and correlation, then import data through custom SQL.
|
||||
|
||||
|
@ -47,7 +35,7 @@ To fully leverage Power BI's advantages in analyzing data from TDengine, users n
|
|||
- Time-Series: When drawing curves or aggregating data by time, it is usually necessary to introduce a date table. Date tables can be imported from Excel spreadsheets, or obtained in TDengine by executing SQL like `select _wstart date, count(*) cnt from test.meters where ts between A and B interval(1d) fill(0)`, where the fill clause represents the filling mode in case of data missing, and the pseudocolumn `_wstart` is the date column to be obtained.
|
||||
- Correlation: Tells how data is related, such as metrics and dimensions can be associated together through the tbname column, date tables and metrics can be associated through the date column, combined to form visual reports.
|
||||
|
||||
## Smart Meter Example
|
||||
### Smart Meter Example
|
||||
|
||||
TDengine employs a unique data model to optimize the storage and query performance of time-series data. This model uses supertables as templates to create an independent table for each device. Each table is designed with high scalability in mind, supporting up to 4096 data columns and 128 tag columns. This design enables TDengine to efficiently handle large volumes of time-series data while maintaining flexibility and ease of use.
|
||||
|
||||
|
@ -56,24 +44,35 @@ Taking smart meters as an example, suppose each meter generates one record per s
|
|||
In Power BI, users can map the tag columns in TDengine tables to dimension columns for grouping and filtering data. Meanwhile, the aggregated results of the data columns can be imported as measure columns for calculating key indicators and generating reports. In this way, Power BI helps decision-makers quickly obtain the information they need, gain a deeper understanding of business operations, and make more informed decisions.
|
||||
|
||||
Follow the steps below to experience the functionality of generating time-series data reports through Power BI.
|
||||
Step 1, Use TDengine's taosBenchMark to quickly generate data for 1,000 smart meters over 3 days, with a collection frequency of 1s.
|
||||
```shell
|
||||
taosBenchmark -t 1000 -n 259200 -S 1000 -y
|
||||
```
|
||||
Step 2, Import dimension data. In Power BI, import the tag columns of the table, named as tags, using the following SQL to get the tag data of all smart meters under the supertable.
|
||||
```sql
|
||||
select distinct tbname device, groupId, location from test.meters
|
||||
```
|
||||
Step 3, Import measure data. In Power BI, import the average current, voltage, and phase of each smart meter in 1-hour time windows, named as data, with the following SQL.
|
||||
```sql
|
||||
select tbname, _wstart ws, avg(current), avg(voltage), avg(phase) from test.meters PARTITION by tbname interval(1h)
|
||||
```
|
||||
Step 4, Import date data. Using a 1-day time window, obtain the time range and data count of the time-series data, with the following SQL. In the Power Query editor, convert the format of the date column from "text" to "date".
|
||||
```sql
|
||||
select _wstart date, count(*) from test.meters interval(1d) having count(*)>0
|
||||
```
|
||||
Step 5, Establish the relationship between dimensions and measures. Open the model view and establish the relationship between the tags and data tables, setting tbname as the relationship data column.
|
||||
Step 6, Establish the relationship between date and measures. Open the model view and establish the relationship between the date dataset and data, with the relationship data columns being date and datatime.
|
||||
Step 7, Create reports. Use these data in bar charts, pie charts, and other controls.
|
||||
|
||||
**Step 1**, Use TDengine's taosBenchMark to quickly generate data for 1,000 smart meters over 3 days, with a collection frequency of 1s.
|
||||
|
||||
```shell
|
||||
taosBenchmark -t 1000 -n 259200 -S 1000 -y
|
||||
```
|
||||
|
||||
**Step 2**, Import dimension data. In Power BI, import the tag columns of the table, named as tags, using the following SQL to get the tag data of all smart meters under the supertable.
|
||||
|
||||
```sql
|
||||
select distinct tbname device, groupId, location from test.meters
|
||||
```
|
||||
|
||||
**Step 3**, Import measure data. In Power BI, import the average current, voltage, and phase of each smart meter in 1-hour time windows, named as data, with the following SQL.
|
||||
|
||||
```sql
|
||||
select tbname, _wstart ws, avg(current), avg(voltage), avg(phase) from test.meters PARTITION by tbname interval(1h)
|
||||
```
|
||||
|
||||
**Step 4**, Import date data. Using a 1-day time window, obtain the time range and data count of the time-series data, with the following SQL. In the Power Query editor, convert the format of the date column from "text" to "date".
|
||||
|
||||
```sql
|
||||
select _wstart date, count(*) from test.meters interval(1d) having count(*)>0
|
||||
```
|
||||
|
||||
**Step 5**, Establish the relationship between dimensions and measures. Open the model view and establish the relationship between the tags and data tables, setting tbname as the relationship data column.
|
||||
|
||||
**Step 6**, Establish the relationship between date and measures. Open the model view and establish the relationship between the date dataset and data, with the relationship data columns being date and datatime.
|
||||
|
||||
**Step 7**, Create reports. Use these data in bar charts, pie charts, and other controls.
|
||||
|
||||
Due to TDengine's superior performance in handling time-series data, users can enjoy a very good experience during data import and daily regular data refreshes. For more information on building Power BI visual effects, please refer to the official Power BI documentation.
|
||||
|
|
|
@ -11,43 +11,42 @@ import imgStep04 from '../../assets/seeq-04.png';
|
|||
|
||||
Seeq is advanced analytics software for the manufacturing and Industrial Internet of Things (IIOT). Seeq supports innovative new features using machine learning in process manufacturing organizations. These features enable organizations to deploy their own or third-party machine learning algorithms to advanced analytics applications used by frontline process engineers and subject matter experts, thus extending the efforts of a single data scientist to many frontline staff.
|
||||
|
||||
Through the TDengine Java connector, Seeq can easily support querying time-series data provided by TDengine and offer data presentation, analysis, prediction, and other functions.
|
||||
Through the `TDengine Java connector`, Seeq can easily support querying time-series data provided by TDengine and offer data presentation, analysis, prediction, and other functions.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Seeq has been installed. Download the relevant software from [Seeq's official website](https://www.seeq.com/customer-download), such as Seeq Server and Seeq Data Lab, etc. Seeq Data Lab needs to be installed on a different server from Seeq Server and interconnected through configuration. For detailed installation and configuration instructions, refer to the [Seeq Knowledge Base](https://support.seeq.com/kb/latest/cloud/).
|
||||
- TDengine 3.1.0.3 and above version is installed and running normally (both Enterprise and Community versions are available).
|
||||
- taosAdapter is running normally, refer to [taosAdapter Reference](../../../tdengine-reference/components/taosadapter/).
|
||||
- Seeq has been installed. Download the relevant software from [Seeq's official website](https://www.seeq.com/customer-download), such as `Seeq Server` and `Seeq Data Lab`, etc. `Seeq Data Lab` needs to be installed on a different server from `Seeq Server` and interconnected through configuration. For detailed installation and configuration instructions, refer to the [Seeq Knowledge Base](https://support.seeq.com/kb/latest/cloud/).
|
||||
- Install the JDBC driver. Download the `TDengine JDBC connector` file `taos-jdbcdriver-3.2.5-dist.jar` or a higher version from `maven.org`.
|
||||
|
||||
- TDengine local instance has been installed. Please refer to the [official documentation](../../../get-started). If using TDengine Cloud, please go to https://cloud.taosdata.com apply for an account and log in to see how to access TDengine Cloud.
|
||||
## Configure Data Source
|
||||
|
||||
## Configuring Seeq to Access TDengine
|
||||
### Configuration of JDBC Connector
|
||||
|
||||
1. Check the data storage location
|
||||
**Step 1**, Check the data storage location
|
||||
|
||||
```shell
|
||||
sudo seeq config get Folders/Data
|
||||
```
|
||||
|
||||
2. Download the TDengine Java connector package from maven.org, the latest version is [3.2.5](https://repo1.maven.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/3.2.5/taos-jdbcdriver-3.2.5-dist.jar), and copy it to the plugins\lib in the data storage location.
|
||||
**Step 2**, Download the TDengine Java connector package from `maven.org` and copy it to the `plugins\lib` directory in the data storage location.
|
||||
|
||||
3. Restart seeq server
|
||||
**Step 3**, Restart seeq server
|
||||
|
||||
```shell
|
||||
sudo seeq restart
|
||||
```
|
||||
|
||||
4. Enter License
|
||||
**Step 4**, Enter License
|
||||
|
||||
Use a browser to visit ip:34216 and follow the instructions to enter the license.
|
||||
|
||||
## Using Seeq to Analyze TDengine Time-Series Data
|
||||
## Load TDengine Time-Series Data
|
||||
|
||||
This section demonstrates how to use Seeq software in conjunction with TDengine for time-series data analysis.
|
||||
This chapter demonstrates how to use the Seeq software to load TDengine time-series data.
|
||||
|
||||
### Scenario Introduction
|
||||
|
||||
The example scenario is a power system where users collect electricity usage data from power station instruments daily and store it in the TDengine cluster. Now, users want to predict how power consumption will develop and purchase more equipment to support it. User power consumption varies with monthly orders, and considering seasonal changes, power consumption will differ. This city is located in the northern hemisphere, so more electricity is used in summer. We simulate data to reflect these assumptions.
|
||||
|
||||
### Data Schema
|
||||
**Step 1**, Create tables in TDengine.
|
||||
|
||||
```sql
|
||||
CREATE STABLE meters (ts TIMESTAMP, num INT, temperature FLOAT, goods INT) TAGS (device NCHAR(20));
|
||||
|
@ -58,7 +57,7 @@ CREATE TABLE goods (ts1 TIMESTAMP, ts2 TIMESTAMP, goods FLOAT);
|
|||
<Image img={imgStep01} alt=""/>
|
||||
</figure>
|
||||
|
||||
### Data Construction Method
|
||||
**Step 2**, Construct data in TDengine.
|
||||
|
||||
```shell
|
||||
python mockdata.py
|
||||
|
@ -67,11 +66,7 @@ taos -s "insert into power.goods select _wstart, _wstart + 10d, avg(goods) from
|
|||
|
||||
The source code is hosted on [GitHub Repository](https://github.com/sangshuduo/td-forecasting).
|
||||
|
||||
## Using Seeq for Data Analysis
|
||||
|
||||
### Configuring Data Source
|
||||
|
||||
Log in using a Seeq administrator role account and create a new data source.
|
||||
**第 3 步**,Log in using a Seeq administrator role account and create a new data source.
|
||||
|
||||
- Power
|
||||
|
||||
|
@ -251,6 +246,12 @@ Log in using a Seeq administrator role account and create a new data source.
|
|||
}
|
||||
```
|
||||
|
||||
## Data Analysis
|
||||
|
||||
### Scenario Introduction
|
||||
|
||||
The example scenario is a power system where users collect electricity usage data from power station instruments daily and store it in the TDengine cluster. Now, users want to predict how power consumption will develop and purchase more equipment to support it. User power consumption varies with monthly orders, and considering seasonal changes, power consumption will differ. This city is located in the northern hemisphere, so more electricity is used in summer. We simulate data to reflect these assumptions.
|
||||
|
||||
### Using Seeq Workbench
|
||||
|
||||
Log in to the Seeq service page and create a new Seeq Workbench. By selecting data sources from search results and choosing different tools as needed, you can display data or make predictions. For detailed usage methods, refer to the [official knowledge base](https://support.seeq.com/space/KB/146440193/Seeq+Workbench).
|
||||
|
@ -330,77 +331,7 @@ Program output results:
|
|||
<Image img={imgStep03} alt=""/>
|
||||
</figure>
|
||||
|
||||
## Configuring Seeq Data Source Connection to TDengine Cloud
|
||||
|
||||
Configuring a Seeq data source connection to TDengine Cloud is essentially no different from connecting to a local TDengine installation. Simply log in to TDengine Cloud, select "Programming - Java" and copy the JDBC string with a token to fill in as the DatabaseJdbcUrl value for the Seeq Data Source.
|
||||
Note that when using TDengine Cloud, the database name needs to be specified in SQL commands.
|
||||
|
||||
### Configuration example using TDengine Cloud as a data source
|
||||
|
||||
```json
|
||||
{
|
||||
"QueryDefinitions": [
|
||||
{
|
||||
"Name": "CloudVoltage",
|
||||
"Type": "SIGNAL",
|
||||
"Sql": "SELECT ts, voltage FROM test.meters",
|
||||
"Enabled": true,
|
||||
"TestMode": false,
|
||||
"TestQueriesDuringSync": true,
|
||||
"InProgressCapsulesEnabled": false,
|
||||
"Variables": null,
|
||||
"Properties": [
|
||||
{
|
||||
"Name": "Name",
|
||||
"Value": "Voltage",
|
||||
"Sql": null,
|
||||
"Uom": "string"
|
||||
},
|
||||
{
|
||||
"Name": "Interpolation Method",
|
||||
"Value": "linear",
|
||||
"Sql": null,
|
||||
"Uom": "string"
|
||||
},
|
||||
{
|
||||
"Name": "Maximum Interpolation",
|
||||
"Value": "2day",
|
||||
"Sql": null,
|
||||
"Uom": "string"
|
||||
}
|
||||
],
|
||||
"CapsuleProperties": null
|
||||
}
|
||||
],
|
||||
"Type": "GENERIC",
|
||||
"Hostname": null,
|
||||
"Port": 0,
|
||||
"DatabaseName": null,
|
||||
"Username": "root",
|
||||
"Password": "taosdata",
|
||||
"InitialSql": null,
|
||||
"TimeZone": null,
|
||||
"PrintRows": false,
|
||||
"UseWindowsAuth": false,
|
||||
"SqlFetchBatchSize": 100000,
|
||||
"UseSSL": false,
|
||||
"JdbcProperties": null,
|
||||
"GenericDatabaseConfig": {
|
||||
"DatabaseJdbcUrl": "jdbc:TAOS-RS://gw.cloud.tdengine.com?useSSL=true&token=41ac9d61d641b6b334e8b76f45f5a8XXXXXXXXXX",
|
||||
"SqlDriverClassName": "com.taosdata.jdbc.rs.RestfulDriver",
|
||||
"ResolutionInNanoseconds": 1000,
|
||||
"ZonedColumnTypes": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Example of Seeq Workbench Interface with TDengine Cloud as Data Source
|
||||
|
||||
<figure>
|
||||
<Image img={imgStep04} alt=""/>
|
||||
</figure>
|
||||
|
||||
## Solution Summary
|
||||
### Solution Summary
|
||||
|
||||
By integrating Seeq and TDengine, users can fully leverage the efficient storage and querying capabilities of TDengine, while also benefiting from the powerful data visualization and analysis features provided by Seeq.
|
||||
|
||||
|
|
|
@ -1,78 +1,79 @@
|
|||
---
|
||||
title: 与 PowerBI 的集成
|
||||
title: 与 PowerBI 集成
|
||||
sidebar_label: PowerBI
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
Power BI是由Microsoft提供的一种商业分析工具。通过配置使用ODBC连接器,Power BI可以快速访问TDengine的数据。用户可以将标签数据、原始时序数据或按时间聚合后的时序数据从TDengine导入到Power BI,制作报表或仪表盘,整个过程不需要任何代码编写过程。
|
||||
Power BI 是由 Microsoft 提供的一种商业分析工具。通过配置使用 ODBC 连接器,Power BI 可以快速访问 TDengine 的数据。用户可以将标签数据、原始时序数据或按时间聚合后的时序数据从 TDengine 导入到 Power BI,制作报表或仪表盘,整个过程不需要任何代码编写过程。
|
||||
|
||||
## 前置条件
|
||||
|
||||
安装完成Power BI Desktop软件并运行(如未安装,请从其官方地址下载最新的Windows操作系统 32/64 位版本)。
|
||||
准备以下环境:
|
||||
- TDengine 3.3.4.0 以上版本集群已部署并正常运行(企业及社区版均可)。
|
||||
- taosAdapter 能够正常运行,详细参考 [taosAdapter 参考手册](../../../reference/components/taosadapter)。
|
||||
- 从 TDengine 官网下载最新的 Windows 操作系统 X64 客户端驱动程序并进行安装,详细参考 [安装 ODBC 驱动](../../../reference/connector/odbc/#安装)。
|
||||
- 安装完成 Power BI Desktop 软件并运行(如未安装,请从其官方地址下载最新的Windows操作系统 32/64 位版本)。
|
||||
|
||||
## 安装 ODBC 驱动
|
||||
## 配置数据源
|
||||
|
||||
从TDengine官网下载最新的Windows操作系统X64客户端驱动程序,并安装在运行Power BI的机器上。安装成功后可在“ODBC数据源(32位)”或者“ODBC数据源(64位)”管理工具中看到 TDengine 驱动程序。
|
||||
**第 1 步**,在 Windows 操作系统的开始菜单中搜索并打开【ODBC数据源(64位)】管理工具并进行配置。详细参考 [配置ODBC数据源](../../../reference/connector/odbc/#配置数据源)。
|
||||
|
||||
## 配置ODBC数据源
|
||||
**第 2 步**,打开 Power BI 并登录后,点击【主页】->【获取数据】->【其他】->【ODBC】->【连接】,添加数据源。
|
||||
|
||||
配置ODBC数据源的操作步骤如下。
|
||||
**第 3 步**,选择刚才创建的数据源名称,比如【MyTDengine】,如果需要输入 SQL,则可以点击【高级选项】选项卡,在展开的对话框的编辑框中输入 SQL 语句。点击【确定】按钮,即可连接到配置好的数据源。
|
||||
|
||||
第1步,在Windows操作系统的开始菜单中搜索并打开“ODBC数据源(32位)”或者“ODBC数据源(64位)”管理工具。
|
||||
第2步,点击“用户DSN”选项卡→“添加”按钮,进入“创建新数据源”对话框。
|
||||
第3步,在“选择您想为其安装数据源的驱动程序”列表中选择“TDengine”,点击“完成”按钮,进入TDengine ODBC数据源配置页面。填写如下必要信息。
|
||||
- DSN:数据源名称,必填,比如“MyTDengine”。
|
||||
- 连接类型:勾选“WebSocket”复选框。
|
||||
- URL:ODBC 数据源 URL,必填,比如`http://127.0.0.1:6041`。
|
||||
- 数据库:表示需要连接的数据库,可选,比如“test”。
|
||||
- 用户名:输入用户名,如果不填,默认为“root”。
|
||||
- 密码:输入用户密码,如果不填,默认为“taosdata”。
|
||||
**第 4 步**,进入【导航器】后,可以浏览对应数据库的数据表/视图并加载数据。
|
||||
|
||||
第4步,点击“测试连接”按钮,测试连接情况,如果成功连接,则会提示“成功连接到`http://127.0.0.1:6041`”。
|
||||
第5步,点击“确定”按钮,即可保存配置并退出。
|
||||
## 数据分析
|
||||
|
||||
## 导入TDengine数据到Power BI
|
||||
### 使用说明
|
||||
|
||||
将TDengine数据导入Power BI的操作步骤如下:
|
||||
第1步,打开Power BI并登录后,点击“主页”→“获取数据”→“其他”→“ODBC”→“连接”,添加数据源。
|
||||
第2步,选择刚才创建的数据源名称,比如“MyTDengine”,如果需要输入SQL,则可以点击“高级选项”选项卡,在展开的对话框的编辑框中输入SQL语句。点击“确定”按钮,即可连接到配置好的数据源。
|
||||
第3步,进入“导航器”后,可以浏览对应数据库的数据表/视图并加载数据。
|
||||
为了充分发挥 Power BI 在分析 TDengine中 数据方面的优势,用户需要先理解维度、度量、窗口切分查询、数据切分查询、时序和相关性等核心概念,之后通过自定义的 SQL 导入数据。
|
||||
- 维度:通常是分类(文本)数据,描述设备、测点、型号等类别信息。在 TDengine 的超级表中,使用标签列存储数据的维度信息,可以通过形如 “select distinct tbname, tag1, tag2 from supertable” 的SQL语法快速获得维度信息。
|
||||
- 度量:可以用于进行计算的定量(数值)字段,常见计算有求和、取平均值和最小值等。如果测点的采集周期为1s,那么一年就有 3000 多万条记录,把这些数据全部导入 Power BI 会严重影响其执行效率。在 TDengine 中,用户可以使用数据切分查询、窗口切分查询等语法,结合与窗口相关的伪列,把降采样后的数据导入Power BI 中,具体语法请参阅 TDengine 官方文档的特色查询功能部分。
|
||||
- 窗口切分查询:比如温度传感器每秒采集一次数据,但须查询每隔 10min 的温度平均值,在这种场景下可以使用窗口子句来获得需要的降采样查询结果,对应的 SQL 形如 `select tbname, _wstart date,avg(temperature) temp from table interval(10m)`,其中,`_wstart` 是伪列,表示时间窗口起始时间,10m 表示时间窗口的持续时间,`avg(temperature)` 表示时间窗口内的聚合值。
|
||||
- 数据切分查询:如果需要同时获取很多温度传感器的聚合数值,可对数据进行切分,然后在切分出的数据空间内进行一系列的计算,对应的 SQL 形如 `partition by part_list`。数据切分子句最常见的用法是在超级表查询中按标签将子表数据进行切分,将每个子表的数据独立出来,形成一条条独立的时间序列,方便针对各种时序场景的统计分析。
|
||||
- 时序:在绘制曲线或者按照时间聚合数据时,通常需要引入日期表。日期表可以从 Excel 表格中导入,也可以在 TDengine 中执行 SQL 获取,例如 `select _wstart date, count(*) cnt from test.meters where ts between A and B interval(1d) fill(0)`,其中 fill 字句表示数据缺失情况下的填充模式,伪列 _wstart 则为要获取的日期列。
|
||||
- 相关性:告诉数据之间如何关联,如度量和维度可以通过 tbname 列关联在一起,日期表和度量则可以通过 date 列关联,配合形成可视化报表。
|
||||
|
||||
为了充分发挥Power BI在分析TDengine中数据方面的优势,用户需要先理解维度、度量、窗口切分查询、数据切分查询、时序和相关性等核心概念,之后通过自定义的SQL导入数据。
|
||||
- 维度:通常是分类(文本)数据,描述设备、测点、型号等类别信息。在TDengine的超级表中,使用标签列存储数据的维度信息,可以通过形如“select distinct tbname, tag1, tag2 from supertable”的SQL语法快速获得维度信息。
|
||||
- 度量:可以用于进行计算的定量(数值)字段,常见计算有求和、取平均值和最小值等。如果测点的采集周期为1s,那么一年就有3000多万条记录,把这些数据全部导入Power BI会严重影响其执行效率。在TDengine中,用户可以使用数据切分查询、窗口切分查询等语法,结合与窗口相关的伪列,把降采样后的数据导入Power BI中,具体语法请参阅TDengine官方文档的特色查询功能部分。
|
||||
- 窗口切分查询:比如温度传感器每秒采集一次数据,但须查询每隔10min的温度平均值,在这种场景下可以使用窗口子句来获得需要的降采样查询结果,对应的SQL形如`select tbname, _wstart date,avg(temperature) temp from table interval(10m)`,其中,_wstart是伪列,表示时间窗口起始时间,10m表示时间窗口的持续时间,avg(temperature)表示时间窗口内的聚合值。
|
||||
- 数据切分查询:如果需要同时获取很多温度传感器的聚合数值,可对数据进行切分,然后在切分出的数据空间内进行一系列的计算,对应的SQL形如 `partition by part_list`。数据切分子句最常见的用法是在超级表查询中按标签将子表数据进行切分,将每个子表的数据独立出来,形成一条条独立的时间序列,方便针对各种时序场景的统计分析。
|
||||
- 时序:在绘制曲线或者按照时间聚合数据时,通常需要引入日期表。日期表可以从Excel表格中导入,也可以在TDengine中执行SQL获取,例如 `select _wstart date, count(*) cnt from test.meters where ts between A and B interval(1d) fill(0)`,其中fill字句表示数据缺失情况下的填充模式,伪列_wstart则为要获取的日期列。
|
||||
- 相关性:告诉数据之间如何关联,如度量和维度可以通过tbname列关联在一起,日期表和度量则可以通过date列关联,配合形成可视化报表。
|
||||
### 智能电表样例
|
||||
|
||||
## 智能电表样例
|
||||
TDengine 采用了一种独特的数据模型,以优化时序数据的存储和查询性能。该模型利用超级表作为模板,为每台设备创建一张独立的表。每张表在设计时考虑了高度的可扩展性,最多可包含 4096 个数据列和 128 个标签列。这种设计使得 TDengine 能够高效地处理大量时序数据,同时保持数据的灵活性和易用性。
|
||||
|
||||
TDengine采用了一种独特的数据模型,以优化时序数据的存储和查询性能。该模型利用超级表作为模板,为每台设备创建一张独立的表。每张表在设计时考虑了高度的可扩展性,最多可包含4096个数据列和128个标签列。这种设计使得TDengine能够高效地处理大量时序数据,同时保持数据的灵活性和易用性。
|
||||
以智能电表为例,假设每块电表每秒产生一条记录,那么每天将产生 86400 条记录。对于 1000 块智能电表来说,每年产生的记录将占用大约 600GB 的存储空间。面对如此庞大的数据量,Power BI 等商业智能工具在数据分析和可视化方面发挥着重要作用。
|
||||
|
||||
以智能电表为例,假设每块电表每秒产生一条记录,那么每天将产生86 400条记录。对于1000块智能电表来说,每年产生的记录将占用大约600GB的存储空间。面对如此庞大的数据量,Power BI等商业智能工具在数据分析和可视化方面发挥着重要作用。
|
||||
在 Power BI 中,用户可以将 TDengine 表中的标签列映射为维度列,以便对数据进行分组和筛选。同时,数据列的聚合结果可以导入为度量列,用于计算关键指标和生成报表。通过这种方式,Power BI 能够帮助决策者快速获取所需的信息,深入了解业务运营情况,从而制定更加明智的决策。
|
||||
|
||||
在Power BI中,用户可以将TDengine表中的标签列映射为维度列,以便对数据进行分组和筛选。同时,数据列的聚合结果可以导入为度量列,用于计算关键指标和生成报表。通过这种方式,Power BI能够帮助决策者快速获取所需的信息,深入了解业务运营情况,从而制定更加明智的决策。
|
||||
根据如下步骤,便可以体验通过 Power BI 生成时序数据报表的功能。
|
||||
|
||||
根据如下步骤,便可以体验通过Power BI生成时序数据报表的功能。
|
||||
第1步,使用TDengine的taosBenchMark快速生成1000块智能电表3天的数据,采集频率为1s。
|
||||
```shell
|
||||
taosBenchmark -t 1000 -n 259200 -S 1000 -y
|
||||
```
|
||||
第2步,导入维度数据。在Power BI中导入表的标签列,取名为tags,通过如下SQL获取超级表下所有智能电表的标签数据。
|
||||
```sql
|
||||
select distinct tbname device, groupId, location from test.meters
|
||||
```
|
||||
第3步,导入度量数据。在Power BI中,按照1小时的时间窗口,导入每块智能电表的电流均值、电压均值、相位均值,取名为data,SQL如下。
|
||||
```sql
|
||||
select tbname, _wstart ws, avg(current), avg(voltage), avg(phase) from test.meters PARTITION by tbname interval(1h)
|
||||
```
|
||||
第4步,导入日期数据。按照1天的时间窗口,获得时序数据的时间范围及数据计数,SQL如下。需要在Power Query编辑器中将date列的格式从“文本”转化为“日期”。
|
||||
```sql
|
||||
select _wstart date, count(*) from test.meters interval(1d) having count(*)>0
|
||||
```
|
||||
第5步,建立维度和度量的关联关系。打开模型视图,建立表tags和data的关联关系,将tbname设置为关联数据列。
|
||||
第6步,建立日期和度量的关联关系。打开模型视图,建立数据集date和data的关联关系,关联的数据列为date和datatime。
|
||||
第7步,制作报告。在柱状图、饼图等控件中使用这些数据。
|
||||
**第 1 步**,使用 TDengine 的 taosBenchMark 快速生成1000块智能电表3天的数据,采集频率为 1s。
|
||||
|
||||
由于TDengine处理时序数据的超强性能,使得用户在数据导入及每日定期刷新数据时,都可以得到非常好的体验。更多有关Power BI视觉效果的构建方法,请参照Power BI的官方文档。
|
||||
```shell
|
||||
taosBenchmark -t 1000 -n 259200 -S 1000 -y
|
||||
```
|
||||
|
||||
**第 2 步**,导入维度数据。在 Power BI 中导入表的标签列,取名为 tags,通过如下 SQL 获取超级表下所有智能电表的标签数据。
|
||||
|
||||
```sql
|
||||
select distinct tbname device, groupId, location from test.meters
|
||||
```
|
||||
|
||||
**第 3 步**,导入度量数据。在 Power BI 中,按照 1 小时的时间窗口,导入每块智能电表的电流均值、电压均值、相位均值,取名为 data,SQL如下。
|
||||
|
||||
```sql
|
||||
select tbname, _wstart ws, avg(current), avg(voltage), avg(phase) from test.meters PARTITION by tbname interval(1h)
|
||||
```
|
||||
|
||||
**第 4 步**,导入日期数据。按照 1 天的时间窗口,获得时序数据的时间范围及数据计数,SQL 如下。需要在 Power Query 编辑器中将 date 列的格式从“文本”转化为“日期”。
|
||||
|
||||
```sql
|
||||
select _wstart date, count(*) from test.meters interval(1d) having count(*)>0
|
||||
```
|
||||
|
||||
**第 5 步**,建立维度和度量的关联关系。打开模型视图,建立表 tags 和 data 的关联关系,将 tbname 设置为关联数据列。
|
||||
|
||||
**第 6 步**,建立日期和度量的关联关系。打开模型视图,建立数据集 date 和 data 的关联关系,关联的数据列为 date 和 datatime。
|
||||
|
||||
**第 7 步**,制作报告。在柱状图、饼图等控件中使用这些数据。
|
||||
|
||||
由于TDengine处理时序数据的超强性能,使得用户在数据导入及每日定期刷新数据时,都可以得到非常好的体验。更多有关 Power BI 视觉效果的构建方法,请参照 Power BI 的官方文档。
|
|
@ -1,46 +1,55 @@
|
|||
---
|
||||
title: 与永洪 BI 的集成
|
||||
title: 与永洪 BI 集成
|
||||
sidebar_label: 永洪 BI
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
永洪 BI 是一个专为各种规模企业打造的全业务链大数据分析解决方案,旨在帮助用户轻松发掘大数据价值,获取深入的洞察力。该平台以其灵活性和易用性而广受好评,无论企业规模大小,都能从中受益。
|
||||
|
||||
为了实现与 TDengine 的高效集成,永洪 BI 提供了 JDBC 连接器。用户只须按照简单的步骤配置数据源,即可将 TDengine 作为数据源添加到永洪BI中。这一过程不仅快速便捷,还能确保数据的准确性和稳定性。
|
||||
为了实现与 TDengine 的高效集成,永洪 BI 提供了 JDBC 连接器。用户只须按照简单的步骤配置数据源,即可将 TDengine 作为数据源添加到永洪 BI 中。这一过程不仅快速便捷,还能确保数据的准确性和稳定性。
|
||||
|
||||
一旦数据源配置完成,永洪BI便能直接从TDengine中读取数据,并利用其强大的数据处理和分析功能,为用户提供丰富的数据展示、分析和预测能力。这意味着用户无须编写复杂的代码或进行烦琐的数据转换工作,即可轻松获取所需的业务洞察。
|
||||
一旦数据源配置完成,永洪 BI 便能直接从 TDengine 中读取数据,并利用其强大的数据处理和分析功能,为用户提供丰富的数据展示、分析和预测能力。这意味着用户无须编写复杂的代码或进行烦琐的数据转换工作,即可轻松获取所需的业务洞察。
|
||||
|
||||
## 前置条件
|
||||
|
||||
准备以下环境:
|
||||
- TDengine 3.3.2.0 以上版本集群已部署并正常运行(企业及社区版均可)。
|
||||
- taosAdapter 能够正常运行,详细参考 [taosAdapter 参考手册](../../../reference/components/taosadapter)。
|
||||
- 确保永洪 BI 已经安装并运行(如果未安装,请到永洪科技官方下载页面下载)。
|
||||
- 安装JDBC驱动。从 maven.org 下载 TDengine JDBC 连接器文件 “taos-jdbcdriver-3.4.0-dist.jar”,并安装在永洪 BI 的机器上。
|
||||
- 安装JDBC驱动。从 maven.org 下载 TDengine JDBC 连接器文件 `taos-jdbcdriver-3.4.0-dist.jar` 及以上版本。
|
||||
|
||||
## 配置JDBC数据源
|
||||
## 配置数据源
|
||||
|
||||
配置JDBC数据源的步骤如下。
|
||||
配置JDBC数据源的步骤如下:
|
||||
|
||||
第1步,在打开的永洪BI中点击“添加数据源”按钮,选择SQL数据源中的“GENERIC”类型。
|
||||
第2步,点击“选择自定义驱动”按钮,在“驱动管理”对话框中点击“驱动列表”旁边的“+”,输入名称“MyTDengine”。然后点击“上传文件”按钮,上传刚刚下载的TDengine JDBC连接器文件“taos-jdbcdriver-3.2.7-dist.jar”,并选择“com.taosdata.jdbc.
|
||||
rs.RestfulDriver”驱动,最后点击“确定”按钮,完成驱动添加步骤。
|
||||
第3步,复制下面的内容到“URL”字段。
|
||||
```text
|
||||
jdbc:TAOS-RS://127.0.0.1:6041?user=root&password=taosdata
|
||||
```
|
||||
第4步,在“认证方式”中点击“无身份认证”单选按钮。
|
||||
第5步,在数据源的高级设置中修改“Quote 符号”的值为反引号(`)。
|
||||
第6步,点击“测试连接”按钮,弹出“测试成功”对话框。点击“保存”按钮,输入“MyTDengine”来保存TDengine数据源。
|
||||
**第 1 步**,在打开的永洪 BI 中点击【添加数据源】按钮,选择 SQL 数据源中的 “GENERIC” 类型。
|
||||
|
||||
## 创建TDengine数据集
|
||||
**第 2 步**,点击【选择自定义驱动】按钮,在【驱动管理】对话框中点击【驱动列表】旁边的 “+”,输入名称 “MyTDengine”。然后点击【上传文件】按钮,上传刚刚下载的 TDengine JDBC 连接器文件 `taos-jdbcdriver-3.2.7-dist.jar`,并选择 `com.taosdata.jdbc.rs.RestfulDriver` 驱动,最后点击“确定”按钮,完成驱动添加步骤。
|
||||
|
||||
创建TDengine数据集的步骤如下。
|
||||
**第 3 步**,复制下面的内容到【URL】字段。
|
||||
|
||||
第1步,在永洪BI中点击“添加数据源”按钮,展开刚刚创建的数据源,并浏览TDengine中的超级表。
|
||||
第2步,可以将超级表的数据全部加载到永洪BI中,也可以通过自定义SQL导入部分数据。
|
||||
第3步,当勾选“数据库内计算”复选框时,永洪BI将不再缓存TDengine的时序数据,并在处理查询时将SQL请求发送给TDengine直接处理。
|
||||
```text
|
||||
jdbc:TAOS-RS://127.0.0.1:6041?user=root&password=taosdata
|
||||
```
|
||||
|
||||
当导入数据后,永洪BI会自动将数值类型设置为“度量”列,将文本类型设置为“维度”列。而在TDengine的超级表中,由于将普通列作为数据的度量,将标签列作为数据的维度,因此用户可能需要在创建数据集时更改部分列的属性。TDengine在支持标准SQL的基础之上还提供了一系列满足时序业务场景需求的特色查询语法,例如数据切分查询、窗口切分查询等,具体操作步骤请参阅TDengine的官方文档。通过使用这些特色查询,当永洪BI将SQL查询发送到TDengine时,可以大大提高数据访问速度,减少网络传输带宽。
|
||||
**第 4 步**,在【认证方式】中点击【无身份认证】单选按钮。
|
||||
|
||||
**第 5 步**,在数据源的高级设置中修改 “Quote 符号” 的值为反引号(`)。
|
||||
|
||||
**第 6 步**,点击【测试连接】按钮,弹出【测试成功】对话框。点击【保存】按钮,输入 “MyTDengine” 来保存 TDengine 数据源。
|
||||
|
||||
**第 7 步**,在永洪 BI 中点击【添加数据源】按钮,展开刚刚创建的数据源,并浏览 TDengine 中的超级表。
|
||||
|
||||
**第 8 步**,可以将超级表的数据全部加载到永洪 BI 中,也可以通过自定义 SQL 导入部分数据。
|
||||
|
||||
**第 9 步**,当勾选【数据库内计算】复选框时,永洪 BI 将不再缓存 TDengine 的时序数据,并在处理查询时将 SQL 请求发送给 TDengine 直接处理。
|
||||
|
||||
## 数据分析
|
||||
|
||||
当导入数据后,永洪 BI 会自动将数值类型设置为 “度量” 列,将文本类型设置为 “维度” 列。而在 TDengine 的超级表中,由于将普通列作为数据的度量,将标签列作为数据的维度,因此用户可能需要在创建数据集时更改部分列的属性。TDengine 在支持标准 SQL 的基础之上还提供了一系列满足时序业务场景需求的特色查询语法,例如数据切分查询、窗口切分查询等,具体操作步骤请参阅 TDengine 的官方文档。通过使用这些特色查询,当永洪 BI 将 SQL 查询发送到 TDengine 时,可以大大提高数据访问速度,减少网络传输带宽。
|
||||
|
||||
在永洪 BI 中,你可以创建 “参数” 并在 SQL 中使用,通过手动、定时的方式动态执行这些 SQL,即可实现可视化报告的刷新效果。如下 SQL 可以从 TDengine 实时读取数据。
|
||||
|
||||
在永洪BI中,你可以创建“参数”并在SQL中使用,通过手动、定时的方式动态执行这些SQL,即可实现可视化报告的刷新效果。如下SQL可以从TDengine实时读取数据。
|
||||
```sql
|
||||
select _wstart ws, count(*) cnt from supertable where tbname=?{metric} and ts = ?{from} and ts < ?{to} interval(?{interval})
|
||||
```
|
||||
|
@ -49,17 +58,15 @@ select _wstart ws, count(*) cnt from supertable where tbname=?{metric} and ts =
|
|||
1. `_wstart`:表示时间窗口起始时间。
|
||||
2. `count(*)`:表示时间窗口内的聚合值。
|
||||
3. `?{interval}`:表示在 SQL 语句中引入名称为 `interval` 的参数,当 BI 工具查询数据时,会给 `interval` 参数赋值,如果取值为 1m,则表示按照 1 分钟的时间窗口降采样数据。
|
||||
4. `?{metric}`:该参数用来指定查询的数据表名称,当在 BI 工具中把某个“下拉参数组件”的 ID 也设置为 metric 时,该“下拉参数组件”的被选择项将会和该参数绑定在一起,实现动态选择的效果。
|
||||
5. `?{from}` 和 `?{to}`:这两个参数用来表示查询数据集的时间范围,可以与“文本参数组件”绑定。
|
||||
您可以在 BI 工具的“编辑参数”对话框中修改“参数”的数据类型、数据范围、默认取值,并在“可视化报告”中动态设置这些参数的值。
|
||||
4. `?{metric}`:该参数用来指定查询的数据表名称,当在 BI 工具中把某个 “下拉参数组件” 的 ID 也设置为 metric 时,该 “下拉参数组件” 的被选择项将会和该参数绑定在一起,实现动态选择的效果。
|
||||
5. `?{from}` 和 `?{to}`:这两个参数用来表示查询数据集的时间范围,可以与 “文本参数组件” 绑定。
|
||||
您可以在 BI 工具的【编辑参数】对话框中修改 “参数” 的数据类型、数据范围、默认取值,并在 “可视化报告” 中动态设置这些参数的值。
|
||||
|
||||
## 21.4.5 制作可视化报告
|
||||
制作可视化报告的步骤如下:
|
||||
|
||||
制作可视化报告的步骤如下。
|
||||
|
||||
1. 在永洪 BI 工具中点击“制作报告”,创建画布。
|
||||
2. 拖动可视化组件到画布中,例如“表格组件”。
|
||||
3. 在“数据集”侧边栏中选择待绑定的数据集,将数据列中的“维度”和“度量”按需绑定到“表格组件”。
|
||||
4. 点击“保存”后,即可查看报告。
|
||||
1. 在永洪 BI 工具中点击【制作报告】,创建画布。
|
||||
2. 拖动可视化组件到画布中,例如 “表格组件”。
|
||||
3. 在【数据集】侧边栏中选择待绑定的数据集,将数据列中的 “维度” 和 “度量” 按需绑定到 “表格组件”。
|
||||
4. 点击【保存】后,即可查看报告。
|
||||
5. 更多有关永洪 BI 工具的信息,请查询永洪科技官方帮助文档。
|
||||
|
||||
|
|
|
@ -1,48 +1,48 @@
|
|||
---
|
||||
sidebar_label: Seeq
|
||||
title: 与 Seeq 的集成
|
||||
title: 与 Seeq 集成
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
Seeq 是制造业和工业互联网(IIOT)高级分析软件。Seeq 支持在工艺制造组织中使用机器学习创新的新功能。这些功能使组织能够将自己或第三方机器学习算法部署到前线流程工程师和主题专家使用的高级分析应用程序,从而使单个数据科学家的努力扩展到许多前线员工。
|
||||
|
||||
通过 TDengine Java connector, Seeq 可以轻松支持查询 TDengine 提供的时序数据,并提供数据展现、分析、预测等功能。
|
||||
通过 `TDengine Java connector`, Seeq 可以轻松支持查询 TDengine 提供的时序数据,并提供数据展现、分析、预测等功能。
|
||||
|
||||
## 前置条件
|
||||
|
||||
- Seeq 已经安装。从 [Seeq 官网](https://www.seeq.com/customer-download)下载相关软件,例如 Seeq Server 和 Seeq Data Lab 等。Seeq Data Lab 需要安装在和 Seeq Server 不同的服务器上,并通过配置和 Seeq Server 互联。详细安装配置指令参见[Seeq 知识库]( https://support.seeq.com/kb/latest/cloud/)。
|
||||
准备以下环境:
|
||||
- TDengine 3.1.0.3 以上版本集群已部署并正常运行(企业及社区版均可)。
|
||||
- taosAdapter 能够正常运行,详细参考 [taosAdapter 参考手册](../../../reference/components/taosadapter)。
|
||||
- Seeq 已经安装。从 [Seeq 官网](https://www.seeq.com/customer-download)下载相关软件,例如 `Seeq Server` 和 `Seeq Data Lab` 等。`Seeq Data Lab` 需要安装在和 `Seeq Server` 不同的服务器上,并通过配置和 `Seeq Server` 互联。详细安装配置指令参见 [Seeq 知识库]( https://support.seeq.com/kb/latest/cloud/)。
|
||||
- 安装 JDBC 驱动。从 `maven.org` 下载 `TDengine JDBC` 连接器文件 `taos-jdbcdriver-3.2.5-dist.jar` 及以上版本。
|
||||
|
||||
- TDengine 本地实例已安装。 请参考[官网文档](../../../get-started)。 若使用 TDengine Cloud,请在 https://cloud.taosdata.com 申请帐号并登录查看如何访问 TDengine Cloud。
|
||||
## 配置数据源
|
||||
|
||||
## 配置 Seeq 访问 TDengine
|
||||
### 配置 JDBC 连接器
|
||||
|
||||
1. 查看 data 存储位置
|
||||
**第 1 步**,查看 data 存储位置
|
||||
|
||||
```
|
||||
sudo seeq config get Folders/Data
|
||||
```
|
||||
|
||||
2. 从 maven.org 下载 TDengine Java connector 包,目前最新版本为[3.2.5](https://repo1.maven.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/3.2.5/taos-jdbcdriver-3.2.5-dist.jar),并拷贝至 data 存储位置的 plugins\lib 中。
|
||||
**第 2 步**,将 `maven.org` 下载 `TDengine Java connector` 包并拷贝至 data 存储位置的 `plugins\lib` 中。
|
||||
|
||||
3. 重新启动 seeq server
|
||||
**第 3 步**,重新启动 seeq server
|
||||
|
||||
```
|
||||
sudo seeq restart
|
||||
```
|
||||
|
||||
4. 输入 License
|
||||
**第 4 步**,输入 License
|
||||
|
||||
使用浏览器访问 ip:34216 并按照说明输入 license。
|
||||
|
||||
## 使用 Seeq 分析 TDengine 时序数据
|
||||
### 加载 TDengine 时序数据
|
||||
|
||||
本章节演示如何使用 Seeq 软件配合 TDengine 进行时序数据分析。
|
||||
本章节演示如何使用 Seeq 软件加载 TDengine 时序数据。
|
||||
|
||||
### 场景介绍
|
||||
|
||||
示例场景为一个电力系统,用户每天从电站仪表收集用电量数据,并将其存储在 TDengine 集群中。现在用户想要预测电力消耗将会如何发展,并购买更多设备来支持它。用户电力消耗随着每月订单变化而不同,另外考虑到季节变化,电力消耗量会有所不同。这个城市位于北半球,所以在夏天会使用更多的电力。我们模拟数据来反映这些假定。
|
||||
|
||||
### 数据 Schema
|
||||
**第 1 步**,在 TDengine 中创建表。
|
||||
|
||||
```
|
||||
CREATE STABLE meters (ts TIMESTAMP, num INT, temperature FLOAT, goods INT) TAGS (device NCHAR(20));
|
||||
|
@ -51,20 +51,16 @@ CREATE TABLE goods (ts1 TIMESTAMP, ts2 TIMESTAMP, goods FLOAT);
|
|||
|
||||

|
||||
|
||||
### 构造数据方法
|
||||
**第 2 步**,在 TDengine 中构造数据。
|
||||
|
||||
```
|
||||
python mockdata.py
|
||||
taos -s "insert into power.goods select _wstart, _wstart + 10d, avg(goods) from power.meters interval(10d);"
|
||||
```
|
||||
|
||||
源代码托管在[GitHub 仓库](https://github.com/sangshuduo/td-forecasting)。
|
||||
源代码托管在 [GitHub 仓库](https://github.com/sangshuduo/td-forecasting)。
|
||||
|
||||
## 使用 Seeq 进行数据分析
|
||||
|
||||
### 配置数据源(Data Source)
|
||||
|
||||
使用 Seeq 管理员角色的帐号登录,并新建数据源。
|
||||
**第 3 步**,使用 Seeq 管理员角色的帐号登录,并新建数据源。
|
||||
|
||||
- Power
|
||||
|
||||
|
@ -244,9 +240,15 @@ taos -s "insert into power.goods select _wstart, _wstart + 10d, avg(goods) from
|
|||
}
|
||||
```
|
||||
|
||||
## 数据分析
|
||||
|
||||
### 场景介绍
|
||||
|
||||
示例场景为一个电力系统,用户每天从电站仪表收集用电量数据,并将其存储在 TDengine 集群中。现在用户想要预测电力消耗将会如何发展,并购买更多设备来支持它。用户电力消耗随着每月订单变化而不同,另外考虑到季节变化,电力消耗量会有所不同。这个城市位于北半球,所以在夏天会使用更多的电力。我们模拟数据来反映这些假定。
|
||||
|
||||
### 使用 Seeq Workbench
|
||||
|
||||
登录 Seeq 服务页面并新建 Seeq Workbench,通过选择数据源搜索结果和根据需要选择不同的工具,可以进行数据展现或预测,详细使用方法参见[官方知识库](https://support.seeq.com/space/KB/146440193/Seeq+Workbench)。
|
||||
登录 Seeq 服务页面并新建 Seeq Workbench,通过选择数据源搜索结果和根据需要选择不同的工具,可以进行数据展现或预测,详细使用方法参见 [官方知识库](https://support.seeq.com/space/KB/146440193/Seeq+Workbench)。
|
||||
|
||||

|
||||
|
||||
|
@ -319,78 +321,10 @@ plt.show()
|
|||
|
||||

|
||||
|
||||
## 配置 Seeq 数据源连接 TDengine Cloud
|
||||
### 方案总结
|
||||
|
||||
配置 Seeq 数据源连接 TDengine Cloud 和连接 TDengine 本地安装实例没有本质的不同,只要登录 TDengine Cloud 后选择“编程 - Java”并拷贝带 token 字符串的 JDBC 填写为 Seeq Data Source 的 DatabaseJdbcUrl 值。
|
||||
注意使用 TDengine Cloud 时 SQL 命令中需要指定数据库名称。
|
||||
通过集成 Seeq 和 TDengine,可以充分利用 TDengine 高效的存储和查询性能,同时也可以受益于 Seeq 提供给用户的强大数据可视化和分析功能。
|
||||
|
||||
### 用 TDengine Cloud 作为数据源的配置内容示例:
|
||||
这种集成使用户能够充分利用 TDengine 的高性能时序数据存储和检索,确保高效处理大量数据。同时,Seeq 提供高级分析功能,如数据可视化、异常检测、相关性分析和预测建模,使用户能够获得有价值的洞察并基于数据进行决策。
|
||||
|
||||
```
|
||||
{
|
||||
"QueryDefinitions": [
|
||||
{
|
||||
"Name": "CloudVoltage",
|
||||
"Type": "SIGNAL",
|
||||
"Sql": "SELECT ts, voltage FROM test.meters",
|
||||
"Enabled": true,
|
||||
"TestMode": false,
|
||||
"TestQueriesDuringSync": true,
|
||||
"InProgressCapsulesEnabled": false,
|
||||
"Variables": null,
|
||||
"Properties": [
|
||||
{
|
||||
"Name": "Name",
|
||||
"Value": "Voltage",
|
||||
"Sql": null,
|
||||
"Uom": "string"
|
||||
},
|
||||
{
|
||||
"Name": "Interpolation Method",
|
||||
"Value": "linear",
|
||||
"Sql": null,
|
||||
"Uom": "string"
|
||||
},
|
||||
{
|
||||
"Name": "Maximum Interpolation",
|
||||
"Value": "2day",
|
||||
"Sql": null,
|
||||
"Uom": "string"
|
||||
}
|
||||
],
|
||||
"CapsuleProperties": null
|
||||
}
|
||||
],
|
||||
"Type": "GENERIC",
|
||||
"Hostname": null,
|
||||
"Port": 0,
|
||||
"DatabaseName": null,
|
||||
"Username": "root",
|
||||
"Password": "taosdata",
|
||||
"InitialSql": null,
|
||||
"TimeZone": null,
|
||||
"PrintRows": false,
|
||||
"UseWindowsAuth": false,
|
||||
"SqlFetchBatchSize": 100000,
|
||||
"UseSSL": false,
|
||||
"JdbcProperties": null,
|
||||
"GenericDatabaseConfig": {
|
||||
"DatabaseJdbcUrl": "jdbc:TAOS-RS://gw.cloud.taosdata.com?useSSL=true&token=41ac9d61d641b6b334e8b76f45f5a8XXXXXXXXXX",
|
||||
"SqlDriverClassName": "com.taosdata.jdbc.rs.RestfulDriver",
|
||||
"ResolutionInNanoseconds": 1000,
|
||||
"ZonedColumnTypes": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### TDengine Cloud 作为数据源的 Seeq Workbench 界面示例
|
||||
|
||||

|
||||
|
||||
## 方案总结
|
||||
|
||||
通过集成Seeq和TDengine,可以充分利用TDengine高效的存储和查询性能,同时也可以受益于Seeq提供给用户的强大数据可视化和分析功能。
|
||||
|
||||
这种集成使用户能够充分利用TDengine的高性能时序数据存储和检索,确保高效处理大量数据。同时,Seeq提供高级分析功能,如数据可视化、异常检测、相关性分析和预测建模,使用户能够获得有价值的洞察并基于数据进行决策。
|
||||
|
||||
综合来看,Seeq和TDengine共同为制造业、工业物联网和电力系统等各行各业的时序数据分析提供了综合解决方案。高效数据存储和先进的分析相结合,赋予用户充分发挥时序数据潜力的能力,推动运营改进,并支持预测和规划分析应用。
|
||||
综合来看,Seeq 和 TDengine 共同为制造业、工业物联网和电力系统等各行各业的时序数据分析提供了综合解决方案。高效数据存储和先进的分析相结合,赋予用户充分发挥时序数据潜力的能力,推动运营改进,并支持预测和规划分析应用。
|
||||
|
|
Loading…
Reference in New Issue