Skip to content

Commit

Permalink
Merge pull request #11 from jye-lim/main
Browse files Browse the repository at this point in the history
Moved "price" argument into config.json
  • Loading branch information
XiaogangHe authored Jul 14, 2023
2 parents b822260 + 272ac83 commit 0ff8731
Show file tree
Hide file tree
Showing 22 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
!/log/.gitkeep
/output/*
!/output/.gitkeep
*.pyc
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"hour": 48,
"month": 1,
"dt": 1,
"hours_in_year": 8760
"hours_in_year": 8760,
"price": 0.01
},
"hydro_parameters": {
"ishydro": true,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed prepshot/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file removed prepshot/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file removed prepshot/__pycache__/load_data.cpython-37.pyc
Binary file not shown.
Binary file removed prepshot/__pycache__/load_data.cpython-39.pyc
Binary file not shown.
Binary file removed prepshot/__pycache__/logs.cpython-37.pyc
Binary file not shown.
Binary file removed prepshot/__pycache__/model.cpython-37.pyc
Binary file not shown.
Binary file removed prepshot/__pycache__/model.cpython-39.pyc
Binary file not shown.
Binary file removed prepshot/__pycache__/model_hydro.cpython-37.pyc
Binary file not shown.
Binary file removed prepshot/__pycache__/parameters.cpython-37.pyc
Binary file not shown.
Binary file removed prepshot/__pycache__/rules.cpython-37.pyc
Binary file not shown.
Binary file removed prepshot/__pycache__/solver.cpython-37.pyc
Binary file not shown.
Binary file removed prepshot/__pycache__/utils.cpython-37.pyc
Binary file not shown.
Binary file removed prepshot/__pycache__/utils.cpython-39.pyc
Binary file not shown.
5 changes: 4 additions & 1 deletion prepshot/load_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def get_required_config_data(config_data):
month = int(config_data['general_parameters']['month'])
dt = int(config_data['general_parameters']['dt'])
hours_in_year = int(config_data['general_parameters']['hours_in_year'])
price = float(config_data['general_parameters']['price'])
includes_hydrological_constraints = config_data['hydro_parameters']['ishydro']
error_threshold = float(config_data['hydro_parameters']['error_threshold'])
iteration_number = int(config_data['hydro_parameters']['iteration_number'])
Expand All @@ -40,6 +41,7 @@ def get_required_config_data(config_data):
# Create dictionary containing required data from configuration file.
required_config_data = {
'dt': dt,
'price': price,
'weight': (month * hour * dt) / hours_in_year,
'solver': solver,
'timelimit': timelimit,
Expand All @@ -56,6 +58,7 @@ def load_input_params(input_filepath, params_data, para):
Load input data into its respective parameter.
Args:
input_filepath (str): Path to the input folder.
params_data (dict): Dictionary containing parameters.
para (dict): Dictionary to store input data of parameters.
Expand Down Expand Up @@ -128,8 +131,8 @@ def load_data(params_data, input_filepath):
Loads data from provided file path and processes it according to parameters from params.json.
Args:
params_data (dict): Dictionary of parameters data.
input_filename (str): Name of input folder.
params_filename (str): Name of parameters file containing attributes of input data.
Returns:
dict: Dictionary containing processed parameters.
Expand Down
1 change: 0 additions & 1 deletion prepshot/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ def parse_arguments(params_list):
parser = argparse.ArgumentParser(description='filename')
for param in params_list:
parser.add_argument(f'--{param}', type=str, default=None, help=f'The suffix of input paramemeters: {param}')
parser.add_argument(f'--price', type=float, default=0.01, help='The value of price paramemeters')
return parser.parse_args()
1 change: 0 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def setup(params_data, args):
# Load configuration data
config_data = load_json(CONFIG_FILENAME)
required_config_data = get_required_config_data(config_data)
required_config_data.update({'price': args.price})

# Get the path to input folder.
filepath = path.dirname(path.abspath(__file__))
Expand Down

0 comments on commit 0ff8731

Please sign in to comment.