Commit cf0e032d authored by Juha Kiviluoma's avatar Juha Kiviluoma
Browse files

First working commit for the new inputs and outputs system. Probably buggy......

First working commit for the new inputs and outputs system. Probably buggy... In Google Drive there is 8unit system excel that works with this (vInputOutput.xlsx).
parent f4f8bcb4
......@@ -17,12 +17,10 @@ loop(unit${r_invest(unit)},
tmp = round(r_invest(unit), 0)
put "p_unit('", unit.tl, "', 'unitCount') = p_unit('", unit.tl, "', 'unitCount') + ", tmp, ";"/;
);
* Update maxGen and maxCons values in the child setups
* Update capacity values in the child setups
loop(gnu(grid, node, unit)${r_invest(unit)},
tmp = round(r_invest(unit), 0) * p_gnu(grid, node, unit, 'unitSizeGen');
put "p_gnu('", grid.tl, "', '", node.tl, "', '", unit.tl, "', 'maxGen') = p_gnu('", grid.tl, "', '", node.tl, "', '", unit.tl, "', 'maxGen') + ", tmp, ";"/;
tmp = round(r_invest(unit), 0) * p_gnu(grid, node, unit, 'unitSizeCons');
put "p_gnu('", grid.tl, "', '", node.tl, "', '", unit.tl, "', 'maxCons') = p_gnu('", grid.tl, "', '", node.tl, "', '", unit.tl, "', 'maxCons') + ", tmp, ";"/;
tmp = round(r_invest(unit), 0) * p_gnu(grid, node, unit, 'unitSize');
put "p_gnu('", grid.tl, "', '", node.tl, "', '", unit.tl, "', 'capacity') = p_gnu('", grid.tl, "', '", node.tl, "', '", unit.tl, "', 'capacity') + ", tmp, ";"/;
);
* Do not allow investments in the child setups (commented out at the moment)
......
......@@ -47,18 +47,17 @@ Model building /
* q_genRampChange
* q_rampUpLimit
* q_rampDownLimit
* q_outputRatioFixed
* q_outputRatioConstrained
q_conversionDirectInputOutput
* q_conversionSOS2InputIntermediate
* q_conversionSOS2Constraint
* q_conversionSOS2IntermediateOutput
* q_conversionIncHR
* q_conversionIncHRMaxGen
* q_conversionIncHRMaxOutput
* q_conversionIncHRBounds
* q_conversionIncHR_help1
* q_conversionIncHR_help2
* q_fuelUseLimit
* q_unitEqualityConstraint
* q_commodityUseLimit
// Energy Transfer
q_transfer
......
......@@ -47,18 +47,17 @@ Model invest /
q_rampDownLimit
q_rampUpDown
q_rampSlack
q_outputRatioFixed
q_outputRatioConstrained
q_conversionDirectInputOutput
q_conversionSOS2InputIntermediate
q_conversionSOS2Constraint
q_conversionSOS2IntermediateOutput
q_conversionIncHR
q_conversionIncHRMaxGen
q_conversionIncHRMaxOutput
q_conversionIncHRBounds
q_conversionIncHR_help1
q_conversionIncHR_help2
q_fuelUseLimit
q_unitEqualityConstraint
* q_commodityUseLimit
// Energy Transfer
q_transfer
......
......@@ -33,7 +33,7 @@ Model schedule /
q_maxDownwardOfflineReserve
q_maxUpward
q_maxUpwardOfflineReserve
* q_reserveProvision
q_reserveProvision
q_reserveProvisionOnline
q_startshut
q_startuptype
......@@ -41,24 +41,23 @@ Model schedule /
q_onlineOnStartUp
q_offlineAfterShutDown
q_onlineMinUptime
* q_onlineCyclic
* q_onlineCyclic
q_genRamp
q_rampUpLimit
q_rampDownLimit
q_rampUpDown
q_rampSlack
q_outputRatioFixed
q_outputRatioConstrained
q_conversionDirectInputOutput
q_conversionSOS2InputIntermediate
q_conversionSOS2Constraint
q_conversionSOS2IntermediateOutput
q_conversionIncHR
q_conversionIncHRMaxGen
q_conversionIncHRMaxOutput
q_conversionIncHRBounds
q_conversionIncHR_help1
q_conversionIncHR_help2
q_fuelUseLimit
* q_unitEqualityConstraint
* q_commodityUseLimit
// Energy Transfer
q_transfer
......@@ -66,8 +65,8 @@ Model schedule /
q_transferLeftwardLimit
q_resTransferLimitRightward
q_resTransferLimitLeftward
* q_reserveProvisionRightward
* q_reserveProvisionLeftward
q_reserveProvisionRightward
q_reserveProvisionLeftward
// State Variables
q_stateSlack
......@@ -80,7 +79,7 @@ Model schedule /
q_inertiaMin
q_instantaneousShareMax
q_constrainedOnlineMultiUnit
* q_capacityMargin
q_capacityMargin
* q_constrainedCapMultiUnit
* q_emissioncap
* q_energyShareMax
......
......@@ -130,7 +130,7 @@ if (mType('schedule'),
mTimeseries_loop_read('schedule', 'ts_cf') = no;
mTimeseries_loop_read('schedule', 'ts_reserveDemand') = no;
mTimeseries_loop_read('schedule', 'ts_node') = no;
mTimeseries_loop_read('schedule', 'ts_fuelPriceChange') = no;
mTimeseries_loop_read('schedule', 'ts_priceChange') = no;
mTimeseries_loop_read('schedule', 'ts_unavailability') = no;
// Define Realized and Central forecasts
......
......@@ -49,13 +49,12 @@ p_gnuReserves
p_gnPolicy
p_groupPolicy
p_groupPolicy3D
p_fuelEmission
p_uFuel
p_unitFuelEmissionCost
p_nEmission
p_unitEmissionCost
p_effUnit
p_effGroupUnit
p_uNonoperational
p_uStartup
p_uStartupfuel
p_u_maxOutputInLastRunUpInterval
p_u_runUpTimeIntervals
dt_toStartup
......@@ -74,7 +73,6 @@ v_gen_inc
v_genRamp
v_transfer
v_state
v_fuelUse
v_sos2
v_spill
v_online_LP
......@@ -123,18 +121,16 @@ v_help_inc
q_rampDownLimit
q_rampUpDown
q_rampSlack
q_outputRatioFixed
q_outputRatioConstrained
q_conversionDirectInputOutput
q_conversionSOS2InputIntermediate
q_conversionSOS2Constraint
q_conversionSOS2IntermediateOutput
q_conversionIncHR
q_conversionIncHRMaxGen
q_conversionIncHRMaxOutput
q_conversionIncHRBounds
q_conversionIncHR_help1
q_conversionIncHR_help2
q_fuelUseLimit
* q_commodityUseLimit
// Energy Transfer
q_transfer
......
......@@ -125,12 +125,22 @@ Sets
cc(counter) "Temporary subset of counter used for calculations"
// Directional Sets
input_output "Designating nodes as either inputs or outputs"
/ input, output /
up_down "Direction set used by some variables, e.g. reserve provisions and generation ramps"
/ up, down /
inc_dec "Increase or decrease in dummy, or slack variables"
/ increase, decrease /
min_max "Minimum and maximum"
/ min, max /
constraint "Possible names for constraints"
/ eq1*eq9, gt1*gt9, lt1*lt9 /
eq_constraint(constraint) "Equality constraints"
/ eq1*eq9 /
gt_constraint(constraint) "Greater than constraints"
/ gt1*gt9 /
lt_constraint(constraint) "Less than constraints"
/ lt1*lt9 /
* --- Model Feature Sets ------------------------------------------------------
......@@ -165,8 +175,8 @@ Sets
ts_cf
ts_reserveDemand
ts_node
ts_fuelPriceChange
ts_fuelPrice
ts_priceChange
ts_price
ts_unavailability
/
......@@ -205,6 +215,7 @@ Sets
* --- Parameter Data Related Sets ---------------------------------------------
param_gn "Possible parameters for grid, node" /
nodeBalance "A flag to decide whether node balance constraint is to be used"
selfDischargeLoss "Self discharge rate of the node (MW/[v_state])"
energyStoredPerUnitOfState "A possible unit conversion if v_state uses something else than MWh (MWh/[v_state])"
boundStart "A flag to bound the first t in the run using reference constant or time series"
......@@ -253,19 +264,15 @@ param_gnn "Set of possible data parameters for grid, node, node (nodal interconn
/
param_gnu "Set of possible data parameters for grid, node, unit" /
maxGen "Maximum output capacity (MW)"
maxCons "Maximum loading capacity (MW)"
capacity "Maximum capacity (MW)"
conversionCoeff "Coefficient for conversion equation (multiplies each input or output when summing v_gen from multiple inputs/outputs)"
useInitialGeneration "A flag to indicate whether to fix generation for the first time step (binary)"
initialGeneration "Initial generation/consumption of the unit in the first time step (MW)"
conversionFactor "Conversion factor for inputs or outputs (for changing the unit of measurement)"
doNotOutput "Flag for inputs that are not included in the output commodities"
cV "Reduction in primary output when increasing secondary output, e.g. reduction of electricity generation due to heat generation in extraction CHP (MWh_e/MWh_h)"
maxRampUp "Speed to ramp up (p.u./min)"
maxRampDown "Speed to ramp down (p.u./min)"
upperLimitCapacityRatio "Ratio of the upper limit of the node state and the unit capacity investment ([v_state]/MW)"
unitSizeGen "Output capacity of one subunit for integer investments (MW)"
unitSizeCons "Loading capacity of one subunit for integer investments (MW)"
unitSizeTot "Sum of output and loading capacity of one subunit (MW)"
unitSize "Input/Output capacity of one subunit for integer investments (MW)"
invCosts "Investment costs (EUR/MW)"
annuity "Investment annuity factor"
fomCosts "Fixed operation and maintenance costs (EUR/MW/a)"
......@@ -327,20 +334,18 @@ param_eff "Parameters used for unit efficiency approximations" /
slope "Heat rate parameter representing no-load fuel consumption"
/
param_fuel "Parameters for fuels" /
main "Main fuel of the unit - unless input fuels defined as grids"
startup "Startup fuel of the unit, if exists. Can be the same as main fuel - consumption using startupFuelCons"
param_constraint "Parameters for constraints" /
constant "Constant when binding inputs/outputs"
coefficient "Coefficient when binding inputs/outputs"
/
param_fuelPrice "Paramters for fuel prices" /
fuelPrice "Fuel price (EUR/MWh)"
useConstant "Flag to use constant data for fuels"
useTimeSeries "Flag to use time series form data for fuels"
param_price "Parameters for commodity prices" /
price "Commodity price (EUR/MWh)"
useConstant "Flag to use constant data for commodities"
useTimeSeries "Flag to use time series form data for commodities"
/
param_unitFuel "Parameters for fuel limits in units" /
maxFuelCons "Maximum absolute fuel consumption in a unit - not used for start-up fuels"
maxFuelFraction "Maximum share of a fuel in the consumption mix" //only for main fuels
param_unitStartupfuel "Parameters for startup fuel limits in units" /
fixedFuelFraction "Fixed share of a fuel in the consumption mix" //only for start-up fuels
/
......
......@@ -20,15 +20,15 @@ Sets
grid "Forms of energy endogenously presented in the model" / empty /
node "Nodes where different types of energy are converted"
* --- Fuels & resources -------------------------------------------------------
* --- Commodities & resources -------------------------------------------------------
emission "Emissions"
fuel "Fuels"
commodity(node) "Commodities that can be bought or sold exogenous to model"
flow "Flow based energy resources (time series)"
* --- Energy generation and consumption ---------------------------------------
unit "Set of generators, storages and loads"
unit_flow(unit) "Unit that depend directly on variable energy flows (RoR, solar PV, etc.)"
unit_fuel(unit) "Units using a commercial fuel"
unit_commodity(unit) "Units using an exogenous commodity with a price"
unit_fail(unit) "Units that might fail"
unit_minLoad(unit) "Units that have unit commitment restrictions (e.g. minimum power level)"
unit_online(unit) "Units that have an online variable in the first active effLevel"
......@@ -44,7 +44,7 @@ Sets
flowUnit(flow, *) "Units or storages linked to a certain energy flow time series"
unitUnittype(unit, *) "Link generation technologies to types"
unitStarttype(unit, starttype) "Units with special startup properties"
uFuel(unit, param_fuel, fuel) "Units linked with fuels"
un_commodity(unit, node) "Units linked with commodities"
unittype "Unit technology types"
unit_investLP(unit) "Units with continuous investments allowed"
unit_investMIP(unit) "Units with integer investments allowed"
......@@ -196,7 +196,7 @@ alias(op, op_, op__);
alias(hrop, hrop_, hrop__);
alias(eff, eff_, eff__);
alias(hr, hr_, hr__);
alias(fuel, fuel_);
alias(commodity, commodity_);
alias(effLevel, effLevel_);
alias(restype, restype_);
alias(group, group_);
......
......@@ -43,14 +43,17 @@ Scalars
firstResultsOutputSolve /1/;
;
* --- Power plant and fuel data -----------------------------------------------
* --- Power plant and commodity data -----------------------------------------------
Parameters
p_gn(grid, node, param_gn) "Properties for energy nodes"
p_gnBoundaryPropertiesForStates(grid, node, param_gnBoundaryTypes, param_gnBoundaryProperties) "Properties of different state boundaries and limits"
p_gnn(grid, node, node, param_gnn) "Data for interconnections between energy nodes"
p_gnu(grid, node, unit, param_gnu) "Unit data where energy type matters"
p_gnu_io(grid, node, unit, input_output, param_gnu) "Unit data where energy type matters"
p_gnuBoundaryProperties(grid, node, unit, slack, param_gnuBoundaryProperties) "Properties for unit boundaries where energy type matters"
p_unit(unit, param_unit) "Unit data where energy type does not matter"
p_unitConstraint(unit, constraint) "Constant for constraints (eq1-9, gt1-9, lt1-9) between inputs and outputs"
p_unitConstraintNode(unit, constraint, node) "Coefficients for constraints (eq1-9, gt1-9, lt1-9) between inputs and outputs"
p_gnReserves(grid, node, restype, *) "Data defining the reserve rules in each node"
p_groupReserves(group, restype, *) "Data defining the reserve rules in each node group"
p_groupReserves3D(group, restype, up_down, param_policy) "Reserve policy in each node group separately for each reserve type and direction"
......@@ -61,10 +64,11 @@ Parameters
p_gnPolicy(grid, node, param_policy, *) "Policy data for grid, node"
p_groupPolicy(group, param_policy) "Two-dimensional policy data for groups"
p_groupPolicy3D(group, param_policy, *) "Three-dimensional policy data for groups"
p_fuelPrice(fuel, param_fuelPrice) "Fuel price parameters"
p_fuelEmission(fuel, emission) "Fuel emission content"
p_uFuel(unit, param_fuel, fuel, param_unitFuel) "Parameters interacting between units and fuels"
p_unitFuelEmissionCost(unit, fuel, emission) "Emission costs for each unit, calculated from input data"
p_price(commodity, param_price) "Commodity price parameters"
p_nEmission(node, emission) "Emission contents"
p_uStartupfuel(unit, node, param_unitStartupfuel) "Parameters for startup fuels"
p_uStartupEmission(unit, starttype, emission) "Calculation for startup related emissions"
p_unitEmissionCost(unit, node, emission) "Emission costs for each unit, calculated from input data"
p_effUnit(effSelector, unit, effSelector, param_eff) "Data for piece-wise linear efficiency blocks"
p_effGroupUnit(effSelector, unit, param_eff) "Unit data specific to a efficiency group (e.g. left border of the unit)"
p_uNonoperational(unit, starttype, min_max) "Non-operational time after being shut down before start up"
......@@ -83,7 +87,7 @@ Parameters
p_uCounter_shutdownMax(unit, counter) "Maximum output for the time steps where the unit is being shut down from the minimum load (minimum output in the first interval) (p.u.)"
p_u_minRampSpeedInLastRunUpInterval(unit) "Minimum ramp speed in the last interval for the run-up to min. load (p.u./min)"
p_u_minRampSpeedInFirstShutdownInterval(unit) "Minimum ramp speed in the fist interval for the shutdown from min. load (p.u./min)"
// Time dependent unit & fuel parameters
// Time dependent unit & commodity parameters
ts_unit(unit, param_unit, f, t) "Time dependent unit data, where energy type doesn't matter"
ts_effUnit(effSelector, unit, effSelector, param_eff, f, t) "Time dependent data for piece-wise linear efficiency blocks"
ts_effGroupUnit(effSelector, unit, param_eff, f, t) "Time dependent efficiency group unit data"
......@@ -157,17 +161,17 @@ Parameters
ts_cf(flow, node, f, t) "Available capacity factor time series (p.u.)"
ts_reserveDemand(restype, up_down, group, f, t) "Reserve demand in region in the time step (MW)"
ts_node(grid, node, param_gnBoundaryTypes, f, t) "Fix the states of a node according to time-series form exogenous input ([v_state])"
ts_fuelPriceChange(fuel, t) "Initial fuel price and consequent changes in fuel price (EUR/MWh)"
ts_fuelPrice(fuel, t) "Fuel price time series (EUR/MWh)"
ts_priceChange(node, t) "Initial commodity price and consequent changes in commodity price (EUR/MWh)"
ts_price(node, t) "Commodity price time series (EUR/MWh)"
ts_unavailability(unit, t) "Unavailability of a unit in the time step (p.u.)"
// Aliases used in the equations after interval aggregation
// NOTE: Sample dimension has to be last because of the scenario reduction algorithm
ts_influx_(grid, node, s, f, t) "Mean external power inflow/outflow during a time step (MWh/h)"
ts_cf_(flow, node, s, f, t) "Mean available capacity factor time series (p.u.)"
ts_reserveDemand_(restype, up_down, group, f, t) "Mean reserve demand in region in the time step (MW)"
ts_node_(grid, node, param_gnBoundaryTypes, s, f, t) "Mean value of ts_node"
ts_fuelPrice_(fuel, t) "Mean fuel price time during time step (EUR/MWh)"
ts_vomCost_(grid, node, unit, t) "Calculated variable O&M cost that includes O&M cost, fuel cost and emission cost"
ts_startupCost_(unit, starttype, t) "Calculated variable startup cost that includes startup cost, fuel cost and emission cost"
// Aliases used for updating data in inputsLoop.gms
ts_unit_update(unit, param_unit, f, t)
......@@ -177,7 +181,7 @@ Parameters
ts_cf_update(flow, node, f, t)
ts_reserveDemand_update(restype, up_down, group, f, t)
ts_node_update(grid, node, param_gnBoundaryTypes, f, t)
ts_fuelPriceChange_update(fuel, t)
ts_priceChange_update(node, t)
ts_unavailability_update(unit, t)
// Help parameters for calculating smoothening of time series
......
......@@ -29,8 +29,8 @@ Parameters
// Unit Operational Cost Components
r_gnuVOMCost(grid, node, unit, f, t) "Variable O&M costs for energy outputs (MEUR)"
r_gnuTotalVOMCost(grid, node, unit) "Total gnu VOM costs over the simulation (MEUR)"
r_uFuelEmissionCost(fuel, unit, f, t) "Unit fuel & emission costs for normal operation (MEUR)"
r_uTotalFuelEmissionCost(fuel, unit) "Total unit fuel & emission costs over the simulation for normal operation (MEUR)"
r_uFuelEmissionCost(node, unit, f, t) "Unit fuel & emission costs for normal operation (MEUR)"
r_uTotalFuelEmissionCost(commodity, unit) "Total unit fuel & emission costs over the simulation for normal operation (MEUR)"
r_uStartupCost(unit, f, t) "Unit startup VOM, fuel, & emission costs (MEUR)"
r_uShutdownCost(unit, f, t) "Unit startup VOM, fuel, & emission costs (MEUR)"
r_uTotalStartupCost(unit) "Total unit startup costs over the simulation (MEUR)"
......@@ -88,13 +88,13 @@ Parameters
r_gen(grid, node, unit, f, t) "Energy generation for a unit (MW)"
// Fuel use results
r_fuelUse(fuel, unit, f, t) "Fuel use of units"
r_genFuel(grid, node, fuel, f, t) "Energy generation/consumption based on fuels / flows (MW)"
r_fuelUse(node, unit, f, t) "Fuel use of units"
r_genFuel(grid, node, commodity, f, t) "Energy generation/consumption based on fuels / flows (MW)"
r_genUnittype(grid, node, unittype, f, t) "Energy generation/consumption for each unittype (MW)"
r_gnTotalGenFuel(grid, node, fuel) "Total energy generation in gn per fuel over the simulation (MWh)"
r_gnTotalGenFuelShare(grid, node, fuel) "Total energy generation fuel consumption gn/g share"
r_gTotalGenFuel(grid, fuel) "Total energy generation in g per fuel over the simulation (MWh)"
r_totalGenFuel(fuel) "Total overall energy generation/consumption per fuel over the simulation (MWh)"
r_gnTotalGenFuel(grid, node, commodity) "Total energy generation in gn per fuel over the simulation (MWh)"
r_gnTotalGenFuelShare(grid, node, commodity) "Total energy generation fuel consumption gn/g share"
r_gTotalGenFuel(grid, commodity) "Total energy generation in g per fuel over the simulation (MWh)"
r_totalGenFuel(commodity) "Total overall energy generation/consumption per fuel over the simulation (MWh)"
// Interesting energy generation results
r_gnuTotalGen(grid, node, unit) "Total energy generation in gnu over the simulation (MWh)"
......
......@@ -28,16 +28,18 @@ $ifthen exist '%input_dir%/inputData.gdx'
$$loaddc unit
$$loaddc unitUnittype
$$loaddc unit_fail
$$loaddc fuel
$$loaddc commodity
$$loaddc unitUnitEffLevel
$$loaddc uFuel
$$loaddc un_commodity
$$loaddc effLevelGroupUnit
$$loaddc group
$$loaddc p_gn
$$loaddc p_gnn
$$loaddc p_gnu
$$loaddc p_gnu_io
$$loaddc p_gnuBoundaryProperties
$$loaddc p_unit
$$loaddc p_unitConstraint
$$loaddc p_unitConstraintNode
$$loaddc ts_unit
$$loaddc restype
$$loaddc restypeDirection
......@@ -51,15 +53,15 @@ $ifthen exist '%input_dir%/inputData.gdx'
$$loaddc ts_reserveDemand
$$loaddc p_gnBoundaryPropertiesForStates
$$loaddc p_gnPolicy
$$loaddc p_uFuel
$$loaddc p_uStartupfuel
$$loaddc flowUnit
$$loaddc gngnu_fixedOutputRatio
$$loaddc gngnu_constrainedOutputRatio
* $$loaddc gngnu_fixedOutputRatio
* $$loaddc gngnu_constrainedOutputRatio
$$loaddc emission
$$loaddc p_fuelEmission
$$loaddc p_nEmission
$$loaddc ts_cf
* $$loaddc p_fuelPrice // Disabled for convenience, see line 278-> ("Determine Fuel Price Representation")
$$loaddc ts_fuelPriceChange
* $$loaddc p_price // Disabled for convenience, see line 278-> ("Determine Fuel Price Representation")
$$loaddc ts_priceChange
$$loaddc ts_influx
$$loaddc ts_node
$$loaddc t_invest
......@@ -115,25 +117,29 @@ $offtext
* --- Generate Unit Related Sets ----------------------------------------------
p_gnu(grid, node, unit, param_gnu) = sum(input_output, p_gnu_io(grid, node, unit, input_output, param_gnu));
// Set of all existing gnu
gnu(grid, node, unit)${ not sameas(grid, 'empty')
and ( p_gnu(grid, node, unit, 'maxGen')
or p_gnu(grid, node, unit, 'maxCons')
or p_gnu(grid, node, unit, 'unitSizeGen')
or p_gnu(grid, node, unit, 'unitSizeCons')
and ( p_gnu(grid, node, unit, 'capacity')
or p_gnu(grid, node, unit, 'unitSize')
or p_gnu(grid, node, unit, 'conversionCoeff')
)
}
= yes;
// Reduce the grid dimension
nu(node, unit) = sum(grid, gnu(grid, node, unit));
//p_gnu(grid, node, unit, 'capacity')$(p_gnu(grid, node, unit, 'capacity') = 0) = inf;
// Separation of gnu into inputs and outputs
gnu_output(gnu(grid, node, unit))${ p_gnu(grid, node, unit, 'maxGen')
or p_gnu(grid, node, unit, 'unitSizeGen')
gnu_output(gnu(grid, node, unit))${ p_gnu_io(grid, node, unit, 'output', 'capacity')
or p_gnu_io(grid, node, unit, 'output', 'unitSize')
or p_gnu_io(grid, node, unit, 'output', 'conversionCoeff')
}
= yes;
gnu_input(gnu(grid, node, unit))${ p_gnu(grid, node, unit, 'maxCons')
or p_gnu(grid, node, unit, 'unitSizeCons')
gnu_input(gnu(grid, node, unit))${ p_gnu_io(grid, node, unit, 'input', 'capacity')
or p_gnu_io(grid, node, unit, 'input', 'unitSize')
or p_gnu_io(grid, node, unit, 'input', 'conversionCoeff')
}
= yes;
......@@ -149,10 +155,10 @@ unit_minload(unit)${ p_unit(unit, 'op00') > 0 // If the first defined operati
}
= yes;
// Units with flows/fuels
// Units with flows/commodities
unit_flow(unit)${ sum(flow, flowUnit(flow, unit)) }
= yes;
unit_fuel(unit)${ sum(fuel, uFuel(unit, 'main', fuel)) }
unit_commodity(unit)${ sum(node, un_commodity(unit, node)) }
= yes;
// Units with investment variables
......@@ -198,25 +204,17 @@ p_unit(unit, 'unitCount')${ not p_unit(unit, 'unitCount')
// By default add outputs in order to get the total capacity of the unit
p_unit(unit, 'outputCapacityTotal')${ not p_unit(unit, 'outputCapacityTotal') }
= sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'maxGen'));
= sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'capacity'));
p_unit(unit, 'unitOutputCapacityTotal')
= sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSizeGen'));
= sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSize'));
// Assume unit sizes based on given maximum capacity parameters and unit counts if able
p_gnu(gnu(grid, node, unit), 'unitSizeGen')
${ not p_gnu(grid, node, unit, 'unitSizeGen')
and p_gnu(grid, node, unit, 'maxGen')
and p_unit(unit, 'unitCount')
}
= p_gnu(grid, node, unit, 'maxGen') / p_unit(unit, 'unitCount'); // If maxGen and unitCount are given, calculate unitSizeGen based on them.
p_gnu(gnu(grid, node, unit), 'unitSizeCons')
${ not p_gnu(grid, node, unit, 'unitSizeCons')
and p_gnu(grid, node, unit, 'maxCons')
p_gnu(gnu(grid, node, unit), 'unitSize')
${ not p_gnu(grid, node, unit, 'unitSize')
and p_gnu(grid, node, unit, 'capacity')
and p_unit(unit, 'unitCount')
}
= p_gnu(grid, node, unit, 'maxCons') / p_unit(unit, 'unitCount'); // If maxCons and unitCount are given, calculate unitSizeCons based on them.
p_gnu(gnu(grid, node, unit), 'unitSizeTot')
= p_gnu(grid, node, unit, 'unitSizeGen') + p_gnu(grid, node, unit, 'unitSizeCons');
= p_gnu(grid, node, unit, 'capacity') / p_unit(unit, 'unitCount'); // If capacity and unitCount are given, calculate unitSize based on them.
// Determine unit startup parameters based on data
// Hot startup parameters
......@@ -226,10 +224,10 @@ p_uNonoperational(unitStarttype(unit, 'hot'), 'max')
= p_unit(unit, 'startWarmAfterXhours');
p_uStartup(unitStarttype(unit, 'hot'), 'cost')
= p_unit(unit, 'startCostHot')
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSizeGen'));
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSize'));
p_uStartup(unitStarttype(unit, 'hot'), 'consumption')
= p_unit(unit, 'startFuelConsHot')
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSizeGen'));
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSize'));
// Warm startup parameters
p_uNonoperational(unitStarttype(unit, 'warm'), 'min')
......@@ -238,70 +236,68 @@ p_uNonoperational(unitStarttype(unit, 'warm'), 'max')
= p_unit(unit, 'startColdAfterXhours');
p_uStartup(unitStarttype(unit, 'warm'), 'cost')
= p_unit(unit, 'startCostWarm')
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSizeGen'));
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSize'));
p_uStartup(unitStarttype(unit, 'warm'), 'consumption')
= p_unit(unit, 'startFuelConsWarm')
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSizeGen'));
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSize'));
// Cold startup parameters
p_uNonoperational(unitStarttype(unit, 'cold'), 'min')
= p_unit(unit, 'startColdAfterXhours');
p_uStartup(unit, 'cold', 'cost')
= p_unit(unit, 'startCostCold')
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSizeGen'));
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSize'));
p_uStartup(unit, 'cold', 'consumption')
= p_unit(unit, 'startFuelConsCold')
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSizeGen'));
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSize'));
//shutdown cost parameters
p_uShutdown(unit, 'cost')
= p_unit(unit, 'shutdownCost')
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSizeGen'));
* sum(gnu_output(grid, node, unit), p_gnu(grid, node, unit, 'unitSize'));
// Determine unit emission costs
p_unitFuelEmissionCost(unit_fuel, fuel, emission)${ sum(param_fuel, uFuel(unit_fuel, param_fuel, fuel)) }
= p_fuelEmission(fuel, emission)
p_unitEmissionCost(unit, node, emission)${nu(node, unit) and p_nEmission(node, emission)}
= p_nEmission(node, emission)
/ 1e3 // NOTE!!! Conversion to t/MWh from kg/MWh in data
* sum(gnu_output(grid, node, unit_fuel),
+ p_gnPolicy(grid, node, 'emissionTax', emission) // Weighted average of emission costs from different output energy types
* [ + p_gnu(grid, node, unit_fuel, 'maxGen')
+ p_gnu(grid, node, unit_fuel, 'unitSizeGen')${not p_gnu(grid, node, unit_fuel, 'maxGen')}
] // END * p_gnPolicy
) // END sum(gnu_output)
/ sum(gnu_output(grid, node, unit_fuel), // Weighted average of emission costs from different output energy types
+ p_gnu(grid, node, unit_fuel, 'maxGen')
+ p_gnu(grid, node, unit_fuel, 'unitSizeGen')$(not p_gnu(grid, node, unit_fuel, 'maxGen'))
) // END sum(gnu_output)
* sum(gnu_output(grid, node, unit_commodity),
+ p_gnPolicy(grid, node, 'emissionTax', emission)
)
;
// If the start-up fuel fraction is not defined, it equals 1
p_uFuel(uFuel(unit_fuel, 'startup', fuel), 'fixedFuelFraction')${ not p_uFuel(unit_fuel, 'startup', fuel, 'fixedFuelFraction') }
p_uStartupfuel(unit, commodity, 'fixedFuelFraction')${ ( p_unit(unit, 'startFuelConsHot')
or p_unit(unit, 'startFuelConsWarm')
or p_unit(unit, 'startFuelConsCold')
)
and un_commodity(unit, commodity)
and not p_uStartupfuel(unit, commodity, 'fixedFuelFraction')
}
= 1;
* =============================================================================
* --- Determine Fuel Price Representation -------------------------------------
* --- Determine Commodity Price Representation -------------------------------------
* =============================================================================
// Use either constant or time series for fuel prices depending on 'ts_fuelPriceChange'
// Should be handled separately by 'p_fuelPrice' also being included in the input data,
// but this is more convenient for now as no changes to inputs are required
// Use time series for commodity prices depending on 'ts_priceChange'
// Determine if fuel prices require a time series representation or not
loop(fuel,
// Determine if commodity prices require a time series representation or not
loop(commodity,
// Find the steps with changing fuel prices
option clear = tt;
tt(t)${ ts_fuelPriceChange(fuel, t) } = yes;
tt(t)${ ts_priceChange(commodity, t) } = yes;
// If only up to a single value
if(sum(tt, 1) <= 1,
p_fuelPrice(fuel, 'useConstant') = 1; // Use a constant for fuel prices
p_fuelPrice(fuel, 'fuelPrice') = sum(tt, ts_fuelpriceChange(fuel, tt)) // Determine the price as the only value in the time series
p_price(commodity, 'useConstant') = 1; // Use a constant for commodity prices
p_price(commodity, 'price') = sum(tt, ts_priceChange(commodity, tt)) // Determine the price as the only value in the time series
// If multiple values found, use time series
else
p_fuelPrice(fuel, 'useTimeSeries') = 1;
p_price(commodity, 'useTimeSeries') = 1;
); // END if(sum(tt))
); // END loop(fuel)
* =============================================================================
* --- Generate Node Related Sets Based on Input Data --------------------------
* =============================================================================
......@@ -559,21 +555,21 @@ loop( unit,
); // END loop(effLevelGroupUnit)
);
* --- Check fuel fraction related data ----------------------------------------
* --- Check startupfuel fraction related data ----------------------------------------
loop( unit_fuel(unit)${sum(fuel, uFuel(unit_fuel, 'startup', fuel))},
if(sum(fuel, p_uFuel(unit, 'startup', fuel, 'fixedFuelFraction')) <> 1,