Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
Expand all | Collapse all

Question about scheduling based on time

  • 1.  Question about scheduling based on time

    Posted Fri February 07, 2020 03:59 AM

    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


  • 2.  Re: Question about scheduling based on time

    Posted Fri February 07, 2020 12:29 PM

    Originally posted by: ChrisBr


    Hello,

    You might try the Conflict Refiner ; it will help you to find which constraints lead to this result with no solution.
    The simplest way would be:

    oplrun -conflict model.mod data.dat
    

    See documentation of oplrun Command Line Interface.

    I hope this helps,

    Chris.

     


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: Question about scheduling based on time

    Posted Sat February 08, 2020 09:11 AM

    Originally posted by: JG. KIM


    Thank you for answer. :)

    but I still have problem..

    Can we make 1-day battery charging/discharging scheduling with CP?


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 4.  Re: Question about scheduling based on time

    Posted Sun February 09, 2020 02:30 PM

    Originally posted by: Petr Vilím


    Hello,

    could you give us also your data file? Without it I cannot test your model.

    I noticed that there are interval variables "t" in the model. However they are not used (there are more identifiers "t" in the model used as indexes in the forall and they hide "t" from outer scopes). So I recommend to delete those variables (but it will not solve the problem probably).

    I'm also wondering about the following constraint:

      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]; 
    

    It is in the form A >= B <= C. I'm wondering whether it isn't a typo, maybe it was intended as A <= B <= C?

    If it is not a typo then maybe you can rewrite it to B <= minl(A, C).

    In the model you have a question why you cannot use floating-point decision variables. It is simply not supported in CP. You can scale an integer variable instead. For example, if precision of 2 decimal places is enough then you can use integer variable x and use x/100 everywhere.

    Best regards, Petr


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 5.  Re: Question about scheduling based on time

    Posted Sun February 09, 2020 02:44 PM

    Originally posted by: Petr Vilím


    I was able to run your model using the data file from your second question. And here are two constraints that together make the problem infeasible:

    "Pcmax[3,2]" + -("Pdmax[3,2]" * (1 + -1)) <= 0.6 + -0.9;
    "Pcmax[3,2]" >= 0;
    

    Best regards, Petr


    #DecisionOptimization
    #OPLusingCPOptimizer