88
GAMS hands-on exercises Energy demand module July 2019, Ankara – Turkey

GAMS hands-on exercises

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: GAMS hands-on exercises

GAMS hands-on exercisesEnergy demand module

July 2019, Ankara – Turkey

Page 2: GAMS hands-on exercises

Energy demand hands-on exercise – transport sector

Page 3: GAMS hands-on exercises

Basic principles

• Energy commodities are used for obtaining useful services from energy. Energy demand corresponds to the demand of all energy commodities:

• Electricity• Natural gas• Byproducts of oil• Biomass

• Industry• Households• Services• Transport

Used in

• Demand for energy is therefore derived from the overall behaviour of the individual or the enterprise. • Individuals maximize their utility under a budget constraint• Enterprises maximize profits under market constraints

• The transformation of energy into activity depends on the equipment. The equipment type defines the characteristics of energy consumption:• Energy intensity of the activity – how many KWh for one unit of product. Energy efficiency depends on

the equipment used • The fuel mix – the contribution of fuels into the equipment operation

Activities

Page 4: GAMS hands-on exercises

Basic principles

• Equipment choice is directly related to investment decisions. Apart from the operation of the already existing equipment, firms and individuals make decisions about the future. The agents make investments for covering the activity demand in the future.

• This implies that short term behaviour (with already existing equipment) and long term behaviour (with possibility to change technology and capital) differ.

Equipment in operation

New equipment

Coverage of activity demand:IndustryServicesHouseholdsTransport

Investment

Existing equipment

Input fuels

Transformation to activity

Choice

Choice

Choice

Page 5: GAMS hands-on exercises

Model taxonomy

•Analytical decomposition of demand (tree)

•Engineering relations at each step

•Explicit representation of technologies

Bottom-up engineering-type

•Reduced - form relationships linking drivers with energy demand

•No engineering relations

•Statistically estimated coefficients of the relationship

Top-down econometric type

•Microeconomic behaviour is represented analytically

•Engineering relations and explicit technologies are represented at certain steps of the behaviour

•Energy demand is linked with non energy decisions

Hybrid approach microeconomic

foundation

Page 6: GAMS hands-on exercises

EST demand module

• The demand module of EST belongs to the classification of hybrid models. Energy decisions are based on microeconomic foundations.

• Detailed representation of activities in industrial, transport and tertiary sectors.

The model chooses:• The optimum mix of new investments• The optimum mix of equipment in operation• The fuels used in each type of equipment• The model allows for options like agent heterogeneity and hidden costs

Attention: • Choices are made under the principle of imperfect substitution. The least expensive option will not totally

prevail over the most expensive ones.• This is contrasted to linear programming problem. In their case, the cheapest resource is used until its

exhaustion.

Page 7: GAMS hands-on exercises

Nesting Decisions

• Target: cover the demand of a specified activity(e.g. transport sector). • Activity demand is exogenous to the model. It is estimated econometrically or it is obtained by

macroeconomic models that project sectoral activity • Energy related decisions are made in discrete nodes over a nesting tree.

➢ In passenger transport sector, the model tries to meet the demand for passenger kilometers.➢ The choices are made in discrete steps:

1. Public transport vs private transport2. Private Car vs Motorbike3. Conventional vs electric car4.Conventional gasoline vs conventional diesel

Page 8: GAMS hands-on exercises

Nesting Decisions

Demand for passenger kilometers

Land Water transport

Passenger Private

Passenger Public

Rail passenger

Inland navigation

Low level of substitution between choices

2 wheelers

Public Road transport

Metro

Fast rail

Slow rail

Passenger water

Passenger Cars

Internal Comb. Engine Cars

Electric Cars

Plug-in Hybrid Cars

H2 CarsHigh level ofsubstitution between choices

High level of substitution between choices

ICE gasoline

ICE diesel

ICE gas

Page 9: GAMS hands-on exercises

Energy demand exercise for the transport sector

2015 2020 2025 2030 2035 2040 2045 2050

Activity for passenger cars Mpkm 199,884 234,000 266,000 302,000 341,000 396,000 455,000 522,000

Increasing activity demand for passenger cars has to be served in 5 year steps, until the year 2050.

Three vehicle types are candidates for servicing the activity:

• Internal Combustion Engine cars. Fuel: Gasoline

• Electric cars. Fuel: Electricity

• Plugin Hybrid cars. Fuel: 80% Gasoline, 20% Electricity

Activity for passenger cars

The problem: • satisfy the increasing demand for transportation in the sub-sector of private cars

until the year 2050.• Calculate the final energy consumption for the fuels used.

Page 10: GAMS hands-on exercises

A simplified decision tree

Demand for passenger kilometers for private cars

Private Cars

Internal Combustion Engine

Electric

Plugin Hybrid

Gasoline

Gasoline 80%

Electricity

Electricity 20%

Substitution on technologies

No substitution on fuels in this example

• The three passenger car technologies are substitutable.

• On this example, no fuel substitution is assumed given the choice of the equipment

Page 11: GAMS hands-on exercises

Before proceeding: decision making

• In this exercise, two decisions are made on the same time:➢ The investment in new vehicles. The decision is based on the long term unit cost, which

accommodates investment and operational expenses.➢ The mix of vehicles in operation which cover the activity demand for all the years of the projection.

The choice of operation takes into account only the short term vehicle cost.

• However, the model should not choose just the least expensive vehicle option, as in case of linear programming. Instead, a pattern of imperfect substitution between choices must be followed.

How should we model decisions for firms and individuals?

The theory of discrete choice provides a useful framework for modelling decision making.

Page 12: GAMS hands-on exercises

The theory of discrete choice

The theory of discrete choice was developed during the 1970s and focused on the analysis of the consumerbehavior. Daniel McFaden won the Nobel prize in Economic Sciences in 2000 for his pioneering work in developingthe theoretical basis for discrete choice.

• Discrete choice models describe the selection process between two or more alternatives.• In contrast to continuous models, the choices have to be discrete. Eventually, the consumer chooses only

one of its alternatives.

Continuous choice models

Discrete Choice models

Problem definitionHow much of each

alternative?Which one of the

alternatives?

• A discrete choice problem for an individual: Choosing which car to buy. Alternatives:1. Conventional car2. Electric car3. Plug-in hybrid

Page 13: GAMS hands-on exercises

The theory of discrete choice

• The choice is not stochastic, but deterministic. If all information and decision criteria were available, we would be able to define the choice without uncertainty.

1. Conventional car2. Electric car3. Plug-in hybrid

• However, due to the lack of specific information, discrete choice models rely on the use of stochastic assumptions in order to incorporate:

1. Preferences that vary between by agents or time2. Unobserved factors that affect the selection decision

• For the “which car to buy” problem, the result would eventually be:1. Conventional car – 80%2. Electric car – 10%3. Plug-in hybrid – 10%

Page 14: GAMS hands-on exercises

The mathematics behind discrete choice

Starting point: the choice of one individual• Number of choices: N• Choices: 𝐴1, 𝐴2, 𝐴3, … . 𝐴𝑁

Each choice offers the individual a specific amount of utility U :• Choice 𝐴1 : 𝑈1 = 𝑉1 + ε1

• Choice 𝐴2 : 𝑈2 = 𝑉2 + ε2

........• Choice 𝐴Ν : 𝑈Ν = 𝑉Ν + εΝ

Utility related to observed factors(cost, time etc.)

Utility represented by unobserved factors. It is represented by a variable that follows a specific distribution

Page 15: GAMS hands-on exercises

Assume that only two choices were available:

• Choice 𝐴1 : 𝑈1 = 𝑉1 + ε1

