Fuzzy Logic eFFL Library in ST

truly-bent
2019-02-04
2023-09-19
  • truly-bent - 2019-02-04

    I have finished translating the eFFL C++ Fuzzy Logic Library () into IEC 61131-3 (CODESYS) ST language. The project file is too large to attach here so I have provided a OneDrive link () with the hope that any interested parties can download it.

    The original C++ program was written in Spanish. During the translation process, a few liberties were taken in renaming some of the components and reorganized some of the code for (my) better understanding. You can find the original C++ code, commented out, at the bottom of each module. Note that the library is open-source.

    It runs reasonably well, but the advanced example program has thrown an exception or two which I haven't resolved as yet. It looks like the statement "IF temp^.previous^.previous <> NULL THEN" in the FuzzyComposition.build() method (line 16) is allowing a call on the next line when the pointer is invalid. If someone knows how to verify a pointer before using it, I would appreciate knowing how it's done. Apparently, the __TRY/__CATCH exception handler isn't available on the simulation platform.

    IF temp^.previous^.previous <> NULL THEN
    // result = rebuild(zPoint, zPoint->next, temp->previous, temp->previous->previous); C++ original source
    build := THIS^.rebuild(zPoint, zPoint^.next, temp^.previous, temp^.previous^.previous);
    END_IF

     
  • truly-bent - 2019-02-05

    I don't know why it took me so long to notice. The problem was in the translation of course - i was calling the rebuild method incorrectly:

    Incorrect call:
    build := THIS^.rebuild(zPoint, zPoint^.next, temp^.previous, temp^.previous^.previous);

    Correct call:
    build := THIS^.rebuild(aSegmentBegin := zpoint, aSegmentEnd := zPoint^.next, bSegmentBegin := temp^.previous, bSegmentEnd := temp^.previous^.previous);

    Since making this correction i haven't been able to generate any exceptions. Please find the revised file (Fuzzy_eFFL_011.project) in the same cloud location as above.

     
  • aliazzz

    aliazzz - 2019-02-09

    Hi,

    Maybe you are interested in using CODESYS FORGE platform to release your project on?
    As I am myself an enthusiast (not related with codesys) I can really say it's an ideal platform for your work and future endeavors.
    Hope to see you soon on https://forge.codesys.com/

    Aliazzz

     
  • nk-tesla - 2023-01-16

    Hi

    Could you make the library available again?

     

Log in to post a comment.