Commit 46788de9 authored by Toni's avatar Toni
Browse files

Adding capability to plot outside temperature + improvements to plot layout

parent f6a6cb32
......@@ -210,15 +210,15 @@ if(!empty(df_p2)){
my_title_font_size = 8
my_axis_title_font_size = 7
my_axis_scale_font_size = 6
my_legend_title_font_size <- 6
my_legend_entry_font_size <- 5
my_legend_title_font_size <- 7
my_legend_entry_font_size <- 6
nr_cat <- nr_colors + nr_shapes
if(nr_cat<=8){
mypalette="Dark2"
} else if(nr_cat<=12){
mypalette="Set"
my_legend_title_font_size <- 6
my_legend_entry_font_size <- 5
mypalette=NULL
my_legend_title_font_size <- 7
my_legend_entry_font_size <- 6
}else if(nr_cat<=20) {
mypalette=NULL
my_legend_title_font_size <- 4
......@@ -236,7 +236,9 @@ g1 <- ggplot() +
labs(colour = value) + ggtitle(ptitle) + xlab(xlabel) +
theme(plot.title = element_text(size = my_title_font_size), axis.title=element_text(size=my_axis_title_font_size),
axis.text = element_text(size = my_axis_scale_font_size), legend.position="bottom",
legend.title = element_text(size=my_legend_title_font_size), legend.text = element_text(size=my_legend_entry_font_size))
legend.title = element_text(size=my_legend_title_font_size), legend.box = "vertical",
legend.text = element_text(size=my_legend_entry_font_size)) +
guides(color=guide_legend(ncol=3))
if(!is.empty(mypalette)){
g1 <- g1 +
scale_color_brewer(palette = mypalette)
......@@ -252,7 +254,8 @@ if(!empty(df_p2)){
scale_y_continuous(
name = paste(value, "-axis. ", ylabel),
sec.axis = sec_axis(~./scaleFactor, name=paste(value2, "-axis. ",zlabel))) +
scale_linetype_discrete(name = paste(value2))
scale_linetype_discrete(name = paste(value2))+
guides(linetype=guide_legend(ncol=3))
}
#g2_copy<-g2 # to avoid errors we create a copy, g2 changes with switch -w
#plot(g2_copy)
......
......@@ -50,25 +50,35 @@ $set backbone_output_GDX "output\out.gdx"
$if "%archive%"=="TRUE" $call cp "%backbone_output_GDX%" "plots/archive/%archive_prefix%_backbone_out.gdx"
* Preparation
$set GDXparam2 priceElec
$set GDXparam2set2 price_2013
$set GDXparam2 priceElec
$set GDXparam2set2 price_2013
$set GDXparam2alt2 TempOut
$set GDXparam2set2alt2 temp
* Define sets and parameters to be used to prepare data for plots or in ggplots in R
Set
tparam(t) "Time steps (in hours)"
%GDXparam2set2% "Electricity price (EUR/MWh)" /price/
%GDXparam2set2alt2% "Outside temperature (C)" /temp_out/
out_temp "Outside temperature (C)"
;
Parameter
myerrorlevel "Save Rscript callback error level" / 0 /
w2kw "Convert whatt to kilowhatt" / 0.001 /
sign "Switch sign" / -1 /
%GDXparam2%(t,%GDXparam2set2%) "Electricity spot price (EUR/MWh)"
myerrorlevel "Save Rscript callback error level" / 0 /
w2kw "Convert whatt to kilowhatt" / 0.001 /
sign "Switch sign" / -1 /
%GDXparam2%(t,%GDXparam2set2%) "Electricity spot price (EUR/MWh)"
%GDXparam2alt2%(t,%GDXparam2set2alt2%) "Temperature outside (Celcius)"
;
* Prepare priceElspot (continued)
* Prepare priceElspot
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, ts_priceElspot;
%GDXparam2%(tparam,%GDXparam2set2%)=ts_priceElspot(tparam) +eps ;
$set Ylabel2 "Price of electricity (EUR/MWh) :"
$set Ylabel2_alt1 "Price of electricity (EUR/MWh) :"
*Prepare outside temperature
*%GDXparam2alt2%(tparam,%GDXparam2set2alt2%)=16 +eps ;
%GDXparam2alt2%(tparam,%GDXparam2set2alt2%)=0 ;
$set Ylabel2_alt2 "Outside temperature (C) :"
* Create summary_emob.gdx
$include plots/summary_emob.inc
......@@ -85,23 +95,25 @@ $set GDXfile plot4r.gdx
$set GDXparam ts_influx
$set TMPparam ts_influx_absolute
$set Ylabel "Track exogenous commodities (kWh) :"
$set Ylabel2 %Ylabel2_alt2%
Parameter %TMPparam%(t,node) "External power (weather) influencing building" ;
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, %GDXparam%;
* Below line is adjusted for each paramGDX and paramPlot pair
%TMPparam%(tparam(t),node)=sum((grid,f)$(sameas(grid,"building") and sameas(f,'f00')),w2kw*%GDXparam%(grid,node,f,t) + eps);
execute_unload 'plots/%GDXfile%', tparam=t, node, %TMPparam%, %GDXparam2set2%, %GDXparam2% ;
$batInclude runR.inc %GDXfile% %TMPparam% %GDXparam2%
%TMPparam%(tparam(t),node)=sum((grid,node_building2node(node_building,node),f)$(sameas(grid,"building") and sameas(f,'f00')),w2kw*%GDXparam%(grid,node,f,t) + eps);
execute_unload 'plots/%GDXfile%', tparam=t, node, %TMPparam%, %GDXparam2set2alt2%, %GDXparam2alt2% ;
$batInclude runR.inc %GDXfile% %TMPparam% %GDXparam2alt2%
* Plot ts_influx_normalized *******************************************************
$set GDXfile plot4r.gdx
$set GDXparam ts_influx
$set TMPparam ts_influx_normalized
$set Ylabel "Track exogenous commodities per m2 (kWh) :"
$set Ylabel2 %Ylabel2_alt2%
Parameter %TMPparam%(t,node) "External power (weather) influencing building - normalized by bulding m2" ;
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, %GDXparam%;
* Below line is adjusted for each paramGDX and paramPlot pair
%TMPparam%(tparam(t),node)=sum((grid,node_building2node(node_building,node),f)$(sameas(grid,"building") and sameas(f,'f00')), w2kw*%GDXparam%(grid,node,f,t)/building_squares(node_building) + eps);
execute_unload 'plots/%GDXfile%', tparam=t, node, %TMPparam%, %GDXparam2set2%, %GDXparam2% ;
$batInclude runR.inc %GDXfile% %TMPparam% %GDXparam2%
execute_unload 'plots/%GDXfile%', tparam=t, node, %TMPparam%, %GDXparam2set2alt2%, %GDXparam2alt2% ;
$batInclude runR.inc %GDXfile% %TMPparam% %GDXparam2alt2%
* Plots 2 : r_gen
* Electric power consumption for heating and cooling of air and heating of domestic hot water
......@@ -110,6 +122,7 @@ $set GDXfile plot4r.gdx
$set GDXparam r_gen
$set TMPparam r_gen_heat_absolute
$set Ylabel Electricity usage (kW) :
$set Ylabel2 %Ylabel2_alt1%
Parameter %TMPparam%(t,unit) "Electric power consumption for heating and cooling of air" ;
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, %GDXparam%;
* Below line is adjusted for each paramGDX and paramPlot pair
......@@ -121,6 +134,7 @@ $set GDXfile plot4r.gdx
$set GDXparam r_gen
$set TMPparam r_gen_heat_normalized
$set Ylabel Electricity usage per m2(kW) :
$set Ylabel2 %Ylabel2_alt1%
Parameter %TMPparam%(t,unit) "Electric power consumption for heating and cooling of air - normalized by bulding m2" ;
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, %GDXparam%;
* Below line is adjusted for each paramGDX and paramPlot pair
......@@ -132,6 +146,7 @@ $set GDXfile plot4r.gdx
$set GDXparam r_gen
$set TMPparam r_gen_dhw_absolute
$set Ylabel Electricity usage (kW) :
$set Ylabel2 %Ylabel2_alt1%
Parameter %TMPparam%(t,unit) "Electric power consumption for domestic hot water" ;
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, %GDXparam%;
* Below line is adjusted for each paramGDX and paramPlot pair
......@@ -143,6 +158,7 @@ $set GDXfile plot4r.gdx
$set GDXparam r_gen
$set TMPparam r_gen_dhw_normalized
$set Ylabel Electricity usage per m2(kW) :
$set Ylabel2 %Ylabel2_alt1%
Parameter %TMPparam%(t,unit) "Electric power consumption for domestic hot water - normalized by bulding m2" ;
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, %GDXparam%;
* Below line is adjusted for each paramGDX and paramPlot pair
......@@ -157,10 +173,12 @@ $set GDXfile plot4r.gdx
$set GDXparam r_state
$set TMPparam r_state_interior_air
$set Ylabel Temperture (Celcius) :
Parameter %TMPparam%(t,node) "Temperature at interior_air_and_furniture (Celcius)" ;
$set Ylabel2 %Ylabel2_alt1%
Parameter %TMPparam%(t,*) "Temperature at interior_air_and_furniture (Celcius)" ;
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, %GDXparam%;
* Below line is adjusted for each paramGDX and paramPlot pair
%TMPparam%(tparam(t),node_building_interior_air_and_furniture(node))=sum((grid,f)$(sameas(grid,"building") and sameas(f,'f00')),%GDXparam%(grid,node,f,t) - c2k + eps);
*%TMPparam%(tparam(t),'out_temp')=16;
execute_unload 'plots/%GDXfile%', tparam=t, node, %TMPparam%, %GDXparam2set2%, %GDXparam2% ;
$batInclude runR.inc %GDXfile% %TMPparam% %GDXparam2%
* Plot r_state(internal_mass) *******************************************************
......@@ -168,10 +186,12 @@ $set GDXfile plot4r.gdx
$set GDXparam r_state
$set TMPparam r_state_internal_mass
$set Ylabel Temperture (Celcius) :
Parameter %TMPparam%(t,node) "Temperature at internal_mass: inside walls (Celcius)" ;
$set Ylabel2 %Ylabel2_alt1%
Parameter %TMPparam%(t,*) "Temperature at internal_mass: inside walls (Celcius)" ;
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, %GDXparam%;
* Below line is adjusted for each paramGDX and paramPlot pair
%TMPparam%(tparam(t),node_building_internal_mass(node))=sum((grid,f)$(sameas(grid,"building") and sameas(f,'f00')),%GDXparam%(grid,node,f,t) - c2k + eps);
*%TMPparam%(tparam(t),'out_temp')=16;
execute_unload 'plots/%GDXfile%', tparam=t, node, %TMPparam%, %GDXparam2set2%, %GDXparam2% ;
$batInclude runR.inc %GDXfile% %TMPparam% %GDXparam2%
* Plot r_state(envelope_mass) *******************************************************
......@@ -179,10 +199,12 @@ $set GDXfile plot4r.gdx
$set GDXparam r_state
$set TMPparam r_state_envelope_mass
$set Ylabel Temperture (Celcius) :
Parameter %TMPparam%(t,node) "Temperature at envelope_mass: outside walls (Celcius)" ;
$set Ylabel2 %Ylabel2_alt1%
Parameter %TMPparam%(t,*) "Temperature at envelope_mass: outside walls (Celcius)" ;
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, %GDXparam%;
* Below line is adjusted for each paramGDX and paramPlot pair
%TMPparam%(tparam(t),node_building_envelope_mass(node))=sum((grid,f)$(sameas(grid,"building") and sameas(f,'f00')),%GDXparam%(grid,node,f,t) - c2k + eps);
*%TMPparam%(tparam(t),'out_temp')=16;
execute_unload 'plots/%GDXfile%', tparam=t, node, %TMPparam%, %GDXparam2set2%, %GDXparam2% ;
$batInclude runR.inc %GDXfile% %TMPparam% %GDXparam2%
* Plot r_state(DHWT) *******************************************************
......@@ -190,10 +212,12 @@ $set GDXfile plot4r.gdx
$set GDXparam r_state
$set TMPparam r_state_DHWT
$set Ylabel Temperture (Celcius) :
Parameter %TMPparam%(t,node) "Temperature at Domestic Hot Water Tank (Celcius)" ;
$set Ylabel2 %Ylabel2_alt1%
Parameter %TMPparam%(t,*) "Temperature at Domestic Hot Water Tank (Celcius)" ;
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, %GDXparam%;
* Below line is adjusted for each paramGDX and paramPlot pair
%TMPparam%(tparam(t),node_building_DHWT(node))=sum((grid,f)$(sameas(grid,"building") and sameas(f,'f00')),%GDXparam%(grid,node,f,t) - c2k + eps);
*%TMPparam%(tparam(t),'out_temp')=16;
execute_unload 'plots/%GDXfile%', tparam=t, node, %TMPparam%, %GDXparam2set2%, %GDXparam2% ;
$batInclude runR.inc %GDXfile% %TMPparam% %GDXparam2%
......@@ -203,10 +227,12 @@ $set GDXfile plot4r.gdx
$set GDXparam r_state
$set TMPparam r_state_DH1
$set Ylabel Temperture (Celcius) :
Parameter %TMPparam%(t,node) "Temperature at Domestic Hot Water Tank (Celcius)" ;
$set Ylabel2 %Ylabel2_alt1%
Parameter %TMPparam%(t,*) "Temperature at Domestic Hot Water Tank (Celcius)" ;
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, %GDXparam%;
* Below line is adjusted for each paramGDX and paramPlot pair
%TMPparam%(tparam(t),node)$(node_building2node("IDA_ESBO_DH1",node)) = sum((grid,f)$(sameas(grid,"building") and sameas(f,'f00')),%GDXparam%(grid,node,f,t) - c2k + eps);
*%TMPparam%(tparam(t),'out_temp')=16;
execute_unload 'plots/%GDXfile%', tparam=t, node, %TMPparam%, %GDXparam2set2%, %GDXparam2% ;
$batInclude runR.inc %GDXfile% %TMPparam% %GDXparam2%
* Plot r_state: Building DH2 *******************************************************
......@@ -214,10 +240,12 @@ $set GDXfile plot4r.gdx
$set GDXparam r_state
$set TMPparam r_state_DH2
$set Ylabel Temperture (Celcius) :
Parameter %TMPparam%(t,node) "Temperature at Domestic Hot Water Tank (Celcius)" ;
$set Ylabel2 %Ylabel2_alt1%
Parameter %TMPparam%(t,*) "Temperature at Domestic Hot Water Tank (Celcius)" ;
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, %GDXparam%;
* Below line is adjusted for each paramGDX and paramPlot pair
%TMPparam%(tparam(t),node)$(node_building2node("IDA_ESBO_DH2",node)) = sum((grid,f)$(sameas(grid,"building") and sameas(f,'f00')),%GDXparam%(grid,node,f,t) - c2k + eps);
*%TMPparam%(tparam(t),'out_temp')=16;
execute_unload 'plots/%GDXfile%', tparam=t, node, %TMPparam%, %GDXparam2set2%, %GDXparam2% ;
$batInclude runR.inc %GDXfile% %TMPparam% %GDXparam2%
* Plot r_state: Building AB *******************************************************
......@@ -225,9 +253,11 @@ $set GDXfile plot4r.gdx
$set GDXparam r_state
$set TMPparam r_state_AB
$set Ylabel Temperture (Celcius) :
Parameter %TMPparam%(t,node) "Temperature at Domestic Hot Water Tank (Celcius)" ;
$set Ylabel2 %Ylabel2_alt1%
Parameter %TMPparam%(t,*) "Temperature at Domestic Hot Water Tank (Celcius)" ;
execute_loaddc "%backbone_output_GDX%", tparam=t_realized, %GDXparam%;
* Below line is adjusted for each paramGDX and paramPlot pair
%TMPparam%(tparam(t),node)$(node_building2node("IDA_ESBO_AB",node)) = sum((grid,f)$(sameas(grid,"building") and sameas(f,'f00')),%GDXparam%(grid,node,f,t) - c2k + eps);
*%TMPparam%(tparam(t),'out_temp')=16;
execute_unload 'plots/%GDXfile%', tparam=t, node, %TMPparam%, %GDXparam2set2%, %GDXparam2% ;
$batInclude runR.inc %GDXfile% %TMPparam% %GDXparam2%
Supports Markdown
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