CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Tue Aug 20, 2019 2:58 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Feb 04, 2019 8:52 pm 
Offline

Joined: Wed Dec 05, 2018 3:00 pm
Posts: 11
I have finished translating the eFFL C++ Fuzzy Logic Library (https://github.com/zerokol/eFLL) into IEC 61131-3 (CODESYS) ST language. The project file is too large to attach here so I have provided a OneDrive link (https://1drv.ms/f/s!AgeXD5P3kwJIg2tNBt0q05Y4lxuu) 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


Top
   
PostPosted: Tue Feb 05, 2019 11:39 pm 
Offline

Joined: Wed Dec 05, 2018 3:00 pm
Posts: 11
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.


Top
   
PostPosted: Sat Feb 09, 2019 10:00 pm 
Offline
User avatar

Joined: Fri Jan 19, 2018 3:38 pm
Posts: 76
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

_________________
CfUnit is a free and opensource Unit testing framework for CODESYS
My profile on cForge


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited