From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
06-29-2017 07:51 PM
Hello,
I am trying to compute an FFT calculation every 0.1 ms on a incoming signal. This signal is being fed through a design in multisim, and the FFT is being preformed on the voltage and current to calculate a Nyquist.
In matlab, storing the values of a signal to pass through the FFT block is done simply with a buffer. In labview it seems near impossible.
Any help would be appreciated!
Solved! Go to Solution.
06-29-2017 08:12 PM
06-29-2017 08:53 PM - edited 06-29-2017 08:53 PM
See the other discussion with the same question.
06-29-2017 09:47 PM
Here is the VI, I just cannot loop the FFT function to occur ever 0.1 ms
06-29-2017 10:02 PM
If you want the FFT to occur during the simulation, place it inside the simulation loop. If you have a step size smaller than 0.1 ms and you don't want it to occur every case, use a Case Structure.
If you need to buffer a bunch of points from subsequent iterations of the Control and Sim loop between iterations where you want to use the FFT, use a Shift Register and Build Array. Reset the array when you take the FFT.
06-29-2017 10:10 PM - edited 06-29-2017 10:34 PM
06-30-2017 10:12 AM
hmm seems like it should work, I've updated the code with the Nyquist plot below, however I'm getting an error saying that case structures are not allowed within the simulation loop..
06-30-2017 10:42 AM
I don't think the problem is the case structure - I think it's that you've put the Nyquist plot inside the case structure.
See this article: Block diagram terminals are not allowed inside Case structures on simulation diagrams.
You can probably work around it by using another Memory block, and writing the graph every iteration. Move the graph outside of the case structure, and send the plot out of the True case, into the Memory, and then back into the case structure, where you can wire it straight through the False case. Then, it will only change in the True case, when you make a new FFT measurement.
06-30-2017 11:25 AM - edited 06-30-2017 11:27 AM
hmm okay I have the real and imaginary parts of the Nyquist plot coming out okay. I use the memory block to output the results every 0.1 seconds discretely. (there should only be 1 real and imaginary component every 0.1 sec)
However I still cant seem to get the FFT to perform every 0.1 sec which is making the output Nyquist incorrect. Am I supposed to be switching the case structure on and off every 0.1 seconds in the simulation? I am unclear on how the memory blocks are working with the case structure
06-30-2017 11:53 AM
The Memory blocks act like a Shift Register - they are building an array of Y values which once every so often (so yes, make the boolean true every 0.1ms for example, not with a control) is passed to the FFT function. The rest of the time (for example, when the iteration time is 0.00008, 0.00009) it just adds a new element to the array. When it reaches 0.0001, it should trigger the True case and carry out the FFT.
I don't know what the Img functions do and I don't have the Simulation toolkit available right now, but it might be that you can use those. Did my suggestion before involving a 3rd Memory block lead to a broken wire complaining about direct feedback cycles?