This file contains some links and some videos for OFB usage in Libre/Open office graphic programming, code generation for C(++) and test

FBcl means 'Function Block Connection Language' which is the textual description of the graphic. The idea comes from ~2018.
OFB means 'Object oriented Function Block graphic'.
Graphical programming of function blocks has been common practice for decades. The automation control, for example Simatic-S7 or Codesys, use it with its "FBD" language (Function Block Diagrams). Another representative is Simulink © Mathworks. There are some more similar tools for that. But for these Function Block programming solutions ObjectOrientation is missing. It is also non-conform to UML. The OFB closes this missing relation with some enhancements in concept, using of Aggregations (UML like), and also a event control system for execution.
What is the approach? Drawing the software with graphic and code generation in C/++ (maybe later also in Rust, or in Java) so that the functionality is seen and understandable by everybody with physic knowlege, obviously, no code lines. But the code lines are generated and follows guaranteed the graphic. Graphical software development does not save effort (money) for development. It improves the documentation! That’s the benefit. The basis for the graphics should be an available, proven tool (without basic costs, usable by anyone at any time). LibreOffice was chosen for this purpose. It is well-known and easy to use for this approach of graphics. The translation is an algorithm written in Java, which reads the graphic data and have capabilities for Code generation.
1. Resources
Of course the current version needs to be improve, and some small things are seen immediately. But if it is not offered in a definitive time, it is never offered. Procrastination is usual not the best idea.
You can write feedbacks and questions to info (at) vishia.org
A download zip file which contains all files to reproduce the content in the videos and have own experience is contained in
-
https://vishia.org/fbg/deploy/OFB_presentation-2025-07-25.zip: Last version This are experience versions.
The zipfile does not contain the tools itself. It contains examples, graphic, generated files to compare, Visual Studio and CodeBlock projects. The tools are downloaded with the unpacked zip in
OFB_presentation/src/load_tools/+checkAndLoadTools.bat
with a MD5 check code from this web page. See also Hints Handling load, file tree
older downloads:
-
https://vishia.org/fbg/deploy/OFB_presentation-2025-04-02.zip: Old version to compare it
-
https://vishia.org/fbg/deploy/UFBgl_presentation-2024-05-02.zip: Very Old version to compare it
Hint: Use the newer file to test whether all features are ok, use the older one as fall back if you know that in the older version a detail has worked, to compare with the new one.
Documentation:
-
https://vishia.org/fbg/pdf/Handling-OFB_VishiaDiagrams-2025-07-23.pdf The current manual for handling with OFB
Note: Use two-page view if you have a larger monitor (1980 x 1020 or more). The documentation is page-oriented. The odd page should be on right side ('book view'), but because usual the Browser-pdf view don’t support the book view an empty left page is introduced for that.
-
https://vishia.org/fbg/pdf/Handling-OFB_VishiaDiagrams-Bookmode.pdf The same current manual for handling with OFB but reading in book mode (first page right).
-
https://vishia.org/fbg/pdf/Impl-OFB_VishiaDiagrams-2024-11-01.pdf - how does it work, internals It is currently not actual.
-
https://vishia.org/fbg/pdf/OFB-Examples.odg-Ccode-2025-03-12a.pdf This is the paper shown on Embedded World 2025
New created on 2025-March-27: Git repository on Gitlab. (The repository itself is grown since 2019):
-
https://gitlab.com/jzhartmut/OFB_Presentation content, sources in the download zip file
-
https://gitlab.com/jzhartmut/srcJava_vishiaFBcl sources for the OFB converter
-
https://gitlab.com/jzhartmut/srcJava_vishiaBase basic sources, no more is used outside the standard JRE-8
Javadoc html of the converting tool
2. New version 2025-07-25
The new version comes in comparison to the April version with a lot of new features. As the versions in 2024, the April version may seen only as start. This version is now suitable for professional use.
2.1. Changes since 2025-April
Some important news are:
-
The access to data with operations and return values are now supported. The older versions were oriented, as usual also in ordinary C programming, only to (public) data. Working with operations and hence encapsulate data are a proper decision.
inline
operations also in C language does not enforce additional calculation time on machine level. Also usage of reference variables for return values is possible. What is not clarified: Return of a reference is intrinsically an association in UML thinking, and should be handled in exact that way. Function block graphics do not deal with references, only with data flow. But usage of references is usual in C/++ programming. This should be basically proper clarified for the Object Oriented Function Block (OFB) concept. -
In opposite to this feature, also public access to structured data works, sometimes necessary for embedded applications. Inner variables well structured can be declared as outputs to immediately access from outside.
-
Defining and usage of module input and output pins is improved (as result of the changes above).
-
Usage of non determined types are supported. This is sometimes necessary if a library module is written first independent of usage in a
float
orint
environment. The graphic is the same. The usage and code generation decides about the numeric, with unchanged graphic. -
The fix point arithmetic is improved and tested, with automatic conversion from and to float with dedicated given 'number of fractional bits'. Also using saturation arithmetic is supported. It is not yet tested elaborately in embedded hardware, but the system for that is established.
-
The concept of predefined FBlocks and the alias are improved. The name of a
struct
in C language is determined only on code generation, not already in the graphic diagrams. The mapping is done with an extra text file (-cfg:
), see video below. Used names in the graphic diagrams are more independent of target implementation stuff. -
logs and comments are improved to see how and why the code is generated in the given result.
-
The translation from the graphic to target code can now be started also from LibreOffice in the toolbar, using a macro in LibreOffice, which calls the used batch file (or todo: shell script for Linux). See video below. Also executing the target code build process and start execution can be done in this kind, but is not done yet. This would be a faster way from the graphic to execution results.
All in all, some tests on living examples are done, a lot of fine tuning was done. A list of details of changes can be seen in the version history: https://gitlab.com/jzhartmut/srcJava_vishiaFBcl. Of course the documentation is improved step by step.
2.2. Videos showing the new features and working with OFB
There are some videos showing the new features and showing how working with OFB:
2.2.1. Working with alias and determine the struct names in target code
This video (18 min) shows how alias designations are used and how the header files are determined from the graphic content.
It includes also the explanation how the graphic definition of FBlocks is related to the given (legacy) target code.
2.2.2. Module output possibilities, return by value, value reference variables, operation access
This video (26 min) shows possibilities of the outputs of the module as also as called function blocks also written in target language.
Operation access is the recommended style for encapsulated Object oriented programming. But beside this, for embedded C, as usual, also the public access also to structured data is supportet.
The video discusses also the possibility to use pointer access. But this is a question of associations (UML thinking), and some questions are open regarding code style, public access, const access. Associations are not yet ready to use handled in the version 2025-07, should be added in the next time. Then this video is still valid, and a second video using associations will be offered in parallel.
2.2.3. PID control - with different numeric data types
This video (21 min) shows the example ''Position control with PID'' which is implemented with float
,
int32
and int16
arithmetic.
It shows more details about controlling effects, especially the D-Part in PID controlling,
than details of the OFB concept.
But may be interesting as application example.
This second video (11 min) for the same diagrams now shows, how the numeric data types are selected in code generation and from the given (legacy) core C codes.
2.2.4. Integer and saturation arithmetic, using fractional bits
This video (26 min) shows how integer artithmetic with dedicated number of fractional bits is used beside float arithmetic, with automatic conversion between, and especially how saturation for integer arithmetic is possible and works. Hint: The video has some technical hanging effects especially on end. It should be replaced by a new version.
2.2.5. How insert an icon and macro in LibreOffice draw for the translation
This video (8 min) shows how to insert a macro in the LibreOffice toolbar to fast start the OFB translation from LibreOffice (after saving the file).
The translation itself is controlled by a batch file (TODO offer also a shell script for linux) from the stored file.odg content. The macro does the same as start the batch file from outside. But it is faster to handle.
2.2.6. Fix a problem with hanging socket on CurveView
Not all is perfect. The current version of the CurveViewApplication has the problem that sometimes (rarely) it is not correct closed, and the used socket remains open. This problem should be fixed in the CurveViewAppl, which is only used here as helper. But it is not fixed yet in the moment. If it occurs, "a new boot is good", booting the PC helps. But to fix the problem also only the hanging process can be killed, using the TaskManager (of Windows). This video (8 min) shows the problem, and show how to find the blocked socket in the ResourceMonitor on Windows and kill the process. The process-ID is written to the socket in the Resource Monitor. But it is unfortunately not written in the standard view of the task manager, only in the "Details" view on the task manager.
3. Presentation on Linux-Day in Augsburg, Germany
My presentation in German language has shown the OFB-Converter only as example how to use indirect styles in documentation and graphic. The topic there was LibreOffice, not the OFB-Converter. But nevertheless the presentation may show some hints on usage also for the OFB topic:
https://youtu.be/CfxPV5skklM The presentation itself, German.
4. New version 2025-04-02:
Hint: The videos below are also valid for the current version, only small changes in implementation are different. The approach and system is not generally changed.
Many details are improved in the last year, in the work is also current in progress. But new versions has run also in the past with changed versions. The base is stable.
My own main focus should now be on improving the comprehensibility of the sources (programmed in Java) All tagged or downloadable versions are (and should be in the future) tested and fulfill the examples shown. The second effort should go into the documentation. The state machines are not yet available, but are in progress. Follow the videos. They show what is available.
4.1. Unpack zip file, use code generation
This video right side on the image shows how to unpack and start test with the new zip file from 2025-april-02. It is a short presentation, 6min with ~43 MByte
4.2. Detail explaination with example BandpassFilter
This video (in German language) right side on the image is an introduction to the new zip file from 2025-april-02. It is a longer presentation, 1h10min. The resolution is reduced (to save a little bit our world), it uses only ~200 MByte space on the server and for traffic.
5. Older content from ~2024
Older zip file to download:
-
https://vishia.org/fbg/deploy/UFBgl_presentation-2024-05-02.zip (older version from last year 2024)
The following videos are the old ones, still valid exclusive small details. They will be replaced step by step by videos with the newer versions if necessary.
A documentation can be viewed or downloaded, see start of this page.
Older and not complete documentation:
-
https://vishia.org/fbg/pdf/Impl-OFB_VishiaDiagrams-2024-11-01.pdf - how does it work, internals
-
https://vishia.org/fbg/pdf/UFBgl-Diagrams-OpenLibreoffice-2024-05-02.pdf (this was the version one year ago)
5.1. First example from 2024, goal of graphic in Libre/Open office
This first video (12 min) shows how to copy and use the template in LibreOffice for a first simple own UFBgl-diagram. It shows the general approach drawing UFBgl diagrams.
This second video (16 min) shows the code generation for this first example,
5.2. Comprehensive example: Bandpass Filter for 50 Hz electrical grid
This video (8 min) explains a more comprehensive module or graphical model. It is the first video for that example and shows the approach how to deal really with graphical modelling.
This video (13 min) shows how test results are output in a curve view, and how the functionality can be designed, tested and improved in the graphic module, with help of execution the generated code.
In this video (10 min) it is shown how the code generation for this specific scope program is done, with preparing of an ethernet telegram to the scope "Curve View" application, inclusively generation of the configuration of the code generation script
5.3. Details about running mode
In this third video (6 min) it is shown in single step in the generated code how the initialization works. It is also the concept of ../../emC/index.html[emC] for the phases constructor, initialization and run.
This video (8 min) enhances the example in the video above with the possibility to assign the aggregation between the classes in the constructor instead in the init…() routine. Both is possible.
Also the possibility of vice-versa aggregations are explained. But not full completely. The topic is, vise-versa aggregations in the constructor are not possible if allocated memory is used. Because the other instance does not exists if it is necessary for referencing in the constructor. That’s why aggregations can also be assigned in the init, after construction of all instances. This topic should be explained in an extra video, yet todo
6. Hints Handling load, file tree
Also handling with "load tools"
Hint for the file tree in the examples: The generally approaches for the file tree are described in ../../SwEng/html/srcFileTree.html.
It means here:
Working_tree_where_zip_is_unpacked +-tools This is created after src/load_tools +-IDE This is created after executing a +spawn_IDE_....bat | +-Example_Component | +-CB for Codeblocks projects to execute and test | +-MSC for Visual Studio projects to execute and test +-src The sources, only this directory is contained in the zip +-load_toos To load the translation tools for UFBgl from vishia page +-src_emC Version of used sources from emC (embedded multiplatform C/++) +-Templates_odg contains the odg template file, and makescripts to create onw stuff +-Example_Component | +-IDE... The IDE files to spawn it. | +-+spawn_IDE_....bat click it to spawn | +-odg Here is the odg file for this example | +-cpp Some C/++ files | | +-genSrc This are the destination for generated C/++-Files | +-cmpGen This directory contains the versions from older generations, to compare | +-curveView Files for the CurveView toool | +-makeScripts Files to translate the module. +-ExmplBandpass It is such an example +-IDE +-odg ... etc.