06-15-2020 03:40 PM
Hi all,
I just started learning Classes and I have doubt when converting my existing project to OOP based.
To read Digital Input from NI devices, normally I make a parallel loop that keep acquire the boolean array and shove it into an FGV, then use it wherever I need. I intended to translate it into something like this (just ignore the local variable :D)
1) (Aside from the Parent/Child selector) Is this okay, or it's not recommended? I read in another thread that FGV and OOP shouldn't be used together in one architecture for easier trace and debugging. Though personally I prefer option 2 to prevent clutter when using more devices. I put the global outside the class method just in case i want to use more than 1 device, but basically it's part of the class that should be configured be used when someone using this class.
2) Since DVR doesn't work with dynamic dispatch, is there any way to work around it? Let's say I want to change the hardware from NI to something that use Modbus, which of course have different initialization and read method.
I want to make sure I get the basic right before continuing. Any input is appreciated and thanks!
06-15-2020 04:46 PM
Your picture is too small and to blurry. And I can't open a .rar.
06-15-2020 05:22 PM
@paul_cardinale wrote:
Your picture is too small and to blurry.
Hover over the picture and click on the icon that shows up at the upper right. That will open the picture full size in a new tab.
(Newly added forum feature in the last few weeks.)
06-15-2020 05:42 PM
Sorry paul,
Here is the .zip version. As for the picture, that's a vi snippet though. I can click to zoom it on my laptop.
Note: I'm using LV2018 on Win10 Home
06-16-2020 12:52 PM
It seems kind of odd to have a loop that's constantly reading devices and then putting the data someplace to be read later.
I'm generally opposed to mirroring data (unless there's a really good reason to do so).
Why not just read the devices as you need the data?
As for workarounds for no DD with DVRs, there's not much. You can use an In Place Element structure to dereference the DVR, or
you can use the attached files.
06-16-2020 01:02 PM
Seems like you should just be using a simple Producer/Consumer.