Modules detection in python or C++

Hi,

I am looking for a way to collect automatically all tags from the PLC in Python (or C++) from all modules connected to the back plane of an Epic or a Rio, all program tags would be good too. Basically the equivalent of a discover/browse function.

Regards

Hugues

Interesting question… @torchard and I have kicked it back and forth and cant think of way to do this after giving it some thought.

Whats the use case?

Beno,

It is basically to detect automatically the available tags available from the PLCs (Epic or Rio) connected to the network. Like Ignition or others do in Ethernet/IP with Allen Bradley for example.
In my case PLCs on the network come and go so I need to detect them as I cant know the available tag it in advance most of the time.

cheers

Are they running PAC Control?

This could be a key aspect to getting this done…

yes they ll run PAC Control Strategies

Thanks for the extra info. Based on what you’re looking for I think the best approach would be with the REST API’s, probably a combination of the groov Manage API and the PAC Control API. You can find out more about each on the developer site:
developer.opto22.com/groov/manage/
developer.opto22.com/rest/pac/

I find the most useful tool is the swagger page, which are linked from the developer site but are also available directly on your EPIC – just go to “Info and Help” then click “REST APIs” and pick which API you want to use. Once you’re on that page you’ll see a green “Authorize” option in the lower right where you can paste in an admin API key to test out the exact endpoints you want, for example to get the details for your on-board IO you might want to check out /api/v1/io/{device}/modules/{moduleIndex}/config. It won’t return everything for the whole device, but it’s pretty easy to put in a loop that will hit each of your modules.

For the PAC Control variables you can sweep through each data type that you need using endpoints like GET /device/strategy/vars/floats

Finally, when it comes to actually programming this, most languages have some way of doing HTTP requests and handling JSON, the basics for requests with Python are covered here: developer.opto22.com/epicdev/python/ and you can find sample code on the developer GitHub, like this example: restreaddigmodch.py

1 Like

Terry,

the RestApi was the obvious option but I wanted to know if there was lower level ones.
I’ll look at it in detail and revert back if needed.

Cheers

Would the (EXPANDED) ANALOG & DIGITAL CHANNEL CONFIGURATION—READ/WRITE section of the memory map provide anything useful? Not sure if the channel name gets populated or not.