• No results found

4 | Model Construction

4.4 Power Flow Model

The power flow model represents the main and outer loop of the model. It is developed to handle hourly-based load data and to give the power flow solution of the problem as the output for each hour. If no battery is connected to the system, the loop has no control organ, and the power flow solution will be delivered based on the BFS-algorithm presented in chapter 3. However, if there is a battery connected, this will operate as a voltage regulating device, delivering or consuming the required power for the system voltage to not deviate more than 10% of the rated voltage level. The output will both contain the updated power flow solution solved with the BFS-algorithm, as well as the battery operation data.

The grid that is to be analysed has to have a radial structure. Further, it has to follow the BFS numbering scheme presented in section 3.2.1. The numbering of buses and branches is done before the model runs. As described in section 3.2, the slack bus is the only bus where the voltage magnitude and angle are known, and the other buses in the system are load buses. The slack bus is numbered as bus 0.

The input data to the power flow model can be seen in table 4.1.

Table 4.1: Input data to the power flow model Parameter Description

N Number of buses in the system, numbered based on system topology.

B Number of branches, B = N - 1, in the system, numbered based on system topology.

V0t Voltage level at slack bus∀t∈T . Set to be 1 pu δ0t Phase angle at slack bus∀t∈T. Set to be 0 rad.

Zb

The impedance value of all the branches in the system, given in per unit values based on the system apparant power basis.

T Total number of operating hours, including the starting and ending hour.

Pnt Real power injection at every hour t for all the load buses in the system.

n∈ {1,N}

Qtn Reactive power injection at every hour t for all the load buses in the system. n∈ {1,N}

bbattery

Binary variable for the model to know if the battery is to be included.

Will be equal to 1 if battery is included and 0 if not.

κBF S

Maximum allowed mismatch between the specified and the calculated power injections at the load buses.

Battery data Information about the battery to be further included in the battery model.

See table 4.3.

4.4.1 Solution Method

The solution method of the power flow model is divided into three steps, where the first step will be carried out for all situations, and the second and the third step will only take place if the BESS is connected. A flowchart of the model algorithm can be seen in figure 4.1.

Step 1 - Solve the Power Flow Problem

The power flow solution is found by solving the BFS-algorithm. The iterative power flow proced-ure is modelled in Python following the solution method presented in section 3.2.2. Within the BFS-model there is included a limit of the maximum allowed iterations before the loop breaks, to avoid infinite loops to run.

Step 2 - Determine the Lowest System Voltage

If a battery is included in the system, its primary goal is to regulate the voltage to avoid situations with very high voltage drops caused by high load demand. It is also desired that the battery is being charged if the system voltage allows it. The basis for what role the battery will have in a given hour, is the lowest voltage level in the grid,Vmint . If the lowest voltage level is

precisely 0.9 pu., the battery will not be operated for this hour, and step 3 will not be carried out.

Step 3 - Run Battery Model

If the lowest voltage level is below 0.9 pu., the battery will deliver power to the system, given that the battery state allows it. And if the voltage level is above 0.9 pu., the battery will con-sume power from the system, if the battery state requires it. Details about the charging and discharging of the battery will be explained in section 4.5 and 4.6. The battery model returns the updated system data, based on the appropriate charging or discharging level found. The update relevant for the power flow model involves the change in the power delivered or consumed at the bus where the battery is installed,Pbbust .

After the system data is updated from the battery algorithm, step number 1 is repeated, to deliver the updated power flow solution. The loop will continue until the last hour is oper-ated. The power flow model output data is presented in table 4.2. The output data from both the power flow model and the battery model will be stored in python dictionaries during the operation, and when the power flow model is completed, all data will be exported to Excel.

Table 4.2: Output data from power flow model Variable Description

Vnt Voltage level each hour for all the load buses, n∈ {1,N}

δnt Phase angle at every hour for all the load buses,n∈ {1,N}

P0t Total active power delivered from slack bus every hour Qt0 Total reactive power delivered from slack bus every hour

Battery output Output data from the battery operation, if the battery is included.

See table 4.4

Start

Read initial input data

Start with first hour,t =t0

Solve the BFS fort

Battery? FindVmint Vmint =0.9? Run battery model

Read updated data

Solve BFS Save results

t=Tmax? t=t+1

Store results in Excel Stop

yes no

yes

no

yes no

Figure 4.1: Flowchart power flow model