LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to implement ratio control

Solved!
Go to solution

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.

0 Kudos
Message 11 of 26
(2,204 Views)

Hello,

 

Due to some inconvenience I was unable to reply back. Thanks a lot for the example. I am still working on it.

 

Regards

0 Kudos
Message 12 of 26
(2,192 Views)

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

0 Kudos
Message 13 of 26
(2,188 Views)

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?

0 Kudos
Message 14 of 26
(2,184 Views)

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.

0 Kudos
Message 15 of 26
(2,180 Views)
Thos won't be that easy. For example what should happen if a+b>100? You need extra validation code anyway...
0 Kudos
Message 16 of 26
(2,174 Views)

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?

0 Kudos
Message 17 of 26
(2,171 Views)

 


@rohini_basu wrote:

. Is it possible anyway?


Yes, everything is possible! 😄

 

0 Kudos
Message 18 of 26
(2,169 Views)

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

0 Kudos
Message 19 of 26
(2,159 Views)

P.S. How do you make the animated GIFs of the block diagram?

0 Kudos
Message 20 of 26
(2,157 Views)