???? Fuzzy thinking ?????
Are you asking the right questions?
One does not need a integrate function or use numberical methods to do a centroid function unless polynomials, sines or sine^2 are used to specify the regions for fuzzifying and de fuzzifying. If you use simple trigangles, trapezoids and rectanges then this is easy and faster. Using numerical integration will slow the PLC down to a crawl. I have plenty of source code on how this is done. See high school geometry book. There is plenty of code on the internet.
The big question is why? What are you trying to do in the end? A plc is not a good platform for writing fuzzy logic code. Do you expect people to use this Fuzzy Logic block? What would this Fuzzy Logic block be good for besides wasting CPU time?
I have seen the Omron fuzzy logic module work. It work well but it is its own module with its own CPU I am pretty sure is has a separate program to download the rules, it was long ago. How do you plan to download the rules? Are you going to write a HMI just for that function block? If so, I can tell you that writing the Fuzzy Logic block will be easy compared to doing the HMI.
If this is for a college project, what new ground are you trying to explore? There must be more that just be the first person to implement fuzzy logic in a PLC. How will this advance the field of Fuzzy Logic? I think it will only show that it can be done, but should shouldn't have tried.
Just because you can does not mean you should.
I would prove that it can be down economically on a small micro or DSP that could be made into a fuzzy logic card for those PLC manufacturers that don't have one.
What Omron able to give theirs away? Could anyone make it go? I am sure some people could but the market is limited in how many applications require fuzzy logic and how many people can make the rules. That is why people stay with the devil they ( don't) know. ( PID ).
Get a TI DSP starter kit. On the TI website they have an app note, with code' on how to implement a fuzzy logic controller. The application compares a fuzzy logic implementation with a PID implentation on a servo motor.
I have broken my rule about asking questions again.