01-20-2022 02:04 PM
@Mark_Yedinak wrote:
I would avoid using shared variables as your means of communications. Shared variables are not that reliable for a variety of reasons. Better methods of communicating between application components are to use queues, user events, notifiers or channel wires. More complex systems like the ones I use will have more advanced communication mechanisms such as the publish/subscribe messaging system.
I didn't mention this yet, but I am using a compactRIO. I think the main reason I use shared variables a lot is because that's what Real Time 1 course from NI said to do. Also, since it's a compactRIO then user events would not be a good idea, correct? Since those don't really work on RIO's from what I understand. No front panel software or something
01-20-2022 02:08 PM
Hi David,
@David99999 wrote:
I didn't mention this yet, but I am using a compactRIO. I think the main reason I use shared variables a lot is because that's what Real Time 1 course from NI said to do. Also, since it's a compactRIO then user events would not be a good idea, correct? Since those don't really work on RIO's from what I understand. No front panel software or something
You should have mentioned that right from beginning!
01-20-2022 02:14 PM
@GerdW wrote:
Hi David,
You should have mentioned that right from beginning!
- Just because NI recommends SVs in RT1 course you should not rely on them for more advanced topics. There are better options as mentioned before. There are also RT-FIFOs...
- You can use user-defined events, but not UI events (like ValueChange or MouseMove).
Count on me to leave vital information out 😁
And RT-FIFO's are for making sure you grab all the data, where you may be data logging, no? A lot of my shared variable usage (so far) has just been for utilizing the latest value
01-20-2022 02:22 PM
@David99999 wrote:
@Mark_Yedinak wrote:
I would avoid using shared variables as your means of communications. Shared variables are not that reliable for a variety of reasons. Better methods of communicating between application components are to use queues, user events, notifiers or channel wires. More complex systems like the ones I use will have more advanced communication mechanisms such as the publish/subscribe messaging system.
I didn't mention this yet, but I am using a compactRIO. I think the main reason I use shared variables a lot is because that's what Real Time 1 course from NI said to do. Also, since it's a compactRIO then user events would not be a good idea, correct? Since those don't really work on RIO's from what I understand. No front panel software or something
Read https://www.ni.com/en-us/shop/compactrio/compactrio-developers-guide.html
Stepping back, I prefer a systems engineering approach to these kinds of projects. Some kind of (high level) system diagram, data flow diagram, and sequence diagram can be very helpful and more efficient than what happens in most cases (as here) where words are being used to describe a system (or its intent). This is generally not common with LabVIEW users and a hidden cost in their approach. I do not think this is always needed but when a certain complexity threshold is passed (and this may be more complex) the systems engineering approach is helpful. Going to code level discussions such as how many loops, events vs queues or this variable type versus another may be too far along than is important.