Mass concrete temperature monitoring generates tens of thousands of data points daily. Extracting key insights and producing supervisor-approved standard reports from this data deluge is the core pain point for every monitoring engineer. We've built a complete data analysis system on the TG Cloud Mode platform: from real-time dashboards to historical curve tracing, from a custom formula engine to C5-9 standard reports, from ECharts visualization to one-click XLS export. This article unpacks each tool's capabilities and design rationale.
1. Data Analysis System Overview
The TG Cloud platform's data analysis system is organized into four layers:
| Layer | Module | Core Capability | Typical Use Case |
|---|---|---|---|
| L1 | Real-time Dashboard | Overview stats, temperature distribution chart, device online rate, alarm summary | Daily inspection, quick global status check |
| L2 | History Curves | ECharts time-series, single/multi-channel comparison, hour/day aggregation, image/print export | Trend analysis, peak verification, anomaly investigation |
| L3 | Custom Data | Custom data columns (air/surface/center/max internal/differential/cooling rate), formula engine, 24h-back comparison | Multi-dimensional automatic computation of temperature control indicators |
| L4 | Standard Reports | C5-9 format reports, multi-definition management, date range/aggregation/step, XLS export | Final acceptance submission, supervisor review and sign-off |
2. Real-Time Dashboard — Global Situation at a Glance
The Dashboard is the most frequently accessed page. It provides a one-screen overview of core statistics:
| Stat Card | Data Source | Technical Implementation |
|---|---|---|
| Device Stats | TG_cjqSetting / DG_cjqSetting tables | SQL COUNT + online status polling |
| Online Rate | Device last communication time vs current time | Delta ≤ 2h → online |
| Temperature Overview | All_LastDt.db (joint query of all device latest values) | max/min/avg aggregation + Chart.js temperature distribution |
| Alarm Overview | custom_data_alarm table | Total / Enabled / Disabled rule counts |
| Trend Comparison | Previous snapshot vs current snapshot | Online rate delta / average temperature delta |
💡 Design Consideration
Dashboard queries are heavily optimized for PostgreSQL: using materialized views for latest data to avoid cross-table JOINs; Chart.js for lightweight rendering (not ECharts) to ensure first-load completion within 1 second.
3. History Curve Analysis — The Power Tool for Trend Discovery
3.1 Single-Device History Curves
Each TG device's data is stored in a PostgreSQL database (partitioned by device SN). The system provides paginated query APIs and dedicated curve pages:
- Data Query API:
GET /api/data/history/{dtype}/{sn}, supports pagination (50/page, max 500) and date range filtering - Curve Page:
/data/chart/{dtype}/{sn}, full 32-channel time-series display - Data Integrity: power-loss resume + offline catch-up ensures gapless curves
3.2 Multi-Group History Curves (ECharts Rendering)
The custom data module's history chart feature supports grouped rendering of multiple comparison curves:
- Group Management: logically group sensors (e.g., "Base Slab Group / Pile Cap Group / Pier Group")
- Time Aggregation: raw / hourly average / daily average — three modes for different analysis granularity
- Visual Interaction: ECharts time-series with zoom, drag, tooltip, legend filtering, save-as-image, print
- Data Export: single-group XLS and all-group XLS export for offline analysis
4. Formula Engine — No More Manual Calculation
This is the core capability of the custom data module. The system has a built-in flexible formula engine that lets engineers define data columns like they would in Excel, with the system automatically extracting and computing from massive sensor datasets.
4.1 Sensor Reference Syntax
| Syntax | Meaning | Example |
|---|---|---|
SN_channel | Current value of specified device channel | TG01_04 — TG01 channel 4 current temp |
SNBchannel | 24-hour-ago value of specified device channel | TG01B04 — TG01 channel 4 24h-ago temp |
max(a, b, ...) | Maximum value | =max(TG01_01, TG01_02, TG01_03) |
avg(a, b, ...) | Average value | =avg(TG01_01, TG02_01, TG03_01) |
abs(x) | Absolute value | =abs(TG01_04 - TG01_05) |
+, -, *, / | Arithmetic operations | =TG01_01 - TG01_02 |
4.2 Default Column Definitions + One-Click Smart Fill
The system comes with 9 standard data columns covering common temperature control indicators:
| # | Column | Type | Smart Fill Formula |
|---|---|---|---|
| 1 | Seq No. | Fixed | Auto-increment |
| 2 | Date/Time | Fixed | Sensor data timestamp |
| 3 | Group Name | Fixed | Last communication time |
| 4 | Ambient Temp | Keyword | =ambient sensor |
| 5 | Surface Temp | Keyword | =surface sensor |
| 6 | Center Temp | Keyword | =max(internal sensors) |
| 7 | Core-Surface Differential | Keyword | =abs(max(internal) - surface) |
| 8 | Surface-Ambient Diff | Keyword | =surface - ambient |
| 9 | Cooling Rate (24h) | Keyword | =avg(24h-ago internal) - avg(current internal) |
A single click on "Smart Fill" automatically matches sensor references by keyword and populates all formulas — no manual entry of lengthy sensor IDs needed.
4.3 24-Hour Lookback (Core of Cooling Rate Calculation)
Cooling rate requires comparing current values against 24-hour-ago values. The B-suffix reference (e.g., TG01B04) enables this:
- Query each device's latest data timestamp (
IDATETIMEfield), backtrack 24 hours - Find the closest matching record in the per-device PostgreSQL table
- Inject the result into the formula engine, replacing B-suffix references for final computation
This design ensures cooling rate calculation doesn't require continuous 24-hour data — even with communication gaps (offline catch-up), the system finds the nearest valid data point approximately 24 hours ago.
5. C5-9 Standard Report — The Key Deliverable for Final Acceptance
C5-9 is the most critical deliverable in mass concrete temperature monitoring. It is the Mass Concrete Temperature Monitoring Record Form specified in GB 50496 Appendix, which must be signed and archived during supervisor acceptance. We have fully implemented automatic generation of this form.
5.1 Report Structure
| Section | Content | Data Source |
|---|---|---|
| Project Info | Project name, contractor, monitoring location, method, curing method, doc number | Manual entry (configure once, reuse across reports) |
| Header Definition | Sensor point IDs + measurement time + per-point temps + ambient + curing temp | Auto-configured (based on point count and sensor binding) |
| Data Area | One row per record: timestamp + all channel temperature values | TG.db real-time query + aggregation (raw/hourly/daily) |
| Signature Area | Review opinion + technical lead / foreman / measurer + table date | Manual fill + auto date generation |
5.2 Report Configuration Tool
- Multi-Definition Management: multiple report definitions per project (different pour locations, curing methods), independently managed
- Date Range + Aggregation + Step: select any time range; raw/hourly/daily aggregation; step N to skip rows (e.g., 1 row per 4h for printing)
- C5-9 Preview API:
POST /api/custom-data/c59-preview, returns fully populated data rows - Dedicated Display Page:
/custom-data/c59-report, A4 print-optimized layout, UI controls hidden by default
5.3 Export Capabilities
| Export Method | Technical Approach | Use Case |
|---|---|---|
| XLS Export | SheetJS (xlsx 0.20.0), CDN lazy load, table_to_sheet conversion | Submit for supervisor review, stamp and archive |
| Web Print | @media print CSS optimization, A4 portrait, UI controls hidden | On-site printing for signing, paper archive |
| Curve Image | ECharts native getDataURL PNG export | Embed in proposal reports, PPT presentations |
💡 Key to Supervisor Acceptance
C5-9 reports use SheetJS to directly convert HTML tables to XLSX, preserving original formatting (merged cells, borders, fonts). The exported XLS matches GB 50496 Appendix format with near-100% supervisor acceptance rate.
6. Data Reliability and Integrity Assurance
Data quality is the foundation of data analysis. The TG system ensures reliability at three levels:
| Mechanism | Implementation | Result |
|---|---|---|
| Power-Loss Resume | TG terminal EEPROM + TF card dual storage, auto catch-up after power restoration | Zero data loss |
| Offline Catch-Up | Data buffered locally during 4G outage, time-ordered backfill upon reconnection | No curve gaps |
| Sensor Calibration | Factory point-by-point calibration, ±0.2°C accuracy, optional CNAS certificate | Trustworthy data source |
| Data Redundancy | HDD backup + Bluetooth transfer (TF card local backup), multi-copy protection | Multi-level disaster recovery |
7. Report System Backend Design Highlights
The report system backend (custom_data.py, ~1455 lines) is one of the most complex modules in the platform. Key technical decisions:
7.1 PostgreSQL Config Storage + JSON Serialization
User-customized data (report configs, chart headers, alarm rules) are stored as JSON in PostgreSQL JSONB columns:
- Flexible schema — no ALTER TABLE needed (each user's column definitions may differ)
- JSON passes directly between frontend and backend without extra serialization
- Centralized PostgreSQL deployment — single database manages all project data, with master-slave replication and automated backups
7.2 Multi-Database Joint Queries
A single report may span multiple TG devices whose data stored in the same PostgreSQL database (partitioned by device SN). The system uses UNION ALL or cross-table JOINs for direct joint queries — no ATTACH/DETACH needed, with native concurrency support.
7.3 Aggregation Query Optimization
For large time-span history chart queries (e.g., 30 days), querying raw data returns tens of thousands of rows, causing frontend rendering lag. The backend performs aggregation at the SQL layer before returning data.
-- Hourly average aggregation (per sensor channel)
SELECT strftime('%Y-%m-%d %H:00:00',
REPLACE(IDATETIME, '#', '')) as dt_hour,
AVG(WD01), AVG(WD02), ..., AVG(WD32)
FROM sheet1
WHERE dt_hour BETWEEN ? AND ?
GROUP BY dt_hour
ORDER BY dt_hourThis mechanism reduces frontend rendering from tens of thousands of rows to at most 720 (30 days × 24 hours), cutting chart load time from 5 seconds to 500ms.
📋 Conclusion
Data analysis is not the goal — making data generate decision value is the goal. The TG Cloud platform's data analysis system is designed around three "speed" principles: dashboard refresh is fast (1-second global status), trend discovery is fast (ECharts zoom is 10x faster than Excel dragging), and reports are generated fast (one-click generation + one-click export). For monitoring engineers, this means spending more time analyzing what the data means rather than creating tables and drawing charts.