Research topic: creating FMU from PLC programs
Initial look into the topic materials and my thoughts
I have looked into the materials and asked ChatGPT to get some deeper understanding of the topic ( may or may not be accurate ), I think it would be a good practice to document them down before I forget about everything after I wake up overnight.
I'm mainly trying to have a general understanding about the tools involved, goals and possible roadmap of approaching the goals, as well as some possible challenges that I can think of.
PLC programming and IEC 61131-3
I spent some time learning about IEC 6113-3
before, basically it defines some textual and graphical programming languages ( namely Ladder diagram (LD, graphical)
, Function block diagram (FBD, graphical)
, Structured text (ST, textual)
, Instruction list (IL, textual)
and Sequential function chart (SFC, graphical)
) for the control program in PLC.
Taking OpenPLC for example, it contains an editor that allows developers to edit the source files in these languages and then using the MatIEC Compiler
compiles them into C code or equivalence of IEC standard code [1].
In OpenPLC's documentation, they also mentioned the OpenPLC Runtime, which is installed on the target device where the actual PLC program is supposed to be executed. And OpenPLC also provides some built-in tools for various purposes, for example to configure the parameters of the runtime, uploading programs etc.
For other PLC development tools, the process should be more or less similar.
FMI standard and FMU
I have only glanced through the FMI 3.0 overview slides and it's a bit overwhelming, but basically now I know that FMU is a cross-language simulation unit, namely a compressed file ends with .fmu
, which contains mainly 2 types of content and some optional contents:
modelDescription.xml
: some descriptive information about the model being exported into as FMU;- Model representation: binaries ( executables or libraries for one or many platforms ), or maybe source code;
Optionals: icons, documentations, port definition, resources etc...
There's tons of tools and resources related to this, definitely going to be helpful after sorting them out.
Open Simulation Platform (OSP)
Also I had only glanced through the slides, from my understanding it's a platform / tool set that can take in multiple FMUs from various sources and operate some integrated simulation.
Goals
The goal is to figure out how to export the PLC program into FMU, alternatively if the PLC development tool comes from some vendors that has their own proprietary binaries or runtime, is there a way to wrap up the whole PLC program alongside with these dependencies and export them into FMUs.
Possible roadmap
- Get familiar with some PLC development tools, as well as the process of running PLC programs on the runtime / target devices;
- Get familiar with FMI standard and FMU generation, get some hands-on experience on creating FMU from existing demo models;
- Get familiar with eh OSP co-simulation software;
During the process above, investigate into possible solutions to the goal.
Some difficulties or challenges ( that I can think of )
- I personally have no experience directly programming with PLC development tools, nor did I have tried anything related to simulations, these might take me some time to familiarize;
Due to my unfamiliarity to the related concepts, sometimes it might be quite tricky to come up with the proper questions. And the documentations and tools are quite overwhelming, it would be helpful if I'm able to consult someone with more experience in it to get some guidance;
Questions
In the FMI 3.0 overview slides they introduced FMU for
model exchange
andco-simulation
, I don't know much about simulation but according to what I read, both of them are some sort of ordinary differential equations (ODEs) with events ( I assume this is the mathematic models to describe some features of real-world hardware ), and they also need a solver ( should be a program that generate discrete values based on one specific input to the models ), the main difference between these 2 seems to be how the solver is incorporated into the FMUs.
So my questions is, does it mean these simulation models are kind of like the "intermediate results" of PLC programs? From my understanding, the PLC program defines the behavior of the runtime / physical devices that are going to execute them, and these simulations are probably a form of representation of the physical devices, but the connections between these two seem to be complicated.Side notes and concepts that might be related (or not)
industrial automation layers
References
: documentations about the MatIEC compilers;