• Choice 𝐴2 : 𝑈2 = 𝑉2 + ε2

The individual will choose the choice 𝐴1 if:

𝑈1 > 𝑈2

𝑉1 + 𝜀1> 𝑉2 + ε2

As 𝜀1, 𝜀2 are not directly observable, but follow a specific distribution, the probability of choice 𝐴1 over the choice 𝐴2 is defined:

𝑃𝐴1= 𝑃𝑟𝑜𝑏{𝑉1 + 𝜀1> 𝑉2 + 𝜀2}= 𝑃𝑟𝑜𝑏{𝜀1> 𝑉2 + 𝜀2 − 𝑉1}

The mathematics behind discrete choice

Page 16: GAMS hands-on exercises

The probabilities 𝑃𝐴1 and 𝑃𝐴2 can be calculated under specific assumptions for the distribution of the variables 𝜀1 and 𝜀2 . In our case, the assumptions are:• 𝜀1 and 𝜀2 follow the same distribution, the same variance and zero mean• the distributions between 𝜀1 and 𝜀2 are independent from each other

Distribution

Gumbel

𝐶𝐷𝐹: 𝐹 𝑥 = 𝑒−𝑒−𝑥

𝑃𝐷𝐹: 𝑓 𝑥 = 𝑒−𝑥 ⋅ 𝑒−𝑒−𝑥Normal

Model type Logit Probit

Commonly used distributions in discrete choice models

The mathematics behind discrete choice

Page 17: GAMS hands-on exercises

• In case of multiple choices {𝐴1, 𝐴2 … . 𝐴𝑁} , the probability of choosing 𝐴1 over the other options is taken as:

𝑃𝐴1 =𝑒𝑉1

𝑗=1

𝑁𝑒𝑉𝑗

By using the same formula, the probabilities {𝑃𝛢1, 𝑃𝛢2 … . 𝑃𝛢𝛮} of choosing all options can be calculated.

• It can be seen, that in case of a logit model, the probability of choosing 𝐴1 over 𝐴2 is:

𝑃𝐴1 =𝑒𝛽·𝑉1

𝑒𝛽·𝑉1 + 𝑒𝛽·𝑉2

,where β a parameter related to the standard deviation σ of the distribution. It is conventionally set equal to unity.

The mathematics behind discrete choice

Page 18: GAMS hands-on exercises

Choices for many individuals

Each individual evaluates the options with different weights or criteria:

• Choice 𝐴1 : 𝑈11 = 𝑉11 + ε1

• Choice 𝐴2 : 𝑈12 = 𝑉12 + ε2

Individual 1:

Individual 2:

• Choice 𝐴1 : 𝑈21 = 𝑉21 + ε1

• Choice 𝐴2 : 𝑈22 = 𝑉22 + ε2

Individual N:

• Choice 𝐴1 : 𝑈𝑁1 = 𝑉𝑁1 + ε1

• Choice 𝐴2 : 𝑈𝑁2 = 𝑉𝑁2 + ε2

………

As the utilities for each choice differ the logit functions estimate different probabilities for each individual.

Page 19: GAMS hands-on exercises

Aggregation of individual choices

The simplest method of aggregating separate individual choices is to use the average utility by each choice

Representative Individual:

• Choice 𝐴1 : 𝑈1 = ത𝑉1 + ε1

• Choice 𝐴2 : 𝑈2 = ത𝑉2 + ε2

• Probability 𝑃𝐴1 =𝑒 ഥ𝑉1

𝑒 ഥ𝑉1 + 𝑒 ഥ𝑉2

With this approximation, the probabilities can be interpreted as the shares of each choice in the population examined.

Page 20: GAMS hands-on exercises

Aggregation of individual choices

Another method is to separate individuals in groups according to their characteristics. On the “which car to buy” problem this grouping can be done based on income.

{𝑃𝐴1,𝑖𝑛𝑐1, 𝑃𝐴1,𝑖𝑛𝑐2, 𝑃𝐴1,𝑖𝑛𝑐3, 𝑃𝐴1,𝑖𝑛𝑐4

, 𝑃𝐴1,𝑖𝑛𝑐5}

These probabilities can be used for the calculation of choice shares in total population:

The logit model calculates the probabilities for choosing 𝐴1 for each income category:

𝑆𝐻𝐴1 =1

𝑁·

1

5

𝑃𝐴1,𝐼𝑁𝐶𝑖· 𝑁𝑖

where:𝑆𝐻𝐴1: the share of choice A1, among other choices in total population𝑁 : population𝑁𝑖: the size of each population group

Page 21: GAMS hands-on exercises

Discrete choice in practice…

• In EST the logit function is the main mechanism for decision making.• The observed parameter that is included in the utility function is the cost of the choice either long-term or

short-term.• In this case, cost has a negative effect on utility. This is the reason why it is seen with a negative sign:

𝑈𝑗 = −𝛾 ∙ 𝑝𝑗 + 𝜀𝑗

where:𝑈𝑗: the utility from choice j𝛾 : the sensitivity of utility to price changes𝑝𝑗: the unit cost of choice j

• The probability or the share of the choice among N discrete options can be calculated as:

𝑆𝐻𝑗 =𝑒

−𝛾𝑝𝑗

𝑗=1

𝑁𝑒

−𝛾𝑝𝑗

Page 22: GAMS hands-on exercises

Back to the exercise…

2015 2020 2025 2030 2035 2040 2045 2050

Activity for passenger cars Mpkm 199,884 234,000 266,000 302,000 341,000 396,000 455,000 522,000

Increasing activity demand for passenger cars has to be served in 5 year steps, until the year 2050.

Three vehicle types are candidates for servicing the activity:

• Internal Combustion Engine cars. Fuel: Gasoline

• Electric cars. Fuel: Electricity

• Plugin Hybrid cars. Fuel: 80% Gasoline, 20% Electricity

Activity for passenger cars

The problem: • satisfy the increasing demand for transportation in the sub-sector of private cars

until the year 2050.• Calculate the final energy consumption for the fuels used.

Page 23: GAMS hands-on exercises

Problem data - equipment

• In order to solve this problem detailed data as well as future assumptions are required for passenger

cars: Unit 2015 2020 2025 2030 2035 2040 2045 2050

Capital cost

ICE USD/vehicle 22,016 21,641 21,337 21,139 21,027 20,970 20,942 20,928

Electric USD/vehicle 54,476 43,645 37,902 36,060 35,572 35,449 35,419 35,412

Plugin Hybrid USD/vehicle 33,667 28,886 26,351 25,538 25,322 25,268 25,255 25,252

mileage

ICE Km/year 12,000 12,000 12,000 12,000 12,000 12,000 12,000 12,000

Electric Km/year 12,000 12,000 12,000 12,000 12,000 12,000 12,000 12,000Plugin Hybrid Km/year 12,000 12,000 12,000 12,000 12,000 12,000 12,000 12,000

lifetime

ICE years 10 10 10 10 10 10 10 10

Electric years 10 10 10 10 10 10 10 10

Plugin Hybrid years 10 10 10 10 10 10 10 10

Data for passenger cars

• Capital cost is the cost of purchase of the car.• Mileage is the average kilometers travelled by each vehicle type• 10 years are assumed to be the typical lifetime of all vehicles

Page 24: GAMS hands-on exercises

Unit 2015 2020 2025 2030 2035 2040 2045 2050

occupancy ratio

ICE Km/year 1,73 1,73 1,73 1,73 1,73 1,73 1,73 1,73

Electric Km/year 1,54 1,54 1,54 1,54 1,54 1,54 1,54 1,54

Plugin Hybrid Km/year 1,54 1,54 1,54 1,54 1,54 1,54 1,54 1,54

