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…
Code:
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.