12-09-2020 06:56 AM
@Broken_Arrow wrote:
@crossrulz wrote:
Well, I must point out the obvious first...
1. Local and/or Global variables - I inherited a test system that used locals to pass data between loops and it worked perfectly...on a P4 processor. Took it to an Intel Core 2, and only every 5th data point was saved. I rewrote that code to use queues.
2. Functional Global Variables - These are a little less obvious since they immediately look like they are protecting against race conditions, but if they are just "get" and "set", ...
The program has tons of Locals
The program has tons of Globals
But moreso, the program has tons of FGs with just Set & Get. It seems this code was written when FGs were all the rage. "Look mom, no Globals". Yeah rite.
The code is full of asynchronous parallel structures, and a complex XControl, which is an asynchronous parallel structure with land mines.
In other words, you got lucky for 10 years and a new (faster/more parallel) computer exposed all of your architectural technical debt. Start the refactor/rewrite process with a good architecture.
12-10-2020 08:24 AM
I've had issues just from upgrading computers, where the device under test use to wait for the computer but now the computer waits for the DUT and thinks it's not there and throws an error.
06-01-2021 03:20 PM
@Broken_Arrow wrote:
But moreso, the program has tons of FGs with just Set & Get. It seems this code was written when FGs were all the rage. "Look mom, no Globals". Yeah rite.
That's not a "Functional" Global, but simply a LabVIEW 2 style global. In LabVIEW 2 there were no globals and this was the way to make them anyways.
A Functional Global has some "function" to it that is supposed to protect all updating accesses. The Set (or better yet Init) method is only supposed to be called during application startup when no tasks (parallel loops) have been started up yet, to define a specific starting value. The Get can be available but all updates to the stored value are supposed to happen as an extra method such as Increment, Add, Subtract, etc, etc. To make them a little more distinguished, many people referred to them rather as IGV (Intelligent Global Variable).
The Set/Get FGV is basically adding the worst of two worlds together:
The overhead of subVI calls and the race conditions of standard global variables.
06-01-2021 03:57 PM
@rolfk wrote:
@Broken_Arrow wrote:
But moreso, the program has tons of FGs with just Set & Get. It seems this code was written when FGs were all the rage. "Look mom, no Globals". Yeah rite.
That's not a "Functional" Global, but simply a LabVIEW 2 style global. In LabVIEW 2 there were no globals and this was the way to make them anyways.
A Functional Global has some "function" to it that is supposed to protect all updating accesses. The Set (or better yet Init) method is only supposed to be called during application startup when no tasks (parallel loops) have been started up yet, to define a specific starting value. The Get can be available but all updates to the stored value are supposed to happen as an extra method such as Increment, Add, Subtract, etc, etc. To make them a little more distinguished, many people referred to them rather as IGV (Intelligent Global Variable).
The Set/Get FGV is basically adding the worst of two worlds together:
The overhead of subVI calls and the race conditions of standard global variables.