Esempio n. 1
0
File: optx.py Progetto: 19MM97/elvis
 def xcharge_battery(model_in,i):
     """
     Adjusting the charging/discharging capacity based on the current SOC of the vehicle.
     """
     model_in.xcharging_power[i] = aml.Expr_if(model_in.soc_temp[i] > 0.8,
                                            - 5 * model_in.xcharging_power[i] * (model_in.soc_temp[i]
                                                                              - 1.0), aml.Expr_if(model_in.soc_temp[i] < 0.2, 5 *
                                                                                                  model_in.xcharging_power[i] *
                                                                                     model_in.soc_temp[i], model_in.xcharging_power[i]))
Esempio n. 2
0
 def test_expr_if(self):
     m = pe.ConcreteModel()
     m.x = pe.Var()
     m.y = pe.Var()
     e = pe.Expr_if(m.x <= 0, m.y + m.x == 0, m.y - m.x == 0)
     pn = convert_expression_to_prefix_notation(e)
     expected = [(Expr_ifExpression, 3), (InequalityExpression, 2), m.x, 0,
                 (EqualityExpression, 2), (SumExpression, 2), m.y, m.x, 0,
                 (EqualityExpression, 2), (SumExpression, 2), m.y,
                 (MonomialTermExpression, 2), -1, m.x, 0]
     self.assertEqual(pn, expected)
Esempio n. 3
0
File: optx.py Progetto: 19MM97/elvis
    def demand_rule(model_in, i):
        """
        Adjust vehicle energy demand based on either parking time and maximal charging power or SOC target.

        :param model_in: Pyomo optimization model_in.
        :param i: Model instance index.
        :type i: int
        :return: Energy demand.
        """
        connection_time = min(data[ev_set.index(i)]['parking_time'], len(hours) / 60 * tau)
        return sum(
            getattr(model_in, 'power_' + str(j))[i] for j in model_in.time) / 60 / model_in.battery_size[i] + \
               model_in.soc[i] >= aml.Expr_if(
                   model_in.soc_target[i] <= connection_time * model_in.xcharging_power[i] / model_in.battery_size[i] +
                   model_in.soc[i], model_in.soc_target[i], connection_time * model_in.xcharging_power[i] /
                   model_in.battery_size[i] + model_in.soc[i])