Historian: Store & Trend Data (Tutorial) teaches you to:
- Configure historian storage
- Select tags for logging
- Create trend displays
- Query historical data
Prerequisites:
- Add Tags to UNS (Tutorial) - uses TankFarm tags
In this page:
Configure Storage Location
- Optional (You can the default TagHistorian DB)
- Navigate to Historian → Storage
- Configure database:
Default SQLite (Development):
- Type: SQLite
- Path: Default or custom
- File Size: 1GB per file
- Auto-create: Yes
SQL Server (Production):
- Type: SQL Server
- Server:
SQLServer\Instance
- Database:
FrameworX_History
- Authentication: Windows/SQL
Create Historian Tables
- Go to Historian → Tables
- Create table:
Process Data:
- Name:
ProcessData
- Type: Continuous
- Storage: 1 second resolution
- Retention: 90 days
- Compression: Deadband
Production Counters:
- Name:
Production
- Type: Counter
- Storage: On change
- Retention: 365 days
Configure Tags for Logging
- Navigate to Historian → Tags
- Add tags to log:
Analog Value:
- Tag: TagFarm/
Tank1/Temperature
- Table:
ProcessData
- Deadband: 0.5
- Rate: 10 seconds
Digital Value:
- Tag: TagFarm/Tank1/
MotorRunning
- Table:
ProcessData
- Log: On change only
Production Count:
- Tag:
Units_Produced
- Table:
Production
- Type: Counter/Totalizer
Create Trend Display
- Open Displays → New
- Add TrendChart page
- Configure:
Basic Setup:
- Duration: 1 hour
- Update: 1 second
- X-Axis: Time
- Y-Axis: Auto-scale
Add Pens:
- Pen 1: TankFarm/
Tank1/Temperature
(Blue) - Pen 2: TankFarm/
Tank1/Pressure
(Red) - Pen 3: TankFarm/
Motor/Running
(Green, digital)
Configure Trend Features
Time Navigation:
- Enable pan and zoom
- Add time selector
- Quick ranges: 1hr, 8hr, 24hr, 7 days
Analysis Tools:
- Cursors for value reading
- Min/Max/Average display
- Export to CSV
Query Historical Data
Using SQL queries:
sql
SELECT Timestamp, TagName, Value
FROM ProcessData
WHERE TagName = 'Tank1_Temperature'
AND Timestamp > DATEADD(day, -7, GETDATE())
ORDER BY Timestamp
Using Scripts:
csharp
DataTable history = @Historian.GetData(
"Tank1_Temperature",
DateTime.Now.AddDays(-7),
DateTime.Now,
1000 // Max points
);
Create Reports
- Reports → New
- Add data source:
- Type: Historian Query
- Tags: Select multiple
- Period: Shift/Day/Month
- Aggregation: Average, Min, Max
Storage Management
Configure data management:
Compression:
- Deadband: ±0.5% of range
- Time deadband: 60 seconds
- Compression deviation: 1%
Archiving:
- Archive after: 30 days
- Archive location: Network path
- Compression: ZIP
Purging:
- Auto-purge: After retention period
- Manual purge: By date range
Test Historian
- Start Runtime
- Let run for few minutes
- Open trend display
- Verify:
- Data logging active
- Trends updating
- Historical data visible
- Zoom/pan working
Performance Optimization
- Log only necessary tags
- Consider multiple historian table with distinct triggers
- Monitor disk space
Next Steps
- [Create Dashboards] - Historical KPIs
- [Reports Module] - Automated reports
- [Datasets Module] - SQL analysis
In this section...