From 78d68403ef9f7f954a0289c38bfee2cd7d496aef Mon Sep 17 00:00:00 2001 From: Mathias157 Date: Tue, 24 Sep 2024 12:11:31 +0200 Subject: [PATCH] Started work on issue #12 by renaming the output .gdx file to %scenario_input_data.gdx instead of generic _gams_py_gdb0.gdx --- src/pybalmorel/classes.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pybalmorel/classes.py b/src/pybalmorel/classes.py index c635cc7..d7518ca 100644 --- a/src/pybalmorel/classes.py +++ b/src/pybalmorel/classes.py @@ -385,11 +385,15 @@ def load_incfiles(self, # Initialize GAMS Workspace ws = gams.GamsWorkspace(working_directory=model_folder) + # Set options + opt = ws.add_options() + opt.gdx = '%s_input_data.gdx'%scenario # Setting the output gdx name (note, could be overwritten by the cmd line options, which is intended) + # Load the GAMS model - model_db = ws.add_job_from_file(os.path.join(model_folder, read_file)) + model_db = ws.add_job_from_file(os.path.join(model_folder, read_file), job_name=scenario) # Run the GAMS file - model_db.run() + model_db.run(opt) # Store the database (will take some minutes) self.input_data[scenario] = model_db.get_out_db()