I'm trying to schedule power of multiple prosumers in a microgrid.
The problem includes a cost function with min
and max
statements since I want to distinguish between the prices for importing and exporting energy.
The following is a minimal example for the cost function without summing over all timesteps at the moment:
I have two decision variables $P_{charge}$ and $P_{discharge}$ for the battery storage (one of it is assumed to be always zero) and one other controllable load $P_{load}$. Consumption is denoted with positive and generation with negative values. $C_{import}$ and $C_{export}$ are the per unit prices for importing and exporting energy.
$C = max((P_{charge} + P_{discharge} + P_{load}) \cdot \Delta T,0) \cdot C_{import} + min((P_{charge} + P_{discharge} + P_{load}) \cdot \Delta T,0) \cdot C_{export}$
The min
and max
functions form if-else
statements to check if the sum of power flows is negative or positive.
Is it possible to introduce some binary decision variables to transform it into a MILP? I want to use a Matlab solver later.
Thanks for every hint!
Edit 1:
I have tried to introduce the proposed auxiliary variables but they do not match the desired values I computed from my simulation. So maybe I have to clarify the problem. At first, I simplify power flow of battery to one bidirectional power variable to reduce the problem further.
The image shows a part of my problem. My objective is to maximize $R - C$, where $R \ge 0$ is revenue and $C \ge 0$ is cost. Per unit prices are always greater than or equal to zero and $C_{import} > C_{export}$ is valid for now. The nonlinear version would be:
$$R = min(P_{load} + P_{BSS},0) \cdot (-1) \cdot C_{export}$$ $$C = max(P_{load} + P_{BSS},0) \cdot C_{import}$$
I have defined non-negative decision variables $X_{import}$ and $X_{export}$ with the line capacity (energy per timestep) as upper boundary. Additionally I've introduced following equality constraint:
$$(P_{load} + P_{BSS}) \cdot \Delta T == X_{import} - X_{export}$$
I neglected the injected PV power at this node for now. My goal is to be somehow able to use the auxiliary variables for an upper level node. Maybe I didn't fully understand the proposed answers which might led to the undesired result.