Giter Club home page Giter Club logo

Comments (2)

kaklise avatar kaklise commented on July 3, 2024

I tested this out using Net1. The following code correctly adds a rule to the water network model using a list of actions and runs the EpanetSimulator with no errors:

import wntr
inp_file = 'networks/Net1.inp'
wn = wntr.network.WaterNetworkModel(inp_file)

action_list = []
for pipe in ['11', '22']:
    link=wn.get_link(pipe)
    act = wntr.network.controls.ControlAction(link, 'status', 0)
    action_list.append(act)

cond = wntr.network.controls.SimTimeCondition(wn, '=', '12:00:00')
rule = wntr.network.controls.Rule(cond, 
                                  action_list, 
                                  priority = 4,
                                  name = 'rule_name'
                                  )
wn.add_control('rule1', rule)
print(rule)

sim = wntr.sim.EpanetSimulator(wn)
results = sim.run_sim()

However, the WNTR code uses the control rule name (rule1) if a rule name (rule_name) is not provided and that name (rule1) cannot include a space. This can result in EPANET Error 200. This doesn't appear to be your issue, since your rule is named tank1. Let us know if this resolves the issue.

@dbhart, can you resolve this issue by adding an underscore to the RULE name when witting an INP file?

from wntr.

DanielaBS1 avatar DanielaBS1 commented on July 3, 2024

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.