Opto .NET Controller SDK How to Read Digital/Analog Point

I’m using a SNAP-PAC-R1 and am using C# and the following is the code I currently have that I have verified will turn on a discrete i/o point “Sphere_6” I have named in my strategy file via a button click. However, I cannot find/figure out the appropriate calls/setup/code to use to read the status of the same point. I do not see a ReadDiscretePointAttribute or something similar. I do find this ReadGroupItems method that says it applies to 32/64-bit integers, 32-bit floats, up/down timers, string variables, 32/64-bit tables, 32-bit float tables, string tables, discrete points and analog points. So, I was hoping that function could read points? Or is there no way to read an analog/digital point with the .NET Controller SDK? Or do I have to resort to the OptoMMP one? The OptoMMP one is rather confusing to me, so if there is a way in the .NET Controller SDK, that’d be great. Otherwise, what does that read group items function do if it includes points in the description?

My code that I used to write to the point is below.:

mwacsController is the name of the controller.
Controller.ErrorResponse errorResponse1 = mwacsController.WriteDiscretePointAttribute(“Sphere_6”, false, Controller.Item.eDiscretePointAttributes.state, true);

Sorry for taking so long, I don’t have any experience with .NET and I understand that you reached out to our support team… Which was the right thing to do.

One quick workaround (I’m told) would be to use the PAC Control strategy running on the controller to read the analog value and put it in a float variable and then use .NET to read that variable.

This might be helpful, or at least give you an example of getting values using the MMP. We do not use PAC control strategies much (shell access), but we do use the .NET SDK extensively to test panels and for custom HMI’s. I would suggest looking straight at the IO for the digitals and analog values.

For everything else, dump your values in the scratchpad areas (timers, variables, etc.) and reference them from there in the C# code.

Simple Class:

    public class OperationalData
        // read the analog values
        public float[] values = new float[512];
        // read the digital values
        public bool[] digStates = new bool[512];

        // int32 scratchpads
        public int[] i32Ary = new int[1000];
        // float scratchpads
        public float[] fAry = new float[1000];

    public OperationalData oper = new OperationalData();

These are some simple examples that will read an entire controller.

Read Digitals starting from first point (16 modules, 32 channels per module = 512 points):

nResult = unit.ReadHighDensityDigitalStates(oper.digStates, 0);

Example: digStates[3] is the first module, channel 3’s digital state. digStates[40] would be module 2, channel 8…

Read Analogs starting from first point (16 modules, 32 channels per module = 512 points):
nResult = unit.ReadAnalogEus512(oper.values, 0);

nResult = unit.ScratchpadI32Read(oper.i32Ary, 0, 1000, 0);
nResult = ScratchpadFloatRead(oper.fAry, 0, 1000, 0);