General Discussions
Timestamp only when tag value changes

Hi there,

I have recently ventured into trying VTSCADA and I really REALLY like it.

I use scada systems for very simple lab based data aquisition and control. Very seldom more than 15 tags.

My challenge is that I need to aquire a timestamp ONLY when a certain tag value changes. The tag is basically a totaliser (Analog input from MCU). This is very simple to do in the likes of SCADABR and Winlog scada packages (Checkbox), but I cannot seem to figure it out using VTSCADA. Do I need to add a script to do this?

Any assistance or a prod in the right direction will be highly appreciated.

Regards,
Jan
South Africa.

Hi there, I have recently ventured into trying VTSCADA and I really REALLY like it. I use scada systems for very simple lab based data aquisition and control. Very seldom more than 15 tags. My challenge is that I need to aquire a timestamp **ONLY** when a certain tag value changes. The tag is basically a totaliser (Analog input from MCU). This is very simple to do in the likes of SCADABR and Winlog scada packages (Checkbox), but I cannot seem to figure it out using VTSCADA. Do I need to add a script to do this? Any assistance or a prod in the right direction will be highly appreciated. Regards, Jan South Africa.

If you use status tags, we only log when the value itself changes. So you can use a calculation tag with an expression -

[MyTagName]\Timestamp

This will return the time stamp in UTC time. Note that the timestamp is the number of seconds since midnight Jan 01/1970.

If you make the calculation tag a child of the status tag, you could use an expression such as -

concat(Date([numeric]\Timestamp/ 86400, 4), " - ", Time([numeric]\Timestamp% 86400, 2))

If you draw the calc tag as text, this should show the date and time in a readable format. Again, in UTC time.

If you use status tags, we only log when the value itself changes. So you can use a calculation tag with an expression - [MyTagName]\Timestamp This will return the time stamp in UTC time. Note that the timestamp is the number of seconds since midnight Jan 01/1970. If you make the calculation tag a child of the status tag, you could use an expression such as - concat(Date([*numeric]\Timestamp/ 86400, 4), " - ", Time([*numeric]\Timestamp% 86400, 2)) If you draw the calc tag as text, this should show the date and time in a readable format. Again, in UTC time.

Doug Spurrell

Thank you Dougs,

Then my next obvious question, will the data plot also only update as the tag value changes? I have tried triggers etc but to no avail.

Again, much appreciated.
Jan

Thank you Dougs, Then my next obvious question, will the data plot also only update as the tag value changes? I have tried triggers etc but to no avail. Again, much appreciated. Jan

With one caveat -

The Historical Data Viewer (HDV) trends logged data. The data should log immediately as it updates. You do have to check the Historian tab of the analog status tags. The bottom box is the dead band box. To reduce the amount of data that gets logged, the value must change by plus or minus this amount. If the box is empty, it is using the default value. Check the text just above on the box label and see what the default dead band is. It is normally calculated as a percentage of the scaling on the tag. If you are trending calculation tags or totalizers or anything with a large scale, the dead band might not be logging smaller changes.

Also, remember that the trend itself is a straight line average between any two logged values. If you want to see what is exactly being recorded and logged, go to grid view. At the top, there is drop down box that indicates average. Select Raw and you should see what VTScada actually recorded. You can also do a Standard or Detail report on the report page to see the logged values along with the timestamps.

With one caveat - The Historical Data Viewer (HDV) trends logged data. The data should log immediately as it updates. You do have to check the Historian tab of the analog status tags. The bottom box is the dead band box. To reduce the amount of data that gets logged, the value must change by plus or minus this amount. If the box is empty, it is using the default value. Check the text just above on the box label and see what the default dead band is. It is normally calculated as a percentage of the scaling on the tag. If you are trending calculation tags or totalizers or anything with a large scale, the dead band might not be logging smaller changes. Also, remember that the trend itself is a straight line average between any two logged values. If you want to see what is exactly being recorded and logged, go to grid view. At the top, there is drop down box that indicates average. Select Raw and you should see what VTScada actually recorded. You can also do a Standard or Detail report on the report page to see the logged values along with the timestamps.

Doug Spurrell

Hi Dougs,

Thanks for the help. I understand what you are saying but I think my intention is perhaps not getting across properly.

I have a number of hall sensors as input status elements in a small MCU. At rest, the output is (1). When the magnet lifts, the output becomes (0), then after about 2 seconds, the magnet returns to rest and the output becomes (1). In the scada, I reverse the output. Thus far I implemented a counter in the MCU and that is read as an incremental integer (analog status) into VTScada.

When the magnet detaches from the hall sensor, I need a single timestamp and a single incremental integer displayed visually (as well as logged). When I view the grid display with raw data selected, the timestamp and value is logged, but when the magnet returns, another timestamp is logged, but no data. So I end up having gaps in the data. Also, I wish it was possible to also show only a single point and timestamp on the plot, i.e. no averaging, just single datapoints connected by line versus time. This is easily done in many Scada packages.

I think the main challenge is that the hall sensor output is not really a pulse but rather a toggle.

I wonder, could I define a totalizer which I can plot and log as per the above? Or a counter perhaps?

I think I am really stuck....

Regards, Jan

Hi Dougs, Thanks for the help. I understand what you are saying but I think my intention is perhaps not getting across properly. I have a number of hall sensors as input status elements in a small MCU. At rest, the output is (1). When the magnet lifts, the output becomes (0), then after about 2 seconds, the magnet returns to rest and the output becomes (1). In the scada, I reverse the output. Thus far I implemented a counter in the MCU and that is read as an incremental integer (analog status) into VTScada. When the magnet detaches from the hall sensor, I need a single timestamp and a single incremental integer displayed visually (as well as logged). When I view the grid display with raw data selected, the timestamp and value is logged, but when the magnet returns, another timestamp is logged, but no data. So I end up having gaps in the data. Also, I wish it was possible to also show only a single point and timestamp on the plot, i.e. no averaging, just single datapoints connected by line versus time. This is easily done in many Scada packages. I think the main challenge is that the hall sensor output is not really a pulse but rather a toggle. I wonder, could I define a totalizer which I can plot and log as per the above? Or a counter perhaps? I think I am really stuck.... Regards, Jan

The line drawn between two points is a straight line connecting two logged points - the same as other packages. Which makes it a straight average. We do not highlight or emphasise the actual logged points in anyway. Trying to do that for data logging every second or fraction of a second just wouldn't be possible,

Can this be set up as a digital status tag? Have a look at our digital statistics tag. It has counters built into it. We also do have counter and totalizer tags.

The line drawn between two points is a straight line connecting two logged points - the same as other packages. Which makes it a straight average. We do not highlight or emphasise the actual logged points in anyway. Trying to do that for data logging every second or fraction of a second just wouldn't be possible, Can this be set up as a digital status tag? Have a look at our digital statistics tag. It has counters built into it. We also do have counter and totalizer tags.

Doug Spurrell

Jan,

What is the purpose of the timestamp? It sounds like what you really need is an event when this value changes. You could then draw a filtered alarm list to see all the times at which the value went high.

But if you really need it in the data historian, it sounds like you could get rid of the blank value at the low state either by using Doug's timestamp script on a totalizer tag counting positive transitions or a latching script.

Jan, What is the purpose of the timestamp? It sounds like what you really need is an event when this value changes. You could then draw a filtered alarm list to see all the times at which the value went high. But if you really need it in the data historian, it sounds like you could get rid of the blank value at the low state either by using Doug's timestamp script on a totalizer tag counting positive transitions or a latching script.
edited Apr 27 '18 at 3:58 pm
378
6
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft