03-11-2014 12:17 PM
I have a VI that was made by the director of scary movie, so beware, this VI is a nightmare!...or at least to me it is.
Background:
I have 20 pans and I have a water level sensor that outputs a voltage from 0-5 Volts. By knowing the volume of the pans, I calibrated the output to be in gallons. The real output I need is a volumetric flux, which is gallons per minute per square foot. We are currently achiving this by using a VI that a summer intern made (See attached). It works well, but it is just so messy and hard to clean up and expand. The plan is to have 100 pans total and I don't want to copy paste this code 5 more times!
Questions:
-How can I collect a rate differently? If you notice on the calibration subvi attachement, the rate is calculated manually knowing how fast the loop is going in the main VI. I don't know if this is the best way
-Can I get rid of the shift registers some how?
-Is there a way for me to combine the calibration subVIs so that I don't have to have one subvi for each channel?
Thanks in advanced!
Solved! Go to Solution.
03-11-2014 12:37 PM
@Pepi123 wrote:
I have a VI that was made by the director of scary movie, so beware, this VI is a nightmare!...or at least to me it is.
Background:
I have 20 pans and I have a water level sensor that outputs a voltage from 0-5 Volts. By knowing the volume of the pans, I calibrated the output to be in gallons. The real output I need is a volumetric flux, which is gallons per minute per square foot. We are currently achiving this by using a VI that a summer intern made (See attached). It works well, but it is just so messy and hard to clean up and expand. The plan is to have 100 pans total and I don't want to copy paste this code 5 more times!
Questions:
-How can I collect a rate differently? If you notice on the calibration subvi attachement, the rate is calculated manually knowing how fast the loop is going in the main VI. I don't know if this is the best way
-Can I get rid of the shift registers some how?
-Is there a way for me to combine the calibration subVIs so that I don't have to have one subvi for each channel?
Thanks in advanced!
03-11-2014 12:54 PM
Hi,
I'm not sure I see your message. All I see is a copy of what I wrote, was this by mistake?
03-11-2014 01:02 PM
It would be much more helpful to upload the actual VIs; the limited screenshots don't show enough of what you are trying to do. Most likely you could simplify this by making better use of arrays.
03-11-2014 01:28 PM
OK, that's weird. I know I know I typed a response but all that went out was quoted text.
It would help more if you attached your code (VIs) instead of pictures. Only being able to see a picture of part of the block diagram makes it impossible to figure out what's going on.
The things you're wanting to do should be fairly straight forward unless there are things that I can't see that could complicate it. I really need to see your code.
03-11-2014 01:46 PM
It looks like this could easily be handled by a 2d array and a for loop. One shift register, and the for loop calls whatever blue subvi that is with the iteration + 1 wired in. But, without the code, I have no way of knowing if that will actually work.
-M
03-11-2014 02:22 PM
Are all 1D arrays the same lenght? In this case you could use a single 2D array in a shift register. If done right, the code will not change, even if you have 1000 rows later.
To process, autoindex on a FOR loop and wire 'i' to the blie terminal of the subVI.
What is the point of taking a subset starting with element zero. That's a No-op.
Please attach the actual code. We cannot debug an image.
03-11-2014 02:35 PM - edited 03-11-2014 02:51 PM
Hi all,
I will attach the actual code in a few minutes. There's some propietary information that I need to remove before uploading. I'll be right back
EDIT:
Ok guys, please see VI's attached. The VI that I need help with is "AWC - Commercial Main VI - Rev0" and the messy part it's towards the bottom.
I have been cleaning up this VIs and making subVIs for a few months now (time on and off) but I can't seem to get a grasp on how to minimize the big shift register mess.
Maybe some background on myself might help? I'm a ME but I have been using LabView for easy project for the last 2 years. I took Core 1,2,3 class of LabView so I guess I know enought to be dangerous and to get myseld into trouble. I don't practice as much as I would like to and that's probably why I'm stuck with this big mess.
I will also accept any other tips that anybody has offer in any other part of the VI. I can also clarify any parts of the VI if that helps.
Thanks,
Pepi
03-11-2014 03:18 PM
Looking at this, each of those arrays are 1d of size 10. You should easily be able to dump them in to a 2d array and then run it through a for loop, exactly like I explained above. It is a simple solution 🙂
-M
03-11-2014 03:29 PM - edited 03-11-2014 03:30 PM
@BowenM wrote:
Looking at this, each of those arrays are 1d of size 10. You should easily be able to dump them in to a 2d array and then run it through a for loop, exactly like I explained above. It is a simple solution 🙂
-M
Hi M,
I read your first comment and it seems like an easy solution, but I'm having trouble executing what you're suggesting. I'm going to spend the afternoon playing around with arrays and a for loop and see if I can get something to work. I always get confused when it comes to arrays and different dimensions, so bare with me.
Can you clarify what you mean when you say " each of those arrays are 1D of size 10" Which array?