C++ Notification Manager

i have added the latest version to the directory but i still get the same error

What is the result of this command, in the project directory: plcncli get project-sdks It should show the SDK that you have just added to this project. You will also need to remove the invalid SDK from the project, using the procedure in that application note.






this is the result i got [attachment]Screenshot_1.png[/attachment] i removed the old one an now it did make the library succesfully

there seems to be aproblem when i upload the program from the PLCnext Engineer, i have used the files from the example but before even running it gives me a fail notification. maybe a problem with the config files or something? whenever i add this file to my plc nothing works, can’t upload any projects even projects that don’t use the notifications.

It sounds like the PLCnext Engineer project is crashing the PLCnext Runtime, which would explain why PLCnext Engineer cannot connect to the PLC any more. What messages are in the Output.log file immediately after the PLC shows the “fail” notification?

ERROR - Exception occurs while loading plc component ‘Arp.Plc.Plm’: Exception of type ‘Arp::System::Commons::ArgumentException’ was thrown this is the error message shown, underneath is says this: Invalid parameter value: ‘notificationName’ = ‘My.NameSpace.1’: Cannot subscribe to unregistered notification.

I can’t reproduce that … I have just followed the procedure in the Quick Start section of the tutorial with a fresh PLCnext Engineer project, and I don’t see that error. Even when I “forget” to create an instance of the PG_SendNotification program, the worst I get are these warning messages: 23.04.21 12:17:42.516 Arp.System.Nm.Internal.NotificationBroker.NotificationBroker WARN - A subscriber subscribed to unregistered notification name: My.NameSpace.2 23.04.21 12:17:42.518 Arp.System.Nm.Internal.NotificationBroker.NotificationBroker WARN - A subscriber subscribed to unregistered notification name: My.NameSpace.1 This is on an AXC F 2152 FW 2021.0.3 and PLCnext Engineer 2021.3. Without seeing your complete project, or the complete log file, it’s difficult to diagnose the error that you are seeing. If you are happy to send me those, I can send you an email with instructions on how to get them to me.

i understand now, i was always linking the in and out ports, now i see what i was doing wrong. i made a new project and added the library now it works fine. thanks alot for the help. i’m going to try making my own notifications now. wish me luck and another question, how can i let these show up in the web based management and/or cockpit notifications?

[quote]how can i let these show up in the web based management and/or cockpit notifications?[/quote] That was way back in message #11 in this thread … [quote]The notifications shown in Web-Based Management, and in the cockpit window in PLCnext Engineer, are sourced from the notification database that is filled by the Notification Logger … So, you want to configure the Notification Logger to subscribe to your custom notifications. The procedure for doing this is relatively simple, and is described in Part 5 of the tutorial on Github. This includes a link to more information in the Info Center, and a sample Notification Logger configuration file for the example project. Once your custom notification logger configuration is applied to the PLC (and the PLCnext Runtime is restarted), then all the custom notifications sent by your program should be logged by the notification logger, and they should also appear in WBM and in PLCnext Engineer.[/quote] There is a sample notification logger .config file for the example project, which should let you see the example notifications in PLCnext Engineer and WBM. You can then modify that example config file for your own custom notifications. Good luck with the next steps, enjoy the weekend, and please let us know if you have more questions. P.S. Thanks for the very good Makers Blog post.

Hi Martin, thank you so much for all the help. I got it working now and am very happy about it. You also enjoy your weekend. P.S. Thank you, i tried my best to make it as complete as possible. if there are any mistakes please let me know.

Hello Martin, I’m still working with the notification manager and got a question from my superiors. “Is it possible that the client can make their own custom notification in the PLCnext Engineer.” by this they mean to ask if it’s possible if a custom string can be sent to the C++ program to make a notification that way. My question now is if it’s possible to send strings to C++ from PLCnext Engineer? If not how can i get texts from the PLC to C++? Kind regards, Robin

Hi Robin, [quote]My question now is if it’s possible to send strings to C++ from PLCnext Engineer?[/quote] Yes. In this C++ example: https://github.com/PLCnext/CppExamples/tree/master/Examples/CppDataTypeTest … you can see examples of how to send standard-length strings (max 80 chars) and custom-length strings between C++ and IEC programs. The variables from both programs will appear as IN and OUT ports in the Port List in PLCnext Engineer, where compatible types can be connected together.

Hi again, i seem to be having trouble with sending strings, i have no idea why it isn’t working. [attachment]Screenshot_1.png[/attachment] this is what my ports look like, but the port going to c++ never has any values in it [attachment]Screenshot_2.png[/attachment] it looks like this, i have no idea why this doesn’t work. [attachment]Screenshot_3.png[/attachment] these are the ports in c++



I get the same behaviour you are seeing when I overwrite the IN port (StaticString) variable with “…” in the C++ program: [attachment]2021-05-11_10-37-23.jpg[/attachment] When I do not assign any value to the IN port variable in the C++ code, I see the expected behaviour - the value of the IN port variable in the C++ program is the same as the value of the OUT port variable in the IEC program.

I have changed this as you said and removed the overwrite from C++ but get the same as before. All i see in the C++ IN port is ‘…’ [attachment]Screenshot_4.png[/attachment] these are the C++ ports now.

Can you try this: [list] []keep the existing StaticString port, but create another StaticString Input port in the C++ program with a different name. []in the PLCnext Engineer project, link the OUT (string) port to the new IN port on the C++ program. [/list]Does this make a difference? If not, is there anything in the Output.log file that indicates an error? Also - how are you building the C++ code? Using the VS add-in? or the Eclipse add-in? or using the plcncli directly?

I tried doing what you said but the problem i still the same. Nothing in the log files suggests a problem and i am using the VS add-in.

I have just created a new PLM project using the template in Visual Studio Professional 2019 (Version 16.9.4) with the PLCnext C++ Extension (Version 21.0.0.489). The only change I made to the template was to add one Port to the Program .hpp file: [attachment]2021-05-12_12-01-44.jpg[/attachment] [list] []I built the PLCnext Engineer library and added it to an empty PLCnext Engineer project, using the template for AXC F 2152 FW 2021.0.0. []I created an instance of the C++ Program in the same Cyclic task as the Main program instance. []In the Main program, I added a single Out Port variable of type STRING. []In PLCnext Engineer, I connected the OUT port from the Main program instance, to the IN port on the C++ program instance. [*]I sent the program to the PLC, and in Debug mode the value of the IN port variable on the C++ program instance always changes to the value of the OUT port variable on the Main program instance. [/list] If this still does not work for you, then (with your permission) I can email you instructions on where to send your PLCnext Engineer project, so we can check it here.

2021-05-12_12-01-44.jpg

I have followed along with what you said. but it made no difference nothing shows up for the c++ in port. you have my permission to send the email with instructions. solving this would help me advance alot in my current project.

Email has been sent to the address you used to register for this forum. (please check your spam box if necessary).