Configuration file

In this section we will explain all the parts of the config.yaml needed to properly run EMHASS.

We will find three main parts on the configuration file:

  • The parameters needed to retrieve data from Home Assistant (retrieve_hass_conf)

  • The parameters to define the optimization problem (optim_conf)

  • The parameters used to model the system (plant_conf)

Retrieve HASS data configuration

These are the parameters that we will need to define to retrieve data from Home Assistant. There are no optional parameters. In the case of a list, an empty list is a valid entry.

  • freq: The time step to resample retrieved data from hass. This parameter is given in minutes. It should not be defined too low or you will run into memory problems when defining the Linear Programming optimization. Defaults to 30.

  • days_to_retrieve: We will retrieve data from now and up to days_to_retrieve days. Defaults to 2.

  • var_PV: This is the name of the photovoltaic produced power sensor in Watts from Home Assistant. For example: ‘sensor.power_photovoltaics’.

  • var_load: The name of the household power consumption sensor in Watts from Home Assistant. The deferrable loads that we will want to include in the optimization problem should be substracted from this sensor in HASS. For example: ‘sensor.power_load_no_var_loads’

  • load_negative: Set this parameter to True if the retrived load variable is negative by convention. Defaults to False.

  • set_zero_min: Set this parameter to True to give a special treatment for a minimum value saturation to zero for power consumption data. Values below zero are replaced by nans. Defaults to True.

  • var_replace_zero: The list of retrieved variables that we would want to replace nans (if they exist) with zeros. For example:

    • ‘sensor.power_photovoltaics’

  • var_interp: The list of retrieved variables that we would want to interpolate nans values using linear interpolation. For example:

    • ‘sensor.power_photovoltaics’

    • ‘sensor.power_load_no_var_loads’

A second part of this section is given by some privacy-sensitive parameters that should be included in a secrets.yaml file alongside the config.yaml file.

The parameters in the secrets.yaml file are:

  • hass_url: The URL to your Home Assistant instance. For example: https://myhass.duckdns.org/

  • long_lived_token: A Long-Lived Access Token from the Lovelace profile page.

  • time_zone: The time zone of your system. For example: Europe/Paris.

  • lat: The latitude. For example: 45.0.

  • lon: The longitude. For example: 6.0

  • alt: The altitude in meters. For example: 100.0

Optimization configuration parameters

These are the parameters needed to properly define the optimization problem.

  • num_def_loads: Define the number of deferrable loads to consider. Defaults to 2.

  • P_deferrable_nom: The nominal power for each deferrable load in Watts. This is a list with a number of elements consistent with the number of deferrable loads defined before. For example:

    • 3000

    • 750

  • def_total_hours: The total number of hours that each deferrable load should operate. For example:

    • 5

    • 8

  • treat_def_as_semi_cont: Define if we should treat each deferrable load as a semi-continuous variable. Semi-continuous variables are variables that must take a value between their minimum and maximum or zero. For example:

    • True

    • True

  • set_def_constant: Define if we should set each deferrable load as a constant fixed value variable with just one startup for each optimization task. For example:

    • False

    • False

  • list_hp_periods: Define a list of peak hour periods for load consumption from the grid. This is useful if you have a contract with peak and non-peak hours. For example for two peak hour periods:

    • period_hp_1:

      • start: ‘02:54’

      • end: ‘15:24’

    • period_hp_2:

      • start: ‘17:24’

      • end: ‘20:24’

  • load_cost_hp: The cost of the electrical energy from the grid during peak hours in €/kWh. Defaults to 0.1464.

  • load_cost_hc: The cost of the electrical energy from the grid during non-peak hours in €/kWh. Defaults to 0.096359.

  • prod_sell_price: The paid price for energy injected to the grid from excedent PV production in €/kWh. Defaults to 0.065.

  • set_use_battery: Set to True if we should consider an energy storage device such as a Li-Ion battery. Defaults to False.

  • delta_forecast: The number of days for forecasted data. Defaults to 1.

System configuration parameters

These are the technical parameters of the energy system of the household.

  • P_grid_max: The maximum power that can be supplied by the utility grid in Watts. Defaults to 9000.

We will define the technical parameters of the PV installation. For the modeling task we rely on the PVLib Python package. For more information see: https://pvlib-python.readthedocs.io/en/stable/ The complete list of supported modules and inverter models can be found here: https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.pvsystem.retrieve_sam.html

  • module_model: The PV module model. For example: ‘CSUN_Eurasia_Energy_Systems_Industry_and_Trade_CSUN295_60M’

  • inverter_model: The PV inverter model. For example: ‘Fronius_International_GmbH__Fronius_Primo_5_0_1_208_240__240V_’

  • surface_tilt: The tilt angle of your solar panels. Defaults to 30.

  • surface_azimuth: The azimuth of your PV installation. Defaults to 205.

  • modules_per_string: The number of modules per string. Defaults to 16.

  • strings_per_inverter: The number of used strings per inverter. Defaults to 1.

If your system has a battery (set_use_battery=True), then you should define the following parameters:

  • Pd_max: The maximum discharge power in Watts. Defaults to 1000.

  • Pc_max: The maximum charge power in Watts. Defaults to 1000.

  • eta_disch: The discharge efficiency. Defaults to 0.95.

  • eta_ch: The charge efficiency. Defaults to 0.95.

  • Enom: The total capacity of the battery stack in Wh. Defaults to 5000.

  • SOCmin: The minimun allowable battery state of charge. Defaults to 0.3.

  • SOCmax: The minimun allowable battery state of charge. Defaults to 0.9.

  • SOCtarget: The desired battery state of charge at the end of each optimization cycle. Defaults to 0.6.