• No results found

5.5 Offline algorithm

5.5.5 Electrical Vehicles

Architecture

The EV template has one purpose, namely, to determine the fill limit at the start of each charging interval. The fill limit needs to be chosen such that the strain on the grid remains as low as possible. The MainLoop

EV. When the EV is not going to reach its charging target, theMainLoop

template will increase the energy consumption at the end, such that the target is reached.

Design choices

The choice was made to always have an EV reach its charging goal, even when the fill limit does not allow it. This was done such that no simulation runs have to be discarded, thereby improving efficiency.

To choose a correct fill limit, a lower limit and upper limit are calculated. The lower limit is the optimal value considering there are no timeshiftable devices. The upper limit is calculated by adding the maximum possible timeshiftable costs during the interval, divided by the length of the interval, to the lower limit. The upper limit is not the optimal value in case all timeshiftables are activated, due to the maximum timeshiftable costs having been calculated using Python. This was done to reduce the computation time during simulation of the model. Choosing a fill limit is done by taking a random value from the uniform distribution between the lower limit and upper limit. In reality there is a larger probability that the optimal fill limit is towards the lower limit, therefore, a normal distribution could have been a better solution. However, using a normal distribution would incur a high penalty in case a high fill limit is required, due the spacing between the choices being large. Therefore, we decided to use a uniform distribution instead, such that the algorithm does not create a bias for scenarios that benefit from lower fill limits.

The MainLooptemplate calculates the energy consumption of EVs for a multitude of reasons. The reasons why the MainLoop calculates the timeshiftable energy consumption apply here as well, namely, to increase performance and maintain readability of the template. Calculating the energy consumption for all EVs in one place also has the advantage of being able to control the calculation order. The order in which the energy consumption of the EVs is calculated is imported due to how the consumption is calculated. The calculation subtracts the combined energy consumption from the fill limit. The EVs for which the energy consumption has already been calculated are included in the combined energy consumption. Therefore, the order of the energy consumption calculation has a large impact on the resulting schedule. Because the energy consumption is done by theMainLoop template, the calculation order can be controlled which improves the results.

5.5. OFFLINE ALGORITHM 60

Uppaal specifics

The automaton of the EVtemplate can be found in Figure 5.5. Similar to the Timeshiftabletemplate, the first step is checking whether the EV exists in the scenario and whether the EV has any charging intervals. When this is the case, the template finds itself in theWaitinglocation. The template will transition from the Waitinglocation to theChoice location at the start of the interval. This transition is triggered by the MainLoop

emitting on thetsStepchannel. A channel is used rather than an invariant, in order to ensure the order in which actions happen. TheChoicelocation is committed and immediately requires the fill limit to be chosen. The

fillLimit is a reference to a unique index in an array, thereby allowing the

MainLoop to view the chosen fill limit of each EV.

The fill limit is chosen using thegetLimitfunction, which takes a value out of the possibilities ttype. This custom type is an integer in the range of zero until thirty. The possibilities t determines how many parts the uniform distribution is split into, because it is not feasible to simulate every integer value of the distribution. The transition uses aselectlabel to duplicate the transition for every valuepossibilities tcontains. Thisselect

label is the reason that the fill limit cannot be chosen directly when tran- sitioning from the Waiting location, as explained in Section 4.2. Because the transition is controllable, the Stratego optimization algorithm can determine the best value from the possibilities tto be taken. When one of the transitions is traversed, the value selected from the possibilities t

is used as input for thegetLimit function. After the fill limit is selected, the interval counter is incremented. If there is another charging interval the template will return to theWaiting location. When there are no more intervals the template transitions to theFinished location.

Calculating the fill limit The getLimit function first calculates the lower limit and then uses the input value to evenly divide the maximum timeshiftable costs. As mentioned above, the maximum timeshiftable costs have been pre-calculated using Python and are stored in the Up- paal declaration as an attribute of the EV. The calculation of the lower limit needs to be done inside of Uppaal, due to this relying on the fill limits chosen by other EVs. Algorithm 1 explains how the lower limit is calculated.

The algorithm starts by storing the maximum energy consumption at each point in time during the interval, assuming there are only static costs and EVs. These energy consumptions are sorted from low to high.

The energy consumptions are then filled until the charging target is reached, using the sorted list of maximum energy consumptions. This is the same process as valley-filling, only the fill limit increases until the charging target has been reached. Filling the energy consumptions is done by adding the difference between the current consumption and the current fill limit to all energy consumptions that are lower than the current value. Because the consumptions are sorted, all consumptions below the current consumption are filled up until the same level.

Algorithm 1Calculate EV lower limit baseCosts = list()

for i in range(interval.start, interval.end) do

baseCosts += max(static[i], getHighestEVFillLimit(i)) sortedCosts = sort(baseCosts)

neededCharge = interval.requiredCharge previousCost = 0

for index, cost in enumerate(sortedCosts) do

if (cost-previousCost)*index>neededChargethen return previousCost + neededCharge/index

else

neededCharge -= (cost-previousCost)*index previousCost = cost

return prevCost + neededCharge/(interval.end-interval.start)

Figure 5.5: Electrical Vehicle Template

Related documents