MCPcopy Create free account
hub / github.com/ahalev/python-microgrid / add_grid_params

Function add_grid_params

src/pymgrid/convert/to_nonmodular_ops.py:123–145  ·  view source on GitHub ↗
(grid_module, params_dict)

Source from the content-addressed store, hash-verified

121
122
123def add_grid_params(grid_module, params_dict):
124 time_series_df = pd.DataFrame(grid_module.time_series,
125 columns=['grid_price_import', 'grid_price_export', 'grid_co2', 'grid_status'])
126 params_dict['grid_price_import'] = time_series_df['grid_price_import'].to_frame()
127 params_dict['grid_price_export'] = time_series_df['grid_price_export'].to_frame()
128 params_dict['grid_co2'] = time_series_df['grid_co2'].to_frame()
129 params_dict['grid_ts'] = time_series_df['grid_status'].to_frame()
130 _add_to_architecture(params_dict, 'grid')
131 _add_to_parameters(params_dict,
132 grid_weak=(time_series_df['grid_status'].min() < 1).item(),
133 grid_power_import=grid_module.max_import,
134 grid_power_export=grid_module.max_export)
135 _add_to_df_actions(params_dict, 'grid_import','grid_export')
136 _add_to_df_status(params_dict,
137 grid_status=time_series_df['grid_status'].iloc[0],
138 grid_co2=time_series_df['grid_co2'].iloc[0],
139 grid_price_import=time_series_df['grid_price_import'].iloc[0],
140 grid_price_export=time_series_df['grid_price_export'].iloc[0]
141 )
142 _add_to_df_actual_generation(params_dict, 'grid_import', 'grid_export')
143 _add_to_df_cost(params_dict, 'grid_import', 'grid_export')
144 _add_to_control_dict(params_dict, 'grid_import', 'grid_export')
145 _add_cost_co2(params_dict, grid_module.cost_per_unit_co2)
146
147
148def add_genset_params(genset_module, params_dict):

Callers 1

add_params_from_moduleFunction · 0.85

Calls 10

_add_to_architectureFunction · 0.85
_add_to_parametersFunction · 0.85
_add_to_df_actionsFunction · 0.85
_add_to_df_statusFunction · 0.85
_add_to_df_costFunction · 0.85
_add_to_control_dictFunction · 0.85
_add_cost_co2Function · 0.85
itemMethod · 0.80
to_frameMethod · 0.45

Tested by

no test coverage detected