08-15-2018 09:42 AM - edited 08-15-2018 09:48 AM
Hello everyone,
I am working on some code to automate Resonant Ultrasound Spectrometer measurements at varying temperature and field via taking the measurements within a Quantum Design PPMS. Attached is my code, input file, as top level subVIs. Can anyone just verify my logic here and tell me if this code will do what I am wanting it to do? I cannot test the code directly, as the PPMS is in another lab which is across campus; however, I have lab time with it tomorrow.
What I want the code to do:
Just want to make sure I'm not crazy, but I have a feeling I may have screwed something up. Would be nice to have it working as soon as we start operating tomorrow, as time with the PPMS is valuable. Appreciate any feedback and criticism, and thanks in advance!
*RUS_PPMS_File_Control.vi is the main VI
Solved! Go to Solution.
08-15-2018 09:55 AM - edited 08-15-2018 09:55 AM
Hi etvg,
Appreciate any feedback and criticism, and thanks in advance!
Why is there an additional While loop in the FOR loop?
Why is there no project file?
Why do we have to search for your "main" VI?
How do you know "set magnet" and "set temp" have been executed? How do you know they executed successful? (No real error handling! Comparing floats for equality!)
Is there a reason to use those old GPIB function instead of "modern" VISA?
Why is "LIdA3_1" so huge? (With bad coding style in general.)
08-15-2018 10:04 AM - edited 08-15-2018 10:21 AM
@GerdW wrote:
Hi etvg,
Appreciate any feedback and criticism, and thanks in advance!
Why is there an additional While loop in the FOR loop?
Why is there no project file?
Why do we have to search for your "main" VI?
How do you know "set magnet" and "set temp" have been executed? How do you know they executed successful? (No error handling!)
Is there a reason to use those old GPIB function instead of "modern" VISA?
Why is "LIdA3_1" so huge? (With bad coding style in general.)
Hey GerdW,
Thanks for the input, hopefully this clears some things up:
EDIT: Added zip w/ project to this post
08-15-2018 11:20 AM
Added error handling, which you pointed out was absent. Attached is updated main VI.
08-15-2018 01:51 PM
Hi etvg,
some changes to the VI:
- Still no need for that outer WHILE loop: it was finished just after the first iteration, so it was pure Rube-Goldberg!
- No need to IndexArray 5 times when you can resize that function to give the 5 outputs at once…
- No need to get the ArraySize when you already use autoindexing at the FOR loop border…
- Why did you create one more error cluster (without a label in the block diagram)? One error wire is enough!
- use the error wire to set the DATAFLOW and so command the execution order! (I still would use a state machine here: first set new parameters, then wait for reaching new setpoints, then read new measurement values. And an additional error handling state…)
- Keep parameters, which are constant in the loop, outside the loop. See your GPIB address as example…
08-16-2018 02:39 PM - edited 08-16-2018 02:40 PM
GerdW,
While working with the PPMS today I couldn't seem to get the magnet controls working properly, so temporarily I made a temperature only version of this code which works flawlessly. There is no reason, dataflow wise, the "magnet status" subVI and "temp status" subVI cannot operate simultaneously is there? I think it may have just been a bug due to having the field set to "0" and the PPMS reading -3.3Oe as the field, so maybe for some reason it did not understand what it was being told to do (but looking at the data flow the all the subVIs were running besides the "magnet status" one, despite the fact they all should be running).. I would look into it myself but I'm back in my office and am running measurements with the laptop, time is limited on the PPMS so I was in more of a "get something working to collect data" mindset rather than troubleshooting the field issue, because these samples are being tested at zero field anyways.
Best regards,
Erich
08-16-2018 02:54 PM
Hi Erich,
I guess the problem is the simultaneous access to the very same device. Your device gets two commands in parallel and tries to answer both. Which answer is received by which sender routine?
You cannot send multiple commands in parallel to the same device, you need to send them one after the other!
08-16-2018 02:59 PM
The set temp subVI is verified by the temp status subVI, and the set magnet subVI is verified by the magnet status subVI. So how do you suggest I change the layout of this top level VI to be able to manipulate the temp and field? Doing temperature first, once boolean signals temp is stable then set field, and once that is stable run the RUS code, maybe?
Cheers
08-16-2018 03:02 PM