LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why doesn't adding Waveforms with compound arithmetic work?

Solved!
Go to solution

Hello everyone,

 

I have a program that adds up multiple waveforms and displays them all together as one distorted curve in a single waveform graph.    

 

I've had to add them all together using simple add functions, since the compound arithmetic block doesn't work. 

 

Why would this be the case? Isn't it essentially just doing multiple additions in a convinient way? I've attached a VI with a simple example to show what I mean.

 

fr00tcrunch

0 Kudos
Message 1 of 10
(3,588 Views)
Solution
Accepted by topic author fr00tcrunch

Waveforms have timing information.  What if the timing is different?  You need to somehow throw an error.  The Add has that capability.  The Compound Arithmetic function does not have that in it arsenal.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 10
(3,576 Views)

Ah, thank you! Learning something new about LabVIEW every day.    

Is there a simpler way to add multiple waveforms than the method I've used in my example VI? 

I can imagine it being possible by using shift registers and a loop, but I don't really have much experience with shift registers yet.

0 Kudos
Message 3 of 10
(3,517 Views)

If you have an array of waveforms, I would use a shift register on a FOR loop to add the waveforms together.  Learn to use shift registers.  They are a very VERY important construct in LabVIEW.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 10
(3,507 Views)

Okay so I fiddled around a bit with a for loop and shift registers and im pretty sure I came to the same result.

One thing I'd still like to ask is: How do I initialise the shift register using a constant? I can see how to put the dt value into the constant, but the attributes box is just a white square. It gives me a timing error when I try to do this and only works when I use an additional sine waveform block.

I've attached the updated VI to the post.

0 Kudos
Message 5 of 10
(3,488 Views)

1.  No need to wire up the N.  The autoindexing will tell how many iterations to perform.

2. Use Delete From Array to remove one of the waveforms from the array.  Initialize the shift register with the deleted portion.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 10
(3,476 Views)

Oh snap, that's great! 

So many useful functions in LabVIEW, impossible to learn all of them so quickly. 

Thanks again for all the help.

0 Kudos
Message 7 of 10
(3,462 Views)

One more thing, how do you get that cut-out screen shot of the function block like you did in your last post?

0 Kudos
Message 8 of 10
(3,394 Views)

@fr00tcrunch wrote:

One more thing, how do you get that cut-out screen shot of the function block like you did in your last post?


The Code Capture Tool is an amazing add on everybody should have.  It is available through the LabVIEW Tools Network.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 10
(3,390 Views)

Wow, fast response, thanks 🙂

Yes it is amazing, I'll look into it now!

0 Kudos
Message 10 of 10
(3,386 Views)