Commit 0120e11f authored by Juha Kiviluoma's avatar Juha Kiviluoma
Browse files

Merge branch 'variable_input_file' into 'dev'

command line argument for variable input file name and location

See merge request !16
parents 13471bd4 2c7ecb83
......@@ -56,6 +56,16 @@ GAMS command line arguments
--input_dir=<path>
Directory to read input from. Defaults to './input'.
--input_file_gdx=<filename.gdx>
Filename of the GDX input file. Defaults to 'inputData.gdx'.
--input_file_gdx=<path> including the filename also works.
--input_file_excel=<path>
Filename of the Excel input file including the path.
When using this, make sure you have created 1_input_preparation.gms in the
input directory and included the necessary lines there. See example from
1_input_preparation_temp.gms.
--output_dir=<path>
Directory to write output to. Defaults to './output'.
......@@ -81,9 +91,14 @@ $ife %system.gamsversion%<240 $abort GAMS distribution 24.0 or later required!
* Set default debugging level
$if not set debug $setglobal debug 0
* Default values for input and output dir
* Default values for input and output dir as well as input data GDX file and index sheet when importing data from Excel file
* When reading an Excel file, you can opt to read the file only if the Gdxxrw detects changes by using 'checkDate' for
* input_excel_checkdate. It is off by default, since there has been some problems with it.
$if not set input_dir $setglobal input_dir 'input'
$if not set output_dir $setglobal output_dir 'output'
$if not set input_data_gdx $setglobal input_data_gdx 'inputData.gdx'
$if not set input_excel_index $setglobal input_excel_index 'INDEX'
$if not set input_excel_checkdate $setglobal input_excel_checkdate ''
* Make sure output dir exists
$if not dexist %output_dir% $call 'mkdir %output_dir%'
......@@ -96,8 +111,10 @@ $onempty // Allow empty data definitions
* Output file streams
Files log /''/, gdx /''/, f_info /'%output_dir%/info.txt'/;
* Include options file to control the solver
$include '%input_dir%/1_options.gms';
* Include options file to control the solver (if it does not exist, uses defaults)
$ifthen exist '%input_dir%/1_options.gms'
$$include '%input_dir%/1_options.gms';
$endif
* === Libraries ===============================================================
$libinclude scenred2
......
......@@ -19,66 +19,79 @@ $offtext
* --- Load Input Data ---------------------------------------------------------
* =============================================================================
$ifthen exist '%input_dir%/inputData.gdx'
* If input_file excel has been set in the command line arguments, then Gdxxrw will be run to convert the Excel into a GDX file
* using the sheet defined by input_excel_index command line argument (default: 'INDEX').
$if set input_file_excel $call 'gdxxrw Input="%input_dir%/%input_file_excel%" Output="%input_dir%/%input_data_gdx%" Index=%input_excel_index%! %input_excel_checkdate%'
$ife %system.errorlevel%>0 $abort gdxxrw failed!
* --input_file_gdx=nameOfInputFile.gdx for input_file_gdx in input_dir
$ifthen exist '%input_dir%/%input_file_gdx%'
$$gdxin '%input_dir%/%input_file_gdx%'
* --input_file_gdx=ABSOLUTE/PATH/nameOfInputFile.gdx for input_file_gdx not in input_dir
$elseif exist '%input_file_gdx%'
$$gdxin '%input_file_gdx%'
* default, e.g. for using --input_file_excel and gdxxrw
$elseif exist '%input_dir%/inputData.gdx'
$$gdxin '%input_dir%/inputData.gdx'
$$loaddcm grid
$$loaddc node
$$loaddc flow
$$loaddc unittype
$$loaddc unit
$$loaddc unitUnittype
$$loaddc unit_fail
$$loaddc commodity
$$loaddc unitUnitEffLevel
$$loaddc effLevelGroupUnit
$$loaddc group
$$loaddc p_gn
$$loaddc p_gnn
$$loaddc p_gnu_io
$$loaddc p_gnuBoundaryProperties
$$loaddc p_unit
$$loaddc ts_unit
$$loaddc p_unitConstraint
$$loaddc p_unitConstraintNode
$$loaddc restype
$$loaddc restypeDirection
$$loaddc restypeReleasedForRealization
$$loaddc restype_inertia
$$loaddc p_groupReserves
$$loaddc p_groupReserves3D
$$loaddc p_groupReserves4D
$$loaddc p_gnuReserves
$$loaddc p_gnnReserves
$$loaddc p_gnuRes2Res
$$loaddc ts_reserveDemand
$$loaddc p_gnBoundaryPropertiesForStates
$$loaddc p_uStartupfuel
$$loaddc flowUnit
$$loaddc emission
$$loaddc p_nEmission
$$loaddc ts_cf
* $$loaddc p_price // Disabled for convenience, see line 278-> ("Determine Fuel Price Representation")
$$loaddc ts_priceChange
$$loaddc ts_influx
$$loaddc ts_node
$$loaddc p_s_discountFactor
$$loaddc t_invest
$$loaddc utAvailabilityLimits
$$loaddc p_storageValue
$$loaddc ts_storageValue
$$loaddc uGroup
$$loaddc gnuGroup
$$loaddc gn2nGroup
$$loaddc gnGroup
$$loaddc sGroup
$$loaddc p_groupPolicy
$$loaddc p_groupPolicyUnit
$$loaddc p_groupPolicyEmission
$$loaddc gnss_bound
$$loaddc uss_bound
$$gdxin
$endif
$$loaddcm grid
$$loaddc node
$$loaddc flow
$$loaddc unittype
$$loaddc unit
$$loaddc unitUnittype
$$loaddc unit_fail
$$loaddc commodity
$$loaddc unitUnitEffLevel
$$loaddc effLevelGroupUnit
$$loaddc group
$$loaddc p_gn
$$loaddc p_gnn
$$loaddc p_gnu_io
$$loaddc p_gnuBoundaryProperties
$$loaddc p_unit
$$loaddc ts_unit
$$loaddc p_unitConstraint
$$loaddc p_unitConstraintNode
$$loaddc restype
$$loaddc restypeDirection
$$loaddc restypeReleasedForRealization
$$loaddc restype_inertia
$$loaddc p_groupReserves
$$loaddc p_groupReserves3D
$$loaddc p_groupReserves4D
$$loaddc p_gnuReserves
$$loaddc p_gnnReserves
$$loaddc p_gnuRes2Res
$$loaddc ts_reserveDemand
$$loaddc p_gnBoundaryPropertiesForStates
$$loaddc p_uStartupfuel
$$loaddc flowUnit
$$loaddc emission
$$loaddc p_nEmission
$$loaddc ts_cf
*$$loaddc p_price // Disabled for convenience, see line 278-> ("Determine Fuel Price Representation")
$$loaddc ts_priceChange
$$loaddc ts_influx
$$loaddc ts_node
$$loaddc p_s_discountFactor
$$loaddc t_invest
$$loaddc utAvailabilityLimits
$$loaddc p_storageValue
$$loaddc ts_storageValue
$$loaddc uGroup
$$loaddc gnuGroup
$$loaddc gn2nGroup
$$loaddc gnGroup
$$loaddc sGroup
$$loaddc p_groupPolicy
$$loaddc p_groupPolicyUnit
$$loaddc p_groupPolicyEmission
$$loaddc gnss_bound
$$loaddc uss_bound
$$gdxin
* Read changes to inputdata through gdx files (e.g. node2.gdx, unit2.gdx, unit3.gdx) - allows scenarios through Sceleton Titan Excel files.
$include 'inc/1e_scenChanges.gms'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment