afterdream
question1:
                 How to add the User-defined POUs, and which file I need to change?
question2: 
                 If I add the new User-defined POUs, the runtime of openplc should change?
Quote 0 0
thiagoralves
You don't need to change any file or anything on the runtime. To create a User-defined POU, just open PLCOpen Editor, create a new program (or open a blank project), and then click on the grey plus sign "+" in the left panel. From the list that appears, select Function Block (or Function, depending on which type of POU you are planning to create). Give it a name, and select the Language you want to program it (ladder logic, structured text, etc...). Once your POU is finished, you can add it to the main program by dragging it from the left panel or selecting it from the "User-defined POUs" list.

Attached is an example. The added POU calculates the average of two integers.
Quote 0 0
afterdream
Oh,it's very esay.
And I have a anther question how to add new function block into the editor. I need to change which file?
Another,how to realize the function block in the runtime, and I need to change which file?

In my view, in order to add FB in the editor,  need 3 steps:
1step, add a xxx.xml file in the plcopen directory
2step,edit the variable StdTC6Libs in the definition.py
3step,edit the app.fil in the i18n directory

And in order to realize the FB in the runtime, just need: 
Editor many head files(like iec_std_functions.h,etc...) in the path of  matiec_src/lib/c and core/lib etc...

I am not sure ,give me a hand.
Thanks!
Quote 0 0
thiagoralves
What do you mean? You add new function or function blocks by following the steps I mentioned above
Quote 0 0
afterdream
I don't mean to add POUs, I really want to add new funtion blocks like ADD、CTU、 AND、etc...
Quote 0 0
afterdream
for example:
2018-11-17_153140.png 
Quote 0 0
Clock
afterdream wrote:
for example:
2018-11-17_153140.png 


hey, 兄弟,你们最后是怎么添加FunctionBlock的啊,方便透露留个联系方式吗【QQ: 1004568792】
Quote 0 0
rs27
I did not understand that with the file "Average.zip" yet.
Am I correct with the assumption. In the zip file is an XLM file which contains a function block.
How can the XLM file be inserted as a block in the editor?
How was this XLM file created and saved?
Quote 0 0
thiagoralves
The .XML file is a program file for an older version of the editor (PLCOpen Editor). I assume you're using OpenPLC Editor, and therefore you can't open this file directly. To open the .XML file on OpenPLc Editor you will have to create a new blank program (on OpenPLC Editor just go to File -> New) and save it in a folder on your computer. Then, close OpenPLC Editor and go to the folder you just created, and you will see two .xml files in there: beremiz.xml and plc.xml. Get the Average.xml file, rename it to plc.xml, and then drop it inside the folder of your blank program, to replace the plc.xml that was in there. Then open OpenPLC Editor again and open your blank program. It should contain the Average program in it.
Quote 0 0
rs27
Thank you for the fast feedback. So far it has worked. I've just started learning about openPLC, but I think openPLC is a great work.
Quote 0 0
frassquatch
I know it's been a year... but how would I add the average program to an existing one I have? Is there any way to export?
Quote 0 0
thiagoralves
Just copy and paste. Open both programs at the same time, right click on the average block -> copy, and then paste it on your program
Quote 0 0