02-09-2022 11:38 AM
Hello, I am a beginner in LabVIEW. I am trying to write a couple of programs for hardware we have in our lab; however, I don't have access to the hardware all the time. So I'm going to work without hardware. I managed to install the hardware driver and after installation, I have various already-written VIs by the manufacturer. One of the VIs I'm planning to use heavily is related to "get attributes". There are more than 30 attributes in the manual related to this VI which I believe I can recall using this VI and a string. However, for each attribute, I should write a different string which might be not efficient. Instead, I am thinking to write a separate VI with a case structure or a property node to make my job faster in the future. However I don't know whether it is a good idea or not; if so, how I can use a property node without using hardware. Thanks
02-09-2022 12:06 PM - edited 02-09-2022 12:07 PM
Well as long as all the proper drivers are installed you should be able write your code without the hardware, you just can't run it without the hardware.
As for a good ideas or not we would have to see your code or at least an example of what you are trying to do to really answer that question.
02-09-2022 12:23 PM
Yes, you're right. I forgot to attach anything. Here you can see my initial code. In the input, in the attribute ID/name, I can choose between many attributes (here, arbitrary sequence mode). In the output, I'm basically getting the name and ID of each mode. (for instance, ST_SCENARIO mode's value is 2). However, if I follow this approach, either I need to write many separate VIs for each attribute or write a big VI with a case structure. As a solution, I was thinking about a better approach, that's why I was thinking about the property node. However, I'm not sure if it is a good choice or should I do implement my program in another way. Thanks
02-09-2022 01:03 PM
I replied earlier but for some reason, my reply was deleted. strange!
yes, you are right. It would've been better if I attached a picture.
As you can see in the attachment, this is a very basic code I've developed. I'm querying "arb seq mode" here and outputting the relevant sequence and its ID. As I said before, I can query many attributes; so if I want to develop a program for all attributes, either I should write many similar VIs or write a big VI with a case structure (I think). To make my programming more efficient, I was thinking about the property node. Not sure that will help though!
02-09-2022 01:15 PM - edited 02-09-2022 01:20 PM
I would create one Vi with a case for every arbitrary sequence mode value.
Also make the Arbitrary sequencing mode a control.
02-09-2022 01:48 PM
Great, thanks. That helped. I created another case to manage each attribute right after the input (attached). I think it is fine however the downside is each case is returning a specific value, like the example in snapshot "1150049". For future troubleshooting, it might be a pain but I guess I can add a note inside each case; for instance, 1150049 > arbitrary sequence mode and so on. Do you agree with this setup?
Note: the reason I put the output indicator inside the case not outside, is basically each attribute has its own output, so I am working on it to make it look better. haven't found any solution yet though.
Thanks
02-09-2022 02:23 PM
If the input lookup enum in is arbitrary sequence mode cast the integer value to a strictly typed ring of arb sequence modes.
As far as documenting a case structure driven by an enum..... try wiring an enum type to a case selector..... then smile.
02-09-2022 02:47 PM
Thanks for the reply. I should say I didn't quite get your first sentence. Sorry! my bad, as I said, I'm a beginner.
After your reply, I noticed that attributes in the input are in ring type. If they were in enum format, I could add cases for each of them easily/automatically in LabVIEW. I guess this is what you were addressing in your comment. Can you advise how to change ring to enum? I looked up on google but couldn't find any solution. Thanks
02-13-2022 10:31 AM
Hello again, can anyone please advise how to create an enum from the ring? following up on the previous post, it makes my job easier then I can create a case for each enum item quickly. With the ring, it's a very time-consuming job. Thanks
02-13-2022 06:56 PM
I suspect the problem you will have is that your ring values are probably not sequential. That is, they have strings and values like this one:
You can create an enum with the same strings (provided they are unique) but you can't match the values unless they're sequential (or you put in a lot of dummy values - but don't do this if it's more than one or two).
Then you'd need a way to map between them - you could do this with subVIs each way, but it seems likely to be about the same amount of work? (The upside is that you might be able to make use of it repeatedly, and it might make handling easier later - you'd do all the work building the subVIs "up-front" (or at least for the ring values you cared about) and then nevermind, this is definitely scriptable...
Let me try for a minute or 5 🙂