tvey
Lifetime Supporting Member
Hi folks,
I am using a vba sub in RSView32 to perform some statistical calculations on some tag data contained in a data log.
I would like the operator to be able to specify the interval at which these calculations are performed.
I configured an Event that compares the current value of the "system\DateAndTimeInteger" tag to the value of a tag called "dtLastStatCalcTime" and to the operator's desired interval.
After the calculations are complete, I want to set "dtLastStatCalcTime" to the current value of the "system\DateAndTimeInteger".
I've tried a couple of different methods to set "dtLastStatCalcTime": 1) inside the VBA sub and 2) inside a macro that calls the vba sub.
Both methods exhibit similar behaviour - sometimes the value of "dtLastStatCalcTime" ends up GREATER than the current value of "system\DateAndTimeInteger", and sometimes it doesn't seem to get updated at all! However, regardless of the actual outcome the activity log shows that the tag WAS in fact set.
The simplest test case I can think of seems to have the same problem:
1. Create an analog tag called "nTest". (give it a max value of 2147395600)
2. Add a button to a screen and set the action of the button to "Set nTest system\DateAndTimeInteger"
3. Display, on the same screen, the current value of "nTest" next to the current value of "system\DateAndTimeInteger".
4. Click the button a few times. Sometimes "nTest" will get updated, sometimes it will end up GREATER than "system\DateAndTimeInteger", and sometimes it won't be updated at all.
What am I missing?
-Trevor
I am using a vba sub in RSView32 to perform some statistical calculations on some tag data contained in a data log.
I would like the operator to be able to specify the interval at which these calculations are performed.
I configured an Event that compares the current value of the "system\DateAndTimeInteger" tag to the value of a tag called "dtLastStatCalcTime" and to the operator's desired interval.
After the calculations are complete, I want to set "dtLastStatCalcTime" to the current value of the "system\DateAndTimeInteger".
I've tried a couple of different methods to set "dtLastStatCalcTime": 1) inside the VBA sub and 2) inside a macro that calls the vba sub.
Both methods exhibit similar behaviour - sometimes the value of "dtLastStatCalcTime" ends up GREATER than the current value of "system\DateAndTimeInteger", and sometimes it doesn't seem to get updated at all! However, regardless of the actual outcome the activity log shows that the tag WAS in fact set.
The simplest test case I can think of seems to have the same problem:
1. Create an analog tag called "nTest". (give it a max value of 2147395600)
2. Add a button to a screen and set the action of the button to "Set nTest system\DateAndTimeInteger"
3. Display, on the same screen, the current value of "nTest" next to the current value of "system\DateAndTimeInteger".
4. Click the button a few times. Sometimes "nTest" will get updated, sometimes it will end up GREATER than "system\DateAndTimeInteger", and sometimes it won't be updated at all.
What am I missing?
-Trevor