PDA

View Full Version : Querying nodes for data on connected links



Kieron_T
June 2, 2014, 09:05 PM
Hi all,

Is it possible to query nodes to return selected data from the links connected to it?

For example: a Tee is represented by a node with one u/s link and two d/s links. I want to return the nominal diameter (DN), material and pressure class (PN) of each link, preferably displaying a table/grid of the query result with the following headers...

node_id; x; y; us_link_DN; us_link_material; us_link_PN; ds_link_1_DN; ds_link_1_material; ds_link_1_PN; ds_link_2_DN: etc. etc.

...which I can then pass on to the detail design/CAD team to draw up a detail with the required fittings - i.e. tees, reducers, stub flanges, etc.

(This model is of course being used to design a new system, not analyse an existing one.)

Better yet would be to output the direction/bearing of each link so I can let the CAD team know where an elbow/bend might be required - but that would be a nice to have.

Thanks for reading, looking forward to responses.

Kieron

Tom Merrifield
June 4, 2014, 08:55 AM
The basis of what you want to do can be done in this way, please only copy the SQL statements we cannot accept comments in SQL at present:


Here we are using a variable $tee to store a flag for the number of connections to the node
UPDATE [Node] SET $tee = 1
This “where” clause chooses nodes with >2 links so it will find 3 or more link junctions. Using =3 would find only Tees etc.
WHERE (count (us_links.*) + count (ds_links.*) ) > 2;
The “select” clause chooses the items for the downstream links table, additional pipe attributes can be added, separated by commas.
SELECT ds_node.node_id, ds_node.x, ds_node.y, material from [All Links]
This “where” clause specifies only links connected to the nodes selected above
WHERE ds_node.$tee = 1;
Likewise for upstream links
SELECT us_node.node_id, us_node.x, us_node.y, material from [All Links]
WHERE us_node.$tee = 1;

This process will produce a table for upstream links and a table for downstream links these can then be merged in a spreadsheet and sorted by node ID. No doubt with more time the full table could be created in SQL .




Hi all,

Is it possible to query nodes to return selected data from the links connected to it?

For example: a Tee is represented by a node with one u/s link and two d/s links. I want to return the nominal diameter (DN), material and pressure class (PN) of each link, preferably displaying a table/grid of the query result with the following headers...

node_id; x; y; us_link_DN; us_link_material; us_link_PN; ds_link_1_DN; ds_link_1_material; ds_link_1_PN; ds_link_2_DN: etc. etc.

...which I can then pass on to the detail design/CAD team to draw up a detail with the required fittings - i.e. tees, reducers, stub flanges, etc.

(This model is of course being used to design a new system, not analyse an existing one.)

Better yet would be to output the direction/bearing of each link so I can let the CAD team know where an elbow/bend might be required - but that would be a nice to have.

Thanks for reading, looking forward to responses.

Kieron

Kieron_T
June 4, 2014, 02:15 PM
Does pretty much exactly what I need - albeit with a little post processing, as you say. Many thanks Tom!
Kieron