network.lib compilation problem / TcMath and oscat_basic conflict

Begonnen von vmolchanov, 28. August 2015, 13:30:53

Vorheriges Thema - Nächstes Thema

0 Mitglieder und 2 Gäste betrachten dieses Thema.

vmolchanov

We need to encrypt strings using MD5 algorithm. The functional block 'MD5_STR' in folder 'CONVERT' of the OSCAT network library seems to do the job.

After adding the library 'beckhoff_network_121.lib' to the project, many errors appear of type:
Error 3747: (...): Unknown string length 'STRING_LENGTH'

Our guess was that the basic library is needed either. However, after adding 'oscat_basic_333.lib' to the project, the following problem appeared:
Error 3700: FLOOR (...): A POU with name 'FLOOR' is already in library '...oscat_basic_333.lib'

The function 'FLOOR' is contained in TcMath.lib. This library can not be excluded from the project as it has other functions, which are extensively used.

Please, help us to overcome the problem. If possible and appropriate, give an educational answer.

System info:
PLC Control Version v2.11.0 (Build 2220)
TwinCAT v2.11.2249
PC operating system: Windows 7 Home Basic N

peewit

Open oscat basic lib as project and rename or delete the floor module

vmolchanov

#2
Here is my solution for those who need detailed instructions. (NOTE: I am using TwinCAT 2)

The first way: it is possible to open network lib as a project end export the POU you need (right click on POU, Export object...) and then import it in your project (Project->Import). Most probably, you will get some compilation errors as the imported POU will require other POU(s) missing. If not, you are lucky: mission complete. If it is the case, continue exporting and importing missing POUs. I gave up here because I did not know, how many POUs I needed to export/import. Now a hint: check dependencies using "Project->Show Call Tree".

The second way is to include network_lib and oscat_basic as they are. Here I got an error saying that the number of POUs in the project had become over some max (2048 in my case). This can be fixed by specifying a higher limit in the file "" (contained in my case in the folder: "C:/TwinCAT/Plc") like that: "MaxNumOfPOUs=4096". I think it is not nice but it does the job. Then, , I got a conflict with "TcMath.lib", where the function "FLOOR" (same name as in oscat_basic) is defined. Fortunately, only two functions (FLOOR and MODABS) from TcMath.lib were used in my project. Thus, it was enough to exclude TcMath library from my project, export MODABS from it, and import it back to my project (FLOOR is already defined in oscat_basic and does the same thing, I hope).

Conclusion: I do not think that I've done it correctly, when including libraries with thousands POUs into my project in order to use a single small POU from the whole set. It would be a nice new tool, which would allow for exporting a selected POU together with all its dependencies...