Arrays: Storing time in arrays

This is running in a Tstat10. I am not sure what is happening but I would expect Var31 and Var32 to have the same value.
image

1 Like

I would give this a try using the units of TIME to get started. Then the math and logic becomes easier.

IF VAR30 > 0:0:30 THEN START OUT1 ELSE STOP OUT2
IF VAR30 > 0:01:00 THEN VAR30 = 0:0:0
VAR31 = TIME-OFF( OUT2 )
AY2[1] = VAR31
IF VAR31 = VAR32 THEN START VAR33 ELSE STOP VAR33

All vars here are in the units of TIME. You may need to convert TIME to seconds to store them in the array, not sure how the array holds vars but I think its integer. Then deconvert back to TIME to do logic on the contents of the array.

I wrote this code fragment for the purpose of demonstrating what I am finding confusing. It is my understanding that all values regardless of type are stored internally as 16bit values and the units are essentially used for ease of reading. If that is the case copying a value in and out of array should not change its value but it appears to be doing so.

Correct. The arrays are integer only. The vars have a lot more features and ranges.

Sorry about this. If its a big project we can have a look at it with you. We are swamped right now. If theres anyone that can help, I can pay.

I can work without using arrays for now. It is an unexpected behavior that should be corrected when it is possible…

As I see it the system is working as it should. In order to store items with a range setting of TIME, you will need to convert everything to seconds first.

Maurice