08-07-2023 09:11 PM
Hello.
I have a subsequence in a new thread and an action VI. This action VI can change the fileglobal value (read and write) which the subsequence would then act on this fileglobal value. However, it is very prone to data overflow/buffering errors.
One way is to check if the fileglobal value has changed for every iteration before the subsequence can be called. How do I do this and is there any other way to optimise this process? The fileglobal values changes very fast (like 0.1s).
08-08-2023 12:30 AM
Can you please specify a use case / a user story?
Understanding what you are actually trying to achieve greatly helps finding a solution 😊
08-08-2023 01:59 AM
A use case would be let's say the fileglobals is a value like 25, I have a subvi which can adjust the fileglobals from 25 to 5. I can choose to stop at any value from 5 to 25. The subsequence (in a new thread) will then do an action according to the current fileglobal value. However, since the fileglobals value are send very quickly, it will cause a data overflow error.
08-08-2023 08:22 AM
My understanding is that you are trying to exchange data between two threads with the producer (the VI) writing data into a the FileGlobal variable in one thread and the Producer (the subsequence) consuming the data and executing stuff according to the actual value of the FileGlobal.
You are describing the occurence of a data overflow error. How does this manifest itself? Is there a runtime error? Is there any looping involved?
Can you possibly provide a stripped down version of your code?
08-09-2023 10:29 PM
I cannot provide the code unfortunately. But I have reduced the occurrence by assigning the fileglobal.a to a locals.b, then adding a precondition to the action that locals.b!=fileglobal.a. That way, the action would only activate if there is any change in the fileglobal.
However, I will add another action in which the fileglobal can be tuned more finely. I will ask this in a separate thread.