March 2022 onwards - River System Status

Sub-forum to hold river system status topics
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: March 2022 onwards - River System Status

Post by TerryJC »

Yes. I know that but the execution that resumes will carry on as if nothing had happened. So why won't it carry on as normal?
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: March 2022 onwards - River System Status

Post by hamishmb »

Because there's a return statement after the call to your new method, so the rest of sumppi_control_logic() (which is what enables and disables pumps and opens and closes valves) never executes.
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: March 2022 onwards - River System Status

Post by TerryJC »

So after the night logic code has completed, (eg the Sump is empty and the Butts are full), the system does nothing until sumppi_control_logic() is called again. Presumably that would have to be somewhere else in the code because there is nothing to restart it in that Python Module. Searching the code, I see that the only other place that sumppi_control_logic() is mentioned is in Config.py so there must be a call by value somewhere.

I can't see it at the moment. Also, you don't seem worried about the maintenance of system ticks and measurements overnight so presumably they carry on in the background? If that is the case, why can't the night logic function remain active until 0900 UTC?
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: March 2022 onwards - River System Status

Post by hamishmb »

There is a call by value, here: https://gitlab.com/wmtprojectsteam/rive ... in.py#L425

main.py will run the control logic function defined for the current site regularly, after each reading interval has been counted down, in seconds. Measurements are done in a separate thread, so they will continue, but unless the main loop runs the tick values will be wrong.

If these problems are not important, it could be locked in that function until morning, but that isn't how the system was designed so it probably doesn't make sense to introduce an inconsistency here, unless there's a very good reason to do so. I see no reason why the new function can't return as soon as its done whatever work it needs to do like all of the other control logic for this system.
Last edited by hamishmb on 26/04/2022, 16:58, edited 1 time in total.
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: March 2022 onwards - River System Status

Post by TerryJC »

Hamish,

So if the night code is run at the beginning of sumppi_control_logic(), it presumably will go off and do its thing and then come back to the loop. After the loop has counted down, sumppi_control_logic() is called again, ad infinitum (or until the time is 0900 UTC, when things go back to normal). Presumably, as well as turning the Butts Pump on, the night code will monitor the levels and turn off the Butts Pump if the Sump is empty or the Butts full.

Is that right?
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: March 2022 onwards - River System Status

Post by hamishmb »

Terry,

All that is correct, except that sumppi_control_logic() is called periodically, forever, not just until 0900 UTC. This is the normal behaviour as it allows the control logic to change things and react to changes as needed, but it doesn't need to run for any longer than it needs to enable/disable pumps, or use the database to tell a valve to open or close, etc.

The rest of the time, the mainloop is mostly just waiting for the interval to elapse, as well as periodically talking to the NAS box to get the latest interval and tick, and letting the monitor threads (that gather the probe level readings) know what the current tick is.

I believe this nicely demonstrates our need for more documentation, but we knew about that already :)

Hope this helps,
Hamish
Last edited by hamishmb on 26/04/2022, 17:15, edited 1 time in total.
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: March 2022 onwards - River System Status

Post by TerryJC »

So at 0900 UTC, I do nothing and normal operation resumes because the if statement at the beginning of the Method is now false.
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: March 2022 onwards - River System Status

Post by hamishmb »

Yes, exactly. As long as the return statement is inside the if block (as in my psuedocode example), that's exactly what will happen.
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: March 2022 onwards - River System Status

Post by TerryJC »

I'll give it a go tomorrow.
Terry
Penri
Posts: 1284
Joined: 18/05/2017, 21:28

Re: March 2022 onwards - River System Status

Post by Penri »

Just catching up on this.

It may be time to consider replacing the river's existing concrete trough but getting it done will be some years into the future and we've probably not exhausted remedial work that can be done or could do better!. I spent some time thinking about the word "damaged" you used Hamish in relation to the current river bed, it didn't seem to be the right word to use yet the river bed is in fact damaged by the natural processes making the earth it runs through swell and shrink at it gets wet and dries out, in turn stressing the concrete. In the end this project is trying to make the best of a less that perfect river construction job, great strides have been taken and we have made a positive difference.

I'm not sure I understand the full picture behind the Night Control Code and what it's implications would be as the system currently stands, I certainly could see value as and when we have the Stage and Hanham Butts all available for storage.

Penri
Post Reply