Subscribe to this thread
Home - General / All posts - Finding valves along pipes
mathva26 post(s)
#07-Aug-18 09:32

Hi!

I have a specific problem, and I can not find the right answer in existing posts.

I have a pipe network and valves along them. In some places, the lines where the valve is are interrupted in other cases does not. There are no always vertices in the lines where there are valves. But all valves are snaped on pipes.

What I want to do. In the event of a malfunction on a certain part of pipiline (red mark, see example below), I want to find all the valves that I need to close so that the defect can be eliminated.

I'm using M8.

Any help or idea is welcome. Unfortunately, I am not an expert in writing scripts.

I added an example below.

Best regards, Mat

Attachments:
Find_valves.map

adamw


8,242 post(s)
online
#12-Aug-18 09:07

This is not an easy problem.

Finding pipes affected by the defect is easy, you can do this with a short query:

--SQL

SELECT * FROM Pipes WHERE EXISTS

  (SELECT * FROM Defect WHERE Distance(Pipes.ID, Defect.ID) < 1)

Finding pipes connected to specified pipes and finding valves on specified pipes is similarly easy.

But you want to figure out which valves you have to close to fix the problem. In general, this calls for an iterative process and this can only be done using a script.

Here's the gist of the issue: let's say we find the pipe that the defect is on and that pipe contains a valve. Obviously we should close the valve, but this fixes half of the issue and we have to figure out which one and proceed closing valves further in one direction but not in the other. Even simpler, let's say we assume the valves on the pipe with the defect are going to be broken and we have to ignore them. Good, so we find all pipes connected to the pipe with the defect and we find all valves on those pipes. But what if some pipes have no valves? Is it guaranteed that each pipe always has a valve? If so, we solved it. But if not, we have to close the valves that we did find, then identify the pipes without the valves and repeat the search from them. This is a fairly laborious script, particularly because we have to make sure we don't create an infinite loop. If it is a one-off for you, say so and maybe someone will help write it, but if things like that are a recurring task, it would be better for you to start writing the script with the thread helping get through the difficult places.

mathva26 post(s)
#07-Sep-18 06:50

adamw thank you for your reply.

Like you say it's not an easy problem. That's why I posted it.

Especially because the valves that are on branches which are not in the loop not need to be closed, because these parts are already without water but in the same time it is necessary to inform those customers.

Whatever you gave me some ideas for thinking.

Now I am looking for a method by which to achieve this, then I will try to write a script.

adamw


8,242 post(s)
online
#10-Sep-18 08:31

If I may make a suggestion, it might make sense to pre-split the lines so that each line has at most one valve on it. Then we could add a valve ID to each line and fill it, leaving it at something like -1 when the line has no valve.

Take a look at this thread as well, which talks about processing connected lines into clusters. This is different from what we need here, but not that much different, the process is similarly iterative. In this post, you can see the bulk of processing done using a script. The script is for 9, it is more difficult to write such scripts in 8, but it should give you some ideas (and hey, maybe you can use 9, because why not, it does makes such things much easier).

mathva26 post(s)
#18-Sep-18 13:40

It looks like we're thinking similarly.

I did a semi-automatic search for now.

I gave the attribute 1 to the pipes vith valve, and leve 0 the others.

Then, with a "disolve" function, I combined pipes with the same attribute and assigned them different colors.

Now it's nice to see which pipes have a valve to close. I just need to find it on the pipes in all directions.

It's not what I want but temporarily serves the purpose.

I'll look your post to get some idea. I also saw some solution with QGIS plugin function which I will try to use.

https://gis.stackexchange.com/questions/177309/qgis-finding-valves-to-turn-off-for-water-lines

Thank you once again.

artlembo

3,097 post(s)
#18-Sep-18 14:16

because Manifold does not natively support one-way directions in a linear network, it is difficult to perform a network trace. However, there are some iterative solutions described in the help manual. The watersheds example shows how to do some iterations with SQL.

I adapted this 10 years ago to work with a pipe network to calculate flow using the Ford-Fulkerson algorithm here. Perhaps it will give you an idea as to how to adapt your own application.

mathva26 post(s)
#28-Sep-18 08:44

Hello again

Thanks for both ideas. I thought a bit and chose a different approach.

I made a "buffer" of 0,01m around the valves. I cut the pipes with a "clip with (substract)" function with polygons from buffers. So I have pipes that end at valves.

Continuation, it's very simple. I select the line at which the fault occurred. Then repeat the "select touching" function according to the selection until it changes. This way I come to the desired valves.

Now I should only write the entire procedure in the script.

Manifold User Community Use Agreement Copyright (C) 2007-2017 Manifold Software Limited. All rights reserved.