Data Capture from OPTO TABLES and store in SQL

Hi Team,
I have a bunch of Groov Epics and SNAP PAC R1s with rest api enabled.

I am developing an application which can fetch data from Opto 22 Tables via restapi and save that data to SQL.

I have 2 queries:

  1. Is it okay to send a rest api request every 1 second since i need data to be stored every second. Will these repeated requests affect the PLC Or its Performance by anychance?
  2. Apart from RestAPI, i have seen some c++ dev kits and optommp to get the data. I am using python programming language. Optommp has a python wrapper but seems like it only works with Epic and not the SNAP PAC. What do you suggest is the best way to get data from Opto? Or do you suggest me to switch from python to C++ for data fetching?

Thanks a lot

I do not have answers to all of your questions, but some.

I assume you are running your Python application on a PC like device. Is it a Linux or MS Windows PC?

If the controllers use PAC Control, and the Tables you want to read are PAC Control Tables, the REST API is the easiest way to connect.

If you need to access Scratch Pad Tables, that is OptoMMP. How to use OptoMMP protocol in Python is described here.

The EPIC controllers can run Python code right on themselve. For this we offer a package to install on the EPIC-PR1 controller via Shell access.

The PAC controller can’t run Python code.

Beside the REST API access to PAC Control Tags, there is a .Net library available, but it is a managed DLL.

1 Like

Hello Gerhard,

Thank you for the prompt reply.

Yes i am using a python code in linux to fetch the data via REST API.

I would like to ask a follow up question based on your response.
I have tried to review the available documentation on the rest api but was unable to find any information on how it affects the plc processing capability. Do you have any information on the maximum requests the plc can process without affecting its performance?

There is no performance data available. There are several other aspects that come into play. With a poll rate of 1 second you should be ok. There is also a difference if you do this to a PAC-R controller or EPIC. Then it depends on how much data you are requesting per poll. How large is the table you are transfering?

  1. Once per second would be Ok, but 10 per second would be a bit much.
    Also, if you are on a local network only, you can use HTTP for the SNAP controller instead of HTTPS, which will speed things up a bit.
    That said, I would not use REST as your communication method. Since you are using Python, I would use MMP.
    In your PAC Control strategy, have a command in one of the charts that moves the data you need to get via Ptyhon to the MMP area. That will be quicker than using REST.
  2. Both SNAP PAC R1 and EPIC support REST and MMP, so your Python code will be identical except for the IP address of the device you are talking with.
    This will be the most performant way to get the data you need.

There are two Python code examples:
The one Gerhard linked to and this one: Getting Started with Python for groov EPIC | Opto 22 Developer
Remember, MMP works on SNAP as well as EPIC, so you can use the same code for both.

1 Like

Hii Beno and Gerhard,

Thank you very much for the response. As suggested i would go with OptoMMP approach.