Originally posted by: JG. KIM
Hi, everyone.
I'm new at CP. So, I'm developing a model to schedule Energy charging & discharging on ESS battery.
So, I need your help. please help me :)
I have 5 batteries and based on time charging, discharging costs.
these batteries have the initial capacity. this capacity will be changed based on time because of acting charge or discharge.
So, I want to make 3 decision variables.
1. charging, discharging signal. (sig)
2. charging, discharging power (Cpower, Dpower)
but, when I make code like this : I can see 'no solution'
using CP;
int numEVs = ...;
range EVs = 0..numEVs-1;
int time = ...;
range times = 0..time-1;
int k[times,EVs]=...;
int cost[times] = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24];
float min_soc[EVs] = [0.4,0.4,0.4,0.4,0.4];
float max_soc[EVs] = [0.9,0.9,0.9,0.9,0.9];
float Soc[EVs] = [0.4, 0.5, 0.6, 0.7, 0.8];
tuple EVs2 {
key int id;
int Cpower[times];
int Dpower[times];
}
//float delSm[EVs] = Soc[EVs] - min_soc[EVs];
//float delSp[EVs] = Soc[EVs] - max_soc[EVs];
dvar interval t[i in times] optional size 1;
dvar int Pcmax[times, EVs]; // why can't use float.
dvar int Pdmax[times, EVs];
dexpr float Cost = sum(t, j in EVs) (k[t,j]*cost[t]*Pcmax[t,j] - (1-k[t,j])*cost[t]*Pdmax[t,j]);
minimize Cost; // minimize charging/discharging price
subject to {
forall(t, j in EVs)
k[t,j]*Pcmax[t,j] - (1-k[t,j])*Pdmax[t,j] >= Soc[j]-min_soc[j] && k[t,j]*Pcmax[t,j] - (1-k[t,j])*Pdmax[t,j] <= Soc[j]-max_soc[j];
// each EV's battery state of charge must less or bigger than limits.
forall(t, j in EVs)
k[t,j] == 1 || k[t,j] ==0;
forall(t, j in EVs)
{
Pdmax[t][j] >=0;
Pdmax[t][j] <=10;
Pcmax[t][j] >=0;
Pcmax[t][j] <=8;
}
}
And I want to add constraints about changing capacity. how can I model this?
Thank you for help.
#DecisionOptimization#OPLusingCPOptimizer