CODESYS - the IEC 61131-3 automation software

Fuzzy Logic C++ to ST
Page 1 of 1

Author:  truly_bent [ Mon Jan 21, 2019 7:12 pm ]
Post subject:  Fuzzy Logic C++ to ST

Hi All;
I have been translating the (open source) eFFL Fuzzy Logic library from C++ to ST. I have attached a section of that translated work. Part of the reason for doing this is to reacquaint myself with the ST language.

The persistent problem is that, while the code compiles without errors or warnings, the simulator balks at a download with error: "C0367 Internal error 3 prohibiting online change! Clean application and download necessary". Cleaning the application makes no difference. I have been unable to track down the cause of the error and was hoping to find some help from someone who might have a better grasp of OOP principals as applied to CODESYS. There is a possibility of a call to an un-instantiated object, but i haven't found where.

An additional question i have is about the CODESYS "NULL" definition. The code compiles with NULLs, but the editor doesn't appear to recognize it as a defined symbol. I have tried replacing all the NULLs with a numeric '0' - this also compiles without errors, but made no difference to the download.

Any clues to getting this running would be appreciated.

EDIT 1: Changed attached file to .project
EDIT 2: Corrected .project file attached

Author:  shooter [ Tue Jan 22, 2019 11:14 pm ]
Post subject:  Re: Fuzzy Logic C++ to ST

a null is not equal to a zero, null is nothing mostly 00 hex and a null is a symbol

Author:  Edwin Schwellinger [ Wed Jan 23, 2019 7:08 am ]
Post subject:  Re: Fuzzy Logic C++ to ST


you need to attach the .project file not the opt files…!

Author:  truly_bent [ Wed Jan 23, 2019 12:47 pm ]
Post subject:  Re: Fuzzy Logic C++ to ST

Thanks Edwin.
Find attached .project file in the edited post above

Author:  truly_bent [ Tue Jan 29, 2019 5:44 pm ]
Post subject:  Re: Fuzzy Logic C++ to ST

It took a bit of head scratching, but the solution presented itself eventually.
In a few cases, I was creating new objects like this:

IF ((aux := __NEW(fuzzySetArray)) = 0) THEN
// do something

If the object creation is taken out of the IF statement, like this:

aux := __NEW(fuzzySetArray);
IF (aux = 0) THEN
// do something

...then the download fault disappears and the simulator is ready to run.

Find the corrected (..._A.project) file attached to the first post above.

Page 1 of 1 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited