From c80075aefef9826934914f2a42b1fe94452b7857 Mon Sep 17 00:00:00 2001 From: dec-heim <92137442+dec-heim@users.noreply.github.com> Date: Sat, 18 Feb 2023 21:08:35 +1100 Subject: [PATCH] bump to v0.3 --- docs/source/conf.py | 2 +- pyproject.toml | 2 +- src/nemglo/api.py | 15 +-------------- src/nemglo/backend/solver_operator.py | 21 --------------------- src/nemglo/components/electrolyser.py | 9 --------- src/nemglo/components/emissions.py | 8 -------- 6 files changed, 3 insertions(+), 54 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index e84ed20..7197138 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -15,7 +15,7 @@ project = 'NEMGLO' copyright = '2022, Declan Heim' author = 'Declan Heim' -release = '0.2.2' +release = '0.3.0' # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/pyproject.toml b/pyproject.toml index 053aef2..77f59e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nemglo" -version = "0.2.2" +version = "0.3.0" description = "Green-energy Load Optimisation tool for the NEM" authors = ["dec-heim <92137442+dec-heim@users.noreply.github.com>"] license = "BSD-3-Clause license" diff --git a/src/nemglo/api.py b/src/nemglo/api.py index 3e0a3b0..e0baaa8 100644 --- a/src/nemglo/api.py +++ b/src/nemglo/api.py @@ -8,7 +8,6 @@ # Flask/CORS imports from flask import Flask, request, jsonify, abort from flask_cors import CORS, cross_origin -# app = Flask(__name__) # Flask if getattr(sys, 'frozen', False): @@ -55,10 +54,6 @@ def api_get_market_data(): conf = request.json return get_market_data(conf) except: - # with open(LOG_FILEPATH, 'r') as file: - # logfile = file.read() - # err_message = logfile.split('200 -')[-1:] - # abort(500, err_message[0]) throw_error_log() @@ -69,10 +64,6 @@ def api_get_generator_data(): conf = request.json return get_generator_data(conf) except: - # with open(LOG_FILEPATH, 'r') as file: - # logfile = file.read() - # err_message = logfile.split('200 -')[-1:] - # abort(500, err_message[0]) throw_error_log() @@ -84,16 +75,12 @@ def api_get_data(): print(conf) return get_operation(conf) except: - # with open(LOG_FILEPATH, 'r') as file: - # logfile = file.read() - # err_message = logfile.split('200 -')[-1:] - # abort(500, err_message[0]) throw_error_log() def run(port=5000): print("\n======================================================================\n"+\ - "Access NEMGLO-app (web interface) at: https://www.nemglo.org/simulator \n"+\ + "Access NEMGLO-app (user-interface) see: https://www.nemglo.org/start \n"+\ "======================================================================\n") app.run(port=port) diff --git a/src/nemglo/backend/solver_operator.py b/src/nemglo/backend/solver_operator.py index 23c1409..512ca70 100644 --- a/src/nemglo/backend/solver_operator.py +++ b/src/nemglo/backend/solver_operator.py @@ -139,27 +139,7 @@ def add_constraints_bigM(self, lhs_df, bigM_df): else: raise Exception("Error with format of inequality type") self.m.add_constr(constraint, name=str(idx)) - - def add_sos_type_2_ARCHIVE(self, sos_2_df): - #self._decision_vars[lhs_var_idx] - - for interval in sos_2_df['interval'].unique()[0:1]: - - sos_entry = sos_2_df[sos_2_df['interval']==interval] - - #sos_entry['sos_varid'] = sos_entry['sos_varid'].apply(lambda x: self._decision_vars[x]) - sos_entry['sos_varid'].update(pd.Series(self._decision_vars)) - - tupleobj = [(sos_entry.loc[row,'sos_varid'], sos_entry.loc[row,'sos_val']) for row in sos_entry.index] - - self.m.add_sos(tupleobj,2) - - # pass in tuple with weight var name and x-point - - - #self.m.add_sos(,2) - return def add_sos_type_2(self, sos_name, weights_df, x_samples, y_samples, xvar_df, yvar_df): @@ -189,7 +169,6 @@ def add_sos_type_2(self, sos_name, weights_df, x_samples, y_samples, xvar_df, yv y_link = xsum([weights[i]*y_samples[i] for i in range(len(y_samples))]) == yvar self.m.add_constr(y_link, name=sos_name+"_ylink") - return def optimise(self): diff --git a/src/nemglo/components/electrolyser.py b/src/nemglo/components/electrolyser.py index 9c5b3fd..9792c0d 100644 --- a/src/nemglo/components/electrolyser.py +++ b/src/nemglo/components/electrolyser.py @@ -402,15 +402,6 @@ def _set_production_target(self, target_value=100, bound="max", period="hour"): """ planner = self._system_plan - # Create variable production target, set equal to value - # Set sum of lhs params equal to, greater than or less than variable on rhs dynamic - - # consider what happens if timseries data input is hourly but requests < hourly period - # consider what happens if timeseries data stops midway through week, how to consider last week? - - # Create a production target variable on selected intervals determined by `period` - - # production target == p1 + p2 + p3 original = pd.DataFrame(index=planner._timeseries, data={'interval':range(planner._n)}) original['TimeBegin'] = original.index - timedelta(minutes=planner._intlength) diff --git a/src/nemglo/components/emissions.py b/src/nemglo/components/emissions.py index 856bb92..70ddf40 100644 --- a/src/nemglo/components/emissions.py +++ b/src/nemglo/components/emissions.py @@ -103,8 +103,6 @@ def add_emissions(self): coefficient_list=coeffs) - - def _price_emissions(self): planner = self._system_plan co2_name = self._id + '-impact_emissions' @@ -136,10 +134,4 @@ def _set_emissions_limit(self, limit_value): #limit_value in tCo2/tH2 create_constr_rhs_dynamicvar(planner, constr_name=const_nm, constr_type=">=", rhs_var_id=rhs_var_id) create_constr_lhs_on_interval(planner, constr_name=const_nm, constr_rhs=planner._constr_rhs_dynamic[const_nm],\ coefficient_map={prodsum_name: limit_value}) - - # sum emissions <= 3 * h2 production - # tCO2/MWh - # 100 tCO2 for 1000 kg - # kg CO2 per kg H2 - \ No newline at end of file