Observation
Submodules
Observer base class
- class fleetrl.utils.observation.observer.Observer[source]
Bases:
object
Parent class for observer modules.
- get_obs(db, price_lookahead, bl_pv_lookahead, time, ev_conf, load_calc, aux, target_soc)[source]
- Parameters:
db (
DataFrame
) – database from the envprice_lookahead (
int
) – lookahead window for spot pricebl_pv_lookahead (
int
) – lookahead window for building load and pvtime (
Timestamp
) – current time of time stepev_conf (
EvConfig
) – EV config needed for batt capacity and other paramsload_calc (
LoadCalculation
) – Load calc module needed for grid connection and other paramsaux (
bool
) – Include auxiliary information that might help the agent to learn the problemtarget_soc (
list
) – A list of target soc values, one for each car
- Return type:
dict
- Returns:
Returns a list of np arrays that make up different parts of the observation.
Building load and PV
- class fleetrl.utils.observation.observer_bl_pv.ObserverWithBoth[source]
Bases:
Observer
Observer for price, PV, and load (full model).
- get_obs(db, price_lookahead, bl_pv_lookahead, time, ev_conf, load_calc, aux, target_soc)[source]
define the starting and ending time via lookahead, np.where returns the index in the dataframe
add lookahead + 2 here because of rounding issues with the resample function on square times (00:00)
get data of price and date from the specific indices
resample data to only include one value per hour (the others are duplicates)
only take into account the current value, and the specified hours of lookahead
- Parameters:
db (
DataFrame
) – Database from envprice_lookahead (
int
) – Lookahead in hours for pricebl_pv_lookahead (
int
) – Lookahead in hours for PV and buildingtime (
Timestamp
) – Current timeev_conf (
EvConfig
) – EV config data, used for battery capacity, etc.load_calc (
LoadCalculation
) – Load calc module, used for grid connection, etc.aux (
bool
) – Flag to include extra information on the problem or not. Can help with trainingtarget_soc (
list
) – List for the current target SOC of each car
- Return type:
dict
- Returns:
Dict of lists with different parts of the observation
Price only
- class fleetrl.utils.observation.observer_price_only.ObserverPriceOnly[source]
Bases:
Observer
Observer for a model that only takes into account the price, but disregards PV and building load.
- get_obs(db, price_lookahead, bl_pv_lookahead, time, ev_conf, load_calc, aux, target_soc)[source]
define the starting and ending time via lookahead, np.where returns the index in the dataframe
add lookahead + 2 here because of rounding issues with the resample function on square times (00:00)
get data of price and date from the specific indices
resample data to only include one value per hour (the others are duplicates)
only take into account the current value, and the specified hours of lookahead
- Parameters:
db (
DataFrame
) – Database from envprice_lookahead (
int
) – Lookahead in hours for pricebl_pv_lookahead (
int
) – Lookahead in hours for PV and buildingtime (
Timestamp
) – Current timeev_conf (
EvConfig
) – EV config data, used for battery capacity, etc.load_calc (
LoadCalculation
) – Load calc module, used for grid connection, etc.aux (
bool
) – Flag to include extra information on the problem or not. Can help with trainingtarget_soc (
list
) – List for the current target SOC of each car
- Return type:
dict
- Returns:
Dict of lists with different parts of the observation
SOC and time only
- class fleetrl.utils.observation.observer_soc_time_only.ObserverSocTimeOnly[source]
Bases:
Observer
Observer that only regards SOC and time left, but not charging cost, PV or building laod
- get_obs(db, price_lookahead, bl_pv_lookahead, time, ev_conf, load_calc, aux, target_soc)[source]
define the starting and ending time via lookahead, np.where returns the index in the dataframe
add lookahead + 2 here because of rounding issues with the resample function on square times (00:00)
get data of price and date from the specific indices
resample data to only include one value per hour (the others are duplicates)
only take into account the current value, and the specified hours of lookahead
- Parameters:
db (
DataFrame
) – Database from envprice_lookahead (
int
) – Lookahead in hours for pricebl_pv_lookahead (
int
) – Lookahead in hours for PV and buildingtime (
Timestamp
) – Current timeev_conf (
EvConfig
) – EV config data, used for battery capacity, etc.load_calc (
LoadCalculation
) – Load calc module, used for grid connection, etc.aux (
bool
) – Flag to include extra information on the problem or not. Can help with trainingtarget_soc (
list
) – List for the current target SOC of each car
- Return type:
dict
- Returns:
Dict of lists with different parts of the observation
Building load
- class fleetrl.utils.observation.observer_with_building_load.ObserverWithBuildingLoad[source]
Bases:
Observer
Observer that takes into account price, and building load.
- get_obs(db, price_lookahead, bl_pv_lookahead, time, ev_conf, load_calc, aux, target_soc)[source]
define the starting and ending time via lookahead, np.where returns the index in the dataframe
add lookahead + 2 here because of rounding issues with the resample function on square times (00:00)
get data of price and date from the specific indices
resample data to only include one value per hour (the others are duplicates)
only take into account the current value, and the specified hours of lookahead
- Parameters:
db (
DataFrame
) – Database from envprice_lookahead (
int
) – Lookahead in hours for pricebl_pv_lookahead (
int
) – Lookahead in hours for PV and buildingtime (
Timestamp
) – Current timeev_conf (
EvConfig
) – EV config data, used for battery capacity, etc.load_calc (
LoadCalculation
) – Load calc module, used for grid connection, etc.aux (
bool
) – Flag to include extra information on the problem or not. Can help with trainingtarget_soc (
list
) – List for the current target SOC of each car
- Return type:
dict
- Returns:
Dict of lists with different parts of the observation
PV
- class fleetrl.utils.observation.observer_with_pv.ObserverWithPV[source]
Bases:
Observer
Observer that regards price, and PV.
- get_obs(db, price_lookahead, bl_pv_lookahead, time, ev_conf, load_calc, aux, target_soc)[source]
define the starting and ending time via lookahead, np.where returns the index in the dataframe
add lookahead + 2 here because of rounding issues with the resample function on square times (00:00)
get data of price and date from the specific indices
resample data to only include one value per hour (the others are duplicates)
only take into account the current value, and the specified hours of lookahead
- Parameters:
db (
DataFrame
) – Database from envprice_lookahead (
int
) – Lookahead in hours for pricebl_pv_lookahead (
int
) – Lookahead in hours for PV and buildingtime (
Timestamp
) – Current timeev_conf (
EvConfig
) – EV config data, used for battery capacity, etc.load_calc (
LoadCalculation
) – Load calc module, used for grid connection, etc.aux (
bool
) – Flag to include extra information on the problem or not. Can help with trainingtarget_soc (
list
) – List for the current target SOC of each car
- Return type:
dict
- Returns:
Dict of lists with different parts of the observation