Dead Man Switch as a User Limit

I’d like to be able to create a watchdog/dead man switch that would essentially disable the drives (and, perhaps, turn off all outputs) if our Windows app crashes.

Time

Is there a location in the firmware that’s essentially the current clock? If so, I could compare that value to a precalculated value (always 5 sec in the future, let’s say) in a user limit, and if the current time ever exceeded the precalculated value, then I could act (disabling, etc.). My application would just need to redefine the user limit periodically updating the precalculated value to a timestamp (continually) 5 seconds into the future.

Is the current clock available as a memory location in the firmware?

Existing Feature?

Is this something that already exists?

Hi @todd_mm,

There isn’t a feature like that but you could use User Limits for it. The simple example would be to setup a User Limit which Triggered off the SampleCounter. You set it to create an Action on an Axis after SampleCounter is greater than or equal to the current timer + your timeout (5000). Your application then keeps overwriting that User Limit (within the timeout) at whatever frequency you like. If your application hangs and stops updating, the last UserLimit you successfully wrote would trigger after timeout.

Outputs could be done as well, but we’d be talking about a lot of user limit work and my require a change in how you use them.

Other alternatives is building custom logic into the Realtime with either RapidSequencer or RapidCodeRT.

1 Like

Sample Counter

That’s what I was looking for!

Outputs

Supposing that the outputs for a device are all in one or more contiguous block of bits, would I need to do more than just assign 0 to each of those words/word-segments?

Disabling

How would I disable by writing values to the firmware? Would I just need to modify the control word or something?

User Limits

My hunch is that the user limit that’s constantly updated would only set a bit in a user buffer my app manages, and then any number of other user limits whose job it is to “disable” would check the user buffer. Any device that has/needs “disable” behavior, would create its own set of user limits to perform those actions. Those user limits would never need to change and would always be enabled.

Is there a better way to accomplish this with existing features?

You are getting into why the Outputs are more difficult. All of them wouldn’t be in 1 continuous block. A given nodes might, but then you’d want to have that node constantly using Output Overrides so you can write directly to it with the User Limit.

You could also do some gatekeeping. Suppose you had 1 Watchdog user limit that’s only output is to set a User Buffer value from 0 (Good) to 1 (Timeout). All your other User Limits could be left alone just scanning the UserBuffer location for 1. In that situation, your application could check the UserBuffer location to see if they should be allowed to write Outputs that were desirable.

This seems a bit overmanaged, but might work if you really want that type of control.

And you updated your question: Yep you’ve the right idea. I’m not thinking of a better way with the existing feature set. I’ll reply back here if I do.

I think you could set the UserLimit to Enable/Disable OutputOverrides when your application timed out. That should work for you. That would be 1 UserLimit per NetworkOutput you plan to control that way though.

How do I disable an axis? Bits 0-3 in the control word?

Use the Axis # and Action parts of the UserLimit.