• Posts 6
  • Reputation 0
  • Member Since
  • Last Active
Email
    This user has not added any photos yet.
All Posts Topics Started Likes
How to create two programs in one project using PLCopen Editor?
thiagoralves wrote:
The redefinition error appears because you should use a global variable as I explained before. 


Thank you. I see. I will use other methods to do that. Thanks for your patient reply again.
0 0
How to create two programs in one project using PLCopen Editor?
thiagoralves wrote:
First, you need to make sure that there is an instance and a task associated with your new program for it to run. Just go to Config0->Res0 on the left panel to see the instances and tasks window. You will see that there is one task created for the hello world program that runs every 50ms. You will need to create another task similar to that one for your new program. Also, you will need to create an instance that associates the task with the program.

About the variable conflict, having two different programs to work with the same variable is tricky. They can go into a racing condition which is a big problem in computer programs, so beware. The right way to do this is to setup a global variable. You setup global variables in the same screen you setup the tasks and instances (Config0->Res0). The first upper portion of the window is for you to create your global variables. Create your global variable by clicking on the green plus sign ("+"). Then, for each program that you want to use that variable, just add a variable with the same name and select External for the Class. Make sure that the type also matches your global variable otherwise you will get a type mismatch error during compilation.

I can see a racing condition happening on your example. For the first cycle, one program is trying to setup %QX0.0 to false and the other is trying to set it up to true. Since you can't have both at the same time, you will see %QX0.0 oscillating between false and true.


Hi, thiagoralves. Thanks for your quick and patient reply. How hard-working man you are!
I've tried to add instance and task for the program I created. I do that by means of imitating Helloworld project. However, the redefinition error remains. I don't know whether I did that wrong. My project is attached below. I will keep trying.
As for the race problem, thanks for your kind and patient remind. I will set some FLAGs to ensure that two programs won't be executed at the same time(please forget the example project I posted. It's just an example.).
Thanks for your patient reply again!
zip  test2Programs.xml.zip      
0 0
How to initialize the bool_output is all 1?
thiagoralves wrote:
I'm writing tutorials and documentation about the project that will be available soon on the website. For now you could use the manual for LPC Manager from Smarteh. They use PLCOpenEditor as well, so you can look at their user manual for descriptions of FB and standard libraries. http://www.beremiz.org/LpcManager_UserManual.pdf


Thank you so much. The manual you mentioned is of great use. Hoping new tutorials and documentation go online too.
0 0
How to initialize the bool_output is all 1?
I am looking for PLCOpenEditor tutorial too but found nothing. Is there a tutorial for PLCOpenEditor? Or there are any examples of the use of PLCOpenEditor's libraries?
0 0
OpenPLC Manual
I am looking for the same thing too but found nothing. But I found something useful while searching for 'IEC61131'. Perhaps you can try.
0 0
How to create two programs in one project using PLCopen Editor?
Hello! I am using OpenPLC, which is very awesome. Thanks for your great contribution.
But lately, I met some problems. 

I've downloaded Helloworld project from  http://www.openplcproject.com and now trying to edit it using PLCopen Editor(latest version 1.2 for linux). For some reasons, I need to create two (or more)programs(using LD language) in one project. I've tried to create another program based on Helloworld project and added some variables into that program. Then I specified the locations of those variables(eg.%QX0.0). PLCopen Editor successfully generated ST file. But when I uploaded that ST file to OpenPLC Server, the server told me that there were redefinitions. What‘more, the server said ‘program compiled without errors’ but it did not update PLC program(it still runs the previous PLC program).

It seems like that locations specified in program2 conflict with those specified in program1. I need to use those locations(eg.%QX0.0) in program2 and program1. But I don't know how to solve these conflicts. Can you tell me how to fix these conflicts? I am new to PLC and LD language. 

Thank you so much! My program and some screenshots are pasted below.  Screenshot from 2018-02-03 15-59-12.png  Screenshot from 2018-02-03 15-58-47.png  Screenshot from 2018-02-03 15-58-11.png 

p.s. English is not my mother language, so please ignore spell and grammar mistakes. 
0 0
count post selected

Add a Website Forum to your website.