Mahbod Morshedi Posted March 18, 2023 Report Share Posted March 18, 2023 Hi All, I am currently facing some challenges with my application for data acquisition and processing. Specifically, the data cluster in the system has grown quite large, making it difficult for me to manage, especially when I consider adding new features. I have heard that converting everything to a class is the best approach, but I am unable to find any suitable resources or examples for it. Most of the available information pertains to simple and uncomplicated data types. Can anyone please guide me towards the appropriate resources or provide an example? Thank you, P.S. The data cluster in question is the subject of my inquiry look like this: and this is the class I atempted: Quote Link to comment
ShaunR Posted March 19, 2023 Report Share Posted March 19, 2023 10 hours ago, Mahbod Morshedi said: I have heard that converting everything to a class is the best approach I expect you have. Have you also thought about using an SQLite database ? Quote Link to comment
LogMAN Posted March 19, 2023 Report Share Posted March 19, 2023 13 hours ago, Mahbod Morshedi said: I have heard that converting everything to a class is the best approach Not like this 13 hours ago, Mahbod Morshedi said: , but I am unable to find any suitable resources or examples for it. Most of the available information pertains to simple and uncomplicated data types. Because that is the goal; break down your complex and complicated data types into simple and uncomplicated ones. For configuration data you could maintain the path to the storage location and load the data as needed. 1 Quote Link to comment
ShaunR Posted March 20, 2023 Report Share Posted March 20, 2023 (edited) 20 hours ago, LogMAN said: break down your complex and complicated data types into simple and uncomplicated ones. Break down your complex and complicated data types into a complex and complicated architecture. FTFY Edited March 20, 2023 by ShaunR 2 Quote Link to comment
Mahbod Morshedi Posted March 20, 2023 Author Report Share Posted March 20, 2023 Thank you both for your comments, I undrersatnd that my dta organisaion is a mess here. however i use these almost every where and wanthet to use only one wire across. I am not sure if there is a better way to do that since that can programatically change or vis UI. That is why I wanted to use a class to help me with ubn and bbn of the cluster data. Cheers, Quote Link to comment
Neil Pate Posted March 20, 2023 Report Share Posted March 20, 2023 Making a cluster a class is not going to help at all unless you also take some time to restructure your data. Quote Link to comment
ShaunR Posted March 20, 2023 Report Share Posted March 20, 2023 25 minutes ago, Mahbod Morshedi said: That is why I wanted to use a class to help me with ubn and bbn of the cluster data. If you are going they way I think you are, all you will do is swap [un]bundles for VI's and add a lot of boiler plate. To be fair. You monster cluster isn't really that much of a monster-more like a tribble. My advice (if you're not going to re-architect) would be just to split out the data from the config. Your All Scan data BG and HRS is actually an identical format so you could rationalise that into a single array which will make adding more of the same format easier (just add and index into the array-no need to modify the cluster to add more data). Everything else seems to be config data. Quote Link to comment
Rolf Kalbermatter Posted March 20, 2023 Report Share Posted March 20, 2023 (edited) I would agree that it doesn't quite look "monsterly" but there seems to be some cross contamination between simple configuration stuff and actual test specs or data results or whatever it is. If you talk class it would only be an improvement if you start about taking these apart into more fine grained classes. Some manager class that then can contain the individual test classes. Otherwise you simply replace a somewhat unwieldy cluster through a similar unwieldy class. And that is no real improvement at all. A class simply is a cluster on some steroids anyhow. (Yes I know it is a sloppy statement but for many purposes it is quite accurate). Edited March 20, 2023 by Rolf Kalbermatter Quote Link to comment
Mahbod Morshedi Posted March 20, 2023 Author Report Share Posted March 20, 2023 10 hours ago, ShaunR said: If you are going they way I think you are, all you will do is swap [un]bundles for VI's and add a lot of boiler plate. To be fair. You monster cluster isn't really that much of a monster-more like a tribble. My advice (if you're not going to re-architect) would be just to split out the data from the config. Your All Scan data BG and HRS is actually an identical format so you could rationalise that into a single array which will make adding more of the same format easier (just add and index into the array-no need to modify the cluster to add more data). Everything else seems to be config data. I totally Agree and in fact i had that format originally. However, arrays gets rid of the cluster names and replace them wit the first item's name and for me keeping track was becoming difficult even with documentation. it was just easier to have the clusters that can have different name. I know that i could also use a simple enum for indexing but that would add an extra data that needed to add to my system. I also have a duplicate of BG and HRS as an original data and manipulated data. This way when want i can revert back by replacing the data with the original. I am very new to programming and do not have experience in data organisation and almost nothing about labVIEW classes and the NI documentation is just too simple and is not covering any real life application. That is why I was asking for help. Cheers, Quote Link to comment
ShaunR Posted March 21, 2023 Report Share Posted March 21, 2023 11 hours ago, Mahbod Morshedi said: I totally Agree and in fact i had that format originally. However, arrays gets rid of the cluster names and replace them wit the first item's name and for me keeping track was becoming difficult even with documentation. it was just easier to have the clusters that can have different name. I know that i could also use a simple enum for indexing but that would add an extra data that needed to add to my system. I also have a duplicate of BG and HRS as an original data and manipulated data. This way when want i can revert back by replacing the data with the original. I am very new to programming and do not have experience in data organisation and almost nothing about labVIEW classes and the NI documentation is just too simple and is not covering any real life application. That is why I was asking for help. Cheers, Here is a List API. Seems complicated but it's a "managed" list with lots of features. Overkill for what you need but it demonstrates a point. You could use it for your data but then you'd have a dependency. I'm guessing you don't want dependencies at this point. You'll notice it has two items in the cluster - Name and Variant (variant is a general type and think of it as your Cluster). The important part is that it has a "Name". This is a poor replacement for the Cluster Name (functionally) but it does enable lookups, even by regular expressions. It serves a very similar purpose but operates at run-time instead of design time The name is just a string label. It can be anything. Granted it's not as simple as an enum but it does give much more flexibility and doesn't require design time editing of the control to make changes. The tradeoff is complexity. Now you have a way of making a list behave like a database but you need specific functions to look up and return data. This, from one of the list examples, returns all items with a numerical label: Intuitively you will realise that having duplicate data is not very useful unless you can distinguish between the original and manipulated. Up until now you have used the Cluster with an unbundle which has served you well but are now finding that you need to edit the cluster every time you add new variant of your data. The label gives you that ability at run-time instead of design time with a small increase in complexity. However. Your biggest issue is compartmentalization - separating config from data. Now. What if only the List (aka data array) wasn't tied to a particular data type? Then, by thinking carefully about the labels you use, you would be able to differentiate between the different data types, different devices and different configs There are other ways to approach this. But from where you are at present I would suggest this way - at least until you are more confident with your abilities. The database I suggested earlier requires a different mind-set and classes are a huge learning curve. This is a modest step from where you are to where you want to be. Quote Link to comment
Mahbod Morshedi Posted March 23, 2023 Author Report Share Posted March 23, 2023 Thank you ShaunR, That variant looks promising, and I will give that a try a try. I could also use a user even framework such as JKI state machine or DQMH. Any good material you can suggest for me to start with GOOP would be appreciated in the meantime. Cheers Mahbod Quote Link to comment
ShaunR Posted March 23, 2023 Report Share Posted March 23, 2023 5 hours ago, Mahbod Morshedi said: Any good material you can suggest for me to start with GOOP would be appreciated in the meantime. Just mention GOOP 3 times and it will summon MikaelH - who can tell you everything about it. 2 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.