04-09-2011 06:03 PM - edited 04-09-2011 06:04 PM
True. But I did say the math needed to be checked because I couldn't figure out from his code what was supposed to be affected by what. It was unclear which of the other two controls, (or both) were supposed to change. And since there were 6 or 7 different numerics going on, I didn't try to sort it out. I just used 3, and threw down a local variable to change. It just so happened I picked the wrong one.
My purpose was to show some code using the event structure. I figured the OP would be able to figure out how to make it work to suit his needs.
04-11-2011 04:05 AM - edited 04-11-2011 04:11 AM
Hello,
Due to some inconvenience I was unable to reply back. Thanks a lot for the example. I am still working on it.
Regards
04-11-2011 05:35 AM
Hey I was working with the code but cant understand the case structure. Why have you equated the subtracted output of the sum of the array and the output of the index array with zero and connected it as the 'true' logic of the case structure? Say after changing A to 60, which was previously say 50, the total sum becomes 110. Hence the output of the index array is now 60. So subtracting it from 110 will never give a result that will be equal to zero. Can you please explain me this portion?
Thanks in advance
04-11-2011 11:02 AM
You need to specially handle the case where both of the other two controls are zero, else you get a division by zero and an undefined result. The zero case is the exception.
In my code, if you start with A=100, B=C=0 and start reducing A, the values for B and C will grow at an equal rate. Since the original ratio was not defined in this case, this is a reasonable behavior. Also, if ony one of the other controls was zero, changing one of the nonzero values will compensate only with the other nonzero value, keeping the zero value as is. Again, this seems reasonable.
It is possible that you made a mistake. Can you attach your VI?
04-11-2011 11:30 AM
Hello
Can we leave it to the user to give the inputs on the first try? Like here you have already given that A=100, B=C=0 but I want that the user will give A= some value, B= some value and automatically C will become 100-(A+B). Then when any one of the parameter changes, the other two will change accordingly. Can we implement this in the event structure? Basically in the flat sequence you have taken the input to the 'control' array as constants. But I want to change them into control. Like whatever value will be given in the front panel that will be placed in the 1-D array. Have you understood my problem? I will attach the VI soon because in my lab I am using LabVIEW 8.5 but in my home I am using LabVIEW 6. So I will develop the code in LabVIEW 6 and will upload the VI as soon as possible.
Regards.
04-11-2011 12:05 PM
04-11-2011 01:25 PM
no, suppose it will check whether a+b>100 , then if its true it will give a warning (we'll connect a boolean switch i.e a led) and will display an error message. But if its false, i.e a+b<100, then it will calculate c's value. Is it possible anyway? In that case I think taking the variables into 1-d array will not be a good choice, isnt it?
04-11-2011 02:02 PM
04-11-2011 04:06 PM
altenbach,
I have to give you props on this one. It took me a minute to figure out how it was working, but it was implemented elegantly. I think it would have taken me longer to figure out how to do it on my own.
Eric
04-11-2011 04:07 PM
P.S. How do you make the animated GIFs of the block diagram?