consumption

ICE KWh/km 0,92 0,83 0,74 0,65 0,55 0,51 0,46 0,46

Electric KWh/km 0,41 0,38 0,35 0,31 0,28 0,27 0,25 0,25

Plugin Hybrid KWh/km 0,26 0,25 0,24 0,24 0,24 0,24 0,24 0,24

• Occupancy ratio refers to the average number of passengers per vehicle• Vehicle consumption is expressed in KWh of fuel required for travelling 1 kilometer.

Data for passenger cars

These data are necessary for the calculation of the unit cost of the passenger Km, for each vehicle type. The vehicle choices are going to be made under this comparison.

Problem data - equipment

𝑆𝑇𝐶𝑗 =𝑐𝑜𝑛𝑠𝑘𝑚𝑗 ∙ 𝑓𝑢𝑒𝑙𝑝𝑟𝑖𝑐𝑒

𝑜𝑐𝑐𝑢𝑝𝑎𝑛𝑐𝑦 𝑟𝑎𝑡𝑖𝑜𝑗

𝐿𝑇𝐶𝑗 = 𝑆𝑇𝐶𝑗+𝑎𝑛𝑛𝑢𝑎𝑙 𝑐𝑎𝑝𝑖𝑡𝑎𝑙 𝑐𝑜𝑠𝑡𝑗

𝑚𝑖𝑙𝑒𝑎𝑔𝑒𝑗∙𝑜𝑐𝑐𝑢𝑝𝑎𝑛𝑐𝑦 𝑟𝑎𝑡𝑖𝑜𝑗

Short term cost: dependent on operation Long term cost: dependent on operationand purchase of new equipment

Data for passenger cars

Page 25: GAMS hands-on exercises

Problem data - equipment

• On the year 2015, the activity of private cars was accounted to 199,884 Mpkm. It is assumed that

these were covered by a stock mix that includes mostly conventional cars(ICE), which main fuel is

gasoline.

Type unit 2005

ICE th.vehicles 7,215.97

Electric th.vehicles 900.98

Hybrid th.vehicles 1,801.96

Total th.vehicles 9,918.90

Passenger cars for 2015

All existing passenger cars are assumed to be

purchased on the year 2015. With a lifetime of

10 years, this means that the existing stock

should have been replaced by the year 2030.

• The annuity factor must be used for the calculation of the annual capital cost. The vehicles lifetime

and the interest rate are prerequisites for the calculation.

Interest rate 7.5%

Interest rate for passenger vehicles

Page 26: GAMS hands-on exercises

Problem data – fuels and others

Data for fuels are necessary for calculating fuel costs and CO2 emissions.

2015 2020 2025 2030 2035 2040 2045 2050

Fuel price Gasoline USD/KWh 0.168 0.192 0.194 0.196 0.197 0.199 0.200 0.201

Fuel price Electricity USD/KWh 0.143 0.158 0.162 0.164 0.166 0.164 0.166 0.170

Emissions Gasoline gr/KWh 249.2

Emissions Electricity gr/KWh -

Fuel data

Type Gasoline Electricity

Hybrid cars 80% 20%

Plug-in hybrid passenger cars are assumed to have a constant fuel mix throughout the period.

Fuel mix for hybrid vehicles

Page 27: GAMS hands-on exercises

Demand for passenger kilometers for private cars

Private Cars

Internal Combustion Engine

Electric

Plugin Hybrid

Gasoline

Gasoline 80%

Electricity

Electricity 20%

Substitution on technologies

No substitution on fuels in this example

• The three passenger car technologies are substitutable.

• On this example, no fuel substitution is assumed given the choice of the equipment

Solution strategy

Page 28: GAMS hands-on exercises

Solution strategy

• Vehicles are grouped by technology and purchase year.

• Transport activity is covered by vehicles of specific technology and vintage.

Example: Hybrid cars bought on 2030 contribute to the pkm demanded for 2035

• Imperfect substitutability is assumed among the available technologies(ICE, electric, hybrid).

Model structure:

• The mix of vehicles in operation by technology and vintage.

• The purchase of new vehicles by technology. The new vehicles are necessary for covering the

increasing demand for transport activity.

Decisions:

Page 29: GAMS hands-on exercises

Solution strategy - operation

Modelling tools:

• Logit functions for the share of existing vehicles in operation. The short term cost is used for the

operation decision.

• One average representative agent will be used. The calculated probabilities represent the technology

shares in total population.

• For every projection year, the shares of vehicles in operation are calculated:

𝑆𝐻_𝑂𝑃𝐸𝑅𝑡𝑒𝑐ℎ,𝑦𝑒𝑎𝑟 =𝑒

−𝛾𝑆𝑇𝐶𝑡𝑒𝑐ℎ,𝑦𝑒𝑎𝑟

𝑗=1

𝑁𝑒

−𝛾𝑆𝑇𝐶𝑡𝑒𝑐ℎ,𝑦𝑒𝑎𝑟

Share of vehicles in operation

The parameter γ reflects the price sensitivity over technology choice and has been set equal to 3.5

Page 30: GAMS hands-on exercises

• For every projection year, new and old vehicles compete for the coverage of demand for passenger

Kilometers.

• All vehicles have a lifetime of 10 years.

• However, there are no precise dates for the scrapping of old vehicles.

• A probability of survival is assumed with a 10 year lifetime as reference:

Vehicle probability of survival

For vehicles commissioned in the year 2015, on a 30% has survived 10 years later.Almost no vehicles survive by 2035.

Solution strategy – old vehicles

Page 31: GAMS hands-on exercises

Solution strategy – new vehicles

Modelling tools:

• Logit functions are used for the calculation of shares for new vehicles.

• First, technology shares under long term costs are calculated for every projection year.

𝑆𝐻_𝑁𝐸𝑊𝑡𝑒𝑐ℎ,𝑦𝑒𝑎𝑟 =𝑒

−𝛾𝐿𝑇𝐶𝑡𝑒𝑐ℎ,𝑦𝑒𝑎𝑟

𝑗=1

𝑁𝑒

−𝛾𝐿𝑇𝐶𝑡𝑒𝑐ℎ𝑦𝑒𝑎𝑟

• These shares are used to calculate the optimum vehicle mix that covers the transport activity, as if

there is no existing stock from previous years.

Optimum vehicle mix

• Then existing vehicles are subtracted from optimum vehicle mix. The difference gives the new

investments

𝐼𝑛𝑣𝑒𝑠𝑡𝑚𝑒𝑛𝑡𝑡𝑒𝑐ℎ,𝑦𝑒𝑎𝑟 = max(𝑜𝑝𝑡𝑖𝑚𝑢𝑚 𝑚𝑖𝑥𝑡𝑒𝑐ℎ,𝑦𝑒𝑎𝑟 − 𝑒𝑥𝑖𝑠𝑡𝑖𝑛𝑔 𝑠𝑡𝑜𝑐𝑘𝑡𝑒𝑐ℎ,𝑦𝑒𝑎𝑟 , 0)

Page 32: GAMS hands-on exercises

Solution strategy – method of solution

• The transport demand model is not an optimization problem, nor a linear problem.

• The methods of linear programming or non-linear programming cannot be used.

• It can be described with a set of linear and non linear equations.

• These include equalities, inequalities and dual variables.

• It can be written as a Mixed Complementarity Problem(MCP)

Page 33: GAMS hands-on exercises

Preparation

• Open the Project (.gpr) C:\EST_training_weekIII\energy_transport\model\energy demand.gpr

• Open the File (.gms) C:\EST_training_weekIII\ energy_transport\model\energy_transport.gms

• Part of the code has been already inserted.

