A simple yet flexible library to enable easy file control and / or compose or parse XML data in CODESYS based PLC's via the following function blocks;
FB | Usecase |
---|---|
FB_Filecontrol | Provides the user a generic and easy way to open, close, read, write files on disk |
FB_StreamBuffer | Provides the user a generic and easy way to compose file contents, this enables you to build your own file content parser quickly |
FB_XmlControl | Provides a complete solution to read, write, parse and compose XML files. |
The solution can handle xml-parsing in following manner:
1) Buffer > Filesize: Reading an entire XML file into a pre-allocated memory-buffer
2) Buffer < Filesize: Read partially chunks into a smaller and optimized buffer
Method | advantage | disadvantage |
---|---|---|
1) Buffer > Filesize | fast and relatively easy to implement | Larger PLC memory requirement due to loading the file into a pre-allocated memory-buffer |
2) Buffer < Filesize | widely applicable due to small memory footprint | relative slow parsing of large files. Relatively more complex to implement |
Examples for both parsing methods are provided, which can act as a starting point for your implementation
Downloads hosted on github;
https://github.com/HAHermsen/co5e-XML-File-Handling
Basic library idea and coding: H.Hermsen.
bugfixes, testing: i-campbell and Aliazzz.
Additional small memory footprint file parsing: TimvH
https://www.linkedin.com/in/hahermsen