Hi,

I am making a simple model for battery charging and discharging in day-ahead markets for 24h periods. One of the important constraints is P(discharge) x P(charge) =e= 0, meaning that the battery cannot discharge and charge at the same time. However, the results sometimes include a set of time where both powers for P(discharge) and P(charge) have a very small value e-10-16. I have tried QCP and MINLP and both give the same results. Should I assume that there is something wrong with this constraint or is GAMS bad at reading zeros? How do I fix the problem?

Here are all the battery constraints:

*no charging or discharging the battery at the same time (one has to be zero)

mode(t)… P_c(t)*P_dc(t)=e=0.00;

*power charged or discharged only positive and in the limit of battery maximum power

charge_limit_min(t)… P_c(t)=g=P_min;

charge_limit_max(t)… P_c(t)=l=P_max;

discharge_limit_min(t)… P_dc(t)=g=P_min;

discharge_limit_max(t)… P_dc(t)=l=P_max;

*discharged power cannot exceed battery charge level at previous hour

charge_capacity(t)… P_c(t)=l=E_max - E_net(t-1);

discharge_capacity(t)… P_dc(t)=l=E_net(t-1);

*stored energy cannot exceed battery capacity:

energy_limit_min(t)… E_min=l=E_net(t);

energy_limit_max(t)… E_net(t)=l=E_max;

*energy injected to the battery hourly: charged and discharged power equal to net stored energy in battery
energy_stored(t)… E_stored(t) =e= eta*P_c(t)-P_dc(t);

*available energy in the battery
energy_net(t)… E_net(t) =e= SOC_0*E_max$(ord(t)=1) + E_net(t–1)$(ord(t)>1) + E_stored(t);

Thanks!