• Go to the folder energy_transport→ Inputxls

• Open the Excel file elec_demand.xlsx

Page 34: GAMS hands-on exercises

The model – Sets definition

act: set that denotes economic activity. In this case it is filled only with the element

“PS_cars”

tech: vehicle technologies(ICE, electric, hybrid)

fuel: fuels used in vehicles

year: the projection year of the model

v: year of vehicle purchase or vintage

act_tech(act,tech): set that maps economic activity with technologies. In this case

“Ps_cars” is mapped with all technologies

tech_fuel(tech,fuel): set that maps technologies and fuels

PS_CARS ICE

PS_CARS Electric

PS_CARS Hybrid

ICE Gasoline

Electric Electric

Hybrid Gasoline

Hybrid Electric

Page 35: GAMS hands-on exercises

Parameters

capcost(tech,v): cost of buying a new car in USD

annuity_factor(tech,v): annuity factor

ann_capcost(tech,v): annual unit cost of car in USD

conskm(tech,v): fuel consumption in kWh per Km

gamma(act,year): sensitivity in price changes

fuel_share(tech,fuel): share of fuels in vehicle technology

mileage(tech,v): mileage per vehicle and vintage

activity(year): demand for transport activity in Mpkm

stock2015(act, tech): stock of vehicles by technology active on the year 2015

fuel_price(fuel,year): fuel price per year

Page 36: GAMS hands-on exercises

Parameters

LTC(act,tech,v,year): long term cost per pkm per technology

STC(act,tech,v,year) : short term cost per pkm per technology

r : interest rate for calculating the annual cost

lifetime(tech,v) : lifetime of vehicle in years

oc_ratio(tech,v) : occupancy ratio

surv_rate(tech,v,year): survival rate of equipment

em_fac(fuel): CO2 emission factor

Page 37: GAMS hands-on exercises

Variables

SH_NEW(act,tech,year): share of new technologies in current investments

STOCK(act,tech,v,year): vehicles per technology available every year

VEH_INV(act,tech,v) : investment per vehicle technoogy per year

SH_OPER(act,tech,v,year) : share of existing stock in operation

FINAL_ENERGY(act,tech,fuel,year) : final energy per fuel by vehicle technology

CAP_DESIRED(act,tech,year): capital stock desired – optimum stock

AVG_EMISSIONS(act,year): average CO2 emissions

R_LTC(act,tech,v,year) : long term cost including penalties

Page 38: GAMS hands-on exercises

Positive Variables

S_COST(act,tech,v,year): shadow cost due to insufficient capacity

CAP_GAP(act,tech,year): capital gap per technology

• The variable cap_gap denotes the difference between the optimum and the existing stock by vehicle technology.

• This variable will be used for the calculation of investments.

Page 39: GAMS hands-on exercises

Equations

𝑆𝑇𝑂𝐶𝐾(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟) = ቊ𝑠𝑡𝑜𝑐𝑘2015 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ ∙ 𝑠𝑢𝑟𝑣_𝑟𝑎𝑡𝑒(𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟), 𝑣 = 2015

𝐼𝑁𝑉 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣 ∙ 𝑠𝑢𝑟𝑣_𝑟𝑎𝑡𝑒 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟 𝑣 > 2015

Equations for vehicles available in every projection year

• The equation calculates the available stock for every projection year by technology an

technology and vintage.

𝑆𝑇𝑂𝐶𝐾(′𝑃𝑆_𝐶𝐴𝑅𝑆,′ 𝐻𝑦𝑏𝑟𝑖𝑑′, ′2020′,′ 2030′)

• Probability of no survival for old vehicles

The vehicles available for each technology refer either to the remaining stock from 2015 or to investments

made the subsequent years

Page 40: GAMS hands-on exercises

Equations

Equations for the share of vehicles under long term costs(v=year)

𝑆𝐻_𝑁𝐸𝑊(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟) =𝑒−𝛾 𝑎𝑐𝑡,𝑦𝑒𝑎𝑟 ∙𝐿𝑇𝐶(𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟)

𝑡𝑒𝑐ℎ

𝑒−𝛾(𝑎𝑐𝑡,𝑦𝑒𝑎𝑟)∙𝐿𝑇𝐶(𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟)

• The equation calculates the technology shares in the purchase of vehicles, if long term costs

are taken into account

• It corresponds to the optimum mix of vehicles, if there was no existing stock

Page 41: GAMS hands-on exercises

Equations

Equations for calculating the optimum vehicle mix

𝐶𝐴𝑃_𝐷𝐸𝑆𝐼𝑅𝐸𝐷(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟) =𝑆𝐻_𝑁𝐸𝑊(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟) ∙ 𝑎𝑐𝑡𝑖𝑣𝑖𝑡𝑦(𝑦𝑒𝑎𝑟) ∙ 1000

𝑜𝑐𝑐_𝑟𝑎𝑡𝑖𝑜(𝑡𝑒𝑐ℎ, 𝑣) ∙ 𝑚𝑖𝑙𝑒𝑎𝑔𝑒 𝑡𝑒𝑐ℎ, 𝑣

• Having already found the shares under long – term costs, the ideal vehicle mix can be calculated.

• It responds to the question: If none of the existing vehicles survived, which types of vehicles will be

chosen?

• The nominator denotes the activity by technology type.

• If divided by the occupancy ratio and the mileage, it gives the desired vehicles by technology.

• The number “1000” converts the Million vehicles into thousands.

If v maps projection year

Page 42: GAMS hands-on exercises

Equations

Equations for additional vehicles needed, for years greater than 2015

• The equation calculates the difference between the ideal technology mix and the total stock

of vehicles that is inherited from the past years.

• The subtracted component is the sum of the past year’s vehicles of all vintages that have

survived.

• The capital gap is calculated by technology.

• Example: CAP_DESIRED(PS_CARS,Electric,2020)=2,500 thousands(+)

Old_stock= 2,000 thousands (-)

New Electric vehicles=500 thousands (=)

𝐶𝐴𝑃_𝐺𝐴𝑃 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟 ≥ 𝐶𝐴𝑃_𝐷𝐸𝑆𝐼𝑅𝐸𝐷(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟) −

𝑣, 𝑖𝑓 𝑣<𝑦𝑒𝑎𝑟

𝑆𝑇𝑂𝐶𝐾(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟)

⏊𝐶𝐴𝑃_𝐺𝐴𝑃(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟)

Page 43: GAMS hands-on exercises

Equations

Equations for additional vehicles needed, for years greater than 2015

𝐶𝐴𝑃_𝐺𝐴𝑃 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟 ≥ 𝐶𝐴𝑃_𝐷𝐸𝑆𝐼𝑅𝐸𝐷(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟) −

𝑣, 𝑖𝑓 𝑣<𝑦𝑒𝑎𝑟

𝑆𝑇𝑂𝐶𝐾(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟)

⏊𝐶𝐴𝑃_𝐺𝐴𝑃(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟)

• The equation calculates the difference between the ideal technology mix and the total stock

of vehicles that is inherited from the past years.

• The subtracted component is the sum of the past year’s vehicles of all vintages that have

survived.

• The capital gap is calculated by technology.

• If the difference is negative, then no new vehicles are purchased(CAP_GAP equal to zero).

Page 44: GAMS hands-on exercises

Equations

Equations for the stock of new vehicles by vintage

𝑉𝐸𝐻_𝐼𝑁𝑉 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣 = 𝐶𝐴𝑃_𝐺𝐴𝑃(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟), if year maps v

• The equation transfers the capital gap by technology and year into vehicle investment.

• It is useful for keeping the annual purchases with a specific vintage v.

Page 45: GAMS hands-on exercises

Equations

Equations for the share of vehicles under short term costs

• Having decided the stock of available vehicles in a projection year, this equation chooses the

shares of vehicles in operation

• It is based on the comparison of the short-term costs of the technologies

• S_COST is represents a shadow cost which increases if there is not enough capacity for a

specific type of vehicles. It is an auxiliary variable that implements a capacity constraint.

𝑆𝐻_𝑂𝑃𝐸𝑅(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟) =𝑒−𝛾 𝑎𝑐𝑡,𝑦𝑒𝑎𝑟 ∙(𝑆𝑇𝐶 𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟 +𝑆_𝐶𝑂𝑆𝑇(𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟))

𝑡𝑒𝑐ℎ

𝑒−𝛾(𝑎𝑐𝑡,𝑦𝑒𝑎𝑟)∙(𝑆𝑇𝐶 𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟 +𝑆_𝐶𝑂𝑆𝑇(𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟))

Page 46: GAMS hands-on exercises

Equations

Equations for capacity constraints – vehicles in operation

• It represents the capacity constraint for each year of the projection.

• The total activity decided by technology is constrained by the number of vehicles in stock.

• The equation is associated with the dual variable S_COST.

• If the constraint is binding, S_COST increases until the constraint is met.

• If the constraint is not binding, S_COST equals to 0.

𝑆𝑇𝑂𝐶𝐾 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟 · 𝑜𝑐_𝑟𝑎𝑡𝑖𝑜 𝑡𝑒𝑐ℎ, 𝑣 ·𝑚𝑖𝑙𝑒𝑎𝑔𝑒 𝑡𝑒𝑐ℎ, 𝑣

1000≥𝑆𝐻_𝑂𝑃𝐸𝑅(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟) · 𝑎𝑐𝑡𝑖𝑣𝑖𝑡𝑦(𝑦𝑒𝑎𝑟), ⏊ 𝑆_𝐶𝑂𝑆𝑇(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟)

Page 47: GAMS hands-on exercises

Equations

Equations for calculating final energy

• Calculation of final energy by fuel and technology.

• Fuel shares are used in case of hybrid cars. Otherwise they are set equal to unity.

𝐹𝐼𝑁𝐴𝐿_𝐸𝑁𝐸𝑅𝐺𝑌 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑓𝑢𝑒𝑙, 𝑦𝑒𝑎𝑟=

𝑣

𝑖𝑓 𝑣≤𝑦𝑒𝑎𝑟

𝑆𝐻_𝑂𝑃𝐸𝑅(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟) · 𝑎𝑐𝑡𝑖𝑣𝑖𝑡𝑦(𝑦𝑒𝑎𝑟)/𝑜𝑐_𝑟𝑎𝑡𝑖𝑜(𝑡𝑒𝑐ℎ, 𝑣) · 𝑐𝑜𝑛𝑠𝑘𝑚(𝑡𝑒𝑐ℎ, 𝑣) · 𝑓𝑢𝑒𝑙_𝑠ℎ𝑎𝑟𝑒(𝑡𝑒𝑐ℎ, 𝑓𝑢𝑒𝑙)

Page 48: GAMS hands-on exercises

• The transport problem has been written with a set of equations, including equalities or inequalities.

• As it is not an optimization problem, there is not objective function in the equation set.

• It can be solved using Mixed Complementarity algorithms(MCP).

Mixed Complementarity Problem

Page 49: GAMS hands-on exercises

Mixed Complementarity Problem

Assume a continuously differentiable function 𝐹: R𝑛 → R𝑛 and lower and upper bounds 𝑙, 𝑢 .

The mixed complementarity problem is to find 𝑥 ∈ R𝑛 so that one of the following conditions holds for each 𝑖 ∈ 1, … , 𝑛 :

𝐹𝑖 𝑥 < 0 𝑎𝑛𝑑 𝑥𝑖 = 𝑙𝑖

𝐹𝑖 𝑥 = 0 𝑎𝑛𝑑 𝑙𝑖 < 𝑥𝑖 < 𝑢𝑖

𝐹𝑖 𝑥 > 0 𝑎𝑛𝑑 𝑥𝑖 = 𝑢𝑖

MCP associates the function 𝐹𝑖 𝑥 with a variable 𝑥𝑖 which has a lowerand an upper bound.𝐹𝑖 𝑥 is equal to zero, if 𝑥𝑖 is between the bounds.𝐹𝑖 𝑥 is negative if 𝑥𝑖 is on the lower bound and positive if 𝑥𝑖 is on theupper bound.

Source:http://www.recs-solver.org/MCP.html

Page 50: GAMS hands-on exercises

Mixed Complementarity Problem

Many problems can be written in MCP format. If the upper bound is set to +∞ and lower bound equal to zero the MCP form is reduced to:

−𝐹𝑖 𝑥 > 0 𝑎𝑛𝑑 𝑥𝑖 = 0

𝐹𝑖 𝑥 = 0 𝑎𝑛𝑑 𝑥𝑖 > 0

In addition, if the lower bound is equal to −∞, it is equivalent of solving a problem of square non-linear equations.

These two cases are used in the transport demand problem.

Page 51: GAMS hands-on exercises

Implementation

Go to the excel Input file ‘energy_demand.xlsx’ .

• sheet SETS

Sets

• The set act_tec maps activity and vehicle technology.

• The set tech_fuel maps technology and fuels.

Page 52: GAMS hands-on exercises

Implementation

The sheet ‘data’ includes all the parameters required by the model for transport technologies:

Technical and economic data for the transport sector

Parameters:tra_data(labels,tech,v)fuel_share(tech,fuel)

Fuel shares

Page 53: GAMS hands-on exercises

Implementation

The sheet ‘activity’ accommodates parameters related to the demand projections for passenger cars,

among other parameters:

Activity demand and fuel prices

Interest rate and emission factors

Parameters:other_data(labels,fuel,year): activity and fuel pricesr: interest rateEm_fac(fuel): emission factors

Page 54: GAMS hands-on exercises

• Declaration of sets: act, tech, , fuel, year, act_tech, tech_fuel, labels

• Replication of sets with the use of alias command for the sets tech, year and fuel

Implementation: sets definition

Page 55: GAMS hands-on exercises

Assign the parameters capcost, conskm, stock2015, gamma, mileage, activity, fuel_price:

The parameters lifetime, annuity factor and ann_cap_cost are also assigned:

Annuity factor is required for the calculation of annual capital cost.

Implementation: parameters assignment

Page 56: GAMS hands-on exercises

It is necessary then, to calculate short term and long terms costs which are expressed per passenger kilometer:

𝑆𝑇𝐶(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟) =𝑐𝑜𝑛𝑠𝑘𝑚(𝑡𝑒𝑐ℎ, 𝑣) ∙ σ𝑓,𝑖𝑓 𝑡𝑒𝑐ℎ 𝑚𝑎𝑝𝑠 𝑓 𝑓𝑢𝑒𝑙𝑠ℎ𝑎𝑟𝑒(𝑡𝑒𝑐ℎ, 𝑓) ∙ 𝑓𝑢𝑒𝑙𝑝𝑟𝑖𝑐𝑒(𝑓)

𝑜𝑐_𝑟𝑎𝑡𝑖𝑜(𝑡𝑒𝑐ℎ, 𝑣)

𝐿𝑇𝐶(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟) = 𝑆𝑇𝐶(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟)+𝑎𝑛𝑛_𝑐𝑎𝑝_𝑐𝑜𝑠𝑡(𝑡𝑒𝑐ℎ,𝑣)

𝑚𝑖𝑒𝑙𝑎𝑔𝑒(𝑡𝑒𝑐ℎ,𝑣)∙𝑜𝑐_𝑟𝑎𝑡𝑖𝑜(𝑡𝑒𝑐ℎ,𝑣)

Long terms costs are calculated by adding the annual capital costs to the short term costs:

Implementation: parameters assignment

Page 57: GAMS hands-on exercises

Variables declaration

Variables that are included in equalities are declared as free variables:

SH_NEW(act,tech,year)

STOCK(act,tech,v,year)

INV_VEH(act,tech,v)

SH_OPER(act,tech,v,year)

FINAL_ENERGY(act,tech,fuel,year)

CAP_DESIRED(act,tech,year)

AVG_EMISSIONS(act,year)

S_COST(act,tech,v,year)

CAP_GAP(act,tech,year)

Page 58: GAMS hands-on exercises

Variables declaration

Page 59: GAMS hands-on exercises

Implementation: equations definition

• Eleven equations in total must be declared:

• The problem is described by equalities and inequalities

Page 60: GAMS hands-on exercises

𝑆𝑇𝑂𝐶𝐾(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟) = ቊ𝑠𝑡𝑜𝑐𝑘2015 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ ∙ 𝑠𝑢𝑟𝑣_𝑟𝑎𝑡𝑒(𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟), 𝑣 = 2015

𝐼𝑁𝑉_𝑉𝐸𝐻 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣 ∙ 𝑠𝑢𝑟𝑣_𝑟𝑎𝑡𝑒 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟 𝑣 > 2015

Equations for vehicles available in every projection year: EQ_STOCK

Equations for the share of vehicles under long term costs: EQ_SH_NEW

𝑆𝐻_𝑁𝐸𝑊(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟) =𝑒−𝛾 𝑎𝑐𝑡,𝑦𝑒𝑎𝑟 ∙𝐿𝑇𝐶(𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟)

𝑡𝑒𝑐ℎ

𝑒−𝛾(𝑎𝑐𝑡,𝑦𝑒𝑎𝑟)∙𝐿𝑇𝐶(𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟)

Implementation: equations definition

Page 61: GAMS hands-on exercises

𝐶𝐴𝑃_𝐷𝐸𝑆𝐼𝑅𝐸𝐷(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟) =𝑆𝐻_𝑁𝐸𝑊(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟) ∙ 𝑎𝑐𝑡𝑖𝑣𝑖𝑡𝑦(𝑦𝑒𝑎𝑟) ∙ 1000

𝑜𝑐𝑐_𝑟𝑎𝑡𝑖𝑜(𝑡𝑒𝑐ℎ, 𝑣) ∙ 𝑚𝑖𝑙𝑒𝑎𝑔𝑒 𝑡𝑒𝑐ℎ, 𝑣If v maps projection year

Equations for calculating the optimum vehicle mix: EQ_OPT_STOCK

Equations for additional vehicles needed, for years greater than 2015: EQ_GAP

𝐶𝐴𝑃_𝐺𝐴𝑃 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟 ≥ 𝐶𝐴𝑃_𝐷𝐸𝑆𝐼𝑅𝐸𝐷 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟 −

𝑣, 𝑖𝑓 𝑣<𝑦𝑒𝑎𝑟

𝑆𝑇𝑂𝐶𝐾(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟)

⏊𝐶𝐴𝑃_𝐺𝐴𝑃(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟)

Implementation: equations definition

Page 62: GAMS hands-on exercises

Equations for the stock of new vehicles by vintage: EQ_INV

Equations for the share of vehicles under short term costs: EQ_SH_OPER

𝑉𝐸𝐻_𝐼𝑁𝑉 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣 = 𝐶𝐴𝑃_𝐺𝐴𝑃(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑦𝑒𝑎𝑟), if year maps v

𝑆𝐻_𝑂𝑃𝐸𝑅(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟) =𝑒−𝛾 𝑎𝑐𝑡,𝑦𝑒𝑎𝑟 ∙(𝑆𝑇𝐶 𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟 +𝑆_𝐶𝑂𝑆𝑇(𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟))

𝑡𝑒𝑐ℎ

𝑒−𝛾(𝑎𝑐𝑡,𝑦𝑒𝑎𝑟)∙(𝑆𝑇𝐶 𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟 +𝑆_𝐶𝑂𝑆𝑇(𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟))

Implementation: equations definition

Page 63: GAMS hands-on exercises

𝑆𝑇𝑂𝐶𝐾 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟 · 𝑜𝑐_𝑟𝑎𝑡𝑖𝑜 𝑡𝑒𝑐ℎ, 𝑣 ·𝑚𝑖𝑙𝑒𝑎𝑔𝑒 𝑡𝑒𝑐ℎ, 𝑣

1000≥𝑆𝐻_𝑂𝑃𝐸𝑅(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟) · 𝑎𝑐𝑡𝑖𝑣𝑖𝑡𝑦(𝑦𝑒𝑎𝑟), ⏊ 𝑆_𝐶𝑂𝑆𝑇(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟)

Equations for capacity constraints – vehicles in operation: EQ_MCAP

The variable S_COST is associated with the equation EQ_MCAP:- If the existing stock by vehicle technology is sufficient to cover the transport activity demanded, S_COST

equals to zero- Otherwise, the short term cost STC which is used for deciding the operation is increased by the shadow

value S_COST. This results to the reduction of the vehicle share until it is met by the existing stock.

Implementation: equations definition

Page 64: GAMS hands-on exercises

Equations for calculating final energy: EQ_FINAL_ENERGY

𝐹𝐼𝑁𝐴𝐿_𝐸𝑁𝐸𝑅𝐺𝑌 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑓𝑢𝑒𝑙, 𝑦𝑒𝑎𝑟=

𝑣

𝑖𝑓 𝑣≤𝑦𝑒𝑎𝑟

𝑆𝐻_𝑂𝑃𝐸𝑅(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟) · 𝑎𝑐𝑡𝑖𝑣𝑖𝑡𝑦(𝑦𝑒𝑎𝑟)/𝑜𝑐_𝑟𝑎𝑡𝑖𝑜(𝑡𝑒𝑐ℎ, 𝑣) · 𝑐𝑜𝑛𝑠𝑘𝑚(𝑡𝑒𝑐ℎ, 𝑣) · 𝑓𝑢𝑒𝑙_𝑠ℎ𝑎𝑟𝑒(𝑡𝑒𝑐ℎ, 𝑓𝑢𝑒𝑙)

Implementation: equations definition

Page 65: GAMS hands-on exercises

Implementation: model declaration

The model is declared under the name ‘transport’, including all the equations defined. The model is written in MCP formulation. This implies that inequalities must be associated with their dual positive variables. Strict equalities do not need such a declaration. The transport model is declared as follows:

EQ_GAP is the equation that refers to the additional vehicles required. If the existing stock is already sufficient, the variable CAP_GAP is set to 0.

EQ_MCAP is the equation that refers to the installed capacity constraint for the operationdecision. S_COST takes values only if the capacity is not enough to cover activity demand.

Page 66: GAMS hands-on exercises

Implementation: solution with MCP

The model is solved as an MCP problem. This can be seen in the solve statement:

Notice that there are no objective variable that are maximized or minimized. A problem of the form

−𝐹𝑖 𝑥 > 0 𝑎𝑛𝑑 𝑥𝑖 = 0

𝐹𝑖 𝑥 = 0 𝑎𝑛𝑑 𝑥𝑖 > 0 is solved.

Page 67: GAMS hands-on exercises

Implementation: model results

• Execute the model, by writing gdx = C:\EST_training_weekIII\energy_transport\outputgdx\transport in the command line.

• Open the transport.gdx file produced and review the results. Open first the parameters STC and LTC for the short and long term costs respectively:

