ProgettoMartinelli2023/Fig_src/gnuplot/bin/gnuplot_figs_cmp.gp

14014 lines
431 KiB
Gnuplot
Executable File

################################################
# plot the measure (Mean or Variance) as a function of time (on x axis)
# generate plot for aqua terminal
aqua=1
# generate plot for table terminal (print out a multicolumn ASCII table of X Y {Z} R values)
table=1
# generate plot for tikz: standalone output
tikzsa=1
# transparence for filledcurves (confidence interval)
filltransparence=0.3
# gnuplot data file separator
set datafile separator whitespace
# Enable the use of macros
set macros
# unitary cost of energy
costE=1
# unitary cost of having a switch unavailable
costU=10
# cost of having at least a frozen switch at some point during the day
costF=2000
# number of values for Deltam (DPm max age)
ndeltam=5
# number of values for Tthr
ndeltat=6
# number of values for T epsilon1
nepsilon1=7
# number of values for T epsilon2
nepsilon2=7
# number of values for DPepsilon1
ndpepsilon1=7
# number of values for DPepsilon2
ndpepsilon2=7
# time of analysis (min)
t=1440
# number of swithces
n=19
# energy consumed for time unit
energyfortimeunit=7.4/60.0
# get name of current dir
cmd="mypath=$(pwd | sed -e 's/_/-/g'); echo ${mypath##*/} "
currdir=system(cmd)
# bin path
bin="../bin/"
dir="./"
csvfile="Results_results.csv"
csvgzfile="Results_results.csv.gz"
# data file path for scenario name
datapath(name)=sprintf("../%s/%s",name,csvgzfile)
# dir path for data of scenario name
dirdatapath(name)=sprintf("../%s/",name)
# print to check info
print "data file csv: " . csvfile
print "current directory: " . currdir
# get the i-th element of a list s of values separed by sep
wordsep(s,i,sep)=system("echo ".s." |awk '{split($0,v,\"'".sep."'\");print v[".i."]}'")
# remove ext from input
remext(s)=system("echo \"" . tikzfilesa . " \" | awk -F'.' '{NF-=1}1' OFS='.'")
# modulus function
mod(x,y) = (x-floor(x/y)*y)
# round function
round(x)=floor(x +0.5)
# round minutes function, x sec (ending +1 is needed to fix the label for 4800=01:20, otherwise it is labeled with 01:19)
roundmin(x)=floor(x/60.0 +0.5)*60+1
# input function of xticlabels to skip labels based on a step
hhmmlabels(i,step,norm)=(mod(column(0),step)==0)?strftime("%002tH:%002tM",roundmin(column(i)*norm)):NaN
#
# old function where 24:00 is printed as 0:0
# hhmmlabels(i,step,norm)=(mod(column(0),step)==0)?sprintf("%002d:%002d",tm_hour(column(i)*norm),tm_min(column(i)*norm)):NaN
# get global column index of the j-th entry of the i-th block, where each block groups k columns
gcolind(i,j,k)=(i-1)*k+j
# get global column index of the j-th entry of the i-th block (passed by name), where each block groups k columns, nodeind(name)+1 is the index of the i-th block
gcolindbyNodeName(name,j,k)=nodeind(name)*k+j
# convert string to number
ston(i)=i+0
reset
# Delay
fig="01"
measuretype="AvailabilityEnergy"
study="POLICY_0_NN"
title="Threshold-based policy for Alg1, when no channel fails"
scenarios="sim_WScenario_m15_1_1_1_POLICY_0_NN sim_WScenario_m15_1_10_1_POLICY_0_NN sim_WScenario_m15_10_1_10_POLICY_0_NN sim_WScenario_m15_10_10_10_POLICY_0_NN" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret=sprintf("%s", measurelabel)
measuret2=sprintf("%s", measurelabel2)
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(T_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:400]
set y2range [0:1800]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('0' 0,'1' 1,'2' 2,'3' 3) nomirror;\
set xlabel '\\(T_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:3.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 25); set ytics add ('' 400)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.1f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.1f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:25]; set y2range [0:1800];\
set ytics add ('25' 25)"
BYRANGES = "set yrange [0:400]; set y2range [0:1800];\
set ytics add ('400' 400)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:25]; set y2range [0:1800];\
set ytics add ('25' 25)"
BYLOGRANGES = "set yrange [0.001:400]; set y2range [0:1800];\
set ytics add ('400' 400)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot "<" .bin. "/datagz.bash " . measure . " " . data(1) using ($0):($3*t*n) with lp ls 1 title measuret axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(1) using ($0):3 with lp ls 1+m title measuret2 axes x1y2'
# plot for scenario2
PLOT2='plot "<" .bin. "/datagz.bash " . measure . " " . data(2) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(2) using ($0):3 with lp ls 1+m notitle axes x1y2'
LOGPLOT2='plot "<" .bin. "/datagz.bash " . measure . " " . data(2) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
0.0001 with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(2) using ($0):3 with lp ls 1+m notitle axes x1y2'
# plot for scenario3
PLOT3='plot "<" .bin. "/datagz.bash " . measure . " " . data(3) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(3) using ($0):3 with lp ls 1+m notitle axes x1y2'
# plot for scenario4
PLOT4='plot "<" .bin. "/datagz.bash " . measure . " " . data(4) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(4) using ($0):3 with lp ls 1+m notitle axes x1y2'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="02"
measuretype="AvailabilityEnergy"
study="POLICY_2_NN"
title="Forecast-offset-based policy for Alg1, when no channel fails"
scenarios="sim_WScenario_m15_1_1_1_POLICY_2_NN sim_WScenario_m15_1_10_1_POLICY_2_NN sim_WScenario_m15_10_1_10_POLICY_2_NN sim_WScenario_m15_10_10_10_POLICY_2_NN" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon1] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon1] style line i+ndpepsilon1 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# dpepsilon1 values
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:400]
set y2range [0:800]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('-3' 0,'-2' 1,'-1' 2,'0' 3,'1' 4,'2' 5,'3' 6) nomirror;\
set xlabel '\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 25); set ytics add ('' 400)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:25]; set y2range [0:1800];\
set ytics add ('25' 25)"
BYRANGES = "set yrange [0:400]; set y2range [0:1800];\
set ytics add ('400' 400)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:25]; set y2range [0:1800];\
set ytics add ('25' 25)"
BYLOGRANGES = "set yrange [0.001:400]; set y2range [0:1800];\
set ytics add ('400' 400)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# [ http://lowrank.net/gnuplot/datafile2-e.html#7.6 ]
#every I:J:K:L:M:N
#I Line increment
#J Data block increment
#K The first line
#L The first data block
#M The last line
#N The last data block
#every 2 plot every 2 line
#every ::3 plot from the 3-rd lines
#every ::3::5 plot from the 3-rd to 5-th lines
#every ::0::0 plot the first line only
#every 2::::6 plot the 1,3,5,7-th lines
#every :2 plot every 2 data block
#every :::5::8 plot from 5-th to 8-th data blocks
# plot for scenario1
PLOT1='plot for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure . " " . data(1) every ndpepsilon1::i-1 using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ndpepsilon1::i-1 using ($0):3 with lp ls i+ndpepsilon1 title measuret2(i) axes x1y2'
PLOT1y2='plot for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ndpepsilon1::i-1 using ($0):3 with lp ls i+ndpepsilon1 notitle axes x1y2'
# plot for scenario2
PLOT2='plot for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndpepsilon1::i-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndpepsilon1::i-1 using ($0):3 with lp ls i+ndpepsilon1 notitle axes x1y2'
# plot for scenario3
PLOT3='plot for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure . " " . data(3) every ndpepsilon1::i-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure2 . " " . data(3) every ndpepsilon1::i-1 using ($0):3 with lp ls i+ndpepsilon1 notitle axes x1y2'
# plot for scenario4
PLOT4='plot for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure . " " . data(4) every ndpepsilon1::i-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndpepsilon1::i-1 using ($0):3 with lp ls i+ndpepsilon1 notitle axes x1y2'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
# zoom
set tmargin at screen 0.75; set bmargin at screen 0.65
set lmargin at screen 0.2; set rmargin at screen 0.42
set border 15
unset label
unset xlabel
unset ylabel
unset ytics
unset y2label
set xrange [-0.2:3.2]
set y2range [*:*]
set y2tics 0,4
@PLOT1y2
set y2tics auto
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set key at graph -0.5, graph 1 horizontal spacing 1.8 maxrows 14
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="02bis"
measuretype="AvailabilityEnergy"
study="POLICY_2_NN"
title="Forecast-offset-based policy for Alg1, when no channel fails"
scenarios="sim_WScenario_m15_1_1_1_POLICY_2_NN sim_WScenario_m15_1_10_1_POLICY_2_NN sim_WScenario_m15_10_1_10_POLICY_2_NN sim_WScenario_m15_10_10_10_POLICY_2_NN" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon1] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon1] style line i+ndpepsilon1 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# epsilon1 values
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, \\(\\tilde{T}_{thr}\\)=%s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, \\(\\tilde{T}_{thr}\\)=%s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}^{dew}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:400]
set y2range [0:800]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('-3' 0,'-2' 1,'-1' 2,'0' 3,'1' 4,'2' 5,'3' 6) nomirror;\
set xlabel '\\(\\tilde{T}^{dew}_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 25); set ytics add ('' 400)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:25]; set y2range [0:1800];\
set ytics add ('25' 25)"
BYRANGES = "set yrange [0:400]; set y2range [0:1800];\
set ytics add ('400' 400)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:25]; set y2range [0:1800];\
set ytics add ('25' 25)"
BYLOGRANGES = "set yrange [0.001:400]; set y2range [0:1800];\
set ytics add ('400' 400)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure . " " . data(1) every ::(i-1)*ndpepsilon1::i*ndpepsilon1-1 using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ::(i-1)*ndpepsilon1::i*ndpepsilon1-1 using ($0):3 with lp ls i+ndpepsilon1 title measuret2(i) axes x1y2'
# plot for scenario2
PLOT2='plot for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ::(i-1)*ndpepsilon1::i*ndpepsilon1-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ::(i-1)*ndpepsilon1::i*ndpepsilon1-1 using ($0):3 with lp ls i+ndpepsilon1 notitle axes x1y2'
# plot for scenario3
PLOT3='plot for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure . " " . data(3) every ::(i-1)*ndpepsilon1::i*ndpepsilon1-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure2 . " " . data(3) every ::(i-1)*ndpepsilon1::i*ndpepsilon1-1 using ($0):3 with lp ls i+ndpepsilon1 notitle axes x1y2'
# plot for scenario4
PLOT4='plot for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure . " " . data(4) every ::(i-1)*ndpepsilon1::i*ndpepsilon1-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon1] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ::(i-1)*ndpepsilon1::i*ndpepsilon1-1 using ($0):3 with lp ls i+ndpepsilon1 notitle axes x1y2'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set key at graph -0.5, graph 1 horizontal spacing 1.8 maxrows 14
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="03"
measuretype="AvailabilityEnergy"
study="POLICY_NN_0"
title="Threshold-based policy for Alg2, when no channel works"
scenarios="sim_WScenario_m15_1_1_1_POLICY_NN_0 sim_WScenario_m15_1_10_1_POLICY_NN_0 sim_WScenario_m15_10_1_10_POLICY_NN_0 sim_WScenario_m15_10_10_10_POLICY_NN_0" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey="Cost"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret=sprintf("%s", measurelabel)
measuret2=sprintf("%s", measurelabel2)
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(T_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:*]
set y2range [0:*]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('0' 0,'1' 1,'2' 2,'3' 3) nomirror;\
set xlabel '\\(T_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:3.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 20); set ytics add ('' 0.1)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
TYTICS = "set format y '%.0f'; set ylabel measurey offset -1"
BYTICS = "set format y '%.2f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:20]; set y2range [0:3500];\
set ytics add ('20' 20)"
BYRANGES = "set yrange [0:0.1]; set y2range [0:3500];\
set ytics add ('0.1' 0.1)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:20]; set y2range [0:3500];\
unset ytics; set ytics add ('20' 20)"
BYLOGRANGES = "set yrange [0.001:0.1]; set y2range [0:3500];\
unset ytics; set ytics add ('0.1' 0.1)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot "<" .bin. "/datagz.bash " . measure . " " . data(1) using ($0):($3*t*n) with lp ls 1 title measuret axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(1) using ($0):3 with lp ls 1+m title measuret2 axes x1y2'
# plot for scenario2
PLOT2='plot "<" .bin. "/datagz.bash " . measure . " " . data(2) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(2) using ($0):3 with lp ls 1+m notitle axes x1y2'
LOGPLOT2='plot "<" .bin. "/datagz.bash " . measure . " " . data(2) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
0.0001 with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(2) using ($0):3 with lp ls 1+m notitle axes x1y2'
# plot for scenario3
PLOT3='plot "<" .bin. "/datagz.bash " . measure . " " . data(3) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(3) using ($0):3 with lp ls 1+m notitle axes x1y2'
# plot for scenario4
PLOT4='plot "<" .bin. "/datagz.bash " . measure . " " . data(4) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(4) using ($0):3 with lp ls 1+m notitle axes x1y2'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@LOGPLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="04"
measuretype="AvailabilityEnergy"
study="POLICY_NN_2"
# the position in the list of values for deltam (starting from 0)
deltamind="2"
# dpepsilon2 values
deltamvalues="'0' '5' '10' '15' '20'"
title=sprintf("Forecast-offset-based policy for Alg2, when no channel works, \\(\\Delta_m=%s\\)",word(deltamvalues,ston(deltamind)+1))
scenarios="sim_WScenario_m15_1_1_1_POLICY_NN_2 sim_WScenario_m15_1_10_1_POLICY_NN_2 sim_WScenario_m15_10_1_10_POLICY_NN_2 sim_WScenario_m15_10_10_10_POLICY_NN_2" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon2] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon2] style line i+ndpepsilon2 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# dpepsilon2 values (for DP)
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
#set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set xtics 0,1,5 ("0" 0,"5" 1,"10" 2,"15" 3,"20" 4) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:140]
set y2range [0:3500]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('-3' 0,'-2' 1,'-1' 2,'0' 3,'1' 4,'2' 5,'3' 6) nomirror;\
set xlabel '\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 250); set ytics add ('' 180)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('250' 250)"
BYRANGES = "set yrange [0:180]; set y2range [0:3500];\
set ytics add ('180' 180)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
unset ytics; set ytics add ('250' 250)"
BYLOGRANGES = "set yrange [0.001:180]; set y2range [0:3500];\
unset ytics; set ytics add ('180' 180)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 title measuret2(i) axes x1y2'
# plot for scenario2
PLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
LOGPLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
0.0001 with lp ls 1 notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario3
PLOT3='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario4
PLOT4='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
PLOT4y2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
set term tikz
set output tikzfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
# zoom
set tmargin at screen 0.4; set bmargin at screen 0.25
set lmargin at screen 0.6; set rmargin at screen 0.8
set border 15
unset label
unset xlabel
unset ylabel
unset ytics
unset y2label
set xrange [0.8:3.2]
set y2range [*:*]
set y2tics 0,20
@PLOT4y2
set y2tics auto
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@LOGPLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="04b"
measuretype="AvailabilityEnergy"
study="POLICY_NN_2"
# the position in the list of values for deltam (starting from 0)
deltamind="0"
# dpepsilon2 values
deltamvalues="'0' '5' '10' '15' '20'"
title=sprintf("Forecast-offset-based policy for Alg2, when no channel works, \\(\\Delta_m=%s\\)",word(deltamvalues,ston(deltamind)+1))
scenarios="sim_WScenario_m15_1_1_1_POLICY_NN_2 sim_WScenario_m15_1_10_1_POLICY_NN_2 sim_WScenario_m15_10_1_10_POLICY_NN_2 sim_WScenario_m15_10_10_10_POLICY_NN_2" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon2] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon2] style line i+ndpepsilon2 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# dpepsilon2 values (for DP)
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
#set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set xtics 0,1,5 ("0" 0,"5" 1,"10" 2,"15" 3,"20" 4) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:140]
set y2range [0:3500]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('-3' 0,'-2' 1,'-1' 2,'0' 3,'1' 4,'2' 5,'3' 6) nomirror;\
set xlabel '\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 250); set ytics add ('' 180)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('250' 250)"
BYRANGES = "set yrange [0:180]; set y2range [0:3500];\
set ytics add ('180' 180)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
unset ytics; set ytics add ('150' 250)"
BYLOGRANGES = "set yrange [0.001:180]; set y2range [0:3500];\
unset ytics; set ytics add ('180' 180)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 title measuret2(i) axes x1y2'
# plot for scenario2
PLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
LOGPLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
0.0001 with lp ls 1 notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario3
PLOT3='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario4
PLOT4='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
PLOT4y2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
set term tikz
set output tikzfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
# zoom
set tmargin at screen 0.4; set bmargin at screen 0.25
set lmargin at screen 0.6; set rmargin at screen 0.8
set border 15
unset label
unset xlabel
unset ylabel
unset ytics
unset y2label
set xrange [0.8:3.2]
set y2range [*:*]
set y2tics 0,20
@PLOT4y2
set y2tics auto
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@LOGPLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="04c"
measuretype="AvailabilityEnergy"
study="POLICY_NN_2"
# the position in the list of values for deltam (starting from 0)
deltamind="4"
# dpepsilon2 values
deltamvalues="'0' '5' '10' '15' '20'"
title=sprintf("Forecast-offset-based policy for Alg2, when no channel works, \\(\\Delta_m=%s\\)",word(deltamvalues,ston(deltamind)+1))
scenarios="sim_WScenario_m15_1_1_1_POLICY_NN_2 sim_WScenario_m15_1_10_1_POLICY_NN_2 sim_WScenario_m15_10_1_10_POLICY_NN_2 sim_WScenario_m15_10_10_10_POLICY_NN_2" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon2] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon2] style line i+ndpepsilon2 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# dpepsilon2 values (for DP)
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
#set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set xtics 0,1,5 ("0" 0,"5" 1,"10" 2,"15" 3,"20" 4) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:140]
set y2range [0:3500]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('-3' 0,'-2' 1,'-1' 2,'0' 3,'1' 4,'2' 5,'3' 6) nomirror;\
set xlabel '\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 250); set ytics add ('' 180)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('250' 250)"
BYRANGES = "set yrange [0:180]; set y2range [0:3500];\
set ytics add ('180' 180)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
unset ytics; set ytics add ('250' 250)"
BYLOGRANGES = "set yrange [0.001:180]; set y2range [0:3500];\
unset ytics; set ytics add ('180' 180)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 title measuret2(i) axes x1y2'
# plot for scenario2
PLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
LOGPLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
0.0001 with lp ls 1 notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario3
PLOT3='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario4
PLOT4='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
PLOT4y2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
set term tikz
set output tikzfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
# zoom
set tmargin at screen 0.4; set bmargin at screen 0.25
set lmargin at screen 0.6; set rmargin at screen 0.8
set border 15
unset label
unset xlabel
unset ylabel
unset ytics
unset y2label
set xrange [0.8:3.2]
set y2range [*:*]
set y2tics 0,20
@PLOT4y2
set y2tics auto
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@LOGPLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="04bis"
measuretype="AvailabilityEnergy"
study="POLICY_NN_2"
# the position in the list of values for deltam (starting from 0)
deltamind="2"
# dpepsilon2 values
deltamvalues="'0' '5' '10' '15' '20'"
title=sprintf("Forecast-offset-based policy for Alg2, when no channel works, \\(\\Delta_m=%s\\)",word(deltamvalues,ston(deltamind)+1))
scenarios="sim_WScenario_m15_1_1_1_POLICY_NN_2 sim_WScenario_m15_1_10_1_POLICY_NN_2 sim_WScenario_m15_10_1_10_POLICY_NN_2 sim_WScenario_m15_10_10_10_POLICY_NN_2" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon2] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon2] style line i+ndpepsilon2 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# epsilon2 values (for T)
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, \\(\\tilde{T}_{thr}\\)=%s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, \\(\\tilde{T}_{thr}\\)=%s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
#set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set xtics 0,1,5 ("0" 0,"5" 1,"10" 2,"15" 3,"20" 4) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:140]
set y2range [0:3500]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('-3' 0,'-2' 1,'-1' 2,'0' 3,'1' 4,'2' 5,'3' 6) nomirror;\
set xlabel '\\(\\tilde{T}^{dew}_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 70); set ytics add ('' 70)"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 250); set ytics add ('' 180)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('250' 250)"
BYRANGES = "set yrange [0:180]; set y2range [0:3500];\
set ytics add ('180' 180)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
unset ytics; set ytics add ('250' 250)"
BYLOGRANGES = "set yrange [0.001:180]; set y2range [0:3500];\
unset ytics; set ytics add ('180' 180)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(1) every ndeltam::(i-1)*ndeltam*ndpepsilon2+deltamind::(i-1)*ndeltam*ndpepsilon2+deltamind+ndeltam*(ndpepsilon2-1) using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ndeltam::(i-1)*ndeltam*ndpepsilon2+deltamind::(i-1)*ndeltam*ndpepsilon2+deltamind+ndeltam*(ndpepsilon2-1) using ($0):3 with lp ls i+nepsilon2 title measuret2(i) axes x1y2'
# plot for scenario2
PLOT2='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam::(i-1)*ndeltam*ndpepsilon2+deltamind::(i-1)*ndeltam*ndpepsilon2+deltamind+ndeltam*(ndpepsilon2-1) using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam::(i-1)*ndeltam*ndpepsilon2+deltamind::(i-1)*ndeltam*ndpepsilon2+deltamind+ndeltam*(ndpepsilon2-1) using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
LOGPLOT2='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam::(i-1)*ndeltam*ndpepsilon2+deltamind::(i-1)*ndeltam*ndpepsilon2+deltamind+ndeltam*(ndpepsilon2-1) using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
0.0001 with lp ls 1 notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam::(i-1)*ndeltam*ndpepsilon2+deltamind::(i-1)*ndeltam*ndpepsilon2+deltamind+ndeltam*(ndpepsilon2-1) using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
# plot for scenario3
PLOT3='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(3) every ndeltam::(i-1)*ndeltam*ndpepsilon2+deltamind::(i-1)*ndeltam*ndpepsilon2+deltamind+ndeltam*(ndpepsilon2-1) using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(3) every ndeltam::(i-1)*ndeltam*ndpepsilon2+deltamind::(i-1)*ndeltam*ndpepsilon2+deltamind+ndeltam*(ndpepsilon2-1) using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
# plot for scenario4
PLOT4='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(4) every ndeltam::(i-1)*ndeltam*ndpepsilon2+deltamind::(i-1)*ndeltam*ndpepsilon2+deltamind+ndeltam*(ndpepsilon2-1) using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam::(i-1)*ndeltam*ndpepsilon2+deltamind::(i-1)*ndeltam*ndpepsilon2+deltamind+ndeltam*(ndpepsilon2-1) using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
PLOT4y2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam::(i-1)*ndeltam*ndpepsilon2+deltamind::(i-1)*ndeltam*ndpepsilon2+deltamind+ndeltam*(ndpepsilon2-1) using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
set term tikz
set output tikzfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
# zoom
set tmargin at screen 0.4; set bmargin at screen 0.25
set lmargin at screen 0.6; set rmargin at screen 0.8
set border 15
unset label
unset xlabel
unset ylabel
unset ytics
unset y2label
set xrange [0.8:3.2]
set y2range [*:*]
set y2tics 0,20
@PLOT4y2
set y2tics auto
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@LOGPLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="05"
measuretype="AvailabilityEnergy"
study="POLICY_NN_2"
# the position in the list of values for dpepsilon2 (starting from 0)
dpepsilon2ind="3"
# dpepsilon2 values
dpepsilon2values="'-3' '-2' '-1' '0' '1' '2' '3'"
title=sprintf("Forecast-offset-based policy for Alg2, when no channel works, \\(\\tilde{T}^{dew}_{thr}=%s\\)",word(dpepsilon2values,ston(dpepsilon2ind)+1))
scenarios="sim_WScenario_m15_1_1_1_POLICY_NN_2 sim_WScenario_m15_1_10_1_POLICY_NN_2 sim_WScenario_m15_10_1_10_POLICY_NN_2 sim_WScenario_m15_10_10_10_POLICY_NN_2" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon2] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon2] style line i+ndpepsilon2 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# epsilon2 values (for T)
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, \\(\\tilde{T}_{thr}\\)=%s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, \\(\\tilde{T}_{thr}\\)=%s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\Delta m\\)"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
#set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set xtics 0,1,5 ("0" 0,"5" 1,"10" 2,"15" 3,"20" 4) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:140]
set y2range [0:3500]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('0' 0,'5' 1,'10' 2,'15' 3,'20' 4) nomirror;\
set xlabel '\\(\\Delta m\\)';\
set xrange [-0.2:4.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 25); set ytics add ('' 400)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges BRy2:[2600:3300]
TYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('25' 25)"
BYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('400' 400)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
set ytics add ('25' 25)"
BYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
set ytics add ('400' 400)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(1) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):3 with lp ls i+nepsilon2 title measuret2(i) axes x1y2'
# plot for scenario2
PLOT2='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
# plot for scenario3
PLOT3='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(3) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(3) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
# plot for scenario4
PLOT4='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(4) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
set term tikz
set output tikzfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="05b"
measuretype="AvailabilityEnergy"
study="POLICY_NN_2"
# the position in the list of values for dpepsilon2 (starting from 0)
dpepsilon2ind="0"
# dpepsilon2 values
dpepsilon2values="'-3' '-2' '-1' '0' '1' '2' '3'"
title=sprintf("Forecast-offset-based policy for Alg2, when no channel works, \\(\\tilde{T}^{dew}_{thr}=%s\\)",word(dpepsilon2values,ston(dpepsilon2ind)+1))
scenarios="sim_WScenario_m15_1_1_1_POLICY_NN_2 sim_WScenario_m15_1_10_1_POLICY_NN_2 sim_WScenario_m15_10_1_10_POLICY_NN_2 sim_WScenario_m15_10_10_10_POLICY_NN_2" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon2] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon2] style line i+ndpepsilon2 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# epsilon2 values (for T)
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, \\(\\tilde{T}_{thr}\\)=%s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, \\(\\tilde{T}_{thr}\\)=%s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\Delta m\\)"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
#set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set xtics 0,1,5 ("0" 0,"5" 1,"10" 2,"15" 3,"20" 4) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:140]
set y2range [0:3500]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('0' 0,'5' 1,'10' 2,'15' 3,'20' 4) nomirror;\
set xlabel '\\(\\Delta m\\)';\
set xrange [-0.2:4.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 25); set ytics add ('' 400)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges BRy2:[2600:3300]
TYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('25' 25)"
BYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('400' 400)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
set ytics add ('25' 25)"
BYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
set ytics add ('400' 400)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(1) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):3 with lp ls i+nepsilon2 title measuret2(i) axes x1y2'
# plot for scenario2
PLOT2='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
# plot for scenario3
PLOT3='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(3) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(3) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
# plot for scenario4
PLOT4='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(4) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
set term tikz
set output tikzfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="05c"
measuretype="AvailabilityEnergy"
study="POLICY_NN_2"
# the position in the list of values for dpepsilon2 (starting from 0)
dpepsilon2ind="6"
# dpepsilon2 values
dpepsilon2values="'-3' '-2' '-1' '0' '1' '2' '3'"
title=sprintf("Forecast-offset-based policy for Alg2, when no channel works, \\(\\tilde{T}^{dew}_{thr}=%s\\)",word(dpepsilon2values,ston(dpepsilon2ind)+1))
scenarios="sim_WScenario_m15_1_1_1_POLICY_NN_2 sim_WScenario_m15_1_10_1_POLICY_NN_2 sim_WScenario_m15_10_1_10_POLICY_NN_2 sim_WScenario_m15_10_10_10_POLICY_NN_2" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon2] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon2] style line i+ndpepsilon2 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# epsilon2 values (for T)
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, \\(\\tilde{T}_{thr}\\)=%s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, \\(\\tilde{T}_{thr}\\)=%s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\Delta m\\)"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
#set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set xtics 0,1,5 ("0" 0,"5" 1,"10" 2,"15" 3,"20" 4) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:140]
set y2range [0:3500]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('0' 0,'5' 1,'10' 2,'15' 3,'20' 4) nomirror;\
set xlabel '\\(\\Delta m\\)';\
set xrange [-0.2:4.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 25); set ytics add ('' 400)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges BRy2:[2600:3300]
TYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('25' 25)"
BYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('400' 400)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
set ytics add ('25' 25)"
BYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
set ytics add ('400' 400)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(1) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):3 with lp ls i+nepsilon2 title measuret2(i) axes x1y2'
# plot for scenario2
PLOT2='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
# plot for scenario3
PLOT3='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(3) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(3) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
# plot for scenario4
PLOT4='plot for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(4) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:nepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ::(i-1)*ndpepsilon2*ndeltam+dpepsilon2ind*ndeltam::(i-1)*ndpepsilon2*ndeltam+(dpepsilon2ind+1)*ndeltam-1 using ($0):3 with lp ls i+nepsilon2 notitle axes x1y2'
set term tikz
set output tikzfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="05bis"
measuretype="AvailabilityEnergy"
study="POLICY_NN_2"
# the position in the list of values for epsilon2 (starting from 0)
epsilon2ind="0"
# dpepsilon2 values
epsilon2values="'-3' '-2' '-1' '0' '1' '2' '3'"
title=sprintf("Forecast-offset-based policy for Alg2, when no channel works, \\(\\tilde{T}_{thr}=%s\\)",word(epsilon2values,ston(epsilon2ind)+1))
scenarios="sim_WScenario_m15_1_1_1_POLICY_NN_2 sim_WScenario_m15_1_10_1_POLICY_NN_2 sim_WScenario_m15_10_1_10_POLICY_NN_2 sim_WScenario_m15_10_10_10_POLICY_NN_2" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon2] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon2] style line i+ndpepsilon2 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# dpepsilon2 values (for PD)
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\Delta m\\)"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
#set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set xtics 0,1,5 ("0" 0,"5" 1,"10" 2,"15" 3,"20" 4) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:140]
set y2range [0:3500]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('0' 0,'5' 1,'10' 2,'15' 3,'20' 4) nomirror;\
set xlabel '\\(\\Delta m\\)';\
set xrange [-0.2:4.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 25); set ytics add ('' 400)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges BRy2:[2600:3300]
TYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('25' 25)"
BYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('400' 400)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
set ytics add ('25' 25)"
BYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
set ytics add ('400' 400)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(1) every ::epsilon2ind*ndeltam*ndpepsilon2+(i-1)*ndeltam::epsilon2ind*ndeltam*ndpepsilon2+i*ndeltam-1 using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ::epsilon2ind*ndeltam*ndpepsilon2+(i-1)*ndeltam::epsilon2ind*ndeltam*ndpepsilon2+i*ndeltam-1 using ($0):3 with lp ls i+ndpepsilon2 title measuret2(i) axes x1y2'
# plot for scenario2
PLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ::epsilon2ind*ndeltam*ndpepsilon2+(i-1)*ndeltam::epsilon2ind*ndeltam*ndpepsilon2+i*ndeltam-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ::epsilon2ind*ndeltam*ndpepsilon2+(i-1)*ndeltam::epsilon2ind*ndeltam*ndpepsilon2+i*ndeltam-1 using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario3
PLOT3='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(3) every ::epsilon2ind*ndeltam*ndpepsilon2+(i-1)*ndeltam::epsilon2ind*ndeltam*ndpepsilon2+i*ndeltam-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(3) every ::epsilon2ind*ndeltam*ndpepsilon2+(i-1)*ndeltam::epsilon2ind*ndeltam*ndpepsilon2+i*ndeltam-1 using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario4
PLOT4='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(4) every ::epsilon2ind*ndeltam*ndpepsilon2+(i-1)*ndeltam::epsilon2ind*ndeltam*ndpepsilon2+i*ndeltam-1 using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ::epsilon2ind*ndeltam*ndpepsilon2+(i-1)*ndeltam::epsilon2ind*ndeltam*ndpepsilon2+i*ndeltam-1 using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
set term tikz
set output tikzfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="10"
measuretype="AvailabilityEnergy"
study="POLICY_0_0"
title="Threshold-based policy for Alg1 and Alg2, with T-based channel failure"
scenarios="sim_WScenario_m15_1_1_1_POLICY_0_0 sim_WScenario_m15_1_10_1_POLICY_0_0 sim_WScenario_m15_10_1_10_POLICY_0_0 sim_WScenario_m15_10_10_10_POLICY_0_0" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret=sprintf("%s", measurelabel)
measuret2=sprintf("%s", measurelabel2)
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(T_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:400]
set y2range [0:1800]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('0' 0,'1' 1,'2' 2,'3' 3) nomirror;\
set xlabel '\\(T_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:3.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 25); set ytics add ('' 400)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:25]; set y2range [0:1800];\
set ytics add ('25' 25)"
BYRANGES = "set yrange [0:400]; set y2range [0:1800];\
set ytics add ('400' 400)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:25]; set y2range [0:1800];\
set ytics add ('25' 25)"
BYLOGRANGES = "set yrange [0.001:400]; set y2range [0:1800];\
set ytics add ('400' 400)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot "<" .bin. "/datagz.bash " . measure . " " . data(1) using ($0):($3*t*n) with lp ls 1 title measuret axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(1) using ($0):3 with lp ls 1+m title measuret2 axes x1y2'
# plot for scenario2
PLOT2='plot "<" .bin. "/datagz.bash " . measure . " " . data(2) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(2) using ($0):3 with lp ls 1+m notitle axes x1y2'
# plot for scenario3
PLOT3='plot "<" .bin. "/datagz.bash " . measure . " " . data(3) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(3) using ($0):3 with lp ls 1+m notitle axes x1y2'
# plot for scenario4
PLOT4='plot "<" .bin. "/datagz.bash " . measure . " " . data(4) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(4) using ($0):3 with lp ls 1+m notitle axes x1y2'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="11"
measuretype="AvailabilityEnergy"
study="POLICY_2_2"
# the position in the list of values for deltam (starting from 0)
deltamind="2"
# dpepsilon2 values
deltamvalues="'0' '5' '10' '15' '20'"
title=sprintf("Forecast-offset-based policy for Alg1 and Alg2, with T-based channel failure, \\(\\Delta_m=%s\\)",word(deltamvalues,ston(deltamind)+1))
scenarios="sim_WScenario_m15_1_1_1_POLICY_2_2 sim_WScenario_m15_1_10_1_POLICY_2_2 sim_WScenario_m15_10_1_10_POLICY_2_2 sim_WScenario_m15_10_10_10_POLICY_2_2" # space separed list of scenario§s to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon2] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon2] style line i+ndpepsilon2 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# dpepsilon2 values (for DP)
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
#set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set xtics 0,1,5 ("0" 0,"5" 1,"10" 2,"15" 3,"20" 4) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:140]
set y2range [0:3500]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('-3' 0,'-2' 1,'-1' 2,'0' 3,'1' 4,'2' 5,'3' 6) nomirror;\
set xlabel '\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 250); set ytics add ('' 450)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('250' 250)"
BYRANGES = "set yrange [0:450]; set y2range [0:3500];\
set ytics add ('250' 250); set ytics add ('450' 450)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
unset ytics; set ytics add ('250' 250)"
BYLOGRANGES = "set yrange [0.001:450]; set y2range [0:3500];\
unset ytics; set ytics add ('450' 450)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 title measuret2(i) axes x1y2'
# plot for scenario2
PLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
LOGPLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
0.0001 with lp ls 1 notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario3
PLOT3='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario4
PLOT4='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
PLOT4y2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
set term tikz
set output tikzfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
# zoom
set tmargin at screen 0.5; set bmargin at screen 0.35
set lmargin at screen 0.6; set rmargin at screen 0.8
set border 15
unset label
unset xlabel
unset ylabel
unset ytics
unset y2label
set xrange [0.8:3.2]
set y2range [*:*]
set y2tics 0,100
@PLOT4y2
set y2tics auto
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@LOGPLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="11b"
measuretype="AvailabilityEnergy"
study="POLICY_2_2"
# the position in the list of values for deltam (starting from 0)
deltamind="0"
# dpepsilon2 values
deltamvalues="'0' '5' '10' '15' '20'"
title=sprintf("Forecast-offset-based policy for Alg1 and Alg2, with T-based channel failure, \\(\\Delta_m=%s\\)",word(deltamvalues,ston(deltamind)+1))
scenarios="sim_WScenario_m15_1_1_1_POLICY_2_2 sim_WScenario_m15_1_10_1_POLICY_2_2 sim_WScenario_m15_10_1_10_POLICY_2_2 sim_WScenario_m15_10_10_10_POLICY_2_2" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon2] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon2] style line i+ndpepsilon2 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# dpepsilon2 values (for DP)
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
#set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set xtics 0,1,5 ("0" 0,"5" 1,"10" 2,"15" 3,"20" 4) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:140]
set y2range [0:3500]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('-3' 0,'-2' 1,'-1' 2,'0' 3,'1' 4,'2' 5,'3' 6) nomirror;\
set xlabel '\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 250); set ytics add ('' 450)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('250' 250)"
BYRANGES = "set yrange [0:450]; set y2range [0:3500];\
set ytics add ('250' 250); set ytics add ('450' 450)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
unset ytics; set ytics add ('250' 250)"
BYLOGRANGES = "set yrange [0.001:450]; set y2range [0:3500];\
unset ytics; set ytics add ('450' 450)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 title measuret2(i) axes x1y2'
# plot for scenario2
PLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
LOGPLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
0.0001 with lp ls 1 notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario3
PLOT3='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario4
PLOT4='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
PLOT4y2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
set term tikz
set output tikzfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
# zoom
set tmargin at screen 0.5; set bmargin at screen 0.35
set lmargin at screen 0.6; set rmargin at screen 0.8
set border 15
unset label
unset xlabel
unset ylabel
unset ytics
unset y2label
set xrange [0.8:3.2]
set y2range [*:*]
set y2tics 0,100
@PLOT4y2
set y2tics auto
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@LOGPLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="11c"
measuretype="AvailabilityEnergy"
study="POLICY_2_2"
# the position in the list of values for deltam (starting from 0)
deltamind="4"
# dpepsilon2 values
deltamvalues="'0' '5' '10' '15' '20'"
title=sprintf("Forecast-offset-based policy for Alg1 and Alg2, with T-based channel failure, \\(\\Delta_m=%s\\)",word(deltamvalues,ston(deltamind)+1))
scenarios="sim_WScenario_m15_1_1_1_POLICY_2_2 sim_WScenario_m15_1_10_1_POLICY_2_2 sim_WScenario_m15_10_1_10_POLICY_2_2 sim_WScenario_m15_10_10_10_POLICY_2_2" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon2] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon2] style line i+ndpepsilon2 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# dpepsilon2 values (for DP)
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, \\(\\tilde{T}^{dew}_{thr}\\)=%s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
#set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set xtics 0,1,5 ("0" 0,"5" 1,"10" 2,"15" 3,"20" 4) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:140]
set y2range [0:3500]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('-3' 0,'-2' 1,'-1' 2,'0' 3,'1' 4,'2' 5,'3' 6) nomirror;\
set xlabel '\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y ''; unset ylabel;\
set ytics add ('' 250); set ytics add ('' 450)"
NOY2TICS = "set format y2 ''; unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:250]; set y2range [0:3500];\
set ytics add ('250' 250)"
BYRANGES = "set yrange [0:450]; set y2range [0:3500];\
set ytics add ('250' 250); set ytics add ('450' 450)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:250]; set y2range [0:3500];\
unset ytics; set ytics add ('250' 250)"
BYLOGRANGES = "set yrange [0.001:450]; set y2range [0:3500];\
unset ytics; set ytics add ('450' 450)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 title measuret2(i) axes x1y2'
# plot for scenario2
PLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
LOGPLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
0.0001 with lp ls 1 notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario3
PLOT3='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
# plot for scenario4
PLOT4='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):($3*t*n) with lp ls i notitle axes x1y1, \
for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
PLOT4y2='plot for[i=1:ndpepsilon2] "<" .bin. "/datagz.bash " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):3 with lp ls i+ndpepsilon2 notitle axes x1y2'
set term tikz
set output tikzfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
# zoom
set tmargin at screen 0.5; set bmargin at screen 0.35
set lmargin at screen 0.6; set rmargin at screen 0.8
set border 15
unset label
unset xlabel
unset ylabel
unset ytics
unset y2label
set xrange [0.8:3.2]
set y2range [*:*]
set y2tics 0,100
@PLOT4y2
set y2tics auto
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
#replot
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@LOGPLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="20"
measuretype="AvailabilityEnergy"
study="POLICY_0_0_var_WF2Ctrl"
title="Threshold-based policy for Alg1 and Alg2, with T-based channel failure"
scenarios="sim_WScenario_m15_1_1_1_POLICY_0_0_var_WF2Ctrl sim_WScenario_m15_1_10_1_POLICY_0_0_var_WF2Ctrl sim_WScenario_m15_10_1_10_POLICY_0_0_var_WF2Ctrl sim_WScenario_m15_10_10_10_POLICY_0_0_var_WF2Ctrl" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret=sprintf("%s", measurelabel)
measuret2=sprintf("%s", measurelabel2)
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "MTB Weather Forecast (mins)"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:400]
set y2range [0:1800]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 1.0, graph 0.7
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('5' 0,'10' 1,'20' 2,'30' 3,'40' 4,'50' 5,'60' 6) nomirror;\
set xlabel 'MTB Weather Forecast (mins)';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y '';\
set ytics add ('' 25); set ytics add ('' 400)"
NOY2TICS = "set format y2 ''"
NOYLABEL = "unset ylabel"
NOY2LABEL = "unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:90]; set y2range [0:2000];\
set ytics add ('' 25)"
BYRANGES = "set yrange [0:90]; set y2range [0:2000];\
set ytics add ('' 400)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:90]; set y2range [0:2000];\
set ytics add ('25' 25)"
BYLOGRANGES = "set yrange [0.001:90]; set y2range [0:2000];\
set ytics add ('400' 400)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.45"
RMARGIN = "set lmargin at screen 0.65; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot "<" .bin. "/datagz.bash " . measure . " " . data(1) using ($0):($3*t*n) with lp ls 1 title measuret axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(1) using ($0):3 with lp ls 1+m title measuret2 axes x1y2'
# plot for scenario2
PLOT2='plot "<" .bin. "/datagz.bash " . measure . " " . data(2) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(2) using ($0):3 with lp ls 1+m notitle axes x1y2'
# plot for scenario3
PLOT3='plot "<" .bin. "/datagz.bash " . measure . " " . data(3) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(3) using ($0):3 with lp ls 1+m notitle axes x1y2'
# plot for scenario4
PLOT4='plot "<" .bin. "/datagz.bash " . measure . " " . data(4) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(4) using ($0):3 with lp ls 1+m notitle axes x1y2'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="21"
measuretype="AvailabilityEnergy"
study="POLICY_1_1_var_WF2Ctrl"
title="Forecast-R-based policy for Alg1 and Alg2, with T-based channel failure"
scenarios="sim_WScenario_m15_1_1_1_POLICY_1_1_var_WF2Ctrl sim_WScenario_m15_1_10_1_POLICY_1_1_var_WF2Ctrl sim_WScenario_m15_10_1_10_POLICY_1_1_var_WF2Ctrl sim_WScenario_m15_10_10_10_POLICY_1_1_var_WF2Ctrl" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret=sprintf("%s", measurelabel)
measuret2=sprintf("%s", measurelabel2)
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "MTB Weather Forecast (mins)"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:400]
set y2range [0:1800]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 1.0, graph 0.7
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('5' 0,'10' 1,'20' 2,'30' 3,'40' 4,'50' 5,'60' 6) nomirror;\
set xlabel 'MTB Weather Forecast (mins)';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y '';\
set ytics add ('' 25); set ytics add ('' 400)"
NOY2TICS = "set format y2 ''"
NOYLABEL = "unset ylabel"
NOY2LABEL = "unset y2label"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:90]; set y2range [0:2000];\
set ytics add ('' 25)"
BYRANGES = "set yrange [0:90]; set y2range [0:2000];\
set ytics add ('' 400)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:90]; set y2range [0:2000];\
set ytics add ('' 25)"
BYLOGRANGES = "set yrange [0.001:90]; set y2range [0:2000];\
set ytics add ('' 400)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.45"
RMARGIN = "set lmargin at screen 0.65; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot "<" .bin. "/datagz.bash " . measure . " " . data(1) using ($0):($3*t*n) with lp ls 1 title measuret axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(1) using ($0):3 with lp ls 1+m title measuret2 axes x1y2'
# plot for scenario2
PLOT2='plot "<" .bin. "/datagz.bash " . measure . " " . data(2) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(2) using ($0):3 with lp ls 1+m notitle axes x1y2'
# plot for scenario3
PLOT3='plot "<" .bin. "/datagz.bash " . measure . " " . data(3) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(3) using ($0):3 with lp ls 1+m notitle axes x1y2'
# plot for scenario4
PLOT4='plot "<" .bin. "/datagz.bash " . measure . " " . data(4) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(4) using ($0):3 with lp ls 1+m notitle axes x1y2'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@LOGPLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="22"
measuretype="AvailabilityEnergy"
study="POLICY_2_2_var_WF2Ctrl"
title="Forecast-offset-based policy for Alg1 and Alg2, with T-based channel failure"
scenarios="sim_WScenario_m15_1_1_1_POLICY_2_2_var_WF2Ctrl sim_WScenario_m15_1_10_1_POLICY_2_2_var_WF2Ctrl sim_WScenario_m15_10_1_10_POLICY_2_2_var_WF2Ctrl sim_WScenario_m15_10_10_10_POLICY_2_2_var_WF2Ctrl" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret=sprintf("%s", measurelabel)
measuret2=sprintf("%s", measurelabel2)
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "MTB Weather Forecast (mins)"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:400]
set y2range [0:1800]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 1.0, graph 0.7
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('5' 0,'10' 1,'20' 2,'30' 3,'40' 4,'50' 5,'60' 6) nomirror;\
set xlabel 'MTB Weather Forecast (mins)';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y '';\
set ytics add ('' 25); set ytics add ('' 400)"
NOY2TICS = "set format y2 ''"
NOYLABEL = "unset ylabel"
NOY2LABEL = "unset y2label"
YTICS = "set format y '%.1f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:90]; set y2range [0:2000];\
set ytics add ('' 25)"
BYRANGES = "set yrange [0:190]; set y2range [0:2000];\
set ytics add ('' 400)"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:90]; set y2range [0:2000];\
set ytics add ('' 25)"
BYLOGRANGES = "set yrange [0.001:190]; set y2range [0:2000];\
set ytics add ('' 400)"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.45"
RMARGIN = "set lmargin at screen 0.65; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot "<" .bin. "/datagz.bash " . measure . " " . data(1) using ($0):($3*t*n) with lp ls 1 title measuret axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(1) using ($0):3 with lp ls 1+m title measuret2 axes x1y2'
# plot for scenario2
PLOT2='plot "<" .bin. "/datagz.bash " . measure . " " . data(2) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(2) using ($0):3 with lp ls 1+m notitle axes x1y2'
# plot for scenario3
PLOT3='plot "<" .bin. "/datagz.bash " . measure . " " . data(3) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(3) using ($0):3 with lp ls 1+m notitle axes x1y2'
# plot for scenario4
PLOT4='plot "<" .bin. "/datagz.bash " . measure . " " . data(4) using ($0):($3*t*n) with lp ls 1 notitle axes x1y1, \
"<" .bin. "/datagz.bash " . measure2 . " " . data(4) using ($0):3 with lp ls 1+m notitle axes x1y2'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @Y2TICS; @NOY2LABEL
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @YTICS; @NOYLABEL; @Y2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="51"
measuretype="CostAvailabilityEnergy"
study="POLICY_0_NN"
title="Threshold-based policy for Alg1, when no channel fails"
scenarios="sim_WScenario_m15_1_1_1_POLICY_0_NN sim_WScenario_m15_1_10_1_POLICY_0_NN sim_WScenario_m15_10_1_10_POLICY_0_NN sim_WScenario_m15_10_10_10_POLICY_0_NN" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey="Cost"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret=sprintf("%s", measurelabel)
measuret2=sprintf("%s", measurelabel2)
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(T_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:400]
set y2range [0:1800]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('0' 0,'1' 1,'2' 2,'3' 3) nomirror;\
set xlabel '\\(T_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:3.2]"
NOYTICS = "set format y ''; unset ylabel"
NOY2TICS = "set format y2 ''; unset y2label; unset ylabel"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:2000]"
BYRANGES = "set yrange [0:5000]"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:2000]"
BYLOGRANGES = "set yrange [0.001:5000]"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(1) using ($0):(($3*t*n*costU)+($7*costE)) with lp ls 1 notitle'
# plot for scenario2
PLOT2='plot "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(2) using ($0):(($3*t*n*costU)+($7*costE)) with lp ls 1 notitle'
# plot for scenario3
PLOT3='plot "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(3) using ($0):(($3*t*n*costU)+($7*costE)) with lp ls 1 notitle'
# plot for scenario4
PLOT4='plot "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(4) using ($0):(($3*t*n*costU)+($7*costE)) with lp ls 1 notitle'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="52"
measuretype="CostAvailabilityEnergy"
study="POLICY_2_NN"
title="Forecast-offset-based policy for Alg1, when no channel fails"
scenarios="sim_WScenario_m15_1_1_1_POLICY_2_NN sim_WScenario_m15_1_10_1_POLICY_2_NN sim_WScenario_m15_10_1_10_POLICY_2_NN sim_WScenario_m15_10_10_10_POLICY_2_NN" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon1] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon1] style line i+ndpepsilon1 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# dpepsilon1 values
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey="Cost"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("\\(\\tilde{T}^{dew}_{thr}\\)=%s", word(measurets,ston(i)))
measuret2(i)=sprintf("\\(\\tilde{T}^{dew}_{thr}\\)=%s", word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:400]
set y2range [0:800]
#set y2tics add ("2200" 2200)
set border 3
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('-3' 0,'-2' 1,'-1' 2,'0' 3,'1' 4,'2' 5,'3' 6) nomirror;\
set xlabel '\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y ''; unset ylabel"
NOY2TICS = "set format y2 ''; unset y2label; unset y2tics"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:2000]"
BYRANGES = "set yrange [0:5000]"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:2000]"
BYLOGRANGES = "set yrange [0.001:5000]"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# [ http://lowrank.net/gnuplot/datafile2-e.html#7.6 ]
#every I:J:K:L:M:N
#I Line increment
#J Data block increment
#K The first line
#L The first data block
#M The last line
#N The last data block
#every 2 plot every 2 line
#every ::3 plot from the 3-rd lines
#every ::3::5 plot from the 3-rd to 5-th lines
#every ::0::0 plot the first line only
#every 2::::6 plot the 1,3,5,7-th lines
#every :2 plot every 2 data block
#every :::5::8 plot from 5-th to 8-th data blocks
# plot for scenario1
PLOT1='plot for[i=1:ndpepsilon1] "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(1) every ndpepsilon1::i-1 using ($0):(($3*t*n*costU)+($7*costE)) with lp ls i title measuret(i)'
# plot for scenario2
PLOT2='plot for[i=1:ndpepsilon1] "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(2) every ndpepsilon1::i-1 using ($0):(($3*t*n*costU)+($7*costE)) with lp ls i notitle'
# plot for scenario3
PLOT3='plot for[i=1:ndpepsilon1] "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(3) every ndpepsilon1::i-1 using ($0):(($3*t*n*costU)+($7*costE)) with lp ls i notitle'
# plot for scenario4
PLOT4='plot for[i=1:ndpepsilon1] "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(4) every ndpepsilon1::i-1 using ($0):(($3*t*n*costU)+($7*costE)) with lp ls i notitle'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set key at graph -0.5, graph 1 horizontal spacing 1.8 maxrows 14
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="53"
measuretype="CostAvailabilityEnergy"
study="POLICY_NN_0"
title="Threshold-based policy for Alg2, when no channel works"
scenarios="sim_WScenario_m15_1_1_1_POLICY_NN_0 sim_WScenario_m15_1_10_1_POLICY_NN_0 sim_WScenario_m15_10_1_10_POLICY_NN_0 sim_WScenario_m15_10_10_10_POLICY_NN_0" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey="Cost"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret=sprintf("%s", measurelabel)
measuret2=sprintf("%s", measurelabel2)
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(T_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:400]
set y2range [0:1800]
#set y2tics add ("2200" 2200)
set border 3
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('0' 0,'1' 1,'2' 2,'3' 3) nomirror;\
set xlabel '\\(T_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:3.2]"
NOYTICS = "set format y ''; unset ylabel"
NOY2TICS = "set format y2 ''; unset y2label; unset y2tics"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [3000:3600]"
BYRANGES = "set yrange [3000:3600]"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:3600]"
BYLOGRANGES = "set yrange [0.001:3600]"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(1) using ($0):(($3*t*n*costU)+($7*costE)) with lp ls 1 notitle'
# plot for scenario2
PLOT2='plot "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(2) using ($0):(($3*t*n*costU)+($7*costE)) with lp ls 1 notitle'
# plot for scenario3
PLOT3='plot "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(3) using ($0):(($3*t*n*costU)+($7*costE)) with lp ls 1 notitle'
# plot for scenario4
PLOT4='plot "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(4) using ($0):(($3*t*n*costU)+($7*costE)) with lp ls 1 notitle'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="54"
measuretype="CostAvailabilityEnergy"
study="POLICY_NN_2"
# the position in the list of values for deltam (starting from 0)
deltamind="2"
# dpepsilon2 values
deltamvalues="'0' '5' '10' '15' '20'"
title=sprintf("Forecast-offset-based policy for Alg2, when no channel works, \\(\\Delta_m=%s\\)",word(deltamvalues,ston(deltamind)+1))
scenarios="sim_WScenario_m15_1_1_1_POLICY_NN_2 sim_WScenario_m15_1_10_1_POLICY_NN_2 sim_WScenario_m15_10_1_10_POLICY_NN_2 sim_WScenario_m15_10_10_10_POLICY_NN_2" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon1] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon1] style line i+ndpepsilon1 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# dpepsilon2 values (for DP)
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey="Cost"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("\\(\\tilde{T}^{dew}_{thr}\\)=%s", word(measurets,ston(i)))
measuret2(i)=sprintf("\\(\\tilde{T}^{dew}_{thr}\\)=%s", word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:400]
set y2range [0:800]
#set y2tics add ("2200" 2200)
set border 3
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('-3' 0,'-2' 1,'-1' 2,'0' 3,'1' 4,'2' 5,'3' 6) nomirror;\
set xlabel '\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y ''; unset ylabel"
NOY2TICS = "set format y2 ''; unset y2label; unset y2tics"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [3000:5000]"
BYRANGES = "set yrange [2500:5000]"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:5000]"
BYLOGRANGES = "set yrange [0.001:5000]"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# [ http://lowrank.net/gnuplot/datafile2-e.html#7.6 ]
#every I:J:K:L:M:N
#I Line increment
#J Data block increment
#K The first line
#L The first data block
#M The last line
#N The last data block
#every 2 plot every 2 line
#every ::3 plot from the 3-rd lines
#every ::3::5 plot from the 3-rd to 5-th lines
#every ::0::0 plot the first line only
#every 2::::6 plot the 1,3,5,7-th lines
#every :2 plot every 2 data block
#every :::5::8 plot from 5-th to 8-th data blocks
# plot for scenario1
PLOT1='plot for[i=1:ndpepsilon2] "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):(($3*t*n*costU)+($7*costE)) with lp ls i title measuret(i)'
# plot for scenario2
PLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):(($3*t*n*costU)+($7*costE)) with lp ls i notitle'
# plot for scenario3
PLOT3='plot for[i=1:ndpepsilon2] "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):(($3*t*n*costU)+($7*costE)) with lp ls i notitle'
# plot for scenario4
PLOT4='plot for[i=1:ndpepsilon2] "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):(($3*t*n*costU)+($7*costE)) with lp ls i notitle'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set key at graph -0.5, graph 1 horizontal spacing 1.8 maxrows 14
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="60"
measuretype="CostAvailabilityEnergy"
study="POLICY_0_0"
title="Threshold-based policy for Alg1 and Alg2, with T-based channel failure"
scenarios="sim_WScenario_m15_1_1_1_POLICY_0_0 sim_WScenario_m15_1_10_1_POLICY_0_0 sim_WScenario_m15_10_1_10_POLICY_0_0 sim_WScenario_m15_10_10_10_POLICY_0_0" # space separed list of scenarios to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey="Cost"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret=sprintf("%s", measurelabel)
measuret2=sprintf("%s", measurelabel2)
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(T_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:400]
set y2range [0:1800]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('0' 0,'1' 1,'2' 2,'3' 3) nomirror;\
set xlabel '\\(T_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:3.2]"
NOYTICS = "set format y ''; unset ylabel"
NOY2TICS = "set format y2 ''; unset y2label; unset ylabel"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:2100]"
BYRANGES = "set yrange [0:5000]"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:2100]"
BYLOGRANGES = "set yrange [0.001:5000]"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# plot for scenario1
PLOT1='plot "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(1) using ($0):(($3*t*n*costU)+($7*costE)) with lp ls 1 title measuret'
# plot for scenario2
PLOT2='plot "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(2) using ($0):(($3*t*n*costU)+($7*costE)) with lp ls 1 notitle'
# plot for scenario3
PLOT3='plot "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(3) using ($0):(($3*t*n*costU)+($7*costE)) with lp ls 1 notitle'
# plot for scenario4
PLOT4='plot "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(4) using ($0):(($3*t*n*costU)+($7*costE)) with lp ls 1 notitle'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph 0.6, graph 0.4
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="61"
measuretype="CostAvailabilityEnergy"
study="POLICY_2_2"
# the position in the list of values for deltam (starting from 0)
deltamind="2"
# dpepsilon2 values
deltamvalues="'0' '5' '10' '15' '20'"
title=sprintf("Forecast-offset-based policy for Alg1 and Alg2, with T-based channel failure, \\(\\Delta_m=%s\\)",word(deltamvalues,ston(deltamind)+1))
scenarios="sim_WScenario_m15_1_1_1_POLICY_2_2 sim_WScenario_m15_1_10_1_POLICY_2_2 sim_WScenario_m15_10_1_10_POLICY_2_2 sim_WScenario_m15_10_10_10_POLICY_2_2" # space separed list of scenario§s to compare
scenariosts="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(scenariosts)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(scenariosts).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:ndpepsilon1] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:ndpepsilon1] style line i+ndpepsilon1 lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# dpepsilon2 values (for DP)
measurets="'-3' '-2' '-1' '0' '1' '2' '3'"
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey="Cost"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("\\(\\tilde{T}^{dew}_{thr}\\)=%s", word(measurets,ston(i)))
measuret2(i)=sprintf("\\(\\tilde{T}^{dew}_{thr}\\)=%s", word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 ("-3" 0,"-2" 1,"-1" 2,"0" 3,"1" 4,"2" 5,"3" 6) nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:400]
set y2range [0:800]
#set y2tics add ("2200" 2200)
set border 3
#set key bottom left
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
unset logscale x
unset logscale y
# [ http://www.gnuplotting.org/code/multiplot4.gnu ]
# MACROS
# x- and ytics for each row resp. column
LSCENARIO1="'(-15,1,1,1)'"
LSCENARIO2="'(-15,1,10,1)'"
LSCENARIO3="'(-15,10,1,10)'"
LSCENARIO4="'(-15,10,10,10)'"
NOXTICS = "set xtics 0,1,5 ('' 0,'' 1,'' 2,'' 3,'' 4,'' 5,'' 6) nomirror;\
unset xlabel"
XTICS = "set xtics 0,1,5 ('-3' 0,'-2' 1,'-1' 2,'0' 3,'1' 4,'2' 5,'3' 6) nomirror;\
set xlabel '\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))';\
set xrange [-0.2:6.2]"
NOYTICS = "set format y ''; unset ylabel"
NOY2TICS = "set format y2 ''; unset y2label; unset y2tics"
YTICS = "set format y '%.0f'; set ylabel measurey offset -1"
Y2TICS = "set format y2 '%.0f'; set y2label measurey2"
# y and y2 ranges
TYRANGES = "set yrange [0:3500]"
BYRANGES = "set yrange [0:6000]"
# y and y2 log
TYLOGRANGES = "set yrange [0.001:3500]"
BYLOGRANGES = "set yrange [0.001:6000]"
TYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
BYLOGTICS = "set format y '%g'; set ylabel measurey offset -1"
# Margins for each row resp. column
TMARGIN = "set tmargin at screen 0.95; set bmargin at screen 0.57"
BMARGIN = "set tmargin at screen 0.53; set bmargin at screen 0.15"
LMARGIN = "set lmargin at screen 0.15; set rmargin at screen 0.55"
RMARGIN = "set lmargin at screen 0.55; set rmargin at screen 0.95"
# Placement of the a,b,c,d labels in the graphs
POS = "at graph 0.60,0.95 font ',8'"
# [ http://lowrank.net/gnuplot/datafile2-e.html#7.6 ]
#every I:J:K:L:M:N
#I Line increment
#J Data block increment
#K The first line
#L The first data block
#M The last line
#N The last data block
#every 2 plot every 2 line
#every ::3 plot from the 3-rd lines
#every ::3::5 plot from the 3-rd to 5-th lines
#every ::0::0 plot the first line only
#every 2::::6 plot the 1,3,5,7-th lines
#every :2 plot every 2 data block
#every :::5::8 plot from 5-th to 8-th data blocks
# plot for scenario1
PLOT1='plot for[i=1:ndpepsilon2] "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(1) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):(($3*t*n*costU)+($7*costE)) with lp ls i title measuret(i)'
# plot for scenario2
PLOT2='plot for[i=1:ndpepsilon2] "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(2) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):(($3*t*n*costU)+($7*costE)) with lp ls i notitle'
# plot for scenario3
PLOT3='plot for[i=1:ndpepsilon2] "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(3) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):(($3*t*n*costU)+($7*costE)) with lp ls i notitle'
# plot for scenario4
PLOT4='plot for[i=1:ndpepsilon2] "<" .bin. "/data2gz.bash " . measure . " " . measure2 . " " . data(4) every ndeltam*ndpepsilon2::deltamind+(i-1)*ndeltam using ($0):(($3*t*n*costU)+($7*costE)) with lp ls i notitle'
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
#set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
set key at graph -0.4, graph 1 horizontal spacing 1.8 maxrows 14
if( aqua ) {
set output
set term aqua fig
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @YTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYRANGES; @BMARGIN; @LMARGIN
@XTICS; @YTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set format x "% g"
set format y "%g"
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset table
}
# log scale y
#set yrange [0.001:400]
#set format y "%g"
#set ytics add ("400" 400)
set key at graph -0.5, graph 1 horizontal spacing 1.8 maxrows 14
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
### Start multiplot (2x2 layout)
set multiplot layout 2,2 rowsfirst title title offset 0,1.0
# --- GRAPH a
@TYLOGRANGES; @TMARGIN; @LMARGIN
@NOXTICS; @TYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO1 @POS
# plot for scenario1
@PLOT1
# --- GRAPH b
@TYLOGRANGES; @TMARGIN; @RMARGIN
@NOXTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO2 @POS
# plot for scenario2
@PLOT2
# --- GRAPH c
@BYLOGRANGES; @BMARGIN; @LMARGIN
@XTICS; @BYLOGTICS; @NOY2TICS
set label 1 @LSCENARIO3 @POS
# plot for scenario3
@PLOT3
# --- GRAPH d
@BYLOGRANGES; @BMARGIN; @RMARGIN
@XTICS; @NOYTICS; @NOY2TICS
set label 1 @LSCENARIO4 @POS
# plot for scenario4
@PLOT4
unset multiplot
### End multiplot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
#set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="90"
measuretype="AvailabilityEnergy"
study="POLICY_0_NN"
title="Threshold-based policy for Alg1\n when no channel fails"
scenarios="sim_WScenario_m15_1_1_1_POLICY_0_NN sim_WScenario_m15_1_10_1_POLICY_0_NN sim_WScenario_m15_10_1_10_POLICY_0_NN sim_WScenario_m15_10_10_10_POLICY_0_NN" # space separed list of scenarios to compare
measurets="'\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-15, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, %s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(T_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
#set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set xtics 0,1,5 nomirror
set ytics nomirror
set y2tics
set xrange [0:*]
set yrange [0:*]
set y2range [0:*]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
unset logscale x
unset logscale y
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
#print data(1)
#print data(2)
#print data(3)
#print data(4)
#cmd="../bin/datagz.bash " . measure2 . " " . data(2)
#system(cmd)
#cmd="gzip -dc " . data(2) . "| cat "
#system(cmd)
#exit
# plot for each scenario
plot for[i=1:m:1] "<" .bin. "/datagz.bash " . measure . " " . data(i) using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:m:1] "<" .bin. "/datagz.bash " . measure2 . " " . data(i) using ($0):3 with lp ls i+m title measuret2(i) axes x1y2
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# log scale y
set format y "%g"
set ytics add ("400" 400)
#set yrange [0.001:400]
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
set ytics add ("" 400)
unset logscale y
exit
reset
# Delay
fig="01"
measuretype="AvailabilityEnergy"
study="varTdelta_Policy_0"
title="Expected Unavailability for Day (min/day) vs Energy Consumption"
scenarios="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_0" # space separed list of scenarios to compare
measurets="'\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, %s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\Delta T\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set ytics nomirror
set y2tics
set xrange [0:5]
set yrange [0:400]
set y2range [0:2200]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
unset logscale x
unset logscale y
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
# plot for each scenario
plot for[i=1:m:1] "<" .bin. "/datagz.bash " . measure . " " . data(i) using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:m:1] "<" .bin. "/datagz.bash " . measure2 . " " . data(i) using ($0):3 with lp ls i+m title measuret2(i) axes x1y2
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# log scale y
set format y "%g"
set ytics add ("400" 400)
set yrange [0.001:400]
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="02"
measuretype="AvailabilityEnergy"
study="varTdelta_Policy_1"
title="Expected Unavailability for Day (min/day) vs Energy Consumption"
scenarios="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_1" # space separed list of scenarios to compare
measurets="'\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, %s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
set xtics -3,1,3 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set ytics nomirror
set y2tics
set xrange [-3:3]
set yrange [0:*]
set y2range [0:*]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
unset logscale x
unset logscale y
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
# plot for each scenario
plot for[i=1:m:1] "<" .bin. "/datagz.bash " . measure . " " . data(i) using ($0-3):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:m:1] "<" .bin. "/datagz.bash " . measure2 . " " . data(i) using ($0-3):3 with lp ls i+m title measuret2(i) axes x1y2
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# log scale y
set format y "%g"
set ytics add ("400" 400)
set yrange [0.001:400]
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="03"
measuretype="AvailabilityEnergy"
study="varTdelta_Policy_2"
title="Expected Unavailability for Day (min/day) vs Energy Consumption"
scenarios="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_2" # space separed list of scenarios to compare
measurets="'\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8 9 10 11" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8 9 10 11" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# set lines for legend related to TdmAgeMax
tdeltamlineref=2
set for [i=0:ndeltam-1] style line i+1+m+m lt lstyle(tdeltamlineref) dt 2+i lw 1 pt lstyle(tdeltamlineref)
set for [i=0:ndeltam-1] style line i+1+m+m+ndeltam lt lstyle2(tdeltamlineref) dt 2+i lw 1 pt lstyle2(tdeltamlineref)
lstyle3(i,j)=(i==tdeltamlineref)?j+1+m+m:i
lstyle4(i,j)=(i==tdeltamlineref)?j+1+m+m+ndeltam:i+m
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, %s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
measurelabel3="\\(T^{ageMax}_{dm}\\)"
measuret3(i,j)=(j==0)?measuret(i):((i==tdeltamlineref)?sprintf("%s=%d", measurelabel3, j+1):sprintf(""))
measurelabel4="\\(T^{ageMax}_{dm}\\)"
measuret4(i,j)=(j==0)?measuret2(i):((i==tdeltamlineref)?sprintf("%s=%d", measurelabel4, j+1):sprintf(""))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\Delta T\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set ytics nomirror
set y2tics
set xrange [0:5]
set yrange [0:*]
set y2range [0:*]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
unset logscale x
unset logscale y
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
# plot for each scenario
# awk '1 ; NR%" . deltam . "==0 {printf\"\n\"}'
plot for[deltam=0:ndeltam-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure . " " . data(i) using ($0):($3*t*n) every ndeltam::deltam with lp ls lstyle3(i,deltam) title measuret3(i,deltam) axes x1y1, \
for[deltam=0:ndeltam-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure2 . " " . data(i) using ($0):3 every ndeltam::deltam with lp ls lstyle4(i,deltam) title measuret4(i,deltam) axes x1y2
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# log scale y
set format y "%g"
set ytics add ("400" 400)
set yrange [0.001:400]
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="04"
measuretype="AvailabilityEnergy"
study="varDeltam_Policy_2"
title="Expected Unavailability for Day (min/day) vs Energy Consumption"
scenarios="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_2" # space separed list of scenarios to compare
measurets="'\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=0, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# set lines for legend related to TdmAgeMax
tdeltatlineref=2
set for [i=0:ndeltat-1] style line i+1+m+m lt lstyle(tdeltatlineref) dt 2+i lw 1 pt lstyle(tdeltatlineref)
set for [i=0:ndeltat-1] style line i+1+m+m+ndeltat lt lstyle2(tdeltatlineref) dt 2+i lw 1 pt lstyle2(tdeltatlineref)
lstyle3(i,j)=(i==tdeltatlineref)?j+1+m+m:i
lstyle4(i,j)=(i==tdeltatlineref)?j+1+m+m+ndeltat:i+m
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, %s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
measurelabel3="\\(T^{ageMax}_{dm}\\)"
measuret3(i,j)=(j==0)?measuret(i):((i==tdeltamlineref)?sprintf("%s=%d", measurelabel3, j+1):sprintf(""))
measurelabel4="\\(T^{ageMax}_{dm}\\)"
measuret4(i,j)=(j==0)?measuret2(i):((i==tdeltamlineref)?sprintf("%s=%d", measurelabel4, j+1):sprintf(""))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesaci=fig."-measure-".measuretype."-".study."-tikzsa-ci.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\Delta m\\)"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.0f"
#set format y "%3.2f"
set xtics 0,4,20 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set ytics nomirror
set y2tics
set xrange [0:20]
set yrange [0:*]
set y2range [0:*]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
unset logscale x
unset logscale y
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
# plot for each scenario
# awk '1 ; NR%" . deltat . "==0 {printf\"\n\"}'
plot for[deltat=0:ndeltat-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure . " " . data(i) using ($0*2):($3*t*n) every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with lp ls lstyle3(i,deltat) title measuret3(i,deltat) axes x1y1, \
for[deltat=0:ndeltat-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure2 . " " . data(i) using ($0*2):3 every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with lp ls lstyle4(i,deltat) title measuret4(i,deltat) axes x1y2
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
if( tikzsa ) {
set term tikz standalone
set output tikzfilesaci
set style fill transparent solid filltransparence noborder
plot for[deltat=0:ndeltat-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure . " " . data(i) using ($0*2):(($3-$4)*t*n):(($3+$4)*t*n) every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with filledcurves title "95\\% confidence" axes x1y1,\
for[deltat=0:ndeltat-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure . " " . data(i) using ($0*2):($3*t*n) every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with lp ls lstyle3(i,deltat) title measuret3(i,deltat) axes x1y1,\
for[deltat=0:ndeltat-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure2 . " " . data(i) using ($0*2):($3-$4):($3+$4) every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with filledcurves title "95\\% confidence" axes x1y2,\
for[deltat=0:ndeltat-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure2 . " " . data(i) using ($0*2):3 every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with lp ls lstyle4(i,deltat) title measuret4(i,deltat) axes x1y2
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesaci
system(cmd)
}
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# log scale y
set format y "%g"
set ytics add ("400" 400)
set yrange [0.001:400]
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="11"
measuretype="AvailabilityEnergy"
study="varTdelta_Policy_0"
title="Expected Unavailability for Day (min/day) vs Energy Consumption"
scenarios="sim_vardelta_T0m10_T0w1_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T0m10_T0w1_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw10_POLICY_0 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw10_POLICY_0" # space separed list of scenarios to compare
measurets="'\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, %s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\Delta T\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set ytics nomirror
set y2tics
set xrange [0:5]
set yrange [0:400]
set y2range [0:2200]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
unset logscale x
unset logscale y
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
# plot for each scenario
plot for[i=1:m:1] "<" .bin. "/datagz.bash " . measure . " " . data(i) using ($0):($3*t*n) with lp ls i title measuret(i) axes x1y1, \
for[i=1:m:1] "<" .bin. "/datagz.bash " . measure2 . " " . data(i) using ($0):3 with lp ls i+m title measuret2(i) axes x1y2
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# log scale y
set format y "%g"
set ytics add ("400" 400)
set yrange [0.001:400]
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="12"
measuretype="AvailabilityEnergy"
study="varTdelta_Policy_1"
title="Expected Unavailability for Day (min/day) vs Energy Consumption"
scenarios="sim_vardelta_T0m10_T0w1_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T0m10_T0w1_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw10_POLICY_1 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw10_POLICY_1" # space separed list of scenarios to compare
measurets="'\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1 2 3 4 5 6 7 8" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# my color for filledcurves
filledcolors="'#33FFFF' '#FF99CC' '#FF9933' '#0000FF' '#808080' '#00FF00' '#E0E0E0' '#FF0000'"
myfilledcolor(i)=word(filledcolors,i)
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, %s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesasub=fig."-measure-".measuretype."-".study."-tikzsa-sub.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\tilde{T}_{thr}\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.0f"
#set format y "%3.2f"
#set xtics -3,1,3 nomirror rotate by 90 right
set xtics -3,1,3 nomirror
#set xtics add ("0.2" 0.2)
set ytics nomirror
set y2tics
set xrange [-3:3]
set yrange [0:*]
set y2range [0:*]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
unset logscale x
unset logscale y
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
# plot for each scenario
plot for[i in serieinds] "<" .bin. "/datagz.bash " . measure . " " . data(ston(i)) using ($0-3):($3*t*n) with lp ls ston(i) title measuret(ston(i)) axes x1y1, \
for[i in serieinds] "<" .bin. "/datagz.bash " . measure2 . " " . data(ston(i)) using ($0-3):3 with lp ls ston(i)+m title measuret2(ston(i)) axes x1y2
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
if( tikzsa ) {
serieinds="1 3 6 8" # list of the indexes corresponding to the scenarios to plot
set term tikz standalone
set output tikzfilesasub
set style fill transparent solid filltransparence noborder
plot for[i in serieinds] "<" .bin. "/datagz.bash " . measure . " " . data(ston(i)) using ($0-3):(($3-$4)*t*n):(($3+$4)*t*n) with filledcurves lc rgb myfilledcolor(ston(i)) title "95\\% confidence" axes x1y1, \
for[i in serieinds] "<" .bin. "/datagz.bash " . measure . " " . data(ston(i)) using ($0-3):($3*t*n) with lp ls ston(i) title measuret(ston(i)) axes x1y1, \
for[i in serieinds] "<" .bin. "/datagz.bash " . measure2 . " " . data(ston(i)) using ($0-3):($3-$4):($3+$4) with filledcurves lc rgb myfilledcolor(ston(i)) title "95\\% confidence" axes x1y2, \
for[i in serieinds] "<" .bin. "/datagz.bash " . measure2 . " " . data(ston(i)) using ($0-3):3 with lp ls ston(i)+m title measuret2(ston(i)) axes x1y2
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesasub
system(cmd)
serieinds="1 2 3 4 5 6 7 8" # list of the indexes corresponding to the scenarios to plot
}
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# log scale y
set format y "%g"
set ytics add ("400" 400)
set yrange [0.001:400]
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="13"
measuretype="AvailabilityEnergy"
study="varTdelta_Policy_2"
title="Expected Unavailability for Day (min/day) vs Energy Consumption"
scenarios="sim_vardelta_T0m10_T0w1_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T0m10_T0w1_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw10_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw10_POLICY_2" # space separed list of scenarios to compare
measurets="'\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8 9 10 11" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8 9 10 11" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# set lines for legend related to TdmAgeMax
tdeltamlineref=2
set for [i=0:ndeltam-1] style line i+1+m+m lt lstyle(tdeltamlineref) dt 2+i lw 1 pt lstyle(tdeltamlineref)
set for [i=0:ndeltam-1] style line i+1+m+m+ndeltam lt lstyle2(tdeltamlineref) dt 2+i lw 1 pt lstyle2(tdeltamlineref)
lstyle3(i,j)=(i==tdeltamlineref)?j+1+m+m:i
lstyle4(i,j)=(i==tdeltamlineref)?j+1+m+m+ndeltam:i+m
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, %s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
measurelabel3="\\(T^{ageMax}_{dm}\\)"
measuret3(i,j)=(j==0)?measuret(i):((i==tdeltamlineref)?sprintf("%s=%d", measurelabel3, j+1):sprintf(""))
measurelabel4="\\(T^{ageMax}_{dm}\\)"
measuret4(i,j)=(j==0)?measuret2(i):((i==tdeltamlineref)?sprintf("%s=%d", measurelabel4, j+1):sprintf(""))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\Delta T\\) (\\(^{o}C\\))"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.1f"
#set format y "%3.2f"
set xtics 0,1,5 nomirror rotate by 90 right
#set xtics add ("0.2" 0.2)
set ytics nomirror
set y2tics
set xrange [0:5]
set yrange [0:*]
set y2range [0:*]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
unset logscale x
unset logscale y
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
# plot for each scenario
# awk '1 ; NR%" . deltam . "==0 {printf\"\n\"}'
plot for[deltam=0:ndeltam-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure . " " . data(i) using ($0):($3*t*n) every ndeltam::deltam with lp ls lstyle3(i,deltam) title measuret3(i,deltam) axes x1y1, \
for[deltam=0:ndeltam-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure2 . " " . data(i) using ($0):3 every ndeltam::deltam with lp ls lstyle4(i,deltam) title measuret4(i,deltam) axes x1y2
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# log scale y
set format y "%g"
set ytics add ("400" 400)
set yrange [0.001:400]
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
set ytics add ("" 400)
unset logscale y
reset
# Delay
fig="14"
measuretype="AvailabilityEnergy"
study="varTdelta_Policy_2"
title="Expected Unavailability for Day (min/day) vs Energy Consumption"
scenarios="sim_vardelta_T0m10_T0w1_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T0m10_T0w1_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw10_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw10_POLICY_2" # space separed list of scenarios to compare
measurets="'\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=1, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=1, T^{dew}_a=10\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=1\\)' '\\(\\bar{T}_0=-10, T^a_0=10, \\Delta{T}^{dew}_0=10, T^{dew}_a=10\\)'"
serieinds="1 2 3 4 5 6 7 8" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8 9 10 11" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8 9 10 11" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
set for [i=1:m] style line i+m lt lstyle(i) dt 2 lw 1 pt lstyle(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# set style for deltat=deltatref: pi 2 (or ps 2)
deltatref=0
set for [i=1:m] style line i +m+m lt lstyle(i) lw 1 pt lstyle(i) pi 2 linecolor rgb "black"
set for [i=1:m] style line i+m+m+m lt lstyle(i) dt 2 lw 1 pt lstyle(i) pi 2 linecolor rgb "black"
mystyle(i,j)=(j==deltatref)?i +m+m:i
mystyle2(i,j)=(j==deltatref)?i+m+m+m:i+m
# my line width (for deltat)
linewidths="1 1 1 1 1 2"
mylinewidth(i)=word(linewidths,i)
# my color for filledcurves
filledcolors="'#33FFFF' '#FF99CC' '#FF9933' '#0000FF' '#808080' '#00FF00' '#E0E0E0' '#FF0000'"
myfilledcolor(i)=word(filledcolors,i)
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min/day)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, %s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
measurelabel3="\\(T^{ageMax}_{dm}\\)"
measuret3(i,j)=(j==0)?measuret(i):((i==tdeltamlineref)?sprintf("%s=%d", measurelabel3, j+1):sprintf(""))
measurelabel4="\\(T^{ageMax}_{dm}\\)"
measuret4(i,j)=(j==0)?measuret2(i):((i==tdeltamlineref)?sprintf("%s=%d", measurelabel4, j+1):sprintf(""))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesasub=fig."-measure-".measuretype."-".study."-tikzsa-sub.tex"
tikzfilesaci=fig."-measure-".measuretype."-".study."-tikzsa-ci.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "\\(\\Delta m\\)"
set ylabel measurey offset -1
set y2label measurey2
set format x "%2.0f"
#set format y "%3.2f"
#set xtics 0,4,20 nomirror rotate by 90 right
set xtics 0,4,20 nomirror
#set xtics add ("0.2" 0.2)
set ytics nomirror
set y2tics
set xrange [0:20]
set yrange [0:*]
set y2range [0:*]
#set y2tics add ("2200" 2200)
set border 11
#set key bottom left
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
unset logscale x
unset logscale y
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
# plot for each scenario
# awk '1 ; NR%" . deltam . "==0 {printf\"\n\"}'
plot for[deltat=0:ndeltat-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure . " " . data(i) using ($0*2):($3*t*n) every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with lp ls i title measuret3(i,deltat) axes x1y1, \
for[deltat=0:ndeltat-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure2 . " " . data(i) using ($0*2):3 every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with lp ls i+m title measuret4(i,deltat) axes x1y2
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
set key off
if( tikzsa ) {
set term tikz standalone
set output tikzfilesanoleg
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesanoleg
system(cmd)
}
if( tikzsa ) {
set term tikz standalone
set output tikzfilesaci
set style fill transparent solid filltransparence noborder
plot for[deltat=0:ndeltat-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure . " " . data(i) using ($0*2):(($3-$4)*t*n):(($3+$4)*t*n) every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with filledcurves title "95\\% confidence" axes x1y1,\
for[deltat=0:ndeltat-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure . " " . data(i) using ($0*2):($3*t*n) every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with lp ls i title measuret3(i,deltat) axes x1y1,\
for[deltat=0:ndeltat-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure2 . " " . data(i) using ($0*2):($3-$4):($3+$4) every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with filledcurves title "95\\% confidence" axes x1y2,\
for[deltat=0:ndeltat-1:1] for[i=1:m:1] "<" .bin. "/datagz.bash " . measure2 . " " . data(i) using ($0*2):3 every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with lp ls i+m title measuret4(i,deltat) axes x1y2
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesaci
system(cmd)
}
if( tikzsa ) {
serieindsdeltat="0 5" # list of the indexes corresponding to the scenarios to plot
serieinds="1 3 6 8" # list of the indexes corresponding to the scenarios to plot
set term tikz standalone
set output tikzfilesasub
set style fill transparent solid filltransparence noborder
plot for[deltat in serieindsdeltat] for[i in serieinds] "<" .bin. "/datagz.bash " . measure . " " . data(ston(i)) using ($0*2):(($3-$4)*t*n):(($3+$4)*t*n) every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with filledcurves lc rgb myfilledcolor(ston(i)) title "95\\% confidence" axes x1y1,\
for[deltat in serieindsdeltat] for[i in serieinds] "<" .bin. "/datagz.bash " . measure . " " . data(ston(i)) using ($0*2):($3*t*n) every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with lp ls mystyle(i,deltat) title measuret3(ston(i),ston(deltat)) axes x1y1,\
for[deltat in serieindsdeltat] for[i in serieinds] "<" .bin. "/datagz.bash " . measure2 . " " . data(ston(i)) using ($0*2):($3-$4):($3+$4) every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with filledcurves lc rgb myfilledcolor(ston(i)) title "95\\% confidence" axes x1y2,\
for[deltat in serieindsdeltat] for[i in serieinds] "<" .bin. "/datagz.bash " . measure2 . " " . data(ston(i)) using ($0*2):3 every 1::deltat*ndeltam::(deltat+1)*ndeltam-1 with lp ls mystyle2(i,deltat) title measuret4(ston(i),ston(deltat)) axes x1y2
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesasub
system(cmd)
serieinds="1 2 3 4 5 6 7 8" # list of the indexes corresponding to the scenarios to plot
}
set key at graph -0.2, graph 1 spacing 1.8 maxrows 12
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# log scale y
set format y "%g"
set ytics add ("400" 400)
set yrange [0.001:400]
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
set ytics add ("" 400)
unset logscale y
reset
# Tracks
fig="40"
measuretype="Track"
study="m10_10_1_1"
title="\\(T_0=-10, T^w_0=10, T^{diff}_d=1, T^w_d=1\\)"
scenarios="sim_vardelta_T0m10_T0w10_DPT0diff1_DPw1_POLICY_0_traces" # space separed list of scenarios to compare
measurets="'\\(T_0=-10, T^w_0=10, T^{diff}_d=1, T^w_d=1\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 3 4 5 6" # lt and dt style for each scenario
lstyles2="1 2 3 4 5 6" # lt and dt style for each scenario
# temperature at time 0
tbar0=-10
# the base function
basef(x)=-sin(2*pi*x/t)+tbar0
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
dirdata(i)=dirdatapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="PFSys"
measurelabel="Temperature (\\(^{o}C\\))"
measurey=measurelabel
measure2="ExpectedEnergyFSys"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, %s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "t (min)"
set ylabel measurey
#set y2label measurey2
#set format x "%2.1f"
set format y "%g"
#set xtics 0.2,0.2,3 nomirror rotate by 90 right
set xtics nomirror
set ytics nomirror
#set y2tics
#set xrange [0.2:3]
#set yrange [0.0001:1]
set border 3
#set key bottom left
set key at graph 0.7, graph 0.7 spacing 1.8 maxrows 12
unset logscale x
unset logscale y
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
# plot for each scenario
plot [x=0:t] basef(x) title "\\(f(t)=-sin(2\\pi t/1440)\\)", \
"< gunzip -dc " . dirdata(1) . "/track_VT_9_c30.txt.gz" using ($0*10):1 with lp ls 2 pi 9 title "\\(T_9(t)\\)", \
"< gunzip -dc " . dirdata(1) . "/track_VT0_c30.txt" using ($0*10):1 with lp ls 1 pi 9 title "\\(T_0(t)\\\)", \
"< gunzip -dc " . dirdata(1) . "/track_VDP_c30.txt" using ($0*10):1 with lp ls 3pi 9 title "\\(T_d(t)\\)"
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
reset
# Tracks
fig="41"
measuretype="Track"
study="m10_10_1_10"
title="\\(T_0=-10, T^w_0=10, T^{diff}_d=1, T^w_d=10\\)"
scenarios="sim_vardelta_T0m10_T0w10_DPT0diff1_DPw10_POLICY_0_traces" # space separed list of scenarios to compare
measurets="'\\(T_0=-10, T^w_0=10, T^{diff}_d=1, T^w_d=10\\)'"
serieinds="1" # list of the indexes corresponding to the scenarios to plot
m=words(scenarios) # scenarios
lstyles1="1 2 3 4 5 6" # lt and dt style for each scenario
lstyles2="1 2 3 4 5 6" # lt and dt style for each scenario
# temperature at time 0
tbar0=-10
# the base function
basef(x)=-sin(2*pi*x/t)+tbar0
# check input params
if(words(serieinds)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of series index (".words(serieinds).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
dirdata(i)=dirdatapath(word(scenarios,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i)
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i)
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
measure="PFSys"
measurelabel="Temperature (\\(^{o}C\\))"
measurey=measurelabel
measure2="ExpectedEnergyFSys"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measuret(i)=sprintf("%s, %s", measurelabel, word(measurets,ston(i)))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
unset title
set xlabel "t (min)"
set ylabel measurey
#set y2label measurey2
#set format x "%2.1f"
set format y "%g"
#set xtics 0.2,0.2,3 nomirror rotate by 90 right
set xtics nomirror
set ytics nomirror
#set y2tics
#set xrange [0.2:3]
#set yrange [0.0001:1]
set border 3
#set key bottom left
set key at graph 0.55, graph 1 spacing 1.8 maxrows 12
unset logscale x
unset logscale y
set term tikz
set output tikzfile
#set label "$V_{B48}$" at 180,0.83
#set arrow from 204,0.828 to 245,0.85
# plot for each scenario
plot [x=0:t] basef(x) title "\\(f(t)=-sin(2\\pi t/1440)\\)", \
"< gunzip -dc " . dirdata(1) . "/track_VT_9_c30.txt.gz" using ($0*10):1 with lp ls 2 pi 9 title "\\(T_9(t)\\)", \
"< gunzip -dc " . dirdata(1) . "/track_VT0_c30.txt" using ($0*10):1 with lp ls 1 pi 9 title "\\(T_0(t)\\\)", \
"< gunzip -dc " . dirdata(1) . "/track_VDP_c30.txt" using ($0*10):1 with lp ls 3pi 9 title "\\(T_d(t)\\)"
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
reset
# Delay
fig="50"
measuretype="Energy"
study="varWeatherScenario"
title="Energy Consumption for day for different weather scenarios. Label: exp number\npolicy 0, label 1: \\(\\Delta T=0\\)\npolicy 1, label 4: \\(\\tilde{T}_{thr}=0\\)\npolicy 2, label 5: \\(\\Delta T=0,T^{ageMax}_{dm}=5\\)"
scenarios="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_0" # space separed list of scenarios to compare
scenarios_policy_1="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_1" # space separed list of scenarios to compare
scenarios_policy_2="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_2" # space separed list of scenarios to compare
measurets="'(0,1,1,1)' '(0,1,1,10)' '(0,1,10,1)' '(0,1,10,10)' '(0,10,1,1)' '(0,10,1,10)' '(0,10,10,1)' '(0,10,10,10)'"
serieinds="4" # list of the indexes corresponding to the scenarios to plot
serieinds_policy_1="13" # list of the indexes corresponding to the scenarios to plot
xinds="4 2 0 -2" # indexes used for the values on the axis x
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(measurets)>words(scenarios_policy_1)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(measurets)>words(scenarios_policy_2)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
data_policy_2(i)=datapath(word(scenarios_policy_2,i))
serieind(i)=word(serieinds,ston(i))
serieind_policy_1(i)=word(serieinds_policy_1,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
xind(i)=ston(word(xinds,ston(i)))
ms=1 # series number
# using index from seriesinds
cind(i)=ston(word(serieinds,i))
cind_policy_1(i)=ston(word(serieinds_policy_1,i))
# styles
dx=1.1
total_box_width_relative=0.15
gap_width_relative=0.02
d_width=(gap_width_relative+total_box_width_relative)*dx/2.
reset
set boxwidth total_box_width_relative/ms relative
set style fill pattern
set grid y
measure="YUsedEnergy"
measurelabel="\\(\\mu_E\\)"
measurey=measurelabel . " (kWh)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measure3="WNeededEnergy" # optimal energy consumption for switch day averaged
measuret(i)=(i==0)?sprintf("\\(P_{bas}\\)"):( \
(i==1)?sprintf("\\(P_{pre}\\)"):( \
(i==2)?sprintf("\\(P_{mem}\\)"): \
sprintf("\\(P_{opt}\\)")))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
measuret3="Optimal energy consumption"
myxlabel(i)=sprintf("%s", word(measurets,int(ston(i))))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesamax=fig."-measure-".measuretype."-".study."-tikzsa-max.tex"
tikzfilesabase=fig."-measure-".measuretype."-".study."-tikzsa-base.tex"
tikzfilesaexp=fig."-measure-".measuretype."-".study."-tikzsa-exp.tex"
tikzfilesaci=fig."-measure-".measuretype."-".study."-tikzsa-ci.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
#set title title offset 0,5.0
unset title
#set xlabel "time (hours)"
set xlabel "Weather scenario (\\(\\bar{T}_0, T^a_0, \\Delta{T}^{dew}_0, T^{dew}_a\\))" offset 0,-0.5
set ylabel measurey
set format x "%2.0f"
#set format y "%2.0d"
set format y "%2.0f"
#set xtics ("100" 0,"200" 1,"300" 2,"400" 3,"500" 4) nomirror
#set xtics (xlabel(1) 0, xlabel(2) 1, xlabel(3) 2, xlabel(4) 3, xlabel(5) 4, xlabel(6) 5, xlabel(7) 6, xlabel(8) 7, xlabel(9) 8) nomirror rotate by 45 right
set xtics nomirror rotate by 30 right
set ytics nomirror
set yrange [0:2500]
set ytics left offset -4.5,0
set mytics 10
set border 3
#set key bottom left maxrows 4 spacing 1.2
set key at graph 1.05, graph 1 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
unset logscale x
unset logscale y
set term tikz
set output tikzfile
plot "<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 fill solid 0.1 notitle,\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 title measuret(0),\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))) with boxes lc 2 fill solid 0.1 notitle,\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))) with boxes lc 2 title measuret(1),\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):xticlabels(myxlabel($1)) with boxes lc 3 fill solid 0.1 notitle,\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):xticlabels(myxlabel($1)) with boxes lc 3 title measuret(2),\
"<" .bin. "/databysolvergz.bash " . measure3 . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(4)*d_width):(column(cind(1))*t*n*energyfortimeunit) with boxes lc 4 title measuret(3),\
t*n*energyfortimeunit with lines dt 2 title ""
set label sprintf("\\(\\max\{\\mu_E\}=%.0f\\)", t*n*energyfortimeunit) at graph 0.85,0.87 center
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
if( tikzsa ) {
unset label
set yrange [0:*]
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set label sprintf("\\(\\max\{\\mu_E\}=%.0f\\)", t*n*energyfortimeunit) at graph 0.2,0.93 center
set term tikz standalone
set output tikzfilesamax
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesamax
system(cmd)
}
if( tikzsa ) {
unset label
set label sprintf("\\(\\max\{\\mu_E\}=%.0f\\)", t*n*energyfortimeunit) at graph 0.2,0.93 center
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set term tikz standalone
set output tikzfilesaexp
plot "<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 fill solid 0.1 notitle,\
'' using (column(0)-xind(1)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 title measuret(0),\
'' using (column(0)-xind(1)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))) with boxes lc 2 fill solid 0.1 notitle,\
'' using (column(0)-xind(2)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))) with boxes lc 2 title measuret(1),\
'' using (column(0)-xind(2)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):xticlabels(myxlabel($1)) with boxes lc 3 fill solid 0.1 notitle,\
'' using (column(0)-xind(3)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):xticlabels(myxlabel($1)) with boxes lc 3 title measuret(2),\
'' using (column(0)-xind(3)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolvergz.bash " . measure3 . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(4)*d_width):(column(cind(1))*t*n*energyfortimeunit) with boxes lc 4 title measuret(3),\
t*n*energyfortimeunit with lines dt 2 title ""
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesaexp
system(cmd)
}
if( tikzsa ) {
unset label
set label sprintf("\\(\\max\{\\mu_E\}=%.0f\\)", t*n*energyfortimeunit) at graph 0.2,0.93 center
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set term tikz standalone
set output tikzfilesabase
plot "<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 title measuret(0),\
'' using (column(0)-xind(1)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolvergz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))) with boxes lc 2 title measuret(1),\
'' using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))):(strcol(cind_policy_1(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):xticlabels(myxlabel($1)) with boxes lc 3 title measuret(2),\
'' using (column(0)-xind(3)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolvergz.bash " . measure3 . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(4)*d_width):(column(cind(1))*t*n*energyfortimeunit) with boxes lc 4 title measuret(3),\
t*n*energyfortimeunit with lines dt 2 title ""
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesabase
system(cmd)
}
if( tikzsa ) {
unset label
set label sprintf("\\(\\max\{\\mu_E\}=%.0f\\)", t*n*energyfortimeunit) at graph 0.2,0.93 center
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set term tikz standalone
set output tikzfilesaci
plot "<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 title measuret(0),\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))):(column(cind(1))-column(cind(1)+1)):(column(cind(1))+column(cind(1)+1)) with errorbars lc 1 pt 0 notitle,\
'' using (column(0)-xind(1)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolvergz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))) with boxes lc 2 title measuret(1),\
"<" .bin. "/databysolvergz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))):(column(cind_policy_1(1))-column(cind_policy_1(1)+1)):(column(cind_policy_1(1))+column(cind_policy_1(1)+1)) with errorbars lc 2 pt 0 notitle,\
'' using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))):(strcol(cind_policy_1(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):xticlabels(myxlabel($1)) with boxes lc 3 title measuret(2),\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):(column(cind(1))-column(cind(1)+1)):(column(cind(1))+column(cind(1)+1)) with errorbars lc 3 pt 0 notitle,\
'' using (column(0)-xind(3)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolvergz.bash " . measure3 . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(4)*d_width):(column(cind(1))*t*n*energyfortimeunit) with boxes lc 4 title measuret(3),\
"<" .bin. "/databysolvergz.bash " . measure3 . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(4)*d_width):(column(cind(1))*t*n*energyfortimeunit):((column(cind(1))-column(cind(1)+1))*t*n*energyfortimeunit):((column(cind(1))+column(cind(1)+1))*t*n*energyfortimeunit) with errorbars lc 4 pt 0 notitle,\
t*n*energyfortimeunit with lines dt 2 title ""
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesaci
system(cmd)
}
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# test values
cmd=bin. "/datagz.bash " . measure2 . " " . data_policy_2(3)
system(cmd)
#exit
cmd=bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\""
system(cmd)
reset
# Delay
fig="51"
measuretype="Energy"
study="varWeatherScenario"
title="Energy Consumption for day for different weather scenarios. Label: exp number\npolicy 0, label 1: \\(\\Delta T=0\\)\npolicy 1, label 4: \\(\\tilde{T}_{thr}=0\\)\npolicy 2, label 5: \\(\\Delta T=0,T^{ageMax}_{dm}=5\\)"
scenarios="sim_vardelta_T0m10_T0w1_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T0m10_T0w1_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw10_POLICY_0 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw10_POLICY_0" # space separed list of scenarios to compare
scenarios_policy_1="sim_vardelta_T0m10_T0w1_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T0m10_T0w1_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw10_POLICY_1 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw10_POLICY_1" # space separed list of scenarios to compare
scenarios_policy_2="sim_vardelta_T0m10_T0w1_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T0m10_T0w1_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw10_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw10_POLICY_2" # space separed list of scenarios to compare
measurets="'(-10,1,1,1)' '(-10,1,1,10)' '(-10,1,10,1)' '(-10,1,10,10)' '(-10,10,1,1)' '(-10,10,1,10)' '(-10,10,10,1)' '(-10,10,10,10)'"
serieinds="4" # list of the indexes corresponding to the scenarios to plot
serieinds_policy_1="13" # list of the indexes corresponding to the scenarios to plot
colinds="4" # list of the indexes corresponding to the column to plot
xinds="4 2 0 -2" # indexes used for the values on the axis x
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(measurets)>words(scenarios_policy_1)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(measurets)>words(scenarios_policy_2)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
data_policy_2(i)=datapath(word(scenarios_policy_2,i))
serieind(i)=word(serieinds,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
xind(i)=ston(word(xinds,ston(i)))
ms=1 # series number
# using index from colinds
cind(i)=ston(word(colinds,i))
cind_policy_1(i)=ston(word(serieinds_policy_1,i))
# styles
dx=1.1
total_box_width_relative=0.15
gap_width_relative=0.02
d_width=(gap_width_relative+total_box_width_relative)*dx/2.
reset
set boxwidth total_box_width_relative/ms relative
set style fill pattern
set grid y
measure="YUsedEnergy"
measurelabel="\\(\\mu_E\\)"
measurey=measurelabel . " (kWh)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measure3="WNeededEnergy" # optimal energy consumption for switch day averaged
measuret(i)=(i==0)?sprintf("\\(P_{bas}\\)"):( \
(i==1)?sprintf("\\(P_{pre}\\)"):( \
(i==2)?sprintf("\\(P_{mem}\\)"): \
sprintf("\\(P_{opt}\\)")))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
measuret3="Optimal energy consumption"
myxlabel(i)=sprintf("%s", word(measurets,int(ston(i))))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesamax=fig."-measure-".measuretype."-".study."-tikzsa-max.tex"
tikzfilesabase=fig."-measure-".measuretype."-".study."-tikzsa-base.tex"
tikzfilesaexp=fig."-measure-".measuretype."-".study."-tikzsa-exp.tex"
tikzfilesaci=fig."-measure-".measuretype."-".study."-tikzsa-ci.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
#set title title offset 0,5.0
unset title
#set xlabel "time (hours)"
set xlabel "Weather scenario (\\(\\bar{T}_0, T^a_0, \\Delta{T}^{dew}_0, T^{dew}_a\\))" offset 0,-0.5
set ylabel measurey
set format x "%2.0f"
#set format y "%2.0d"
set format y "%2.0f"
#set xtics ("100" 0,"200" 1,"300" 2,"400" 3,"500" 4) nomirror
#set xtics (xlabel(1) 0, xlabel(2) 1, xlabel(3) 2, xlabel(4) 3, xlabel(5) 4, xlabel(6) 5, xlabel(7) 6, xlabel(8) 7, xlabel(9) 8) nomirror rotate by 45 right
set xtics nomirror rotate by 30 right
set ytics nomirror
set yrange [0:*]
set ytics left offset -4.5,0
set mytics 10
set border 3
#set key bottom left maxrows 4 spacing 1.2
set key at graph 1.05, graph 1 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
unset logscale x
unset logscale y
set term tikz
set output tikzfile
plot "<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 fill solid 0.1 notitle,\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 title measuret(0),\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))) with boxes lc 2 fill solid 0.1 notitle,\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))) with boxes lc 2 title measuret(1),\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):xticlabels(myxlabel($1)) with boxes lc 3 fill solid 0.1 notitle,\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):xticlabels(myxlabel($1)) with boxes lc 3 title measuret(2),\
"<" .bin. "/databysolvergz.bash " . measure3 . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(4)*d_width):(column(cind(1))*t*n*energyfortimeunit) with boxes lc 4 title measuret(3)
set label sprintf("\\(\\max\{\\mu_E\}=%.0f\\)", t*n*energyfortimeunit) at graph 0.85,0.87 center
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
if( tikzsa ) {
unset label
set yrange [0:*]
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set label sprintf("\\(\\max\{\\mu_E\}=%.0f\\)", t*n*energyfortimeunit) at graph 0.2,0.93 center
set term tikz standalone
set output tikzfilesamax
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesamax
system(cmd)
}
if( tikzsa ) {
unset label
set yrange [0:*]
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set label sprintf("\\(\\max\{\\mu_E\}=%.0f\\)", t*n*energyfortimeunit) at graph 0.2,0.93 center
set term tikz standalone
set output tikzfilesaexp
plot "<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 fill solid 0.1 notitle,\
'' using (column(0)-xind(1)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 title measuret(0),\
'' using (column(0)-xind(1)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))) with boxes lc 2 fill solid 0.1 notitle,\
'' using (column(0)-xind(2)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))) with boxes lc 2 title measuret(1),\
'' using (column(0)-xind(2)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):xticlabels(myxlabel($1)) with boxes lc 3 fill solid 0.1 notitle,\
'' using (column(0)-xind(3)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):xticlabels(myxlabel($1)) with boxes lc 3 title measuret(2),\
'' using (column(0)-xind(3)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolvergz.bash " . measure3 . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(4)*d_width):(column(cind(1))*t*n*energyfortimeunit) with boxes lc 4 title measuret(3),\
t*n*energyfortimeunit with lines dt 2 title ""
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesaexp
system(cmd)
}
if( tikzsa ) {
unset label
set yrange [0:*]
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set label sprintf("\\(\\max\{\\mu_E\}=%.0f\\)", t*n*energyfortimeunit) at graph 0.2,0.93 center
set term tikz standalone
set output tikzfilesabase
plot "<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 title measuret(0),\
'' using (column(0)-xind(1)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolvergz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))) with boxes lc 2 title measuret(1),\
'' using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))):(strcol(cind_policy_1(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):xticlabels(myxlabel($1)) with boxes lc 3 title measuret(2),\
'' using (column(0)-xind(3)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolvergz.bash " . measure3 . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(4)*d_width):(column(cind(1))*t*n*energyfortimeunit) with boxes lc 4 title measuret(3),\
t*n*energyfortimeunit with lines dt 2 title ""
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesabase
system(cmd)
set key at graph 1.05, graph 1.5 maxrows 3 spacing 1.2 reverse Left width -2
}
if( tikzsa ) {
unset label
set yrange [0:*]
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set label sprintf("\\(\\max\{\\mu_E\}=%.0f\\)", t*n*energyfortimeunit) at graph 0.2,0.93 center
set term tikz standalone
set output tikzfilesaci
plot "<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 title measuret(0),\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))):(column(cind(1))-column(cind(1)+1)):(column(cind(1))+column(cind(1)+1)) with errorbars lc 1 pt 0 notitle,\
'' using (column(0)-xind(1)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolvergz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))) with boxes lc 2 title measuret(1),\
"<" .bin. "/databysolvergz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))):(column(cind_policy_1(1))-column(cind_policy_1(1)+1)):(column(cind_policy_1(1))+column(cind_policy_1(1)+1)) with errorbars lc 2 pt 0 notitle,\
'' using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))):(strcol(cind_policy_1(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):xticlabels(myxlabel($1)) with boxes lc 3 title measuret(2),\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))):(column(cind(1))-column(cind(1)+1)):(column(cind(1))+column(cind(1)+1)) with errorbars lc 3 pt 0 notitle,\
'' using (column(0)-xind(3)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolvergz.bash " . measure3 . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(4)*d_width):(column(cind(1))*t*n*energyfortimeunit) with boxes lc 4 title measuret(3),\
"<" .bin. "/databysolvergz.bash " . measure3 . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(4)*d_width):(column(cind(1))*t*n*energyfortimeunit):((column(cind(1))-column(cind(1)+1))*t*n*energyfortimeunit):((column(cind(1))+column(cind(1)+1))*t*n*energyfortimeunit) with errorbars lc 4 pt 0 notitle,\
t*n*energyfortimeunit with lines dt 2 title ""
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesaci
system(cmd)
}
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# test values
cmd=bin. "/datagz.bash " . measure2 . " " . data_policy_2(3)
system(cmd)
#exit
cmd=bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\""
system(cmd)
reset
# Delay
fig="52"
measuretype="Unavailability"
study="varWeatherScenario"
title="Unavailability for day for different weather scenarios. Label: exp number\npolicy 0, label 1: \\(\\Delta T=0\\)\npolicy 1, label 4: \\(\\tilde{T}_{thr}=0\\)\npolicy 2, label 5: \\(\\Delta T=0,T^{ageMax}_{dm}=5\\)"
scenarios="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_0" # space separed list of scenarios to compare
scenarios_policy_1="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_1" # space separed list of scenarios to compare
scenarios_policy_2="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_2" # space separed list of scenarios to compare
measurets="'(0,1,1,1)' '(0,1,1,10)' '(0,1,10,1)' '(0,1,10,10)' '(0,10,1,1)' '(0,10,1,10)' '(0,10,10,1)' '(0,10,10,10)'"
serieinds="4" # list of the indexes corresponding to the scenarios to plot
serieinds_policy_1="13" # list of the indexes corresponding to the scenarios to plot
xinds="4 2 0 -2" # indexes used for the values on the axis x
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(measurets)>words(scenarios_policy_1)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(measurets)>words(scenarios_policy_2)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
data_policy_2(i)=datapath(word(scenarios_policy_2,i))
serieind(i)=word(serieinds,ston(i))
serieind_policy_1(i)=word(serieinds_policy_1,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
xind(i)=ston(word(xinds,ston(i)))
ms=1 # series number
# using index from seriesinds
cind(i)=ston(word(serieinds,i))
cind_policy_1(i)=ston(word(serieinds_policy_1,i))
# styles
dx=1.1
total_box_width_relative=0.15
gap_width_relative=0.02
d_width=(gap_width_relative+total_box_width_relative)*dx/2.
reset
set boxwidth total_box_width_relative/ms relative
set style fill pattern
set grid y
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measure3="WNeededEnergy" # optimal energy consumption for switch day averaged
measuret(i)=(i==0)?sprintf("\\(P_{bas}\\)"):( \
(i==1)?sprintf("\\(P_{pre}\\)"):( \
(i==2)?sprintf("\\(P_{mem}\\)"): \
sprintf("\\(P_{opt}\\)")))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
measuret3="Optimal energy consumption"
myxlabel(i)=sprintf("%s", word(measurets,int(ston(i))))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesamax=fig."-measure-".measuretype."-".study."-tikzsa-max.tex"
tikzfilesabase=fig."-measure-".measuretype."-".study."-tikzsa-base.tex"
tikzfilesaexp=fig."-measure-".measuretype."-".study."-tikzsa-exp.tex"
tikzfilesaci=fig."-measure-".measuretype."-".study."-tikzsa-ci.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
#set title title offset 0,5.0
unset title
#set xlabel "time (hours)"
set xlabel "Weather scenario (\\(\\bar{T}_0, T^a_0, \\Delta{T}^{dew}_0, T^{dew}_a\\))" offset 0,-0.5
set ylabel measurey
set format x "%2.0f"
set format y "%2.0f"
#set format y "$10^{%L}$"
#set xtics ("100" 0,"200" 1,"300" 2,"400" 3,"500" 4) nomirror
#set xtics (xlabel(1) 0, xlabel(2) 1, xlabel(3) 2, xlabel(4) 3, xlabel(5) 4, xlabel(6) 5, xlabel(7) 6, xlabel(8) 7, xlabel(9) 8) nomirror rotate by 45 right
set xtics nomirror rotate by 30 right
set ytics nomirror
set yrange [0:2200]
set ytics left offset -4.5,0 add ("2200" 2200)
set mytics 10
set border 3
#set key bottom left maxrows 4 spacing 1.2
set key at graph 1.0, graph 1 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
unset logscale x
unset logscale y
set term tikz
set output tikzfile
plot "<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n) with boxes lc 1 fill solid 0.1 title measuret(0),\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n) with boxes lc 1 notitle,\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))*t*n) with boxes lc 2 fill solid 0.1 title measuret(1),\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))*t*n) with boxes lc 2 notitle,\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):xticlabels(myxlabel($1)) with boxes lc 3 fill solid 0.1 title measuret(2),\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):xticlabels(myxlabel($1)) with boxes lc 3 notitle
set label sprintf("\\(\\max\{\\mu_U\}=%.0f\\)", t*n) at graph 0.87,0.87 center
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
# log scale y
set format y "%g"
set ytics add ("" 2200, "3000" 3000)
set yrange [0.001:3000]
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
set ytics add ("" 3000)
unset logscale y
set yrange [0:*]
if( tikzsa ) {
unset label
set yrange [0:*]
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set term tikz standalone
set output tikzfilesamax
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesamax
system(cmd)
}
if( tikzsa ) {
unset label
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set term tikz standalone
set output tikzfilesaexp
plot "<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n) with boxes lc 1 fill solid 0.1 title measuret(0),\
'' using (column(0)-xind(1)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n+5) with boxes lc 1 notitle,\
'' using (column(0)-xind(1)*d_width):(column(cind(1))*t*n+500):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))*t*n) with boxes lc 2 fill solid 0.1 title measuret(1),\
'' using (column(0)-xind(2)*d_width):(column(cind(1))*t*n):(strcol(cind(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))*t*n) with boxes lc 2 notitle,\
'' using (column(0)-xind(2)*d_width):(column(cind(1))*t*n+500):(strcol(cind(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):xticlabels(myxlabel($1)) with boxes lc 3 fill solid 0.1 title measuret(2),\
'' using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):xticlabels(myxlabel($1)) with boxes lc 3 notitle,\
'' using (column(0)-xind(3)*d_width):(column(cind(1))*t*n+500):(strcol(cind(1)-1)) with labels offset 0,1 title ""
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesaexp
system(cmd)
}
if( tikzsa ) {
unset label
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set term tikz standalone
set output tikzfilesabase
plot "<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n) with boxes lc 1 title measuret(0),\
'' using (column(0)-xind(1)*d_width):(column(cind(1))*t*n):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolvergz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))*t*n) with boxes lc 2 title measuret(1),\
'' using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))*t*n):(strcol(cind_policy_1(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):xticlabels(myxlabel($1)) with boxes lc 3 title measuret(2),\
'' using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):(strcol(cind(1)-1)) with labels offset 0,1 title ""
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesabase
system(cmd)
}
if( tikzsa ) {
unset label
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set term tikz standalone
set output tikzfilesaci
plot "<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n) with boxes lc 1 fill solid 0.1 title measuret(0),\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n):((column(cind(1))-column(cind(1)+1))*t*n):((column(cind(1))+column(cind(1)+1))*t*n) with errorbars lc 1 pt 0 notitle,\
'' using (column(0)-xind(1)*d_width):(column(cind(1))*t*n):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))*t*n) with boxes lc 2 fill solid 0.1 title measuret(1),\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))*t*n):((column(cind(1))-column(cind(1)+1))*t*n):((column(cind(1))+column(cind(1)+1))*t*n) with errorbars lc 2 pt 0 notitle,\
'' using (column(0)-xind(2)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):xticlabels(myxlabel($1)) with boxes lc 3 fill solid 0.1 title measuret(2),\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):((column(cind(1))-column(cind(1)+1))*t*n):((column(cind(1))+column(cind(1)+1))*t*n) with errorbars lc 3 pt 0 notitle,\
'' using (column(0)-xind(3)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title ""
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesaci
system(cmd)
}
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# test values
cmd=bin. "/datagz.bash " . measure . " " . data_policy_2(3)
system(cmd)
#exit
cmd=bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\""
system(cmd)
cmd=bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\""
system(cmd)
reset
# Delay
fig="53"
measuretype="Unavailability"
study="varWeatherScenario"
title="Unavailability for day for different weather scenarios. Label: exp number\npolicy 0, label 1: \\(\\Delta T=0\\)\npolicy 1, label 4: \\(\\tilde{T}_{thr}=0\\)\npolicy 2, label 5: \\(\\Delta T=0,T^{ageMax}_{dm}=5\\)"
scenarios="sim_vardelta_T0m10_T0w1_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T0m10_T0w1_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw10_POLICY_0 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw10_POLICY_0" # space separed list of scenarios to compare
scenarios_policy_1="sim_vardelta_T0m10_T0w1_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T0m10_T0w1_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw10_POLICY_1 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw10_POLICY_1" # space separed list of scenarios to compare
scenarios_policy_2="sim_vardelta_T0m10_T0w1_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T0m10_T0w1_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T0m10_T0w1_DPT0diff10_DPw10_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T0m10_T0w10_DPT0diff10_DPw10_POLICY_2" # space separed list of scenarios to compare
measurets="'(-10,1,1,1)' '(-10,1,1,10)' '(-10,1,10,1)' '(-10,1,10,10)' '(-10,10,1,1)' '(-10,10,1,10)' '(-10,10,10,1)' '(-10,10,10,10)'"
serieinds="4" # list of the indexes corresponding to the scenarios to plot
serieinds_policy_1="13" # list of the indexes corresponding to the scenarios to plot
colinds="4" # list of the indexes corresponding to the column to plot
xinds="4 2 0 -2" # indexes used for the values on the axis x
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(measurets)>words(scenarios_policy_1)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(measurets)>words(scenarios_policy_2)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
data_policy_2(i)=datapath(word(scenarios_policy_2,i))
serieind(i)=word(serieinds,ston(i))
serieind_policy_1(i)=word(serieinds_policy_1,ston(i))
lstyle(i)=ston(word(lstyles,ston(i)))
xind(i)=ston(word(xinds,ston(i)))
ms=1 # series number
# using index from seriesinds
cind(i)=ston(word(serieinds,i))
cind_policy_1(i)=ston(word(serieinds_policy_1,i))
# styles
dx=1.1
total_box_width_relative=0.15
gap_width_relative=0.02
d_width=(gap_width_relative+total_box_width_relative)*dx/2.
reset
set boxwidth total_box_width_relative/ms relative
set style fill pattern
set grid y
measure="WUnavailability"
measurelabel="\\(\\mu_U\\)"
measurey=measurelabel . " (min)"
measure2="YUsedEnergy"
measurelabel2="\\(\\mu_E\\)"
measurey2=measurelabel2 . " (kWh)"
measure3="WNeededEnergy" # optimal energy consumption for switch day averaged
measuret(i)=(i==0)?sprintf("\\(P_{bas}\\)"):( \
(i==1)?sprintf("\\(P_{pre}\\)"):( \
(i==2)?sprintf("\\(P_{mem}\\)"): \
sprintf("\\(P_{opt}\\)")))
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
measuret3="Optimal energy consumption"
myxlabel(i)=sprintf("%s", word(measurets,int(ston(i))))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesamax=fig."-measure-".measuretype."-".study."-tikzsa-max.tex"
tikzfilesabase=fig."-measure-".measuretype."-".study."-tikzsa-base.tex"
tikzfilesaexp=fig."-measure-".measuretype."-".study."-tikzsa-exp.tex"
tikzfilesaci=fig."-measure-".measuretype."-".study."-tikzsa-ci.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
#set title title offset 0,5.0
unset title
#set xlabel "time (hours)"
set xlabel "Weather scenario (\\(\\bar{T}_0, T^a_0, \\Delta{T}^{dew}_0, T^{dew}_a\\))" offset 0,-0.5
set ylabel measurey
set format x "%2.0f"
set format y "%2.0f"
#set format y "$10^{%L}$"
#set xtics ("100" 0,"200" 1,"300" 2,"400" 3,"500" 4) nomirror
#set xtics (xlabel(1) 0, xlabel(2) 1, xlabel(3) 2, xlabel(4) 3, xlabel(5) 4, xlabel(6) 5, xlabel(7) 6, xlabel(8) 7, xlabel(9) 8) nomirror rotate by 45 right
set xtics nomirror rotate by 30 right
set ytics nomirror
set yrange [0:*]
set ytics left offset -4.0,0
set mytics 10
set border 3
#set key bottom left maxrows 4 spacing 1.2
set key at graph 1.0, graph 1 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
unset logscale x
unset logscale y
set term tikz
set output tikzfile
plot "<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n) with boxes lc 1 fill solid 0.1 title measuret(0),\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n) with boxes lc 1 notitle,\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))*t*n) with boxes lc 2 fill solid 0.1 title measuret(1),\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))*t*n) with boxes lc 2 notitle,\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):xticlabels(myxlabel($1)) with boxes lc 3 fill solid 0.1 title measuret(2),\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):xticlabels(myxlabel($1)) with boxes lc 3 notitle
set label sprintf("\\(\\max\{\\mu_U\}=%.0f\\)", t*n) at graph 0.87,0.87 center
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
# log scale y
set format y "%g"
set yrange [0.001:*]
set logscale y
if( tikzsa ) {
set term tikz standalone
set output tikzfilesalogy
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesalogy
system(cmd)
}
set ytics add ("" 3000)
unset logscale y
set yrange [0:*]
if( tikzsa ) {
unset label
set yrange [0:*]
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set term tikz standalone
set output tikzfilesamax
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesamax
system(cmd)
}
if( tikzsa ) {
unset label
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set term tikz standalone
set output tikzfilesaexp
plot "<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n) with boxes lc 1 fill solid 0.1 title measuret(0),\
'' using (column(0)-xind(1)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n+5) with boxes lc 1 notitle,\
'' using (column(0)-xind(1)*d_width):(column(cind(1))*t*n+500):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))*t*n) with boxes lc 2 fill solid 0.1 title measuret(1),\
'' using (column(0)-xind(2)*d_width):(column(cind(1))*t*n):(strcol(cind(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))*t*n) with boxes lc 2 notitle,\
'' using (column(0)-xind(2)*d_width):(column(cind(1))*t*n+500):(strcol(cind(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):xticlabels(myxlabel($1)) with boxes lc 3 fill solid 0.1 title measuret(2),\
'' using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):xticlabels(myxlabel($1)) with boxes lc 3 notitle,\
'' using (column(0)-xind(3)*d_width):(column(cind(1))*t*n+500):(strcol(cind(1)-1)) with labels offset 0,1 title ""
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesaexp
system(cmd)
}
if( tikzsa ) {
unset label
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set term tikz standalone
set output tikzfilesabase
plot "<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n) with boxes lc 1 title measuret(0),\
'' using (column(0)-xind(1)*d_width):(column(cind(1))*t*n):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolvergz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))*t*n) with boxes lc 2 title measuret(1),\
'' using (column(0)-xind(2)*d_width):(column(cind_policy_1(1))*t*n):(strcol(cind_policy_1(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):xticlabels(myxlabel($1)) with boxes lc 3 title measuret(2),\
'' using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):(strcol(cind(1)-1)) with labels offset 0,1 title ""
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesabase
system(cmd)
}
if( tikzsa ) {
unset label
set key at graph 1.05, graph 0.8 maxrows 1 spacing 1.2 reverse Left width 0.5 samplen 1.7
set term tikz standalone
set output tikzfilesaci
plot "<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n) with boxes lc 1 fill solid 0.1 title measuret(0),\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))*t*n):((column(cind(1))-column(cind(1)+1))*t*n):((column(cind(1))+column(cind(1)+1))*t*n) with errorbars lc 1 pt 0 notitle,\
'' using (column(0)-xind(1)*d_width):(column(cind(1))*t*n):(strcol(cind(1)-1)) with labels offset 0,1 title "",\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))*t*n) with boxes lc 2 fill solid 0.1 title measuret(1),\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_1 . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))*t*n):((column(cind(1))-column(cind(1)+1))*t*n):((column(cind(1))+column(cind(1)+1))*t*n) with errorbars lc 2 pt 0 notitle,\
'' using (column(0)-xind(2)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title "", \
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):xticlabels(myxlabel($1)) with boxes lc 3 fill solid 0.1 title measuret(2),\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))*t*n):((column(cind(1))-column(cind(1)+1))*t*n):((column(cind(1))+column(cind(1)+1))*t*n) with errorbars lc 3 pt 0 notitle,\
'' using (column(0)-xind(3)*d_width):(column(cind(1))):(strcol(cind(1)-1)) with labels offset 0,1 title ""
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesaci
system(cmd)
}
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# test values
cmd=bin. "/datagz.bash " . measure . " " . data_policy_2(3)
system(cmd)
#exit
cmd=bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\""
system(cmd)
cmd=bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios . "\""
system(cmd)
reset
# Delay
fig="54"
measuretype="Energy"
study="varWeatherScenario"
title="Energy Consumption for day for different weather scenarios"
scenarios="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_0 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_0" # space separed list of scenarios to compare
scenarios_policy_1="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_1 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_1" # space separed list of scenarios to compare
scenarios_policy_2="sim_vardelta_T00_T0w1_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T00_T0w1_DPT0diff10_DPw10_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff1_DPw1_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff1_DPw10_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff10_DPw1_POLICY_2 sim_vardelta_T00_T0w10_DPT0diff10_DPw10_POLICY_2" # space separed list of scenarios to compare
measurets="'(0,1,1,1)' '(0,1,1,10)' '(0,1,10,1)' '(0,1,10,10)' '(0,10,1,1)' '(0,10,1,10)' '(0,10,10,1)' '(0,10,10,10)'"
serieinds="2" # list of the indexes corresponding to the scenarios to plot
colinds="4" # list of the indexes corresponding to the column to plot
xinds="3 2.4 1.5 0.9 0 -0.6 -1.5 -2.1" # indexes used for the values on the axis x
m=words(scenarios) # scenarios
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
# check input params
if(words(measurets)>words(scenarios)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(measurets)>words(scenarios_policy_1)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
# check input params
if(words(measurets)>words(scenarios_policy_2)) {
print "Ops! Fig. #".fig.": Number of scenario labels (".words(measurets).") greater than number of scenarios (".words(scenarios).")"
exit
}
data(i)=datapath(word(scenarios,i))
data_policy_1(i)=datapath(word(scenarios_policy_1,i))
data_policy_2(i)=datapath(word(scenarios_policy_2,i))
serieind(i)=ston(word(serieinds,ston(i)))
lstyle(i)=ston(word(lstyles,ston(i)))
xind(i)=ston(word(xinds,ston(i)))
ms=1 # series number
# using index from seriesinds
scenario(i)=word(scenarios,i)
scenario_policy_1(i)=word(scenarios_policy_1,i)
scenario_policy_2(i)=word(scenarios_policy_2,i)
# using index from colinds
cind(i)=ston(word(colinds,i))
# styles
dx=1.1
total_box_width_relative=0.15
gap_width_relative=0.02
d_width=(gap_width_relative+total_box_width_relative)*dx/2.
reset
#set boxwidth total_box_width_relative/ms relative
set boxwidth 0.05 absolute
set style fill pattern
set grid y
measure="YUsedEnergy"
measurelabel="\\(\\mu_E\\)"
measurey=measurelabel . " (kWh)"
measure2="WUnavailability"
measure2threshold=sprintf("%f",50.0/(t*n))
measurelabel2="\\(\\mu_U\\)"
measurey2=measurelabel2 . " (min)"
measure3="WNeededEnergy" # optimal energy consumption for switch day averaged
measuret=sprintf("\\(\\mu_U^{thr}=50\\)")
measuret2(i)=sprintf("%s, %s", measurelabel2, word(measurets,ston(i)))
measuret3="Optimal energy consumption"
myxlabel(i)=sprintf("%s", word(measurets,int(ston(i))))
tabfile=fig."-measure-".measuretype."-".study.".tab"
tikzfilesa=fig."-measure-".measuretype."-".study."-tikzsa.tex"
tikzfilesabase=fig."-measure-".measuretype."-".study."-tikzsa-base.tex"
tikzfilesaexp=fig."-measure-".measuretype."-".study."-tikzsa-exp.tex"
tikzfilesaci=fig."-measure-".measuretype."-".study."-tikzsa-ci.tex"
tikzfilesanoleg=fig."-measure-".measuretype."-".study."-tikzsa-noleg.tex"
tikzfilesalogy=fig."-measure-".measuretype."-".study."-tikzsa-logy.tex"
tikzfile=fig."-measure-".measuretype."-".study."-tikz.tex"
set notitle
#unset title
#set xlabel "time (hours)"
set xlabel "Policies" offset 0,-0.5
set ylabel measurey
set format x "%2.0f"
#set format y "%2.0d"
set format y "%2.0f"
#set xtics ("100" 0,"200" 1,"300" 2,"400" 3,"500" 4) nomirror
#set xtics (xlabel(1) 0, xlabel(2) 1, xlabel(3) 2, xlabel(4) 3, xlabel(5) 4, xlabel(6) 5, xlabel(7) 6, xlabel(8) 7, xlabel(9) 8) nomirror rotate by 45 right
set xtics ("\\(P_{bas}\\)" -0.2525, "\\(P_{pre}\\)" -0.112, "\\(P_{mem}\\)" 0.0284, "\\(P_{opt}\\)" 0.15) nomirror
set ytics nomirror
set xrange [-0.33:0.2]
set yrange [0:*]
set ytics left offset -4.5,0
set mytics 10
set border 3
#set key bottom left maxrows 4 spacing 1.2
set key at graph 1, graph 0.7 maxrows 1 spacing 1
#set key off
unset logscale x
unset logscale y
set term tikz
set output tikzfile
plot "<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenario(serieind(1)) . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 fill solid 0.1 notitle,\
'' using (column(0)-xind(1)*d_width):(column(cind(1))):("Min/Max") with labels offset 0,3 rotate by 90 title "",\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenario(serieind(1)) . "\"" using (column(0)-xind(1)*d_width):(column(cind(1))) with boxes lc 1 notitle,\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenario_policy_1(serieind(1)) . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))) with boxes lc 2 fill solid 0.1 notitle,\
'' using (column(0)-xind(3)*d_width):(column(cind(1))):("Min/Max") with labels offset 0,3 rotate by 90 title "",\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenario_policy_1(serieind(1)) . "\"" using (column(0)-xind(3)*d_width):(column(cind(1))) with boxes lc 2 notitle,\
"<" .bin. "/databysolversortedreversegz.bash " . measure . " " . csvgzfile . " \"" . scenario_policy_2(serieind(1)) . "\"" using (column(0)-xind(5)*d_width):(column(cind(1))) with boxes lc 3 fill solid 0.1 notitle,\
'' using (column(0)-xind(5)*d_width):(column(cind(1))):("Min/Max") with labels offset 0,3 rotate by 90 title "",\
"<" .bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenario_policy_2(serieind(1)) . "\"" using (column(0)-xind(5)*d_width):(column(cind(1))) with boxes lc 3 notitle,\
"<" .bin. "/data_min_M1_suchthat_M2_lesseq_Thr_gz.bash " . measure . " " . measure2 . " " . measure2threshold . " " . csvgzfile . " \"" . scenario(serieind(1)) . "\"" using (column(0)-xind(2)*d_width):(column(cind(1))) with boxes lc 7 fillstyle pattern 5 notitle,\
"<" .bin. "/data_min_M1_suchthat_M2_lesseq_Thr_gz.bash " . measure . " " . measure2 . " " . measure2threshold . " " . csvgzfile . " \"" . scenario_policy_1(serieind(1)) . "\"" using (column(0)-xind(4)*d_width):(column(cind(1))) with boxes lc 7 fillstyle pattern 5 title measuret,\
"<" .bin. "/data_min_M1_suchthat_M2_lesseq_Thr_gz.bash " . measure . " " . measure2 . " " . measure2threshold . " " . csvgzfile . " \"" . scenario_policy_2(serieind(1)) . "\"" using (column(0)-xind(6)*d_width):(column(cind(1))) with boxes lc 7 fillstyle pattern 5 notitle,\
"<" .bin. "/databysolvergz.bash " . measure3 . " " . csvgzfile . " \"" . scenario_policy_1(serieind(1)) . "\"" using (column(0)-xind(7)*d_width):(column(cind(1))*t*n*energyfortimeunit) with boxes lc 4 notitle,\
t*n*energyfortimeunit with lines dt 2 title ""
set label sprintf("\\(\\max\{\\mu_E\}=%.0f\\)", t*n*energyfortimeunit) at graph 0.2,0.93 center
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
}
if( aqua ) {
set output
set term aqua fig
replot
}
if( table ) {
set format x "% g"
set format y "%g"
set table tabfile
replot
unset table
}
# test values
cmd=bin. "/datagz.bash " . measure2 . " " . data_policy_2(3)
system(cmd)
#exit
cmd=bin. "/databysolversortedgz.bash " . measure . " " . csvgzfile . " \"" . scenarios_policy_2 . "\""
system(cmd)
reset
# legend only
fig="61"
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
m=words(lstyles1)
serieind=1
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# fix yellow color with Maroon
#set for [i=3:3] style line i lt lstyle(i) lw 1 pt lstyle(i) lc rgb '#800000'
#set for [i=3:3] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) lc rgb '#800000'
tikzfilesa=fig."-legend.tex"
tikzfile=fig."-legend.tex"
set yrange [0:1]
unset border
unset tics
set key at graph 0, graph 0.5 vertical samplen 3 maxrows 1
set size 3, 1
set term tikz
set output tikzfile
# plot for each scenario
plot for[i=serieind:serieind] NaN with lp ls i title " ",\
for[i=serieind:serieind] -100 notitle
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
pdffile=remext(tikzfilesa) . ".pdf"
cmdcrop="../bin/pdf2pdfcrop.bash -r " . pdffile
system(cmdcrop)
}
if( aqua ) {
set output
set term aqua fig
replot
}
reset
# legend only
fig="62"
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
m=words(lstyles1)
serieind=3
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# fix yellow color with Maroon
#set for [i=3:3] style line i lt lstyle(i) lw 1 pt lstyle(i) lc rgb '#800000'
#set for [i=3:3] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) lc rgb '#800000'
tikzfilesa=fig."-legend.tex"
tikzfile=fig."-legend.tex"
set yrange [0:1]
unset border
unset tics
set key at graph 0, graph 0.5 vertical samplen 3 maxrows 1
set size 3, 1
set term tikz
set output tikzfile
# plot for each scenario
plot for[i=serieind:serieind] NaN with lp ls i title " ",\
for[i=serieind:serieind] -100 notitle
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
pdffile=remext(tikzfilesa) . ".pdf"
cmdcrop="../bin/pdf2pdfcrop.bash -r " . pdffile
system(cmdcrop)
}
if( aqua ) {
set output
set term aqua fig
replot
}
reset
# legend only
fig="63"
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
m=words(lstyles1)
serieind=6
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# fix yellow color with Maroon
#set for [i=3:3] style line i lt lstyle(i) lw 1 pt lstyle(i) lc rgb '#800000'
#set for [i=3:3] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) lc rgb '#800000'
tikzfilesa=fig."-legend.tex"
tikzfile=fig."-legend.tex"
set yrange [0:1]
unset border
unset tics
set key at graph 0, graph 0.5 vertical samplen 3 maxrows 1
set size 3, 1
set term tikz
set output tikzfile
# plot for each scenario
plot for[i=serieind:serieind] NaN with lp ls i title " ",\
for[i=serieind:serieind] -100 notitle
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
pdffile=remext(tikzfilesa) . ".pdf"
cmdcrop="../bin/pdf2pdfcrop.bash -r " . pdffile
system(cmdcrop)
}
if( aqua ) {
set output
set term aqua fig
replot
}
reset
# legend only
fig="64"
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
m=words(lstyles1)
serieind=8
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# fix yellow color with Maroon
#set for [i=3:3] style line i lt lstyle(i) lw 1 pt lstyle(i) lc rgb '#800000'
#set for [i=3:3] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) lc rgb '#800000'
tikzfilesa=fig."-legend.tex"
tikzfile=fig."-legend.tex"
set yrange [0:1]
unset border
unset tics
set key at graph 0, graph 0.5 vertical samplen 3 maxrows 1
set size 3, 1
set term tikz
set output tikzfile
# plot for each scenario
plot for[i=serieind:serieind] NaN with lp ls i title " ",\
for[i=serieind:serieind] -100 notitle
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
pdffile=remext(tikzfilesa) . ".pdf"
cmdcrop="../bin/pdf2pdfcrop.bash -r " . pdffile
system(cmdcrop)
}
if( aqua ) {
set output
set term aqua fig
replot
}
reset
# legend only
fig="65"
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
m=words(lstyles1)
serieind=1
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# fix yellow color with Maroon
#set for [i=3:3] style line i lt lstyle(i) lw 1 pt lstyle(i) lc rgb '#800000'
#set for [i=3:3] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) lc rgb '#800000'
tikzfilesa=fig."-legend.tex"
tikzfile=fig."-legend.tex"
set yrange [0:1]
unset border
unset tics
set key at graph 0, graph 0.5 vertical samplen 3 maxrows 1
set size 3, 1
set term tikz
set output tikzfile
# plot for each scenario
plot for[i=serieind:serieind] NaN with lp ls i+m title " ",\
for[i=serieind:serieind] -100 notitle
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
pdffile=remext(tikzfilesa) . ".pdf"
cmdcrop="../bin/pdf2pdfcrop.bash -r " . pdffile
system(cmdcrop)
}
if( aqua ) {
set output
set term aqua fig
replot
}
reset
# legend only
fig="66"
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
m=words(lstyles1)
serieind=3
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# fix yellow color with Maroon
#set for [i=3:3] style line i lt lstyle(i) lw 1 pt lstyle(i) lc rgb '#800000'
#set for [i=3:3] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) lc rgb '#800000'
tikzfilesa=fig."-legend.tex"
tikzfile=fig."-legend.tex"
set yrange [0:1]
unset border
unset tics
set key at graph 0, graph 0.5 vertical samplen 3 maxrows 1
set size 3, 1
set term tikz
set output tikzfile
# plot for each scenario
plot for[i=serieind:serieind] NaN with lp ls i+m title " ",\
for[i=serieind:serieind] -100 notitle
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
pdffile=remext(tikzfilesa) . ".pdf"
cmdcrop="../bin/pdf2pdfcrop.bash -r " . pdffile
system(cmdcrop)
}
if( aqua ) {
set output
set term aqua fig
replot
}
reset
# legend only
fig="67"
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
m=words(lstyles1)
serieind=6
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# fix yellow color with Maroon
#set for [i=3:3] style line i lt lstyle(i) lw 1 pt lstyle(i) lc rgb '#800000'
#set for [i=3:3] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) lc rgb '#800000'
tikzfilesa=fig."-legend.tex"
tikzfile=fig."-legend.tex"
set yrange [0:1]
unset border
unset tics
set key at graph 0, graph 0.5 vertical samplen 3 maxrows 1
set size 3, 1
set term tikz
set output tikzfile
# plot for each scenario
plot for[i=serieind:serieind] NaN with lp ls i+m title " ",\
for[i=serieind:serieind] -100 notitle
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
pdffile=remext(tikzfilesa) . ".pdf"
cmdcrop="../bin/pdf2pdfcrop.bash -r " . pdffile
system(cmdcrop)
}
if( aqua ) {
set output
set term aqua fig
replot
}
reset
# legend only
fig="68"
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
m=words(lstyles1)
serieind=8
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# fix yellow color with Maroon
#set for [i=3:3] style line i lt lstyle(i) lw 1 pt lstyle(i) lc rgb '#800000'
#set for [i=3:3] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) lc rgb '#800000'
tikzfilesa=fig."-legend.tex"
tikzfile=fig."-legend.tex"
set yrange [0:1]
unset border
unset tics
set key at graph 0, graph 0.5 vertical samplen 3 maxrows 1
set size 3, 1
set term tikz
set output tikzfile
# plot for each scenario
plot for[i=serieind:serieind] NaN with lp ls i+m title " ",\
for[i=serieind:serieind] -100 notitle
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
pdffile=remext(tikzfilesa) . ".pdf"
cmdcrop="../bin/pdf2pdfcrop.bash -r " . pdffile
system(cmdcrop)
}
if( aqua ) {
set output
set term aqua fig
replot
}
reset
# legend only
fig="71"
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
m=words(lstyles1)
serieind=1
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# my color for filledcurves
filledcolors="'#33FFFF' '#FF99CC' '#FF9933' '#0000FF' '#808080' '#00FF00' '#E0E0E0' '#FF0000'"
myfilledcolor(i)=word(filledcolors,i)
# fix yellow color with Maroon
#set for [i=3:3] style line i lt lstyle(i) lw 1 pt lstyle(i) lc rgb '#800000'
#set for [i=3:3] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) lc rgb '#800000'
tikzfilesa=fig."-legend.tex"
tikzfile=fig."-legend.tex"
set yrange [0:1]
unset border
unset tics
set key at graph 0, graph 0.5 vertical samplen 3 maxrows 1
set size 3, 1
set term tikz
set output tikzfile
# plot for each scenario
plot for[i=serieind:serieind] NaN with filledcurves fill transparent solid filltransparence noborder lc rgb myfilledcolor(ston(i)) title " ", \
for[i=serieind:serieind] -100 notitle
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
pdffile=remext(tikzfilesa) . ".pdf"
cmdcrop="../bin/pdf2pdfcrop.bash -r " . pdffile
system(cmdcrop)
}
if( aqua ) {
set output
set term aqua fig
replot
}
reset
# legend only
fig="72"
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
m=words(lstyles1)
serieind=3
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# my color for filledcurves
filledcolors="'#33FFFF' '#FF99CC' '#FF9933' '#0000FF' '#808080' '#00FF00' '#E0E0E0' '#FF0000'"
myfilledcolor(i)=word(filledcolors,i)
# fix yellow color with Maroon
#set for [i=3:3] style line i lt lstyle(i) lw 1 pt lstyle(i) lc rgb '#800000'
#set for [i=3:3] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) lc rgb '#800000'
tikzfilesa=fig."-legend.tex"
tikzfile=fig."-legend.tex"
set yrange [0:1]
unset border
unset tics
set key at graph 0, graph 0.5 vertical samplen 3 maxrows 1
set size 3, 1
set term tikz
set output tikzfile
# plot for each scenario
plot for[i=serieind:serieind] NaN with filledcurves fill transparent solid filltransparence noborder lc rgb myfilledcolor(ston(i)) title " ", \
for[i=serieind:serieind] -100 notitle
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
pdffile=remext(tikzfilesa) . ".pdf"
cmdcrop="../bin/pdf2pdfcrop.bash -r " . pdffile
system(cmdcrop)
}
if( aqua ) {
set output
set term aqua fig
replot
}
reset
# legend only
fig="73"
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
m=words(lstyles1)
serieind=6
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# my color for filledcurves
filledcolors="'#33FFFF' '#FF99CC' '#FF9933' '#0000FF' '#808080' '#00FF00' '#E0E0E0' '#FF0000'"
myfilledcolor(i)=word(filledcolors,i)
# fix yellow color with Maroon
#set for [i=3:3] style line i lt lstyle(i) lw 1 pt lstyle(i) lc rgb '#800000'
#set for [i=3:3] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) lc rgb '#800000'
tikzfilesa=fig."-legend.tex"
tikzfile=fig."-legend.tex"
set yrange [0:1]
unset border
unset tics
set key at graph 0, graph 0.5 vertical samplen 3 maxrows 1
set size 3, 1
set term tikz
set output tikzfile
# plot for each scenario
plot for[i=serieind:serieind] NaN with filledcurves fill transparent solid filltransparence noborder lc rgb myfilledcolor(ston(i)) title " ", \
for[i=serieind:serieind] -100 notitle
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
pdffile=remext(tikzfilesa) . ".pdf"
cmdcrop="../bin/pdf2pdfcrop.bash -r " . pdffile
system(cmdcrop)
}
if( aqua ) {
set output
set term aqua fig
replot
}
reset
# legend only
fig="74"
lstyles1="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
lstyles2="1 2 5 6 3 4 7 8" # lt and dt style for each scenario
m=words(lstyles1)
serieind=8
lstyle(i)=ston(word(lstyles,ston(i)))
# styles
set pointsize 1.5
set style data lines
lstyle(i)=ston(word(lstyles1,ston(i)))
set for [i=1:m] style line i lt lstyle(i) lw 1 pt lstyle(i) linecolor rgb "black"
lstyle2(i)=ston(word(lstyles2,ston(i)))
set for [i=1:m] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) linecolor rgb "black"
#set style line 1 lt lstyle(1) lw 1 pt 1
#set style line 2 lt lstyle(2) dt lstyle(2) lw 1 pt
# my color for filledcurves
filledcolors="'#33FFFF' '#FF99CC' '#FF9933' '#0000FF' '#808080' '#00FF00' '#E0E0E0' '#FF0000'"
myfilledcolor(i)=word(filledcolors,i)
# fix yellow color with Maroon
#set for [i=3:3] style line i lt lstyle(i) lw 1 pt lstyle(i) lc rgb '#800000'
#set for [i=3:3] style line i+m lt lstyle2(i) dt 2 lw 1 pt lstyle2(i) lc rgb '#800000'
tikzfilesa=fig."-legend.tex"
tikzfile=fig."-legend.tex"
set yrange [0:1]
unset border
unset tics
set key at graph 0, graph 0.5 vertical samplen 3 maxrows 1
set size 3, 1
set term tikz
set output tikzfile
# plot for each scenario
plot for[i=serieind:serieind] NaN with filledcurves fill transparent solid filltransparence noborder lc rgb myfilledcolor(ston(i)) title " ", \
for[i=serieind:serieind] -100 notitle
if( tikzsa ) {
set term tikz standalone
set output tikzfilesa
replot
unset output
cmd="pdflatex -interaction=nonstopmode " . tikzfilesa
system(cmd)
pdffile=remext(tikzfilesa) . ".pdf"
cmdcrop="../bin/pdf2pdfcrop.bash -r " . pdffile
system(cmdcrop)
}
if( aqua ) {
set output
set term aqua fig
replot
}