Giter Club home page Giter Club logo

Comments (7)

uthmankareem avatar uthmankareem commented on June 25, 2024

I was able to address the above issue by getting a list for the leaknode and checking if it already exists. However, I am having error. I do not know the cause of this and what I can do to address it.

ndexError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_28132/2498113446.py in
94 wn.remove_node(j)
95 sim = wntr.sim.WNTRSimulator(wn)
---> 96 results = sim.run_sim(solver=wntr.sim.solvers.NewtonSolver, backup_solver=None, solver_options={'MAXITER':3000, 'TOL':0.0003, 'BT_MAXITER':200},
97 backup_solver_options=None, convergence_error=False, HW_approx='default',
98 diagnostics=False)

~\Anaconda3\lib\site-packages\wntr\sim\core.py in run_sim(self, solver, backup_solver, solver_options, backup_solver_options, convergence_error, HW_approx, diagnostics)
1242 results.network_name = self._wn.name
1243
-> 1244 self._initialize_internal_graph()
1245 self._change_tracker.set_reference_point('graph')
1246 self._change_tracker.set_reference_point('model')

~\Anaconda3\lib\site-packages\wntr\sim\core.py in _initialize_internal_graph(self)
1418 self._number_of_connections = [0 for i in range(self._wn.num_nodes)]
1419 for node_id in self._node_id_to_name.keys():
-> 1420 self._number_of_connections[node_id] = self._internal_graph.indptr[node_id+1] - self._internal_graph.indptr[node_id]
1421 self._number_of_connections = np.array(self._number_of_connections, dtype=self._int_dtype)
1422

IndexError: index 255 is out of bounds for axis 0 with size 255

from wntr.

kaklise avatar kaklise commented on June 25, 2024

I'm happy to hear that you were able to get a list of leak nodes.

"RuntimeError: Cannot remove node..." indicates that the leak node is associated with a control and cannot be removed until the control is removed. This error is thrown anytime you try to remove an element with a control.

I'm not able to follow the third issue regarding index 255. Please post a complete example with a network from the examples folder.

from wntr.

uthmankareem avatar uthmankareem commented on June 25, 2024

from wntr.

kaklise avatar kaklise commented on June 25, 2024

If you get the control name using wn.control_name_list, you can remove the control using wn.remove_control("control name").

You can also remove the leak from the junction object using junction.remove_leak(). The junction object stores the control name and calls remove_control.

from wntr.

uthmankareem avatar uthmankareem commented on June 25, 2024

from wntr.

uthmankareem avatar uthmankareem commented on June 25, 2024

from wntr.

kaklise avatar kaklise commented on June 25, 2024

Thanks @uthmankareem, Feel free update #342 with updates on using WNTR in Google Collab.

from wntr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.