1
$\begingroup$

I am trying to model an Electric Vehicle scheduling to minimise the electricity bill. Of course, the EV will only be able to charge every time that is plugged into a charging station (i.e. it cannot charge when the vehicle is driving). Basically, it is a stationary battery that can be disconnected and connected again.

I already managed to model a stationary battery scheduling before and is working well as I expected, however, I am having a hard time setting up a constraint to connect and disconnect the battery.

In the dataset that I am using the vehicle is plugged in at certain periods of time, and I am using a dictionary like this availDict = dict(enumerate(df[avail])) that contains values 1 = plugged and 0 = not plugged at different times of the day. For example, assuming that when the vehicle is plugged when is not driving then, from 7am to 9am is not plugged as the vehicle is driving, from 9am to 6pm is plugged as the vehicle is not driving, from 6pm to 8pm is not plugged as the vehicle is driving and from 8pm to 7am is plugged as the vehicle is not driving.

At the moment I have tried to model the constraint as a boolean like this:

model.avail_bool = en.Var(model.Time, within=en.Boolean, initialize=1)

model.not_avail_bool = en.Var(model.Time, within=en.Boolean)

I was thinking to use BigM to force the model to constraint the vehicle from charging during that time, but I am having a hard time setting this up.

For further explanation, these are the equations that I am trying to model that I found in a paper:

SOCmin(t) <= SOC(t) <= SOCmax(t)

if avail = 0 (not plugged)

SOCmin(t) = SOCmax(t) = 0

if avail = 1 (plugged) but idle

SOCmin(t) = 0 and SOCmax(t) = SOC

if avail = 1 (plugged) and needed by time (t)

SOCmin(t) = SOCmax(t) = SOC

I hope that I explained my problem properly and hopefully, you are able to understand what I meant.

If there is another suggestion or you need more information please let me know so I can provide it as soon as possible.

$\endgroup$
1
$\begingroup$

First assumption:

I assume that Socmin(t) and Socmax(t) are time-dependent parameters of the model. Define the following:

$\forall t \in model.Time \quad model.idle(t) = \begin{cases} 0 & \text{if not iodle}\\ 1 & \text{if idle} \end{cases}$

Then add the following constraints to the model(it can be easily done by using the constraints list concept in Pyomo):

$$ Socmin(t) \times (avail-idle) \leq Soc(t) \leq Socmax(t) \times avail$$ $$ idle(t) \leq avail(t) \ \ \forall t \in model.time$$

Second assumption:

I assume that $\forall t \in model.Time \ \ \exists \ \ Soc(t)$, which is a parameter and then Socmin(t) and Socmax(t) are variables:

$$ Socmax(t) = Soc(t) \times avail$$ $$ Soc(t) \times (avail-idle) \leq Socmin(t) \leq Soc(t) \times avail$$ $$idle(t) \leq avail(t) \ \ \forall t \in model.time$$

model.cons = ConstraintList()
for t in model.Time:
    model.cons.add('Your Constraints')
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks for your answer, I will test the new constraints and see what happens. $\endgroup$ – DVRJ Jun 18 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.