Battery#

class relsad.network.components.Battery(name: str, bus: relsad.network.components.Bus.Bus, inj_p_max: float = 0.5, inj_q_max: float = 0.5, E_max: float = 1, SOC_min: float = 0.1, SOC_max: float = 1, n_battery: float = 0.95, battery_type: relsad.network.components.Battery.BatteryType = BatteryType.REGULAR, random_instance: Optional[numpy.random.Generator] = None, SOC_start: Optional[float] = None)[source]#

Common class for batteries

name#

Name of the battery

Type

string

mode#

Microgrid mode

Type

str

survival_time#

Total amount of hours the microgrid should survive on battery capacity

Type

Time

remaining_survival_time#

The time left for the battery to ensure energy for the microgrid load

Type

Time

standard_SOC_min#

The minimum State of Charge for the battery which can change based on wanted battery capacity

Type

float

bus#

The bus the battery is connected to

Type

Bus

inj_p_max#

The maximum active power that the battery can inject [MW]

Type

float

inj_q_max#

The maximum reactive power that the battery can inject [MVar]

Type

float

inj_max#

The maximum apperent power that the battery can inject [MVa]

Type

float

f_inj_p#

Active power capacity fraction

Type

float

f_inj_q#

Reactive power capacity fraction

Type

float

E_max#

The maximum capacity of the battery [MWh]

Type

float

SOC_min#

The minimal state of charge level in the battery

Type

float

SOC_max#

The maximum state of charge level in the battery

Type

float

n_battery#

The battery efficiency

Type

float

SOC_start#

The iteration start value for the state of charge level in the battery

Type

float

p_inj#

The injected active power in the battery [MW]

Type

float

q_inj#

The injected reactive power in the battery [MVar]

Type

float

SOC#

The state of charge of the battery

Type

float

E_battery#

The amount of energy stored in the battery [MWh]

Type

float

battery_type#

The battery type

Type

BatteryType

state#

Battery state

Type

BatteryState

history#

Dictonary attribute that stores the historic variables

Type

dict

update_SOC()[source]#

Updates the SOC in the battery

charge(P_ch, dt)[source]#

Charge the battery. Decides how much the battery can charge based on the desired charging power. Restricted by the amount of power that can be stored, the maximum power that can be injected, and the maximum state of charge of the battery. Updates the state of charge of the battery. Returns a float telling how much power the battery is not able to charge

discharge(P_dis, q_dis, dt)[source]#

Discharge the battery. Decides how much the battery can discharge based on the available energy in the battery. Limited by the state of charge, the maximum power that can be injected, and the wanted amount of power from the battery. Updates the state of charge of the battery. Returns a float telling how much power the battery is not able to discharge

print_status()[source]#

Prints the status of the battery

update_bus_load_and_prod(system_load_balance_p, system_load_balance_q)[source]#

Updates the load and production on the bus based on the system load balance. If the balance is negative, there is a surplus of production, and the battery will charge. If the balance is positive, there is a shortage of production, and the battery will discharge. Returns the remaining surplus/shortage of power

initialize_history()[source]#

Initializes the history variables

update_history(prev_time, curr_time, dt, save_flag)[source]#

Updates the history variables

get_history(attribute)[source]#

Returns the history variables of an attribute

update_fail_status(dt)[source]#

Locks and unlocks the battery functionality based on failure states of the basestation

add_random_instance(random_gen)[source]#

Adds global random seed

reset_status()[source]#

Resets and sets the status of the system parameters

set_mode(mode)[source]#

Sets the microgrid mode

start_survival_time()[source]#

Starts the timer for how long the battery should focus on supporting own load Only for when a microgrid is added and follows a survival mode

set_SOC_state()[source]#

Sets the SOC state

draw_SOC_state()[source]#

Draws the SOC state based on a uniform distribution

update(p, q, fail_duration, dt)[source]#

Updates the battery status for the current time step

Battery.add_random_instance(random_gen)

Adds global random seed

Battery.charge(p_ch, dt)

Charge the battery

Battery.discharge(p_dis, q_dis, dt)

Discharge the battery

Battery.draw_SOC_state()

Draws the SOC state based on a uniform distribution

Battery.get_history(attribute)

Returns the history variables of an attribute

Battery.initialize_history()

Initializes the storage of the history variables

Battery.print_status()

Prints the status of the battery

Battery.reset_status(save_flag)

Resets and sets the status of the class parameters

Battery.set_SOC_state(SOC_state)

Sets the SOC state

Battery.set_mode(mode)

Sets the microgrid mode

Battery.start_survival_time()

Starts the timer for how long the battery should focus on supporting own load Only for when a microgrid is added and follows a survival mode

Battery.update(p, q, fail_duration, dt)

Updates the battery status for the current time step

Battery.update_SOC()

Updates the SOC in the battery

Battery.update_bus_load_and_prod(...)

Updates the load and production on the bus based on the system load balance.

Battery.update_fail_status(dt)

Locks og unlocks the battery functionality based on failure states of the basestation

Battery.update_history(prev_time, curr_time, ...)

Updates the history variables

Battery.ps_random