Relay Set toggling between Indexes?

During testing we noticed we are getting error “-44040: invalid relay index”

Upon further investigation, we noticed that inside our compressor control loop (in periodic tasks) the WPI_RelaySet.vi is somehow toggling between relay 1, 2, and 3 by itself and also switching between forward, reverse and off relay modes.

I probed the inputs to this subvi *inside *the compressor control vi, everything is perfect. RelaySet *should *be getting Relay 1 as the index and forward as the relay mode, but probing inside RelaySet, even the controls are toggling uncontrollably.

We do use two other relays (solenoids) but they’re on totally different controls. I checked and we don’t have the same relay set anywhere else in the project.

Anyone know what’s going on? This is causing us headaches and lots of frustration :mad:…

This is expected. The same WPI_RelaySet gets called for all relays, so you’re seeing the data from all calls, not just from where you went into it.

Are you actually having a problem, or just trying to find out why that error message is printing?

The error string should contain an ASCII call stack. It list the lowest node or VI->calling VI->calling VI->etc.

If there are multiple calls to the same node or subVI, on that diagram, then you have to debug which one, but often it is unique.

Does this help determine which refnum wasn’t opened properly, or which didn’t stay opened?

Greg McKaskle

Are you actually having a problem, or just trying to find out why that error message is printing?

This is a big problem because it’s only that specific RelaySet that throws errors and it makes Teleop run and abort at the same rate of change of the index. During teleop, it also makes the relay light on the sidecar toggle between red and green very quickly and following no pattern. We only have *one *compressor also. The other RelaySets for the solenoids work fine.

Because Teleop runs/stops at the same rate as the change in relay index in this compressorloop, I’m led to believe this Relay vi is the problem.

The error string should contain an ASCII call stack. It list the lowest node or VI->calling VI->calling VI->etc.

The call stack leads like this: …Periodic Tasks.vi>CompressorControlLoop.vi>WPI_RelaySet.vi>RelayCache.vi
The error meassage reads: “The relay index is invalid

The sporadic toggling of which relay index is the correct one begins in Relay set, starting with the controls; i mean sporadic in the most literal sense.

Please show us the code where you’re opening the compressor in Begin, and where you’re calling its control loop in Periodic Tasks.

You can select the relevant section of the Begin.vi, then choose “Create VI Snippet from Selection” from the Edit menu. It’ll create a .png file with the name and location you select, which you can then attach here. We’ll be able to see the picture easily, and it will be live LabVIEW code that we can run if we want to check something for more detail.