LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write trace to Citadel

I'm trying to take spreadsheet data and write it to individual traces inside DSC2012 to a Citadel 5 database. I keep getting an error -1967386570 Data has Back in time timestamp.

 

Searching the NI website, back in 2006 there was a way to do this with a vi server.

http://www.ni.com/white-paper/3485/en

Is this still possible with the current DSC version?

 

From the 2012 DSC help file.

 

Writing a Value to a Citadel Trace (DSC Module)

You can use the Write Trace VI to append a data point to a Citadel trace. Complete the following steps to write a value:

  1. Add the Write Trace VI on the block diagram.

     Add  Find
  2. Wire the trace reference output of the Open Trace VI to the trace referenceinput of the Write Trace VI.
  3. Wire the value and timestamp inputs of the Write Trace VI. Leave the timestamp input unwired to use the current time. The Write Trace VI fails if the timestamp input is earlier than the timestamp of the last point written to the trace. You can determine the timestamp of the last point in the trace using the Get Trace Info VI.

 

So, is it no longer possible to write old data into Citadel traces?

I also saw some posts about a registry key for Citadel 5 about server timestamps, but I don't see a registry key where that note says it should be located.

 

Logging Back-in-Time

Most data logging systems generate ever-increasing time stamps. However, if you manually set the system clock back-in-time, or if an automatic time synchronization service resets the system clock during logging, a back-in-time data point might be logged. Citadel handles this case in two ways.

When a point is logged back-in-time, Citadel checks to see if the difference between the point time stamp and the last time stamp in the trace is less than the larger of the global back-in-time tolerance and the time precision of the subtrace. If the time is within the tolerance, Citadel ignores the difference and logs the point using the last time stamp in the trace. For example, the Shared Variable Engine in LabVIEW 8.0 and later uses a tolerance level of 10 seconds. Thus, if the system clock is set backwards up to ten seconds from the previous time stamp, a value is logged in the database on a data change, but the time stamp is set equal to the previous logged point. If the time is set backwards farther than 10 seconds, Citadel creates a new subtrace and begins logging from that time stamp.

Beginning with LabVIEW DSC 8.0, you can define a global back-in-time tolerance in the system registry. Earlier versions of DSC or Lookout always log back-in-time points. Use the backInTimeToleranceMS key located in the HKLM\SOFTWARE\National Instruments\Citadel\5.0 directory. Specify this value in milliseconds. The default value is 0, which indicates no global tolerance.

 

This key doesn't exist on my system.

 

This link from July 2012 seems to mention that it is still possible to use custom timestamps.

http://www.ni.com/white-paper/6579/en

 

Citadel Writing API

The DSC Module 8.0 and later include an API for writing data directly to a Citadel trace. This API is useful to perform the following operations:

· Implement a data redundancy system for LabVIEW Real-Time targets.

· Record data in a Citadel trace faster than can be achieved with a shared variable.

· Write trace data using custom time stamps.

The Citadel writing API inserts trace data point-by-point with either user-specified or server-generated time stamps.

 

Is there some more documentation out there that explains this process a bit better?

 

0 Kudos
Message 1 of 4
(3,013 Views)

I figured out a way around my issue for now. I added 31536000 to the timestamp value to move it to the same date for the next year. Not a huge issue, but I would like to be able to save data with the original custom timestamps that are back in time.

0 Kudos
Message 2 of 4
(2,975 Views)

Hi unclebump,

 

I have been trying to determine what the best course of action would be and I think you need to move the data to a new trace. What I am thinking is for you to open a reference to the trace as it currently exists. Then you will need to read in all the data of that trace. While you read that trace you should also be reading in the data from your file. Once you have both sets of data you will need to iterate over all the data and merge the two sets of data based off their timestamps. The VIs to accomplish this should all exist in the DSC Palette >> Historical or DSC >> Historical >> Database Writing. There is a writing example in the example finder that is called Database Direct Write Demo that would probably be worth looking at. The write trace help says, "

This VI returns an error if you try to write a point with a timestamp that is earlier than the timestamp of the last point written to the trace." which means that if your data is merged and written in order you should not get this error.

 

Hope this helps and let me know if you have any questions.

Patrick H | National Instruments | Software Engineer
0 Kudos
Message 3 of 4
(2,974 Views)

I think I figured it out. My original data in the excel file, had the most recent data in the top rows. So I was trying to write the data to Citadel in the wrong order. Not quite the same message that you get when you make the stop timestamp before the start timestamp.

0 Kudos
Message 4 of 4
(2,964 Views)