Jaakko Pasanen

Fast Fourier transform on PLC

8 posts in this topic

Hello World! I created PLC friendly code for Fast Fourier transform (FFT) on IEC-61131-3 Structured text called StFFT. Program code is freely available on SourceForge. Code is licenced under both open source LGPL and Commercial licence. I couldn't find FFT implementation on PLC anywhere, so I decided to write one myself. Actually I could hardly find any mention about FFT on PLC and certainly not anyone implementing one. StFFT is made with minimal system dependencied on mind, it doesn't use recursion and only needs sine and cosine functions to work. This means that it should be usable on just about any PLC available. For those who don't know what FFT is and where it is used, i recommend taking peek in the Wikipedia. FFT has many applications, we are using it in low-pass FIR filter for analog measurement on PLC without needing any external hardware. I hope somebody has use for this... - Jaakko Pasanen

Share this post


Link to post
Share on other sites
Hi Jaakko, Thanks for the info on the FFT. Most people on the forum would not have been taught FFT in their education, and I have never thought of the use of them beyond frequency isolation in communication systems with FSK, AFSK in mind for data protection on radio comm's/ mobile phones etc. Not sure of what you are trying to achieve with the of the application of a FFT on a Low Pass Filter for analogue signal... Are you trying to eliminate noise ?

Share this post


Link to post
Share on other sites
Noise elimination is exactly what the low pass filter is doing in our case. I'm not talking about just white noise since that's not usually much of an issue, but eliminating higher unwanted frequency components like process induced vibrations might be critical for some applications. Of course usage of FFT isn't limited to low pass filtering, applications are numerous. However problem often is with PLCs' computing power: using FFT with as small as 256 elements might take tens if not hundreds of milliseconds. Whether that is a problem is completely dependent on the application and its requirements.

Share this post


Link to post
Share on other sites
I was going to start playing around with this code, I'm interested in turning raw vibration accelaration data into freq spectrum for analysis. Just glancing at the code, there appears to be variables in the code that are not defined in the Symbols .pdf. In code, w_complex, I assume this is w_imaginary, same for code has x_complex and tmp_complex, .pdf has x_imaginary and tmp_imaginary. Since I need to update this spectra trend alot, and it seems very CPU intensive, what would the effect be if I modified the code to eliminate the for and while loop, simulating the for/whiles but doing it during the PLC scan (like just decrementing or incrementing the variable and exiting the FB, so I don't get hung up in the FB)?
1 person likes this

Share this post


Link to post
Share on other sites

I can't find this program/code, can anyone point to it?

 

Thansk!
Eric

Share this post


Link to post
Share on other sites

I found it. Use the search term, "jaakko pasanen".

Share this post


Link to post
Share on other sites
On 3/3/2015 at 10:09 AM, mjrx said:

I was going to start playing around with this code, I'm interested in turning raw vibration accelaration data into freq spectrum for analysis. Just glancing at the code, there appears to be variables in the code that are not defined in the Symbols .pdf. In code, w_complex, I assume this is w_imaginary, same for code has x_complex and tmp_complex, .pdf has x_imaginary and tmp_imaginary. Since I need to update this spectra trend alot, and it seems very CPU intensive, what would the effect be if I modified the code to eliminate the for and while loop, simulating the for/whiles but doing it during the PLC scan (like just decrementing or incrementing the variable and exiting the FB, so I don't get hung up in the FB)?

Old post but I have a similar need. Did you get this to work?

Share this post


Link to post
Share on other sites

Hello mjrx,

I am working on similar topic, converting raw vibration acceleration data into frequency spectrum on Siemens PLC. I am interested to know the result of your analysis. Is it successful? If so can you share the code?

Thanks,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now