# Path: pywr/model.py

# 
# Path: pywr/nodes.py
# class Input(Node, BaseInput):
#     """A general input at any point in the network"""
# 
#     def __init__(self, *args, **kwargs):
#         """Initialise a new Input node
# 
#         Parameters
#         ----------
#         min_flow : float (optional)
#             A simple minimum flow constraint for the input. Defaults to None
#         max_flow : float (optional)
#             A simple maximum flow constraint for the input. Defaults to 0.0
#         """
#         super(Input, self).__init__(*args, **kwargs)
#         self.color = "#F26C4F"  # light red
# 
# class Output(Node, BaseOutput):
#     """A general output at any point from the network"""
# 
#     def __init__(self, *args, **kwargs):
#         """Initialise a new Output node
# 
#         Parameters
#         ----------
#         min_flow : float (optional)
#             A simple minimum flow constraint for the output. Defaults to 0.0
#         max_flow : float (optional)
#             A simple maximum flow constraint for the output. Defaults to None
#         """
#         kwargs["color"] = kwargs.pop("color", "#FFF467")  # light yellow
#         super(Output, self).__init__(*args, **kwargs)
# 
# class Link(Node, BaseLink):
#     """A link in the supply network, such as a pipe
# 
#     Connections between Nodes in the network are created using edges (see the
#     Node.connect and Node.disconnect methods). However, these edges cannot
#     hold constraints (e.g. a maximum flow constraint). In this instance a Link
#     node should be used.
#     """
# 
#     def __init__(self, *args, **kwargs):
#         """Initialise a new Link node
# 
#         Parameters
#         ----------
#         max_flow : float or function (optional)
#             A maximum flow constraint on the link, e.g. 5.0
#         """
#         kwargs["color"] = kwargs.pop("color", "#A0A0A0")  # 45% grey
#         super(Link, self).__init__(*args, **kwargs)


from pywr.model import Model
from pywr.nodes import Input, Output, Link
#!/bin/python
"""
This script defines and runs a very simple model.

The network looks like this:

  A -->-- B -->-- C

"""


def create_model():
    # create a model
    model = Model(start="2016-01-01", end="2019-12-31", timestep=7)

    # create three nodes (an input, a link, and an output)
    A = Input(model, name="A", max_flow=10.0)
    B = Link(model, name="B", cost=10.0)

# Path: pywr/model.py

# 
# Path: pywr/nodes.py
# class Input(Node, BaseInput):
#     """A general input at any point in the network"""
# 
#     def __init__(self, *args, **kwargs):
#         """Initialise a new Input node
# 
#         Parameters
#         ----------
#         min_flow : float (optional)
#             A simple minimum flow constraint for the input. Defaults to None
#         max_flow : float (optional)
#             A simple maximum flow constraint for the input. Defaults to 0.0
#         """
#         super(Input, self).__init__(*args, **kwargs)
#         self.color = "#F26C4F"  # light red
# 
# class Output(Node, BaseOutput):
#     """A general output at any point from the network"""
# 
#     def __init__(self, *args, **kwargs):
#         """Initialise a new Output node
# 
#         Parameters
#         ----------
#         min_flow : float (optional)
#             A simple minimum flow constraint for the output. Defaults to 0.0
#         max_flow : float (optional)
#             A simple maximum flow constraint for the output. Defaults to None
#         """
#         kwargs["color"] = kwargs.pop("color", "#FFF467")  # light yellow
#         super(Output, self).__init__(*args, **kwargs)
# 
# class Link(Node, BaseLink):
#     """A link in the supply network, such as a pipe
# 
#     Connections between Nodes in the network are created using edges (see the
#     Node.connect and Node.disconnect methods). However, these edges cannot
#     hold constraints (e.g. a maximum flow constraint). In this instance a Link
#     node should be used.
#     """
# 
#     def __init__(self, *args, **kwargs):
#         """Initialise a new Link node
# 
#         Parameters
#         ----------
#         max_flow : float or function (optional)
#             A maximum flow constraint on the link, e.g. 5.0
#         """
#         kwargs["color"] = kwargs.pop("color", "#A0A0A0")  # 45% grey
#         super(Link, self).__init__(*args, **kwargs)


# Path: examples/simple_model.py
from pywr.model import Model
from pywr.nodes import Input, Output, Link

#!/bin/python
"""
This script defines and runs a very simple model.

The network looks like this:

  A -->-- B -->-- C

"""


def create_model():
    # create a model
    model = Model(start="2016-01-01", end="2019-12-31", timestep=7)

    # create three nodes (an input, a link, and an output)
    A = Input(model, name="A", max_flow=10.0)
    B = Link(model, name="B", cost=10.0)

    C = Output(model, name="C", max_flow=5.0, cost=-20.0)