Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
remind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jerome Hilaire
remind
Commits
33008e11
Commit
33008e11
authored
5 years ago
by
Marianna Rottoli
Browse files
Options
Downloads
Patches
Plain Diff
Iterative script adapted to inconvenience cost calculation by component.
parent
a5bb96e0
No related branches found
No related tags found
1 merge request
!159
Pullreq1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/iterative/EDGE_transport.R
+21
-17
21 additions, 17 deletions
scripts/iterative/EDGE_transport.R
with
21 additions
and
17 deletions
scripts/iterative/EDGE_transport.R
+
21
−
17
View file @
33008e11
...
...
@@ -48,15 +48,13 @@ EDGE_scenario <- cfg$gms$cm_EDGEtr_scen
EDGEscenarios
<-
fread
(
"../../modules/35_transport/edge_esm/input/EDGEscenario_description.csv"
)[
scenario_name
==
EDGE_scenario
]
inconvenience
<-
EDGEscenarios
[
options
==
"inconvenience"
,
switch
]
selfmarket_policypush
<-
EDGEscenarios
[
options
==
"selfmarket_policypush"
,
switch
]
selfmarket_acceptancy
<-
EDGEscenarios
[
options
==
"selfmarket_acceptancy"
,
switch
]
if
(
EDGE_scenario
==
"Conservative_liquids"
)
{
techswitch
<
<-
"Liquids"
techswitch
<-
"Liquids"
}
else
if
(
EDGE_scenario
%in%
c
(
"Electricity_push"
,
"Smart_lifestyles_Electricity_push"
))
{
techswitch
<
<-
"BEV"
techswitch
<-
"BEV"
}
else
if
(
EDGE_scenario
==
"Hydrogen_push"
)
{
techswitch
<
<-
"FCEV"
techswitch
<-
"FCEV"
}
else
{
print
(
"You selected a not allowed scenario. Scenarios allowed are: Conservative_liquids, Hydrogen_push, Electricity_push, Smart_lifestyles_Electricity_push"
)
exit
()
...
...
@@ -79,12 +77,15 @@ inputdata <- loadInputData(data_folder)
vot_data
=
inputdata
$
vot_data
sw_data
=
inputdata
$
sw_data
inco_data
=
inputdata
$
inco_data
logit_params
=
inputdata
$
logit_params
int_dat
=
inputdata
$
int_dat
nonfuel_costs
=
inputdata
$
nonfuel_costs
price_nonmot
=
inputdata
$
price_nonmot
pref_data
=
inputdata
$
pref_data
## Moinput produces all combinations of iso-vehicle types and attributes a 0. These ghost entries have to be cleared.
int_dat
=
int_dat
[
EJ_Mpkm_final
>
0
]
pref_data
$
FV_final_pref
=
merge
(
pref_data
$
FV_final_pref
,
unique
(
int_dat
[,
c
(
"iso"
,
"vehicle_type"
)]),
by
=
c
(
"iso"
,
"vehicle_type"
),
all.y
=
TRUE
)
## optional average of prices
average_prices
=
FALSE
...
...
@@ -101,9 +102,13 @@ if (file.exists(datapath("demand_previousiter.RDS"))) {
demand_BEVtmp
=
readRDS
(
datapath
(
"demand_BEV.RDS"
))
## load previous iteration demand
ES_demandpr
=
readRDS
(
datapath
(
"demand_previousiter.RDS"
))
## load previus iteration number of stations
stations
=
readRDS
(
datapath
(
"stations.RDS"
))
## calculate non fuel costs and
nonfuel_costs
=
applylearning
(
gdx
,
REMINDmapping
,
EDGE2teESmap
,
demand_BEVtmp
,
ES_demandpr
)
saveRDS
(
nonfuel_costs
,
"nonfuel_costs_learning.RDS"
)
}
else
{
stations
=
NULL
}
## load price
...
...
@@ -158,12 +163,11 @@ if (inconvenience) {
logit_data
<-
calculate_logit_inconv_endog
(
prices
=
REMIND_prices
[
tot_price
>
0
],
vot_data
=
vot_data
,
inco
_data
=
inco
_data
,
pref
_data
=
pref
_data
,
logit_params
=
logit_params
,
intensity_data
=
int_dat
,
price_nonmot
=
price_nonmot
,
selfmarket_policypush
=
selfmarket_policypush
,
selfmarket_acceptancy
=
selfmarket_acceptancy
)
stations
=
if
(
!
is.null
(
stations
))
stations
)
}
else
{
...
...
@@ -211,7 +215,7 @@ shares_int_dem <- shares_intensity_and_demand(
demByTech
<-
shares_int_dem
[[
"demand"
]]
##in [-]
intensity
<-
shares_int_dem
[[
"demandI"
]]
##in million pkm/EJ
norm_demand
<-
shares_int_dem
[[
"demandF_plot_
pkm
"
]]
## total demand is 1, required for costs
norm_demand
<-
shares_int_dem
[[
"demandF_plot_
EJ
"
]]
## total demand is 1, required for costs
if
(
opt
$
reporting
)
{
...
...
@@ -229,15 +233,15 @@ if (opt$reporting) {
quit
()
}
demand_BEV
=
calc_num_vehicles
(
norm_dem_BEV
=
norm_demand
[
technology
==
"BEV"
&
## battery vehicles
num_veh_stations
=
calc_num_vehicles_stations
(
norm_dem
=
norm_demand
[
subsector_L1
==
"trn_pass_road_LDV_4W"
,
## only 4wheelers
c
(
"iso"
,
"year"
,
"sector"
,
"vehicle_type"
,
"demand_F"
)
],
ES_demand
=
ES_demand
)
c
(
"iso"
,
"year"
,
"sector"
,
"vehicle_type"
,
"technology"
,
"demand_F"
)
],
ES_demand
_all
=
ES_demand
_all
)
## save number of vehicles for next iteration
saveRDS
(
demand_BEV
,
datapath
(
"demand_BEV.RDS"
))
saveRDS
(
num_veh_stations
$
BEVdem
,
datapath
(
"demand_BEV.RDS"
))
saveRDS
(
num_veh_stations
$
stations
,
datapath
(
"stations.RDS"
))
## save the demand for next iteration renaming the column
setnames
(
ES_demand
,
old
=
"demand"
,
new
=
"demandpr"
)
saveRDS
(
ES_demand
,
datapath
(
"demand_previousiter.RDS"
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment