Import Tag History
VTScada can import history data from CSV files that you provide. This is typically done when you have data that was collected outside VTScada and want to bring it into your SCADA system.
This feature has no user interface. All that is required is to create tags and files according to the following conditions, then restart VTScada. If operational needs prevent you from stopping VTScada on the workstation, then you can use the Source Debugger to set a property that will trigger the import.
There are strict requirements for the CSV history files. The import will not succeed unless all of the following conditions are met precisely.
- Spreadsheet programs can add extra formatting that will ruin the import. Ensure that your files match the examples in this topic exactly.
- Do this work on the current primary historian server.
- You must create a folder named CSVHistory within your application's Data folder structure.
- (e.g. C:\VTScada\MyApplication\Data\CSVHistory)
- Copy the CSV history files to this folder.
- Files are destroyed after importing so that the data will not be imported twice. Save a copy elsewhere.
- CSV history files can have any name.
- Each file may contain data for only one tag.
- Data for any given tag may be split across multiple files.
- Within the CSVHistory folder, create a text file named TagMapping.CSV
- For each file that is to be imported, TagMapping.CSV must contain a line mapping that file to an existing VTScada tag name:
TagHistoryFile_1.CSV,Full\Path\To\VTScadaTagName_1
TagHistoryFile_2.CSV,Full\Path\To\VTScadaTagName_2
(Do not copy "Full\Path\To\". This is meant as an example. Use the full name of your VTScada tags. If tag names have spaces, include those here.)
- The VTScada tags must exist and must have a link to a Historian.
- Each CSV history file must have exactly the following structure:
UTC TimeStamp_1,Value_1
UTC TimeStamp_2,Value_2
- If the comma or value is missing, the timestamp will be imported but the value will be logged as Invalid.
- Values that begin with a space will be logged as Invalid.
- The time stamp must be UTC and must be in the form:
YYYY-MM-DD HH:MM:SS.mmm
(If working Excel to generate the CSV, that would be YYY-MM-DD HH:MM:SS.000
)
- Future data or data prior to Jan 1, 1970 is considered out of range and will not be imported.
- The time stamps must be in chronologically ascending order.
Restart the application. The values will be imported to the local Historian. If there are backup Historians, data will not be synchronized to those machines until they are restarted. Note that this will generate a large amount of network traffic and should be done at an otherwise quiet time.
If you may not restart the application on this workstation, do the following:
- Open the VTScada Source Debugger application.
- Select your application from the list of running applications.
- Select CSVHistoryImporter within the module tree.
- Scroll through the module list to find and select DoImport.
- Set this value to 1.
DoImport will reset to 0 following the import operation. TagMapping.CSV will be deleted only if all listed files are imported successfully.