# Historian

### Historian Data Connector

The **Historian Data Connector** allows Tricloud Nexus to store time-series measurements from your Edge-connected devices directly into a dedicated database for long-term archiving, advanced analytics, and reporting. This connector acts as a **data sink -** meaning it receives measurement data from other [data connectors]() (such as MQTT, OPC-UA, Modbus, etc.) and writes those measurements into the historian database of your choice. The Database can be physically located at a local site or in the cloud.&#x20;

> **Note:**\
> Currently, only **TimeScaleDB** (based on PostgreSQL) is supported as a historian target, but additional options such as Microsoft SQL Server will be added in future releases.

***

### Key Features

* **Flexible Historian Support:** Store measurements in industry-standard databases, starting with TimeScaleDB.
* **Edge-Based Storage:** Data can be buffered and written from Edge devices, supporting robust operation even if connections are intermittent.
* **Batched Writes:** Optimize performance and reduce network traffic by batching multiple measurements before writing to the database.
* **Secure Access:** Authentication required for database connections, with full support for credentials management.
* **Configurable Storage:** Set maximum storage intervals and batch sizes to match your data retention and performance requirements.
* **Unified Data Model:** All measurements stored follow the Tricloud Nexus measurement format, ensuring consistency and easy integration for analytics.

***

### Use Cases for Historian Data Connector

The Historian Data Connector is especially useful in scenarios where you need to store selected, high-value operational data from your Edge environment for advanced analytics, compliance, or reporting. Some common use cases include:

* **OEE (Overall Equipment Effectiveness) Tracking**\
  Store a targeted subset of measurements - such as cycle counts, downtime events, quality rejects, and production rates - from specific tags. This enables efficient calculation and historical analysis of OEE metrics directly in your preferred database.
* **Long-Term Data Retention for Compliance**\
  Retain process-critical data or regulatory measurements in a secure, queryable SQL database (such as TimeScaleDB or, in future, SQL Server) to meet compliance requirements for traceability and audit trails.
* **Custom Reporting & Business Intelligence**\
  Feed measurement data into BI tools or custom dashboards by writing measurements to a historian that’s accessible to your enterprise reporting infrastructure.
* **Cross-System Integration**\
  Make selected operational data available to IT or business systems, ERP, or MES by writing measurements from Edge into a centralized, SQL-based historian.
* **Data Archiving**\
  Archive a subset of key measurements from Edge devices and connectors for backup, disaster recovery, or later review - without sending all raw field data to the cloud.
* **Selective Data Storage**\
  Optimize your storage and network usage by only persisting tags and measurements that are most relevant for your business KPIs, instead of archiving every data point collected at the Edge.

These use cases make the Historian Data Connector a powerful tool for bridging your IIoT data model with the broader IT landscape - supporting both operational needs and strategic decision making.

***

### Configuring the Historian Data Connector

#### 1. Add a New Connector

* Select the **Area** node where you want to configure Modbus RTU integration.
* Go to the **Data connectors** tab.
* Click **+ New data connector**, choose **Historian**, and enter a name (e.g., `Historian`).

<figure><img src="https://570593659-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYMGRODsc2QD3N3wmfwTl%2Fuploads%2FD2ytcJ8RDjm0Z5XggisC%2Fimage.png?alt=media&#x26;token=6af8ac74-1010-4e53-bc30-4a7f3f94c919" alt="" width="563"><figcaption><p>Add a new Data Connector</p></figcaption></figure>

#### 2. Configure Connection Settings

<figure><img src="https://570593659-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYMGRODsc2QD3N3wmfwTl%2Fuploads%2FU7xf48Pagq9wOytspWVJ%2Fimage.png?alt=media&#x26;token=79d1c8fc-9e4b-4e6f-8e1a-c1b4d51dcea1" alt="" width="374"><figcaption><p>Configuration of Historian Connector</p></figcaption></figure>

* **Name:** Friendly name for your connector (e.g., `Historian`).
* **Enabled:** Toggle to activate or deactivate this connector.
* **Historian Type:** Select `TimeScale DB` (support for additional databases will be available in the future).
* **Database Name:** Name of your target database (e.g., `mydatabase`).
* **Historian Address:** Hostname or IP address of your database server (e.g., `123.10.10.153`).
* **Historian Port:** Port number for the database connection (default for TimeScaleDB/Postgres is `5432`).

#### 3. Authentication

* **Username:** Database username (e.g., `nexusclient`).
* **Password:** Password for the database user.

#### 4. Batched Storage

There are two ingestion modes available:

* **Batched (recommended for most scenarios)**\
  Batching measurements is a way to reduce load on the historian module, but has the disadvantage that it introduces a delay before measurements are available on the historian. Measurements are buffered and written in batches using:
  * **Maximum storage interval:** Maximum time to buffer measurements before writing them in a batch (e.g., 1 minute).
  * **Maximum batch size:** Maximum number of measurements per batch (e.g., 500). Set to optimize between latency and performance.
* **Immediate (per-sample writes)**\
  Store each measurement as soon as it’s produced. This minimizes latency but increases write IOPS and CPU usage.

{% hint style="info" %}
**Performance guidance:** Start with **batched** ingestion and tune the interval/size to your device and workload. Use **immediate** writes only for critical, low-latency signals and monitor system load (CPU, disk I/O) to avoid contention.
{% endhint %}

***

#### Example Historian Connector Configuration

| Setting                  | Example Value |
| ------------------------ | ------------- |
| Historian Type           | TimeScale DB  |
| Database Name            | mydatabase    |
| Historian Address        | 123.10.10.153 |
| Historian Port           | 5432          |
| Username                 | nexusclient   |
| Password                 | ••••••••••    |
| Measurement Batching     | Enabled       |
| Maximum Storage Interval | 1 minute      |
| Max Batch Size           | 500           |

***

### Best Practices

* **Use batching** to optimize storage performance and minimize network traffic, especially for high-frequency data streams.
* **Choose meaningful connector names** to simplify troubleshooting and system management.
* **Secure your database** by using strong credentials and network security best practices.
* **Monitor storage intervals and batch sizes** to ensure you meet your latency and data retention requirements.
* **Plan for growth:** As support for more historian types becomes available, review your architecture for best-fit options.
