pywrdrb.Model

pywrdrb.Model#

class pywrdrb.Model(**kwargs)#

Model of a water supply network

__init__(self, **kwargs)#

Initialise a new Model instance

Parameters:
  • solver (string) – The name of the underlying solver to use. See the pywr.solvers package. If no value is given, the default GLPK solver is used.

  • start (pandas.Timestamp) – The date of the first timestep in the model

  • end (pandas.Timestamp) – The date of the last timestep in the model

  • timestep (int or datetime.timedelta) – Number of days in each timestep

Methods

__init__(self, **kwargs)

Initialise a new Model instance

after(self)

before(self)

Perform initialisation work before solve on each timestep.

check(self)

Check the validity of the model

check_graph(self)

Check the connectivity of the graph is valid

check_hash(self, filename, hash[, algorithm])

edges(self)

Returns a list of Edges in the model

finalise_node(self, node_name)

find_all_routes(self, type1, type2[, valid, ...])

Find all routes between two nodes or types of node

find_orphaned_parameters(self)

Helper function to find orphaned parameters

finish(self)

flatten_component_tree(self[, rebuild])

is_feasible(self)

Returns True if none of the constraints are violated.

load(cls, data[, model, path])

Load an existing model

loads(cls, data[, model, path])

Read JSON data from a string and parse it as a model document

pre_load_node(self, node_name)

reset(self[, start, profile, ...])

Reset model to it's initial conditions.

run(self)

Run the model

setup(self[, profile, profile_dump_filename])

Setup the model for the first time or if it has changed since last run.

solve(self)

Call solver to solve the current timestep

step(self)

Step the model forward by one day

to_dataframe(self)

Return a DataFrame from any Recorders with a to_dataframe attribute

Attributes

components

constraints

nodes

Returns a model node iterator

objectives

parameters

recorders

variables