Short term cost for ICE cars Short term cost for Electric cars

Page 68: GAMS hands-on exercises

Implementation: model results

• Execute the model, by writing gdx = C:\EST_training_weekIII\energy_transport\outputgdx\transport in the command line.

• Open the transport.gdx file produced and review the results. Open first the parameters STC and LTC for the short and long term costs respectively:

Long term cost for ICE cars Long term cost for Electric cars

Page 69: GAMS hands-on exercises

Implementation: model results

Costs evolution

• The cost of purchase an electric car decreases significantly until 2030 - long term costs decrease. • Conventional cars decrease their fuel consumption per Km - short term cost decrease.

Long term cost for ICE cars Short term cost for ICE cars

Page 70: GAMS hands-on exercises

Implementation: model results

• Open the parameter SH_NEW. These are the shares determined by the long term costs only:

• It can seen that the share of electric cars increases 5 percentage points by 2030, as a results of their cost decrease.

Shares under Long term costs

Page 71: GAMS hands-on exercises

Implementation: model results

• Open the parameter SH_OPER. These are the shares in operation for the existing vehicles by type and vintage:

Shares of vehicles in operation

Decisions are made under short term costs, constrained by the existing vehicles.

Page 72: GAMS hands-on exercises

Implementation: model results

• Open the file C:\EST_training_weekIII\energy_transport\outputxls• The most significant results, like transport activity, energy consumption, investments and stock of

vehicles can be found there:

Model results

2015 2020 2025 2030 2035 2040 2045 2050

th.vehicles ICE 7,216 6,994 4,810 5,448 6,233 7,288 8,449 9,699

th.vehicles Electric 901 3,202 3,914 4,489 5,012 5,788 6,590 7,552

th.vehicles Hybrid 1,802 4,487 5,081 5,738 6,445 7,460 8,547 9,808

investment(th. veh.) ICE 2,156 3,355 2,188 3,932 3,831 4,538

investment(th. veh.) Electric 2,329 1,325 2,348 2,247 2,745 3,102 3,534

investment(th. veh.) Hybrid 2,740 1,762 3,021 2,867 3,569 4,032 4,586

activity(MpKm) ICE 150,000 92,093 99,990 113,248 129,563 151,496 175,623 201,609

activity(MpKm) Electric 16,628 59,097 72,229 82,850 92,491 106,818 121,629 139,371

activity(MpKm) Hybrid 33,256 82,811 93,781 105,902 118,946 137,686 157,748 181,021

fuel consumption(GWh)gasoline 87,120 66,073 66,772 63,117 65,574 67,623 71,149 78,233

fuel consumption(GWh)electricity 4,552 13,906 16,243 17,817 19,244 21,639 24,087 27,293

Page 73: GAMS hands-on exercises

Implementation: graphic diagrams

• In 2015, there is overcapacity of ICE cars comparing to the long term shares. Investments in electric and hybrid cars start from 2020 and increase moderately until the year 2050.

• ICE cars are the most preferable vehicles throughout the period, as a result of their lower costs. However, their share is decreasing as the technology costs converge.

Stock of vehicles Investments

Page 74: GAMS hands-on exercises

Implementation: graphic diagrams

• The transport activity increases over time.• The energy consumed also increases, but not to the same extent. • Electric cars consume much less energy per pkm.• Conventional cars are improve their efficiency significantly.

Stock of vehicles Fuel Consumption in transport sector

Page 75: GAMS hands-on exercises

Part II: CO2 emissions constraints and perceived costs

• On the previous step, the purchase of new vehicles was decided under the nominal equipment cost. As the cost of electric cars decreased, their share in new vehicles increased accordingly.

• This not however the case in reality. New technologies face a number of difficulties that increase the consumer perceived costs. For electric cars these may reflect:

1. The limited existing infrastructure for charging stations.2. The high charging times.3. The attachment of consumers to conventional cars.4. Technology restrictions related to batteries and their storage capacity.

These difficulties can be modelled as extra costs that increase the price of the equipment or the price of the fuel.In this exercise, the perceived will refer only on to equipment cost. Thus, they will affect the choice of investment only.

Open the file: C:\EST_training_weekIII\energy_transport\model\energy_transport_CO2.gms

Page 76: GAMS hands-on exercises

Perceived costs

• It is assumed that pure electric cars face heavier constraints comparing to hybrid cars:

% increase 2015 2020 2025 2030 2035 2040 2045 2050

Perceivedcosts

Electric % 200.00% 160.00% 130.00% 100.00% 70.00% 50.00% 25.00% 0.00%

Hybrid % 160.00% 120.00% 100.00% 80.00% 50.00% 25.00% 0.00% 0.00%

Perceived costs for Electric and Hybrid Cars

• These are expressed as percent of the total long term cost per passenger kilometer.

𝐿𝑇𝐶(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟) = (𝑆𝑇𝐶(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟)+𝑎𝑛𝑛_𝑐𝑎𝑝_𝑐𝑜𝑠𝑡(𝑡𝑒𝑐ℎ,𝑣)

𝑚𝑖𝑒𝑙𝑎𝑔𝑒(𝑡𝑒𝑐ℎ,𝑣)∙𝑜𝑐_𝑟𝑎𝑡𝑖𝑜(𝑡𝑒𝑐ℎ,𝑣)) ∙ (1+perceived_cost(tech,v))

Page 77: GAMS hands-on exercises

CO2 emissions

• Conventional cars contribute to the country’s CO2 emissions, as they combust conventional fuels. In the exercise, ICE and hybrid vehicles produce CO2 emissions. The emissions intensity is related to:

1.the fuel consumption consumption per Kilometer.2.the fuel emission factor.

Emission factors

gasoline 249.2Electricity 0.o0

CO2 emission factors

• For every vehicle technology CO2 emissions per vehicle Km can be calculated with the formula:

𝐶𝑂2_𝑙𝑎𝑏𝑒𝑙𝑠(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟) =

𝑓𝑢𝑒𝑙

(𝑓𝑢𝑒𝑙_𝑠ℎ𝑎𝑟𝑒(𝑡𝑒𝑐ℎ, 𝑓𝑢𝑒𝑙) ∙ 𝑒𝑚_𝑓𝑎𝑐(𝑓𝑢𝑒𝑙)) ∙ 𝑐𝑜𝑛𝑠𝑘𝑚(𝑡𝑒𝑐ℎ, 𝑣)

Parameterem_fac(fuel)

Page 78: GAMS hands-on exercises

CO2 emissions

• A potential policy for CO2 emissions reduction policy would be to restrict the emissions produced by new vehicles.

• New vehicles are not allowed to emit on average more than a certain amount of emissions.

2015 2020 2025 2030 2035 2040 2045 2050

CO2 targets 220.00 180.00 160.00 150.00 130.00 110.00 90.00 80.00

CO2 emission targets for new vehicles

CO2 emissions and target

• In order to meet the targets shadow costs may have to be applied to the ICE vehicle technology option, which exceeds the target in this case.

• This will discourage the investment into new ICE vehicles.

ParameterCO2_stnds(act,year)

Page 79: GAMS hands-on exercises

How are CO2 standards policies modeled?

3 more variables are introduced:AVG_EMISSIONS(act,year): average CO2 emissionsR_LTC(act,tech,v,year): long term cost including penaltiesP_STNDS(act,year): shadow cost for overcoming the CO2 standards

New variables

Page 80: GAMS hands-on exercises

How are CO2 standards policies modeled?

• A new equation is added which impose a maximum constraint in the average emissions of new vehicles:

Equations for the average CO2 standards: EQ_standards

