Dear Community User! We are updating our platform to a new system.
Read more: Important information on the platform change.

cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Passing a method call from a Python OPC-UA server to the PLC environment via the DataLayer

Passing a method call from a Python OPC-UA server to the PLC environment via the DataLayer

Thomas_SF
Established Member

Hi together,
I am still new to the ctrlX system and am currently working with the SDK.

My problem is as follows:
I have programmed an OPC-UA server in Python.
With the help of the examples I was able to add nodes to the datalayer via Python and transfer the variables of the OPC-UA server there.
Now I want to bring my OPC-UA methods to the data layer so that I can pass on a method call to the PLC.

Unfortunately, I have not found any examples for attaching methods to the datalayer.

Is there a way to implement this concept?

 

Thanks in advance!

 

 

4 REPLIES 4

nickH
Community Moderator
Community Moderator

Hi, 

Yes, it is possible to register methods in the Data Layer. You can see a example, if you go to "diagnosis/confirm/error" in the Data Layer. That this node is a method is defined in its metadata (Node Class = Method). If you click the button "Write" of a method, the code at your onWrite() function gets called. 

2022-03-15_11h11_28.png

 

But I don't know if methods in the Data Layer suits your task.

Could you please go into a little more detail on what you want to do in your Python App and what you want to do from the PLC?

 

Best regards

Nick

Thomas_SF
Established Member

Hi Nick thank you for replying,


Yes, exactly, there are methods on the datalayer that motivated me to work with it. (:

I would like to map the methods of my Python OPC-UA server to the datalayer. So when a method is called via the OPC-UA server, the corresponding method should be called on the datalayer.

With the method of the datalayer I want to start a functionality in my PLC environment.

 

Best regards

Thomas

nickH
Community Moderator
Community Moderator

Hello Thomas, 

at the moment it is not possible to get methods from the PLC to the Data Layer, like you can do it with custom apps in high level programming languages. 

I think the best workaround for you would be to have a bool variable in your PLC project and publish them to the Data Layer. From the Python App you can set the bool to true, when you want to start your PLC function. In the PLC program you can start your function when the specific bool variable is true and set the variable back to false, if you have finished the function (see screenshot and link in further information). 

nickH_0-1647512041415.png

To publish PLC methods direct to the Data Layer would be a nicer solution. This feature is on the roadmap for a future release.

Further information: 

Thomas_SF
Established Member

All right thank you for the answer.
Then i will go this way for now. 👍

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist