Commit dc135485 authored by Markus Millinger's avatar Markus Millinger
Browse files

Adapted Monte Carlo function and added a test to the main file

parent f201300f
......@@ -57,6 +57,10 @@ for scenario = 1:noScenarios
%Calculate GHG emissions
[s,f] = ghgEmissions(s,f);
%% Monte Carlo sensitivity analysis example of VRE module
[monteCarloOut,weatherYear,H2,runTimeGAMS,timeSteps,EVfactor,dRate,CO2source,H2max,landMax,CO2Use]...
= monteCarlo(1000,s,f,g,techData,powerData);
%% Scenario loop
switch scenario
case 1 %Base scenario
......
......@@ -37,12 +37,14 @@ for simNum=1:iter
c = g;
biofuelsData = biofuelsDataIn;
powerData = powerDataIn;
EndScale = 1;%+0.5*rand;
ScaleFac = linspace(1,EndScale,7);
a.onShore = round(ScaleFac.*a.onShoreWWF1);
a.offShore = round(ScaleFac.*a.offShoreWWF1);
a.photoV = round(ScaleFac.*a.photoVWWF1);
%
% EndScale = 1;%+0.5*rand;
% ScaleFac = linspace(1,EndScale,7);
% a.onShore = round(ScaleFac.*a.onShore);
% a.offShore = round(ScaleFac.*a.offShore);
% a.photoV = round(ScaleFac.*a.photoV);
% a.powerStorage = linspace(9000,30000,7); %GW
% a.powerStorageMax = linspace(66000,100000,7); %GWh
c.timeStepsIntraYear = 1:20;%(1+randi(49));
......@@ -68,8 +70,8 @@ for simNum=1:iter
a.onShore = round(linspace(55,100+rand*100,7));%[55,65,78,84,97,122,173];
a.offShore = round(linspace(6,30+rand*40,7));%[6,18,27,33,39,45,51];
a.photoV = round(linspace(54,100+rand*150,7));%[54,73,84,101,117,134,150];
a.powerStorage = 9000*rand*20;
a.powerStorageMax = 66000*rand*20;
a.powerStorage = linspace(9000,9000+rand*21000,7);
a.powerStorageMax = linspace(66000,66000+rand*44000,7);
a.demandPower = round(linspace(502,500+rand*200,7));%[496+6,465+24,524-34,524-22,621-14,675-8,786-79];
%
......@@ -116,8 +118,8 @@ for simNum=1:iter
photoV(simNum) = a.photoV(7);
demandPower(simNum) = a.demandPower(7);
powerStorage(simNum) = a.powerStorage;
powerStorageMax(simNum) = a.powerStorageMax;
powerStorage(simNum) = a.powerStorage(7);
powerStorageMax(simNum) = a.powerStorageMax(7);
surplusPower2050(simNum) = sum(a.surplusPowerVar(:,31));
% desdds=c.techbiomass
% sdg=c.techbiomass(:,b.numFeed+b.numResidue+2)
......@@ -169,7 +171,7 @@ mCplot(iter,renShare,surplusPower2050,'RE','surplus',plotRow,plotCol,i+8,'scatte
% % mCplot(iter,weatherYear,H2,'Weather year','Electrofuels',3,3,6,'box')
% % mCplot(iter,timeSteps,runTimeGAMS,'Time steps','Run time',3,3,7,'scatter')
picName=['figures/monteCarloScatterFuels'];
picName=['../fig/monteCarloScatterFuels'];
set(gcf,'Position',[0 0 900 600])
set(gcf,'PaperUnits','points','PaperPosition',[0 0 900 600],'PaperPositionMode','auto');
print(gcf,'-painters','-depsc','-loose',picName)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment