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
78efbd85
Commit
78efbd85
authored
5 years ago
by
Alois Dirnaichner
Browse files
Options
Downloads
Patches
Plain Diff
Remove warning from EDGE_Transport script and correct some indentation issues.
parent
36bd969f
No related branches found
No related tags found
1 merge request
!67
Request to merge the new transport module EDGE-T
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/iterative/EDGE_transport.R
+30
-30
30 additions, 30 deletions
scripts/iterative/EDGE_transport.R
with
30 additions
and
30 deletions
scripts/iterative/EDGE_transport.R
+
30
−
30
View file @
78efbd85
...
...
@@ -93,12 +93,12 @@ if (setlearning | addvintages){
}
if
(
setlearning
&
file.exists
(
"demand_previousiter.RDS"
))
{
if
(
setlearning
&
file.exists
(
"demand_previousiter.RDS"
))
{
## load previous iteration number of cars
demand_BEVtmp
=
readRDS
(
"demand_BEV.RDS"
)
## load previous iteration demand
ES_demandpr
=
readRDS
(
"demand_previousiter.RDS"
)
## calculate non fuel costs and
## calculate non fuel costs and
nonfuel_costs
=
applylearning
(
gdx
,
REMINDmapping
,
EDGE2teESmap
,
demand_BEVtmp
,
ES_demandpr
)
saveRDS
(
nonfuel_costs
,
"nonfuel_costs_learning.RDS"
)
}
...
...
@@ -127,21 +127,21 @@ saveRDS(REMIND_prices, paste0("REMINDprices", iter, ".RDS"))
if
(
average_prices
){
if
(
max
(
unique
(
REMIND_prices
$
iternum
))
>=
20
&
max
(
unique
(
REMIND_prices
$
iternum
))
<=
30
){
old_prices
<-
readRDS
(
pfile
)
all_prices
<-
rbind
(
old_prices
,
REMIND_prices
)
setkeyv
(
all_prices
,
keys
)
## apply moving avg
REMIND_prices
<-
REMIND_prices
[
all_prices
[
iternum
>=
20
,
mean
(
tot_price
),
by
=
keys
],
tot_price
:=
V1
]
all_prices
<-
rbind
(
old_prices
,
REMIND_prices
)
}
else
{
all_prices
<-
REMIND_prices
}
saveRDS
(
all_prices
,
pfile
)
## save REMIND prices (after dampening)
saveRDS
(
REMIND_prices
,
paste0
(
"REMINDpricesDampened"
,
iter
,
".RDS"
))
if
(
max
(
unique
(
REMIND_prices
$
iternum
))
>=
20
&
max
(
unique
(
REMIND_prices
$
iternum
))
<=
30
){
old_prices
<-
readRDS
(
pfile
)
all_prices
<-
rbind
(
old_prices
,
REMIND_prices
)
setkeyv
(
all_prices
,
keys
)
## apply moving avg
REMIND_prices
<-
REMIND_prices
[
all_prices
[
iternum
>=
20
,
mean
(
tot_price
),
by
=
keys
],
tot_price
:=
V1
]
all_prices
<-
rbind
(
old_prices
,
REMIND_prices
)
}
else
{
all_prices
<-
REMIND_prices
}
saveRDS
(
all_prices
,
pfile
)
## save REMIND prices (after dampening)
saveRDS
(
REMIND_prices
,
paste0
(
"REMINDpricesDampened"
,
iter
,
".RDS"
))
}
...
...
@@ -149,15 +149,15 @@ REMIND_prices[, "iternum" := NULL]
## calculates logit
if
(
inconvenience
)
{
years
=
copy
(
REMINDyears
)
years
=
copy
(
REMINDyears
)
logit_data
<-
calculate_logit_inconv_endog
(
prices
=
REMIND_prices
[
tot_price
>
0
],
vot_data
=
vot_data
,
inco_data
=
inco_data
,
logit_params
=
logit_params
,
intensity_data
=
int_dat
,
price_nonmot
=
price_nonmot
)
logit_data
<-
calculate_logit_inconv_endog
(
prices
=
REMIND_prices
[
tot_price
>
0
],
vot_data
=
vot_data
,
inco_data
=
inco_data
,
logit_params
=
logit_params
,
intensity_data
=
int_dat
,
price_nonmot
=
price_nonmot
)
}
else
{
...
...
@@ -172,7 +172,7 @@ logit_data <- calculate_logit_inconv_endog(
}
shares
<-
logit_data
[[
"share_list"
]]
## shares of alternatives for each level of the logit function
shares
$
VS1_shares
=
shares
$
VS1_shares
[,
-
c
(
"sector"
,
"subsector_L2"
,
"subsector_L3"
)]
##
shares$VS1_shares=shares$VS1_shares[,-c("sector","subsector_L2","subsector_L3")]
mj_km_data
<-
logit_data
[[
"mj_km_data"
]]
## energy intensity at a technology level
prices
<-
logit_data
[[
"prices_list"
]]
## prices at each level of the logit function, 1990USD/pkm
...
...
@@ -205,12 +205,12 @@ demByTech <- shares_intensity_demand[["demand"]] ##in [-]
intensity
<-
shares_intensity_demand
[[
"demandI"
]]
##in million pkm/EJ
norm_demand
<-
shares_intensity_demand
$
demandF_plot_pkm
## total demand is 1, required for costs
if
(
setlearning
)
{
if
(
setlearning
)
{
demand_BEV
=
calc_num_vehicles
(
norm_dem_BEV
=
norm_demand
[
technology
==
"BEV"
&
## battery vehicles
subsector_L1
==
"trn_pass_road_LDV_4W"
,
## only 4wheelers
c
(
"iso"
,
"year"
,
"sector"
,
"vehicle_type"
,
"demand_F"
)
],
ES_demand
=
ES_demand
)
## save number of vehicles for next iteration
saveRDS
(
demand_BEV
,
"demand_BEV.RDS"
)
## save the demand for next iteration renaming the column
...
...
@@ -244,8 +244,8 @@ finalInputs <- prepare4REMIND(
REMINDtall
=
REMINDtall
,
REMIND2ISO_MAPPING
=
REMIND2ISO_MAPPING
)
## add the columns of SSP scenario and EDGE scenario to the output parameters
for
(
i
in
names
(
finalInputs
))
{
finalInputs
[[
i
]]
$
SSP_scenario
<-
scenario
...
...
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