Automatically freeing locks: is this desirable behaviour?

A forum for discussion on the software for the WMT River Control System
Post Reply
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Automatically freeing locks: is this desirable behaviour?

Post by hamishmb »

So a while back when we were talking about NAS box control logic, we said one of the things it should do is automatically free locks on devices when they've been held for too long.

We never decided exactly what "too long" was, and as I've started to think about it, I've realised that this feature might become a hindrance rather than a help. This is because (possibly until the matrix pump goes in), each pump and valve that we control is controlled only by one pi.

For example, Sump Pi controls gate valve V4 at the wendy butts site. No other pi tries to control it, and my understanding is that it will remain this way. As a result, Sump Pi never needs to free its lock on the gate valve, so it doesn't. The NAS box automatically freeing the lock after a period of time would be likely to interfere with general operation as I see it, because nothing else should ever control gate valve V4. Does that make sense?

The possible exception here is the matrix pump, but I don't believe we decided exactly how controlling that would be coordinated. As such I propose that we delay this feature until we know we need it, or shelve it entirely if we think it's unnecessary/overcomplicating things.

Thoughts?
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Automatically freeing locks: is this desirable behaviour?

Post by TerryJC »

Hamish,

I don't actually recall any discussion about 'automatically freeing locks'; perhaps we called it something else at the time?

It's true that there will (eventually) be up to three devices that may want to control the Matrix Pump, but I believe that we agreed that this pump would be driven from Wendy Butts Pi, so any arbitration could be included in the Pump code. For example, if the Wendy Butts are running out of water either the Lady Hanham SAC or the Stage SAC might wish to turn on the pump to transfer water from their butts to the Wendy Butts and the pump Class would decide which.

Alternatively, (and this is where the NAS Box discussion may have arisen), When a device such as the Stage Butts SAC requires water to be moved, it might, as you say, invoke the pump and then place a lock on the Matrix Pump Control. With careful design of the algorithm at each site we could ensure that Stage Butts would only do this if it had more water than the Lady Hanham Butts and vice versa. The relative sizes of the two Butts Groups would suggest that Lady Hanham Butts would usually be the Group with the most water, but we may also decide that we would want to empty the Stage Butts before drawing on the water in the Lady Hanham Butts. When all Butts Groups are getting low, then the Solenoid valve would be enabled and the whole cycle would repeat.

Once water movement is no longer required, the lock would be removed.
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Automatically freeing locks: is this desirable behaviour?

Post by hamishmb »

Hmm, I'm not sure if it had a different name.

Okay, that all makes sense. Either way, this sounds like a problem to tackle in the future to me - shall I implement this later when we have a better idea of which approach we want to take?

Hamish
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Automatically freeing locks: is this desirable behaviour?

Post by TerryJC »

hamishmb wrote: 29/07/2020, 13:52Okay, that all makes sense. Either way, this sounds like a problem to tackle in the future to me - shall I implement this later when we have a better idea of which approach we want to take?
I think that's the best thing. Now we have the VPN, it will presumably be relatively easy to add a feature to the NAS Box.

Alternatively, you could add the flag and simply not use it until it's needed, or not at all if we go another way.
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Automatically freeing locks: is this desirable behaviour?

Post by hamishmb »

That's right, adding features to the NAS box should be easy.

On the database side we're pretty much ready to go anyway, it's just figuring out how/when to use it, so that works for me.
Hamish
Post Reply