Skip to content

Commit

Permalink
try to fix docstrings to mitigate sphinx error
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-a-a committed Oct 30, 2024
1 parent a2c97c4 commit 20db58f
Showing 1 changed file with 37 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,28 @@ class DesignModelData(ProcessBlockData):
Example Usage:
def my_design_model(m, p_min, p_max, cost):
m.power = Var()
m.min_capacity = Constraint(
expr=p_min * m.install_unit <= m.power
)
m.max_capacity = Constraint(
expr=m.power <= p_max * m.install_unit
)
.. code-block:: python
# capex and fom must either be a constant, or Var, or Expression
m.capex = Expression(expr=cost["capex"] * m.power)
m.fom = Expression(expr=cost["fom"] * m.power)
def my_design_model(m, p_min, p_max, cost):
m.power = Var()
m.min_capacity = Constraint(
expr=p_min * m.install_unit <= m.power
)
m.max_capacity = Constraint(
expr=m.power <= p_max * m.install_unit
)
m = ConcreteModel()
m.unit_1 = DesignModel(
model_func=my_design_model,
model_args={
"p_min": 150, "p_max": 600, "cost": {"capex": 10, "fom": 1},
},
)
# capex and fom must either be a constant, or Var, or Expression
m.capex = Expression(expr=cost["capex"] * m.power)
m.fom = Expression(expr=cost["fom"] * m.power)
m = ConcreteModel()
m.unit_1 = DesignModel(
model_func=my_design_model,
model_args={
"p_min": 150, "p_max": 600, "cost": {"capex": 10, "fom": 1},
},
)
"""

CONFIG = ConfigDict()
Expand Down Expand Up @@ -127,21 +129,23 @@ class OperationModelData(ProcessBlockData):
Example Usage:
def my_operation_model(m, design_blk):
m.power = Var()
m.fuel_flow = Var()
...
m = ConcreteModel()
m.unit_1 = DesignModel(
model_func=my_design_model,
model_args={
"p_min": 150, "p_max": 600, "cost": {"capex": 10, "fom": 1},
},
)
m.op_unit_1 = OperationModel(
model_func=my_operation_model, model_args={"design_blk": m.unit_1},
)
.. code-block:: python
def my_operation_model(m, design_blk):
m.power = Var()
m.fuel_flow = Var()
...
m = ConcreteModel()
m.unit_1 = DesignModel(
model_func=my_design_model,
model_args={
"p_min": 150, "p_max": 600, "cost": {"capex": 10, "fom": 1},
},
)
m.op_unit_1 = OperationModel(
model_func=my_operation_model, model_args={"design_blk": m.unit_1},
)
"""

CONFIG = ConfigDict()
Expand Down

0 comments on commit 20db58f

Please sign in to comment.