Dynamic Programming, MILP, MINLP as well as CVX, Matlab tools etc. are very used for energy flow optimization in microgrids and smart grids.
In my works I can approximate battery non linearity (i.e. charging and discharging efficiencies) through Dynamic Programming.
How can I do the same in CVX?
In particular, how can I implement this equation:
SoC[k]=SoC[k-1]+(Ech[k]*0.95)+(Edch[k]/0.95)
where 0.95 is the battery efficiency in both charging and discharging modes.
Considering that Ech and Edch are complementary variables, namely if one is different to 0 the other must be kept equal to 0 at the same time slot (i.e. k in formula).