From 20db58f796187d7e981d1a49481089a641aeb250 Mon Sep 17 00:00:00 2001 From: Adam Atia Date: Wed, 30 Oct 2024 15:56:26 -0400 Subject: [PATCH] try to fix docstrings to mitigate sphinx error --- .../design_and_operation_models.py | 70 ++++++++++--------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/idaes/apps/grid_integration/multiperiod/design_and_operation_models.py b/idaes/apps/grid_integration/multiperiod/design_and_operation_models.py index 135bbad66d..db2ff30b44 100644 --- a/idaes/apps/grid_integration/multiperiod/design_and_operation_models.py +++ b/idaes/apps/grid_integration/multiperiod/design_and_operation_models.py @@ -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() @@ -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()