Opto22 emu-snr-dr2


Can anybody give me a helping hand
I’m currently using OPTO22 EMU-SNR-DR2 receiving data over Modbus RTU on Serial port.
The Modicon addresses are 300001-300053 for my Modbus slave node addressing 1
Can anybody give me the solution for get this data in Pac Control Professional R9.4a and from there into Pac Display R9.4a?
I’m currently using OptoEMU Sensor manager to set up my Modbus inputs and displaying them in Pac Display R9.4a.
Using Pac Control Professional R9.4a between OptoEMU Sensor manager and Pac Display R9.4a makes the EMU data disappear. Any solutions on this problem?


Greeting Korkildl

Welcome to the Opto Forums!

I probably have more questions than suggestions, so some of this might be ‘misguided’, but hey, lets not let that get in the way…

So here is the flow as I see it.

Serial Modbus device -----> EMU DR -----> Pac Control -----> Pac Display.

So, lets get to work to make it work…

[B]Option 1.[/B]
Skip the middle bit of PAC Control and just go straight from the EMU to PAC Display.
Unless you are wanting or needing to do some logic on the modbus device data, this is the simplest solution.
To do this, you simply add the Sensor.idb file as a regular controller in Pac Display.
Download the file from here; http://www.opto22.com/site/downloads/dl_drilldown.aspx?aid=4358
Add it and the EMU’s IP address and you can display the Modbus data directly from the corresponding table… How do you know which table?
Download and read the OptoEMU sensor communication guide (PDF warning); http://www.opto22.com/documents/1958_OptoEMU_Sensor_Communication_Guide.pdf
The Modbus tables are listed on page 43.
Connect Pac Display to the table and the element to get the data you want and BOOM! Done.

[B]Option 2.[/B]
Go via Pac Control.
Much the same as going direct to Pac Display… Only this time we are going to bring the same Modbus tables into Pac Control first.
To do this, we are going to follow the instructions in the sensor communication guide, page 6. (Put simply, we are going to configure the EMU as a generic MMP I/O device in the PAC Control strategy).
Then, we are going to use the memory map addresses on page 37 to pull the Modbus data into our Pac Control strategy.
From there, before or after any logic we need to do, we can link Pac Display to that control strategy and display the data.

Either of those options should get you going.
I am a little confused about your last statement that adding PAC Control into the mix makes the data ‘disappear’. Most of the tables and memory map addresses are read only, so I can’t figure out how the data is going away… Hopefully one of the two options will get that sorted.

The last option I have is a question… How are you running PAC Control? Is it on SoftPAC or a SNAP-PAC controller? If it is the latter, what sort of controller?
The reason I ask is this;

[B]Option 3.[/B]
If you are using a PAC-S controller, and you don’t need any of the functions that the EMU provides, you can run the serial Modbus device to the PAC-S and then using the Modbus RTU tool kit, pick up the data directly in PAC Control and do what you need from there.
Grab the tool kit from here; http://www.opto22.com/site/downloads/dl_drilldown.aspx?aid=4206

Hope that helps more than it confuses… If the latter, be sure and pop back and ask more questions!


First im sorry for confusing you about my Project.
Option 1 is describing what i have been doing for the last 2 days and it Works fine. I also use Pac Control and PAC sim to uil extra features into PAC Display while using EMU data directly from OptoEMU Sensor manager Modbus inputs and displaying them in Pac Display R9.4a.
Um looking for the oppertunity to do some logic on the modbus device data from the EMU modul.
Im not usiing SoftPAC or a SNAP-PAC controller only the EMU-SNR-DR2 controller and PAC sim.
Is this possible to do using Option 2 as described above or do i need SoftPAC or a SNAP-PAC Controller to use Pac Control to do some logic on the modbus device data from the EMU modul?
And in the same way, do anyone have some code examples on the Option 2 above , mapping Modbus RTU data from the EMU modul into Pac Control using generic MMP I/O ?


An update on my progress.
I’m now using SoftPAC in PAC Control and setting my EMU module as an Generic memory MAP I/O in PAC Control trying to retrive data from the EMU
I’m struggling using the commands for retrieving data using “Get I/O unit scratch pad integer 32 table” with no luck
Any code examples of how this is done retrieving Modbus RTU data from the EMU SNR D2 unit using Generic memory MAP I/O ?


For what you are doing, there is no real difference between PAC Sim and SoftPAC. Just be aware that Pac Sim only runs for (I think) 12 hours before it stops.
SoftPAC runs as long as the PC is running.

Sounds like you have the EMU configured as a generic MMP I/O unit, so let’s move onto the commands…

To get the data from the EMU:
Here is an example of reading just two values, the pulsing input and the Kw’s.
They are not part of a table (we get to that next).

io_status = GetIoUnitScratchPadFloatElement(EMU, 119, pulse_count);
io_status = GetIoUnitScratchPadFloatElement(EMU, 115, kwh_live_from_emu);

The variables can of course be named whatever you need.
(Note, I am not doing any error checking on the io_status, I should be, but I am not).
Also be sure and move floats to floats and int32’s to int32’s so the types all remain the same.
The element numbers 119 and 115 came from the EMU communication guide.

To get a table is pretty much the same.
First, make your int32 table. Make it as long or longer than you need. If you make it shorter, you will get an error.
Once you have done that, use the command…

io_status = GetIoUnitScratchPadInt32Table(EMU,64, 0, 0, MyInt32Table);

Be sure and look at the PAC Control command reference manual. (In Pac Control, click on Help --> Manuals --> Command Reference. Or, click here to download it; http://www.opto22.com/site/documents…aspx?aid=3164 )
It will help with all the parameters.

In this case, you would call the I/O unit EMU (or what you called your generic IO unit).
You want 64 elements, and you want to start at element zero of the table you are reading and you want to store it in the table ‘MyInt32Table’ starting at element zero.

The manual also lists some error codes that you might get, so be sure and check the io_status in debug when your code runs, it should be zero which means success.
If you get some other number, the manual for the command will guide you in getting that sorted.

Sounds like you are very very close to getting it running.
Hope this helps get you sorted.