Mapzones config - Giswater/giswater_dbmodel GitHub Wiki


GOALS:

Know, which steps must be taken both in QGIS and in the database, to add a new mapzone and subsequently configure its use and impact. This always taking into account the use of dynamic mapzones, managed by the user but created from an internal Giswater algorithm.

DESCRIPTION

There is a guideline below, which describes how to create a new mapzone. For the different types of zones, the steps to follow are exactly the same.

STEP 1: SYSTEM CONFIGURATION

Populate cat_feature_node, field graph_delimiter, which defines which type of node is a delimiter of the graph. There can be two types of delimiters - border elements or dual elements.

In this sense: They are minimum sector boundary element: shut-off valves They are dual elements (header and border) for the following zoning:

  • Sector (high or low): flow input elements (wtp, source, wells, tanks)
  • Measurement area: measurement elements (flowmeter)
  • Pressure zone: pressure control elements (VRP, load break chambers)
  • Quality zone: quality control elements (chlorinators)

Details:

Certain types of deposits such as QUEUE TANK or STORAGE TANK in sectors in HIGH, above all, are not main elements for the sectorization. In this sense, it would be interesting to have TANKS separated into two features, the headers and those that are not, e.g.: queue or transport/storage. Activate the system variable so that the class graph can be realized.

  1. System variable utils_dynamicmapzones_status, om_dynamicmapzones_status (v3.3) defines the graph classes that are enabled:

{"SECTOR":true, "PRESSZONE":true, "DQA":true, "MINSECTOR":true, "DMA":true}

  1. In the cat_feature_node table, node_type (v3.3), each type of node has defined graph_delimiter. The sample has:
  1. Valve configuration table config_valve, anl_mincut_selector_valve (v3.3) defines the valves that act as stoppers.

Example of how to add a new DMA:

  1. In QGIS insert a new node in the desired location. The type of node must be the one, that in the cat_feature_node table has value 'DMA' in the column graph_delimiter, as this column establishes which areas of the map are delimited by different types of nodes. If we want to create different area than dma, it's just necessary to insert a node that is a delimiter of the desired area. For DMA it will usually be 'METER' type node.

STEP 2: MAPZONES CONFIGURATION

Configure the graphconfig field of the different mapzones (sector, dma, dqa, presszone). The syntax is a bit specific, but allows every possible cardinality (multiple nodeParent with multiple toArc for a single mapzone). In case that the node, whose node_type is a graphdelimiter, has not been named as the head of any mapzone, the system will allow the calculation but will give a warning. Since this is a possible option (transport tanks or queue tanks without a specifically defined node_type) it is advisable to use the "ignore" key of the graphconfig field so that at least the system does not give warnings on elements that are clear and checked.

Add new value to the dma table (in case of creating another mapzone fill the corresponding table), with the name of the newly created dma and, above all, fill the graphconfig value with the following json. In the value of nodeParent put the id of the just inserted node, which will be the header of the new dma, and in toArc indicate the direction to take by means of the arc_id of the section. Example:

{"use":[{"nodeParent":"1080", "toArc":[2092]}], "ignore":[], "stopper":[1057,41,1060]}

In ignore (optional) put, if it's the case, those nodes that are graphdelimiters, but you do not want them to participate in the algorithm (for being out of service or for not doing its job).

In stopper (optional) put, if it's the case, those nodes on which you want to force stop of the flood algorithm.

STEP 3: ENJOY IT

Use Giswater toolbox to recalculate the mapzones with the modifications that has been made for DMA, by selecting the desired shape of the geometry.

An alternative to using the Giswater toolbox, is to execute the function directly from the database, making a call such as:

SELECT gw_fct_graphanalytics_mapzones('{"data":{"parameters":{"graphClass":"DMA", "exploitation":[1], "macroExploitation":[1], "checkData":false, "updateFeature":true, "updateMapZone":2, "geomParamUpdate":15,"debug":false, "usePlanPsector":false, "forceOpen":[1,2,3], "forceClosed":[2,3,4]}}}');

where:

Once the process is finished, double check the geometries of the dma. In our example, the geometry has been generated for the new dma that has a new FLOWMETER as a delimiter node.