Hello,
I’m trying to write a command to re-enable my I/O units that become disabled for unknown reasons. That way I don’t have to manually open the I/O units folder, and change the status from “disabled” to “enabled” for the individual controllers (image).
Currently, my script will stop/start the strategy but that is too aggressive and requires the machine to be down.
Here is what I have:
sTransmitBuffer = “_END _RUN” + Chr(13);
//Repeat the following for each controller to restart.
SetCommunicationHandleValue(“tcp:172.27.72.30:22001”, comm); //put the controller to restart IP address in here
status = OpenOutgoingCommunication(comm);
status = TransmitReceiveString(sTransmitBuffer, comm, sReceiveBuffer); //sReceiveBuffer will have a couple nulls in it
status = CloseCommunication(comm);
When you unzip it you will find a doc showing how to set it up and use it.
Its well used and loved since it does the work in a really smooth way - ie does not just bash at the I/O but has a back off timer.
It also logs errors and re-tries to the PAC Terminal / controller error que.
Perhaps this is all you need, so give it a go and if you are looking for ‘more’ or slightly different use case, just ask in this thread and we can brainstorm a bit.
Here is something real simple that captures if an IO went off line and tries to enable 2 times before it would pop a message in PAC Display and allow the operator to retry. This uses the global instruction Enable Communication to All I/O Units and then waits 5 seconds before attempting again since the controller will not be very responsive during this execution. I have been using this global instruction for many years now without any issues and it does always work as long as there are no hardware issues with the IO. IO_UNIT_Reset.R10.4c.Pro.Download.D11092022.T134220.zip (6.9 KB)