LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Seeking suggestion on explanation regarding graph when the value hit the threshold it will be zero and start again

Solved!
Go to solution

Hello Everyone, 

 

I am trying to implement a simple python based code into the LabVIEW, 

Once the value in a graph hits the threshold level then immediately the value dropped to zero (or based on the defined value). 

 

Now in implementation, it works fine but the graph line didn't come to zero immediately and created a slight slope, Also the other thing is the when it hits the threshold one time then the line in the graph didn't increase again. 

 

Here is my current implementation, 

sam67_0-1636493825696.png

 

here is the python code output which I am trying to implement,

sam67_1-1636493958404.png

 

 

Looking for your suggestions,

 

 

 

0 Kudos
Message 1 of 9
(1,662 Views)

Sorry, I don't have LabVIEW 2021, so all I can see is the picture of the snippet. Feel free to "save for previous" and attach the VI instead.

 

Why do you think that you need to generate the same ramp with every iteration of the FOR loop. Wouldn't once before the loop be sufficient? (OTOH, you only generate the noise once, so it will always be the same for 100 iterations. You can combine the two FOR loops into one, right?

 

I think all you need is the while loop and a chart, nothing else.

0 Kudos
Message 2 of 9
(1,625 Views)

here is the previous version snippet.  also, the VI attached,

sample.png

 

The addition function will be performed between each wave where every noise wave (small waves) will add and create the biggest waves if the small wave addition value is greater or equal to the threshold value. 

 

In python, I am using an array function where I can add all those and perform a simple function for this but in LabVIEW, the structure makes me too confused however the results always impressed me because of its front end 😆

0 Kudos
Message 3 of 9
(1,608 Views)
Solution
Accepted by topic author sam67

It might be easier to show is your working python code... 😉

 

You are generating a Gaussian, which has no similarity to what you show on your picture. Are you trying to chart the integral of the Gaussian. What determines the amplitude?

 


@sam67 wrote:

In python, I am using an array function where I can add all those and perform a simple function for this but in LabVIEW, the structure makes me too confused however the results always impressed me because of its front end 😆


 

This sentence makes no sense to me. You need to define all terms used (There are dozens of "array function"! What is a "simple function"! What LabVIEW "structure"?

 

Here's some simple code that generates something that looks similar to your picture. See if it can give you some ideas.

 

altenbach_0-1636571060866.png

 

Message 4 of 9
(1,533 Views)

Thank you so much for your reply and positive response, 

 

Sure, the python code is somehow updated but it gives a clear picture definitely, 

Please find the attached python code file.

 

However, I am trying to understand the previously attached VI but I have a question regarding "Tau" value, if you'd don't mind could you please give me a big picture of how to come with this solution.

 

Thank you 😆

0 Kudos
Message 5 of 9
(1,510 Views)
Solution
Accepted by topic author sam67

@sam67 wrote:

However, I am trying to understand the previously attached VI but I have a question regarding "Tau" value, if you'd don't mind could you please give me a big picture of how to come with this solution.


Your python code has no tau. (It does not even have squares and exponentials as in your snippet.)

 

Are you talking about the snippet that you have attached, or my VI? If you want to adjust the time constants, you can play with the increment. Explain what you mean by "big picture". Do you have a problem with the algorithm or with the LabVIEW implementation?

 

Can you write out the exact formula you are trying to implement? Do you have a link to a research paper?

0 Kudos
Message 6 of 9
(1,472 Views)
Solution
Accepted by topic author sam67

Hello, 

Once again thank you so much for your response and. support. 

 

Sure, here is the formula which I am trying to implement,

 

tau = 20*ms
n = 100
b = 1.2 # constant current mean, the modulation varies
freq = 10*Hz

eqs = ''' dv/dt = (-v + a * sin(2 * pi * freq * t) + b) / tau : 1 a : 1 ''',
 
Regarding the big picture previously asked request, my apologies but it is cleared now. Thanks,
 
And Yes, it is related to research but a small part is where I am trying to use LabVIEW because of its attractive front end. 
 
However, if you could look at the attached VI, where I am trying to add a few seconds static wave once the threshold hit and the new wave will start to generate. furthermore, the part of a condition is already added but I don't know how to run a loop that will be terminated with the time or loop timer. 
 
something like the attached python output. 
 
sam67_0-1636990136949.png

 

Thanks.
 
0 Kudos
Message 7 of 9
(1,444 Views)

Hello and thanks for your advice and I tried to follow your suggestion but still, I am stuck on somehow somewhere, 

 

based on previous suggestions (referred to the other thread) I tried to implement the same formula but still don't know why chart values are stuck when I am using Y-Axis values from. -70 to -50 (mV). Could you please suggest where the problem is and what possible method can help me to figure out the issue?

 

here is the output which I am trying to achieve, 

 

sam67_1-1638223506516.png

 

And here is my current output,

sam67_2-1638223567629.png

 

and the current implementation of the VI is attached,

 

Thanks

0 Kudos
Message 8 of 9
(1,334 Views)

It's still a total mess. Your equal comparison will never (ever!) return TRUE because you are comparing floating point values from complicated formulas. Why are you naming controls such a V_t or I(t). Shouldn't they depend on time? Math looks all wrong!

0 Kudos
Message 9 of 9
(1,298 Views)