04-30-2009 01:08 PM - edited 04-30-2009 01:13 PM
I have a VI library created in LabVIEW 6.1 with a few bugs/glitches in it. Admittedly it uses a while loop instead of an event structure as its main operator, but I've not had the time to look into the alternative fully yet. It is still under heavy maintenance, so there are a few incomplete parts to it. However, all its basic functions do still work. I enclose both the VI library and a picture of the main VI showing its default code.
My main problem is with the 'atten step' variable (scroll bar on the FP). If you play around with it a bit whilst the VI is running (go wild - your aim is to observe it breaking), I'm sure you'll discover at least one of its problems. I have yet to find the root cause(s) of the problem(s) with this particular variable. I am wondering if there is a possible race condition here (though it doesn't show up with the light bulb/illuminator on) due to its local variable...?
Either way, could someone (anyone) please have a look at this to see if they can work out one/some of my many problems! I will warn you that the names of a few of the variables do change slightly amongst the VIs (due to 'parallel construction') but not so much that they become unrecognisable. There is also some defunct code in there resulting from modifications for added effectiveness leaving a previous work-around unused. I should also note that I've not yet assigned the correct error messages to invalid entires to the keypad - you may notice that yourself though!
If there are questions on its operation that need querying, or if you don't think you can find some of the problems, I'm more than happy to go into detail - just didn't think I should make the first post too long!
Thanking you in advance.
04-30-2009 02:04 PM
05-08-2009 06:31 AM
Hello James,
I hope that smercurio_fc helped with your question.
On a side note, you might want to consider wiring your error cluster through any functions that have error handling included. The way "error in" and "error out" are at the moment, you will not be able to handle the errors produced by your code or where they occured. You can either delete that part outside the loop, or wire it through the property/invoke nodes for example.
This brings me to another point, and that is the rest of the nodes outside your loop. There is no guarantee that these will execute before or after your loop. The fact that something is to the left of something else does not mean that they will execute in sequence. In order to make sure that these initialisations execute before you enter your loop, you need to wire something through them and into the loop. The error cluster would be ideal for this.
I hope we helped,
Kind Regards,
Michael S.
Applications Engineer
NI UK & Ireland
05-08-2009 08:29 AM - edited 05-08-2009 08:30 AM
Hi,
Sorry I'd not replied. Yes, knowing the location of my problem was a great help. Saved several hours of searching! Thank you smercurio_fc.
I'd not wired up my error line yet because the VI was still undergoing multiple changes, and it was just one more wire to keep connecting and disconnecting. It's easy enough to wire up once I've got the diagram fairly sorted.
As for the nodes to the left of my loop, would simply wiring their error outputs to the loop suffice to make them execute first? I think that's what you're saying...?
At the moment, this particular VI is undergoing major restructuring - essentially being written again! I'm attaching a section of code that will be used in the new version to handle a large chunk of the code seen in the picture above. I've added controls only so you can see what's going where. The slaves will be going back to the outside world (and the graph in this VI), whilst the masters will remain in the VI's memory (or in memory of a higher level VI). Please tell me what you think.
It is still slightly unfinished, but since I don't have LabVIEW at home I'm putting it up now so I can get some feedback over the weekend (hopefully). One noticeable unfinished bit of code, is the way that Spec Limits master is just wired to itself and isn't changed at all. This is because I'm still trying to work out how to do the following:
Take any one of my four spec limit arrays. They can be imagined as an array of points with both 'x' and 'y' values. Their 'x' values relate to the i/p level array, and their 'y' values are subject to change as a result of user commands. In the lower case statement, there is an auto indexed point with no wires coming out from it. This is a potentially new array of 'x' values. What i want to be able to do is to lengthen or shorten the four spec limit arrays. However, if the i/p level array has more 'x' values below the previous version, i want to add more points to the beginning of the spec limit arrays with their 'y' values the same as that for the current lowest 'x' value. I want a similar operation for if the i/p level array has more 'x' values above the previous version too.
Does this make sense, and if so does anyone know how i would achieve this?
Any help or ideas would be great. Thank you.
James
05-08-2009 08:35 AM
05-11-2009 03:47 AM
05-11-2009 10:10 AM
James Mamakos wrote:
As for the nodes to the left of my loop, would simply wiring their error outputs to the loop suffice to make them execute first? I think that's what you're saying...?
Yes. Connecting the error out of those property nodes to the loop will force the loop to wait until there is data available on those wires, which can only happen once the property nodes finish executing. In this particular case, though, it's not likely to have any impact on the behavior of the VI whether you wire them or not.
Take any one of my four spec limit arrays. They can be imagined as an array of points with both 'x' and 'y' values. Their 'x' values relate to the i/p level array, and their 'y' values are subject to change as a result of user commands. In the lower case statement, there is an auto indexed point with no wires coming out from it. This is a potentially new array of 'x' values. What i want to be able to do is to lengthen or shorten the four spec limit arrays. However, if the i/p level array has more 'x' values below the previous version, i want to add more points to the beginning of the spec limit arrays with their 'y' values the same as that for the current lowest 'x' value. I want a similar operation for if the i/p level array has more 'x' values above the previous version too.
Does this make sense, and if so does anyone know how i would achieve this?
I'm afraid it doesn't make sense, at least not to me. I suspect the problem is that we're not dealing with your problem so we don't understand your "lingo". Specifically:
05-11-2009 12:07 PM
Yes, sorry - it was written quickly and not explained in the best fashion - despite me getting something wrong anyway! I have a 1D array (array 1) which has consecutive values going up in whole numbers. It can change length by adding values to either the top or the bottom (or both). I also have another 4 1D arrays, all of which require the same operation to be performed on each of them. For this example, I shall take one of them (array 2).
When array 1 gets extended 'downwards', I want array 2 also extended downwards by replicating its lowest value however many times necessary. I would then want a similar operation for when array 1 gets extended 'upwards'. It should also be able to handle array 1 being extended in both directions at the same time.
smercurio_fc wrote:
I'm afraid it doesn't make sense, at least not to me. I suspect the problem is that we're not dealing with your problem so we don't understand your "lingo". Specifically:
- "Take any one of my four spec limit arrays." - what four spec limit arrays? I see 2 arrays, and 3 clusters as controls on the front panel.
- "and their 'y' values are subject to change as a result of user commands" - OK, what does this mean?
- "However, if the i/p level array has more 'x' values below the previous version" - what previous version? There is no previous version being passed in, as far as I can tell.
- "i want to add more points to the beginning of the spec limit arrays with their 'y' values the same as that for the current lowest 'x' value" - this made absolutely no sense to me
Direct answers to your points:
Can anyone suggest a good (or best) way of achieving my aim stated in the second paragraph of this post? Thank you in advance.
James
P.S. If anything is still unclear, please let me know.
05-12-2009 05:46 AM
05-12-2009 11:05 AM
James Mamakos wrote:
...just bringing this back to page 1...! 🙂
It was on page 3 when I looked at it. This is a busy board!
To extend an array you would just use Build Array to append/prepend a new array. To create the new array you can just use Initialize Array to create an array of a specific length, all having the same value.