线性的Pyomo非线性约束

时间:2020-01-09 14:59:20

标签: python linear-programming nonlinear-functions

我正在尝试通过使用对数来计算电池(q_batt)的发热量来线性化方程。

我有很多开源软件oemof(oemof.readthedocs.io)中的代码,而这部分是我的问题所在:

    def _q_batt_first_rule(block, n, t):
        current = m.flow[n, i[n], t] / n.inflow_voltage
        expr = 0
        expr += block.q_batt[n, t] - n.inflow_resistance(block.capacity[n, t]) * current**2
        return expr == 0
    self.q_bat_first_rule = Constraint(self.STORAGES, reduced_timesteps,
                                       rule=_q_batt_first_rule)

原始等式是:

q_batt = inflow_resistance * (inflow_flow / inflow_voltage)^2

我想将其重写为线性形式,以便能够使用CBC求解器进行求解

inflow_resistance(n.inflow_resistance(block.capacity [n,t]))是一个输入线性方程,取决于容量(在电池对象中计算的变量,称为块),inflow_flow(m.flow [n ,i [n],t])是在模型中计算出来的,并且voltage_in(n.inflow_voltage)是输入常数

你知道怎么做吗?

提前谢谢!

0 个答案:

没有答案