06-10-2019 04:06 AM
Hi All,
I've written in VI to run a lot of set-points for two instruments (a temperature controller and an electromagnet) running concimitantly. The steps of each program need to be fairly precise. I've managed to do it but I cannot help but feel like there must be a better way...because what I've done seems ridiculous. I've included two images; one of the front pannel and one of the block diagram. Any suggestions?
Thanks,
Solved! Go to Solution.
06-10-2019 04:54 AM
@Potticary wrote:
Any suggestions?
Yes, embed (don't attach) the image if you must post an image (a VI is better):
Usually, you'd try to:
a) use an array in some way to organize the values. Or
b) use VI server to get the values by control reference and label.
And then use for loops to automate things.
You're quite right that your current solution is not desirable.
06-10-2019 11:05 AM - edited 06-10-2019 11:06 AM
I'd suggest an array of clusters. Each element could have Setpoint, Time, and Current. I'd make that into a typedef, then make an array of that type. Then you can handle an arbitrary number of setpoints. I wouldn't use a 2D array for this, though it would definitely work. Using a 1-D array with named sub-elements is much, much easier to handle than a 2D array, as with the 2D array you have to manually index everything with "magic numbers".
Edit: I just realized the naming could be a little confusing, "Setpoint" is the name of the control on the front panel, which I probably could've named better. It's also the name of one element within the cluster. Sorry for potential confusion.
06-18-2019 04:23 AM
Wonderful, worked beautifully.