qwat-data-model icon indicating copy to clipboard operation
qwat-data-model copied to clipboard

[WIP] Network intervention simulation

Open benoitblanc opened this issue 3 years ago • 6 comments

This pull request aims to add some features for the user to simulate network incidents :

  • network leakage
  • network interruption
  • network pollution

benoitblanc avatar Oct 20 '21 15:10 benoitblanc

You've used my proposal for adding network path capabilities to QWAT. The pipe_reference table should be explained a little bit more, it needed geometry because otherwise we couldn't have a real path shown. The pipe_reference table must be kept up to date because otherwise the path could be different from what the user sees.

bogdanvaduva avatar Oct 20 '21 17:10 bogdanvaduva

@benoitblanc Does this has a connection with what kind of network simulation software? Does this comply with the SIA405 water datamodel (Hydraulischer_Strang, hydraulischer_Knoten)?

sjib avatar Oct 28 '21 19:10 sjib

does it fix #171 ?

3nids avatar Dec 10 '21 13:12 3nids

Since there are only deltas, the network simulation are not initialized when initializing from scratch :

https://github.com/qwat/qwat-data-model/blob/master/init_qwat.sh

Please add the necessary files (same content as the deltas) and code adaptation to make it work for new users of TEKSI water module.

ponceta avatar Nov 11 '22 10:11 ponceta

@ponceta I have added code from deltas to data-model and init_qwat.sh

benoitblanc avatar Nov 16 '22 10:11 benoitblanc

Something doesn't please the CI. Is it possible that the delta initialize the functions but does not run these and therefore does not create the tables or vice versa?

Check...DIFFERENCES FOUND tables

  • ('qwat_network', 'network') columns
  • ('qwat_network', 'network', 'cost', None, 'YES', 'double precision', None, '5
  • ('qwat_network', 'network', 'geometry', None, 'YES', 'USER-DEFINED', None, No
  • ('qwat_network', 'network', 'id', None, 'YES', 'integer', None, '32', '2', No
  • ('qwat_network', 'network', 'network_id', "nextval('qwat_network.network_netw
  • ('qwat_network', 'network', 'reverse_cost', None, 'YES', 'double precision',
  • ('qwat_network', 'network', 'source', None, 'YES', 'integer', None, '32', '2'
  • ('qwat_network', 'network', 'target', None, 'YES', 'integer', None, '32', '2' constraints
  • ('pipe_reference_fk_pipe_fkey', 'qwat_network.pipe_reference.fk_pipe', 'qwat_ views sequences
  • ('network_network_id_seq', 'qwat_network')

ponceta avatar Nov 18 '22 07:11 ponceta

@benoitblanc could you rename the deltas to 1.4.0_XXX

ponceta avatar Dec 19 '22 13:12 ponceta

@ponceta I have renamed deltas to match v 1.4.0

benoitblanc avatar Jan 13 '23 15:01 benoitblanc

Tests are fine, upgrade is fine.

We have issues on scalability tests and scalability tests multithreaded :

https://github.com/qwat/qwat-data-model/actions/runs/3912471610/jobs/6687155084#step:7:2289

Could you have a look at it? (It is probably due to our last merge of fk_distributor inheritance and should maybe be adressed in another pull request )

Set baseline...OK
 *** QWAT was successfuly initialized! ***
/home/runner/work/qwat-data-model/qwat-data-model
Running initializations... 
SET
SET
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
OK
Launching requests...
Iteration 0
Traceback (most recent call last):
  File "/home/runner/work/qwat-data-model/qwat-data-model/tests/test_scalability.py", line 206, in <module>
    test_scalability(args.pg_service, args.nb_iterations)
  File "/home/runner/work/qwat-data-model/qwat-data-model/tests/test_scalability.py", line 27, in test_scalability
    _execute_statements(cur, conn, TEST_SCRIPT, nb_iteration)
  File "/home/runner/work/qwat-data-model/qwat-data-model/tests/test_scalability.py", line 191, in _execute_statements
    res = cur.execute(statement)
  File "/home/runner/.local/lib/python3.10/site-packages/psycopg2/extras.py", line 146, in execute
    return super().execute(query, vars)
psycopg2.errors.DatatypeMismatch: column "fk_distributor" is of type integer[] but expression is of type integer
LINE 5: ...at_vl.part_type WHERE value_fr = 'bouchon'), 101, 1, 101, st...
                                                             ^
HINT:  You will need to rewrite or cast the expression.

@olivierdalang can we have a red light when scalability tests are not working fine?

ponceta avatar Jan 18 '23 12:01 ponceta

@benoitblanc if you're ready to merge, please remove the [WIP] Tag in the name of your pull request.

ponceta avatar Jan 23 '23 07:01 ponceta