Hello, I added the Alarms Lib from the PLC Next store to my project (I am using 2020.3). Then I create a program named Alarms , as in the example, and added it to my tasks. But after this, I can’t add any External Variables. I tried a variable named tagG and got this: SEM1056 No matching global variable found for ‘Main:tagG’ in resource ‘axcf2152_1:PLC’. What does the error mean? Is “Alarms” a reserved word? Thanks,
Yes, I am able to create a global variable called tagG inl (PLC) data table but it has to be declare as “BOOL” in the program so it can be used. “tagG” cannot be any other data types than “BOOL” now in the program when it is declared as external.
OK, so the data type of the External variable(s) declared in Program(s), must always match the data type of the corresponding Global variable. So if you declare the global variable tagG as BOOL, all the external Program variables of the same name must also have the type BOOL. If you want to change the type of the tagG External variable(s), this must be changed in the Global data table, and in every program. Or perhaps I am missing something in the description of the problem? ~ Martin.
Hi, You need to expand the columns by clicking here: … then you can change the data type. ~ Martin.
Hi, Martin, The above way works. I can declare global variables in the global variable table. The weird thing is that I can declare the external variables or in/out ports in the programs if I don’t have a program named as “Alarms” with the imported “Alarms” library. With a “Alarms” program, these type of variables cannot be declared in the programs. What is the reason?
Thanks
Jason
OK, so the issue I saw is that, when adding external variables to a Program, the corresponding global variable will only be added automatically if that program currently has one or more instances defined in a Task. If the external variable was created in a program that was not instantiated, then the global variable will be created as soon as that program is instantiated in a task. Does this explain the behaviour that you are seeing? ~ Martin.
Hi, Martin,
Whatever the program is instantiated or not, no external variable can be declared inside the program. It will give out the error message {No Matching Global Variable Found for ‘Alarms.tagGlobal’ in resource ‘axc-f-2152-1:PLC’}. “tagGlobal” is the variable I tried to declare in the program. The above error also apply to the example project “AL_1_2_EXA.pcwex” which I downloaded from PLCNext Store. I tried to rename the program “Alarms” to “MyAlarms” and the error disappeared. The global variable can be declared inside any programs now. However, I realized that I need to import the “Alarms” web pages and this page includes many variables named as “Alarms1..FB_Alarms.xxx”. If I change the program name to “MyAlarms”, all variables in the “Alarms” page have to be changed to “MyAlarms1.FB_Alarms.xxx” and there is no guarantee this change will work. Now this is pretty critical we are facing in developing our application. The error can be simply verified by the example project from the “Alarm” library downloaded from the PLCNext Store. Could you check it? Thank you very much
Jason Li
Hi, Martin,
I had a wrong description in the previous post.
You are right.
If a program is named as “Alarms”, the global (External) variables can be declared in any programs if the “Alarms” is not instantiated. In the contrast, the global (External) variables cannot be declared in any programs if the “Alarms” is instantiated as “Alarms1”. Error message “No matching global variable found” displays.
However, the “Alarms” web page links to many variables named “Alarms1.FB_Alarms.xxxxxx”. It means the program named as “Alarms” has to be used.
Could this problem be solved? Thanks
Jason Li
Hi Jason, I have reproduced the error you are seeing, and I have asked for an explanation for this behaviour. As a work-around, is it acceptable to use the solution in #6 above - that is, to manually create the corresponding global variables? Also, regarding the name of the program and program instances - I understand that you would like to have a program instance named “Alarms1”. This does not mean that the program must be named “Alarms” - it is possible to give program instances whatever name you want. Simply edit the instance name in the PLCnext → Tasks and Events window. ~ Martin.
Hi Jason, I now have more information from the PLCnext Engineer product manager. This behaviour can be explained by the presence of a POU named “Alarms” in the library that you are using from the PLCnext Store. This duplicate POU (in the library) is not visible to users of the library, but it causes the problems you observed. There are two solutions to this problem currently being worked on by the PLCnext Engineer developers: 1. (short term): A clear error message when this situation occurs. 2. (longer term, possibly next year): The ability to have POUs with the same name in different namespaces. Until then, I think that your own function block will need to use a name other than “Alarms”. However, as mentioned above, this does not stop you from creating an instance of this function block called “Alarms1”. Hope this helps. ~ Martin.







