Hi again,
(Long one this answer
)
Well, I’ve been experementing with this a bit now and thought i’d let you know what I’ve done.
I started by subscribing to the signal that I needed, but this required a lot of “infrastructutute” to handle lists of files to subsribe to. I tried to have lists of the signals in external files that I read in att the application start. It worked but I felt there was a few downsides:
-
I felt that I sometimes missed events. This made me still have a slow timed event to round up missed events.
-
I felt it was troblesome to unsubscribe and resubscribe to the signals when I switched between the different forms I use.
This made me switch to a polled solution where I read the signals from the thre involved controllers every two seconds with something like below:
Dim AllMySignals As SignalCollection = FormStartupSelection.HR1Controller.IOSystem.GetSignals(IOFilterTypes.All)
ReDim IoListaHr1(0)
For Each MySignal As Signal In AllMySignals
If Mid(MySignal.Name.ToString, 1, 2) = “di” Or Mid(MySignal.Name.ToString, 1, 2) = “do” Or Mid(MySignal.Name.ToString, 1, 2) = “si” Or Mid(MySignal.Name.ToString, 1, 2) = “so” Then
ReDim Preserve IoListaHr1(UBound(IoListaHr1) + 1)
IoListaHr1(UBound(IoListaHr1)).IoNamn = MySignal.Name.ToString
IoListaHr1(UBound(IoListaHr1)).IoValue = MySignal.Value
End If
Next
Basically What I’ve done is to make a structure containing the IO name ans value, then read all the signals into this array, one time each poll. I then only work towards this array to evaluate the status.I don’t feel that it is slow or anything like that, so i think I will stay with this.
But maybe you know how it works. Is it one call to the controller for each “For Each MySignal”, or is the values already, read?
/Per M