# Historical Replay / Simulation System

**URL:** <https://forum.inductiveautomation.com/t/historical-replay-simulation-system/6920>\
**Category:** Ignition\
**Created:** [July 24, 2013, 2:38am UTC](https://forum.inductiveautomation.com/t/historical-replay-simulation-system/6920 "2013-07-24T02:38:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaronmuir](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@aaronmuir](https://forum.inductiveautomation.com/u/aaronmuir)\
**Post date:** [July 24, 2013, 2:38am UTC](https://forum.inductiveautomation.com/t/historical-replay-simulation-system/6920/1 "2013-07-24T02:38:12Z")

</div>

Hey all!

I have recently purchased the Ignition SQL Bridge module with hopes and dreams of setting it up to log process variables on an existing system… and then “replay” those values back into a controllogix processor to simulate the realtime process in the PLC.

I have a laptop with Ubuntu 12.04, latest & licensed version of Ignition SQL Module, and PostgreSQL talking to my Controllogix over EtherNet/IP.

Here’s where I’m at so far. So far… I’m just logging 1 real value using a Historical Group using timestamps. From there, I’ve created a SQL query tag that polls the database at a specified interval and writes a value back to the PLC.

SQL TAG Query:  
SELECT HIST\_PV  
FROM TEST  
WHERE t\_stamp \>= NOW()- ‘{[~]ReplayDateDiff}’::INTERVAL  
ORDER BY t\_stamp ASC  
LIMIT 1;

HIST\_PV is the column where I’m storing data. ReplayDateDiff is the tag where I’m storing my time span difference.

Now I need to do this for about ~400 tags and want to make sure that I get it right before I deploy this system to collect.

It seems like my approach is going to be tedious to configure, but I don’t know how else to do it. Do any of you have any suggestions for better ways to do this?

---

<div class="post-metadata">

**Author:** ![Robert.McKenzie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert.mckenzie/32/4134_2.png) [@Robert.McKenzie](https://forum.inductiveautomation.com/u/Robert.McKenzie)\
**Post date:** [November 25, 2013, 10:59pm UTC](https://forum.inductiveautomation.com/t/historical-replay-simulation-system/6920/2 "2013-11-25T22:59:47Z")

</div>

There are a couple ways to get a value at a specific time, but most will be pretty tedious. You could use the SQLTags Historian to do it, that system will take in a time range and an interval for the Sample Size. Once you have your list of tags you can call system.tag.queryTagHistory() (or just use a SQLTag History binding on a dataset) to get the values you want with the right interval.