𝐶𝑂2_𝑠𝑡𝑛𝑑𝑠(𝑎𝑐𝑡, 𝑦𝑒𝑎𝑟) ∙ 𝑡𝑒𝑐ℎ,𝑣

𝑖𝑓 𝑣=𝑦𝑒𝑎𝑟

𝐼𝑁𝑉_𝑉𝐸𝐻 𝑡𝑒𝑐ℎ, 𝑣 ≥ 𝑡𝑒𝑐ℎ,𝑣

𝑖𝑓 𝑣=𝑦𝑒𝑎𝑟

𝐼𝑁𝑉_𝑉𝐸𝐻 𝑡𝑒𝑐ℎ, 𝑣 ∙ 𝐶𝑂2_𝑙𝑎𝑏𝑒𝑙𝑠(𝑡𝑒𝑐ℎ, 𝑣)

, ⏊ 𝑃_𝑆𝑇𝑁𝐷𝑆(𝑎𝑐𝑡, 𝑦𝑒𝑎𝑟)

• If the average emissions of the new vehicles are lower than the CO2 standards then a shadow cost must be imposed.

• This is expressed by the variable P_STNDS, which is the dual variable of the constraint.• When the constraint is met, the value of the variable is zero.• It takes values only in case of CO2 emissions violation.

Page 81: GAMS hands-on exercises

How are CO2 standards policies modeled?

Equations for shadow costs for CO2 emissions: EQ_COST

𝑅_𝐿𝑇𝐶 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟 = 𝐿𝑇𝐶 𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟 + 𝑃_𝑆𝑇𝑁𝐷𝑆(𝑎𝑐𝑡, 𝑦𝑒𝑎𝑟) ∙𝐶𝑂2_𝑙𝑎𝑏𝑒𝑙𝑠(𝑡𝑒𝑐ℎ,𝑣)−𝐶𝑂2_𝑠𝑡𝑛𝑑𝑠(𝑎𝑐𝑡,𝑦𝑒𝑎𝑟)

𝐶𝑂2_𝑠𝑡𝑛𝑑𝑠(𝑎𝑐𝑡,𝑦𝑒𝑎𝑟)

• A penalty(shadow cost) is imposed on the vehicle technologies that exceed the CO2 emissions target. This takes the form of an increase in the vehicle long term cost. The penalty is proportional to the distance from the CO2 emissions target:

• The penalty is zero for technologies that do not exceed the emissions target.

Page 82: GAMS hands-on exercises

How are CO2 standards policies modeled?

R_LTC replaces LTC on the equation of long term shares:

Equations for the share of vehicles under long term costs: EQ_SH_NEW

𝑆𝐻_𝑁𝐸𝑊(𝑎𝑐𝑡, 𝑡𝑒𝑐ℎ, 𝑣, 𝑦𝑒𝑎𝑟) =𝑒−𝛾 𝑎𝑐𝑡,𝑦𝑒𝑎𝑟 ∙𝑅_𝐿𝑇𝐶(𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟)

𝑡𝑒𝑐ℎ

𝑒−𝛾(𝑎𝑐𝑡,𝑦𝑒𝑎𝑟)∙𝑅_𝐿𝑇𝐶(𝑎𝑐𝑡,𝑡𝑒𝑐ℎ,𝑣,𝑦𝑒𝑎𝑟)

Page 83: GAMS hands-on exercises

2015 2020 2025 2030 2035 2040 2045 2050

th.vehicles ICE 7,216 8,245 8,229 8,429 8,433 8,841 9,013 9,699

th.vehicles Electric 901 873 1,526 2,342 3,198 4,116 5,384 7,552

th.vehicles Hybrid 1,802 2,643 3,618 4,528 5,781 7,383 9,118 9,808

investment(th. veh.) ICE 1,251 4,362 3,737 3,206 4,357 3,609 4,596

investment(th. veh.) Electric 1,194 1,184 1,611 2,119 2,737 4,118

investment(th. veh.) Hybrid 897 2,086 2,175 2,904 3,767 4,398 4,159

activity(MpKm) ICE 150,000 169,100 171,063 175,207 175,299 183,776 187,353 201,609

activity(MpKm) Electric 16,628 16,117 28,159 43,224 59,015 75,963 99,363 139,371

activity(MpKm) Hybrid 33,256 48,783 66,778 83,569 106,686 136,261 168,284 181,021

fuel consumption(GWh) gasoline 87,120 98,977 92,957 85,629 80,427 77,529 76,320 78,331

fuel consumption(GWh) electricity 4,552 5,233 7,723 10,488 13,481 16,738 20,996 27,289

Average CO2 emissions - new vehicles(gr/vKm)PS_cars 152 124 104 78 73 59 57

Model results

The results of the model including perceived costs and CO2 constraints can be seen on the table below:

Model results

• After the incorporation of the perceived costs, the adoption of new vehicle technologies is delayed.• Electric and hybrid cars increase their share by the significant reduction of the technology costs.• The CO2 emissions constraint is not binding at any year of the projection.

2015 2020 2025 2030 2035 2040 2045 2050

CO2 targets 220.00 180.00 160.00 150.00 130.00 110.00 90.00 80.00

Page 84: GAMS hands-on exercises

Graphic diagrams

Stock of vehicles – Model with perceived costs Stock of vehicles – Simple Model

Page 85: GAMS hands-on exercises

Graphic diagrams

Stock of vehicles – Model with perceived costs Stock of vehicles – Simple Model

Page 86: GAMS hands-on exercises

Imposing a stricter CO2 policy

• Assume now, under the same perceived costs, that the CO2 emissions target for new vehicles are significantly lower:

2015 2020 2025 2030 2035 2040 2045 2050

CO2 targets 220.00 110.00 100.00 80.00 60.00 50.00 40.00 30.00

New CO2 emissions targets for new vehicles

• Under these targets the CO2 emissions constraint is binding.

Page 87: GAMS hands-on exercises

Model results

Model results

• The CO2 emissions target is met by decreasing the share of conventional vehicles.• As the constraint for CO2 emissions becomes stricter, the share of electric vehicles in the total stock and

total activity increases.

2015 2020 2025 2030 2035 2040 2045 2050

th.vehicles ICE 7,216 7,567 6,391 5,637 5,298 4,585 4,119 3,725

th.vehicles Electric 901 918 2,140 3,414 4,455 5,982 8,173 12,515

th.vehicles Hybrid 1,802 3,238 5,075 6,601 8,054 10,311 11,842 11,574

investment(th. veh.) ICE 573 3,181 2,340 1,860 1,920 1,573 1,493

investment(th. veh.) Electric 45 1,765 1,686 2,171 3,256 4,217 7,229

investment(th. veh.) Hybrid 1,492 2,966 3,176 3,884 5,377 5,200 4,553

activity(MpKm) ICE 150,000 157,293 132,844 117,177 110,140 95,309 85,618 77,422

activity(MpKm) Electric 16,628 16,942 39,494 63,006 82,222 110,400 150,833 230,978

activity(MpKm) Hybrid 33,256 59,765 93,661 121,817 148,638 190,291 218,550 213,600

fuel consumption(GWh) gasoline 87,120 95,614 80,987 68,836 63,791 57,807 54,230 49,062

fuel consumption(GWh) electricity 4,552 5,911 10,794 15,295 18,800 24,040 30,641 42,406

Average CO2 emissions - new vehicles(gr/vKm)PS_cars 110 100 80 60 50 40 30

Model results

Page 88: GAMS hands-on exercises

Graphic diagrams

• These trends can be seen in the results for transport activity and fuel consumption:

Use of each technology in transport activity Fuel consumption in transport sector

• ICE vehicles are marginalized by the year 2050, due to their high nominal CO2 emissions.