10-18-2017 09:15 AM
Hello Everyone,
I have question related to the conditional loops. The problem that I am trying to solve is as follows.
I am trying to calculate a discharge coefficient. In order to be clear I am going to use hypothetical equation. Let's say I have an equation of 1-1/x which I am trying to calculate but I should initialize x before starting the loop.
1) I initialize x by 0,6, let's say then
2) I give conditional, if |x-0,6|<0,001 then go to the next step
3) if |x-0,6| > 0,001 then go back to the calculation and plug new value
And the loop continuous until the condition met and after this, it will proceed to the next loop.
Thanks in advance. Any help greatly appreciated.
Solved! Go to Solution.
10-18-2017 09:29 AM - edited 10-18-2017 09:32 AM
Hi Aeros,
you need a while loop with a shift register to store your "x" value…
(according to your description)
This is pretty basic LabVIEW stuff: have you taken the free courses?
10-18-2017 09:33 AM
Thank you for your response GerdW,
Nope, I did not but I will check that now.
I read about shift register but in some point I stuck, I could not realize how to compare the values and feed to the beginning of the calculation.
10-18-2017 09:46 AM
This is what I did until now.
10-18-2017 09:50 AM
10-18-2017 10:06 AM
It seems that it does not go back and update as I intend. The thing that I am trying to do is in the attachment.
10-18-2017 10:15 AM
Hi Aeros,
It seems that it does not go back and update as I intend.
You wired the "C_calculated" into the shift register, so it will be used in the next iteration (like in your requirement).
As I don't have your DAQ hardware you need to debug your VI with real values on your own.
Is the iteration condition met?
Btw. I miss the root(1-beta^4) term in your VI…
10-18-2017 10:35 AM
Since beta is a constant value, I directly wrote constant value to the vi instead of root(1-beta^4).
Condition did not met but I guess there is a problem with calculation. Unfortunately, I can check that tomorrow because I left the lab. Thank you very much for the help.
10-18-2017 02:38 PM
@Aeros08 wrote:
This is what I did until now.
I don't know if this is a problem, but can the Formula Express VI handle a "," as the decimal point?
The formula is (X1)**0,75 and when I run it, it ALWAYS returns "1". It appears to ignore everything after the "," so for me, it evaluates (X1)**0
Why not just use the native LV exponential function Power of X? Seems much simpler than hiding the formula in an express VI.
10-18-2017 03:36 PM
Thank you for your help jamiva, I will check that.