Modbus bit write on Server shutdown

Gentlemen,

I’m trying to write to a bit to a PLC upon gateway shutdown using the syntax of :

value = 0
system.tag.write(‘Warehouses/UnitId 12/12_K150-12_K150/12_K150’, value)

and reverse of startup.

This works wonderfull when the Client start up and shut down routine is used, however nothing happens when the Server is shut down and restarted. To late in the cycle?

In addition, I have a RS485 network in which 4 PLCs are a member of. All are communicationing nicely, however how does one regester communication failures for any one of these machines? I’ve attempted to date to use the if(tag.status != “Good”) for this but it is not realiable. Any ideas would be helpful.

Ignition ver 7.4, Modbus I/P, windows7 OS

Many Thanks,

-Paul

Part 1: Yeah, it’s too late to write to tags during a shutdown script.

Part 2: Can you post the entirety of the code you’re using to try and determine when the quality is bad? I need a little more detail about the context of when/where you’re trying to do this.

My latest attempt was to use an expression tag as follows

if(({[~]Warehouses/UnitId 12/12_C200-12_C218/DI_Fans_On_A7a.Quality} = “Not Connected”),1,0)

at first using != “Good”

Try using != 192 (no quotes).

Paul just a thought and just guessing here at what you are trying to do

if you are just trying to detect when the server is down I’d use a watchdog timer in your PLC i.e. set it to 1 every 10 seconds and have Ignition reset it or something similar. There is probably an extremely elegant way of doing this.

Otherwise you are going to be relying on a bit of a race condition. Especially if Ignition doesn’t shut down nicely i.e. the power for the server is turned off or if the network link goes down to the remote machine.

Use your watchdog timer to turn on your local machine alarm/HMI alarm bit

Like I said just a wild guess at what you’re trying to do.

Alex

Actually I have a couple of things going on. I’m replacing an existing HMI that uses word to bit writes for digital commands.
What I would like to do is to arrest the word to bit write function at the PLCs when using the new application. However they would like to have the ability to ‘plug’ in the old application if the new one fails or under performs.
I’m not in favor of reproducing the bit writes, so I have to come up with a way for the two HMI’s to have the ability to be interchangeable without a lot of grief. Thus the enable at startup and disable at shutdown thought train.
And it may come to using watchdog timers, but I was being hopeful. I’ll test out the tag.value != 192 tonight. That would save me some time in producing communication failure notifications between the individual nodes.

Many thanks for the thoughts

-Paul

“Try using != 192 (no quotes).”

The above suggestion does function correctly if type cast into a int before evaluating.

-Paul