Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions shared/lib_battery_dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ dispatch_automatic_t::dispatch_automatic_t(
double Pd_max_kwac,
double t_min,
int dispatch_mode,
int weather_forecast_mode,
int pv_dispatch,
size_t nyears,
size_t look_ahead_hours,
Expand Down Expand Up @@ -500,6 +501,7 @@ dispatch_automatic_t::dispatch_automatic_t(
curr_year = 0;

_mode = dispatch_mode;
_weather_forecast_mode = weather_forecast_mode;
_safety_factor = 0.03;

m_batteryPower->canClipCharge = can_clip_charge;
Expand All @@ -524,6 +526,7 @@ void dispatch_automatic_t::init_with_pointer(const dispatch_automatic_t* tmp)
_nyears = tmp->_nyears;
curr_year = tmp->curr_year;
_mode = tmp->_mode;
_weather_forecast_mode = tmp->_weather_forecast_mode;
_safety_factor = tmp->_safety_factor;
_forecast_hours = tmp->_forecast_hours;
m_battReplacementCostPerKWH = tmp->m_battReplacementCostPerKWH;
Expand Down
12 changes: 9 additions & 3 deletions shared/lib_battery_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ class dispatch_t
{
public:

enum FOM_MODES { FOM_LOOK_AHEAD, FOM_LOOK_BEHIND, FOM_FORECAST, FOM_CUSTOM_DISPATCH, FOM_MANUAL, FOM_PV_SMOOTHING };
enum BTM_MODES { LOOK_AHEAD, LOOK_BEHIND, MAINTAIN_TARGET, CUSTOM_DISPATCH, MANUAL, FORECAST };
enum FOM_MODES { FOM_AUTOMATED_ECONOMIC, FOM_PV_SMOOTHING, FOM_CUSTOM_DISPATCH, FOM_MANUAL };
enum BTM_MODES { PEAK_SHAVING, MAINTAIN_TARGET, CUSTOM_DISPATCH, MANUAL, FORECAST };
enum METERING { BEHIND, FRONT };
enum WEATHER_FORECAST_CHOICE { WF_LOOK_AHEAD, WF_LOOK_BEHIND, WF_CUSTOM };
enum LOAD_FORECAST_CHOICE { LOAD_LOOK_AHEAD, LOAD_LOOK_BEHIND, LOAD_CUSTOM };
enum PV_PRIORITY { MEET_LOAD, CHARGE_BATTERY };
enum CURRENT_CHOICE { RESTRICT_POWER, RESTRICT_CURRENT, RESTRICT_BOTH };
enum FOM_CYCLE_COST {MODEL_CYCLE_COST, INPUT_CYCLE_COST};
enum CYCLE_COST {MODEL_CYCLE_COST, INPUT_CYCLE_COST};
enum CONNECTION { DC_CONNECTED, AC_CONNECTED };

dispatch_t(battery_t * Battery,
Expand Down Expand Up @@ -243,6 +245,7 @@ class dispatch_automatic_t : public dispatch_t
double Pd_max_kwac,
double t_min,
int dispatch_mode,
int weather_forecast_mode,
int pv_dispatch,
size_t nyears,
size_t look_ahead_hours,
Expand Down Expand Up @@ -341,6 +344,9 @@ class dispatch_automatic_t : public dispatch_t
/*! The dispatch mode, described by dispatch_t::BTM_MODES or dispatch_t::FOM_MODES*/
int _mode;

/*! What weather forecast to use, described by dispatch_t::WEATHER_FORECAST_CHOICE*/
int _weather_forecast_mode;

/*! An internal factor to describe how conservative the peak shaving algorithm should be */
double _safety_factor;

Expand Down
3 changes: 2 additions & 1 deletion shared/lib_battery_dispatch_automatic_btm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dispatch_automatic_behind_the_meter_t::dispatch_automatic_behind_the_meter_t(
double Pd_max_kwac,
double t_min,
int dispatch_mode,
int weather_forecast_mode,
int pv_dispatch,
size_t nyears,
size_t look_ahead_hours,
Expand All @@ -54,7 +55,7 @@ dispatch_automatic_behind_the_meter_t::dispatch_automatic_behind_the_meter_t(
std::vector<double> battCycleCost,
double interconnection_limit
) : dispatch_automatic_t(Battery, dt_hour, SOC_min, SOC_max, current_choice, Ic_max, Id_max, Pc_max_kwdc, Pd_max_kwdc, Pc_max_kwac, Pd_max_kwac,
t_min, dispatch_mode, pv_dispatch, nyears, look_ahead_hours, dispatch_update_frequency_hours, can_charge, can_clip_charge, can_grid_charge, can_fuelcell_charge,
t_min, dispatch_mode, weather_forecast_mode, pv_dispatch, nyears, look_ahead_hours, dispatch_update_frequency_hours, can_charge, can_clip_charge, can_grid_charge, can_fuelcell_charge,
battReplacementCostPerkWh, battCycleCostChoice, battCycleCost, interconnection_limit)
{
_P_target_month = -1e16;
Expand Down
1 change: 1 addition & 0 deletions shared/lib_battery_dispatch_automatic_btm.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class dispatch_automatic_behind_the_meter_t : public dispatch_automatic_t
double Pd_max_kwac,
double t_min,
int dispatch_mode,
int weather_forecast_mode,
int pv_dispatch,
size_t nyears,
size_t look_ahead_hours,
Expand Down
7 changes: 4 additions & 3 deletions shared/lib_battery_dispatch_automatic_fom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dispatch_automatic_front_of_meter_t::dispatch_automatic_front_of_meter_t(
double Pd_max_kwac,
double t_min,
int dispatch_mode,
int weather_forecast_mode,
int pv_dispatch,
size_t nyears,
size_t look_ahead_hours,
Expand All @@ -36,11 +37,11 @@ dispatch_automatic_front_of_meter_t::dispatch_automatic_front_of_meter_t(
double etaGridCharge,
double etaDischarge,
double interconnection_limit) : dispatch_automatic_t(Battery, dt_hour, SOC_min, SOC_max, current_choice, Ic_max, Id_max, Pc_max_kwdc, Pd_max_kwdc, Pc_max_kwac, Pd_max_kwac,
t_min, dispatch_mode, pv_dispatch, nyears, look_ahead_hours, dispatch_update_frequency_hours, can_charge, can_clip_charge, can_grid_charge, can_fuelcell_charge,
t_min, dispatch_mode, weather_forecast_mode, pv_dispatch, nyears, look_ahead_hours, dispatch_update_frequency_hours, can_charge, can_clip_charge, can_grid_charge, can_fuelcell_charge,
battReplacementCostPerkWh, battCycleCostChoice, battCycleCost, interconnection_limit)
{
// if look behind, only allow 24 hours
if (_mode == dispatch_t::FOM_LOOK_BEHIND)
if (_weather_forecast_mode == dispatch_t::WEATHER_FORECAST_CHOICE::WF_LOOK_BEHIND)
_forecast_hours = 24;

_inverter_paco = inverter_paco;
Expand Down Expand Up @@ -79,7 +80,7 @@ void dispatch_automatic_front_of_meter_t::setup_cost_forecast_vector()
ppa_price_series.reserve(_forecast_price_rt_series.size());

// add elements at beginning, so our forecast is looking at yesterday's prices
if (_mode == dispatch_t::FOM_LOOK_BEHIND) {
if (_weather_forecast_mode == dispatch_t::WEATHER_FORECAST_CHOICE::WF_LOOK_BEHIND) {
for (size_t i = 0; i != _forecast_hours * _steps_per_hour; i++)
ppa_price_series.push_back(0);
}
Expand Down
1 change: 1 addition & 0 deletions shared/lib_battery_dispatch_automatic_fom.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class dispatch_automatic_front_of_meter_t : public dispatch_automatic_t
double Pd_max_kwac,
double t_min,
int dispatch_mode,
int weather_forecast_mode,
int pv_dispatch,
size_t nyears,
size_t look_ahead_hours,
Expand Down
3 changes: 2 additions & 1 deletion shared/lib_battery_dispatch_pvsmoothing_fom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dispatch_pvsmoothing_front_of_meter_t::dispatch_pvsmoothing_front_of_meter_t(
double Pd_max_kwac,
double t_min,
int dispatch_mode,
int weather_forecast_mode,
int pv_dispatch,
size_t nyears,
size_t look_ahead_hours,
Expand Down Expand Up @@ -52,7 +53,7 @@ dispatch_pvsmoothing_front_of_meter_t::dispatch_pvsmoothing_front_of_meter_t(
double interconnection_limit

) : dispatch_automatic_t(Battery, dt_hour, SOC_min, SOC_max, current_choice, Ic_max, Id_max, Pc_max_kwdc, Pd_max_kwdc, Pc_max_kwac, Pd_max_kwac,
t_min, dispatch_mode, pv_dispatch, nyears, look_ahead_hours, dispatch_update_frequency_hours, can_charge, can_clip_charge, can_grid_charge, can_fuelcell_charge,
t_min, dispatch_mode, weather_forecast_mode, pv_dispatch, nyears, look_ahead_hours, dispatch_update_frequency_hours, can_charge, can_clip_charge, can_grid_charge, can_fuelcell_charge,
battReplacementCostPerkWh, battCycleCostChoice, battCycleCost, interconnection_limit),
m_batt_dispatch_pvs_nameplate_ac(batt_dispatch_pvs_nameplate_ac),
m_batt_dispatch_pvs_ac_lb(batt_dispatch_pvs_ac_lb),
Expand Down
1 change: 1 addition & 0 deletions shared/lib_battery_dispatch_pvsmoothing_fom.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class dispatch_pvsmoothing_front_of_meter_t : public dispatch_automatic_t
double Pd_max_kwac,
double t_min,
int dispatch_mode,
int weather_forecast_mode,
int pv_dispatch,
size_t nyears,
size_t look_ahead_hours,
Expand Down
Loading