-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCalcSensitivities_final_pv_load_double.m
More file actions
92 lines (77 loc) · 2.31 KB
/
CalcSensitivities_final_pv_load_double.m
File metadata and controls
92 lines (77 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
clear
% p='c:\users\zactus\feederReduction\Alp_mod_2.dss';
p='c:\users\zactus\feederReduction\Alpine_load_pv_double.dss';
tic
%%% createPTDF
useSaved=0;
if ~useSaved
criticalBuses={'sourcebus'}
cd c:/users/zactus/FeederReduction/
[circuit, circuit_orig, powerFlowFull, powerFlowReduced, pathToFile] = reducingFeeders_Final_SI(p,criticalBuses,[],1);
load('circuitMap.mat')
save('CircuitRed_sens.mat')
else
load('CircuitRed_sens.mat')
end
load('c:/users/Zactus/feederReduction/AlpineConf.mat');
c=circuit_orig;
dt=30;
timeStart='2014-12-26';
timeEnd='2014-12-26 00:24:30';
timeDay=cellstr(datestr(datenum(timeStart):1:datenum(timeEnd)));
tDay = timeDay{1}; indent = ' ';
t = datenum(timeStart) : dt/24/3600 : (datenum(timeEnd));
ls0=zeros(2880,1);
ls1=ones(2880,1);
ls2=ls1;
ls2(1:50)=linspace(1,.01,50);
c.loadshape(1)=dssloadshape;
c.loadshape(end).name='loadshape_unity';
c.loadshape(end).mult=ls1;
c.loadshape(end).Npts=2880;
c.loadshape(end).sInterval=30;
c.loadshape(end).Interval=1;
c.loadshape(2)=c.loadshape(end);
c.loadshape(end).name='loadshape_var';
c.loadshape(end).mult=ls2;
c.loadshape(end).Npts=2880;
c.loadshape(end).sInterval=30;
c.loadshape(end).Interval=1;
c.loadshape(3)=dssloadshape;
c.loadshape(end).name='loadshape_zero';
c.loadshape(end).mult=ls0;
c.loadshape(end).Npts=2880;
c.loadshape(end).sInterval=30;
c.loadshape(end).Interval=1;
for ii=1:length(c.load)
c.load(ii).daily='loadshape_unity';
end
for ii=1:length(c.pvsystem)
c.pvsystem(ii).daily='loadshape_unity';
end
V_o = dssSimulation_simple(c, conf.mode, t, tDay, [],0);
for ii=1:length(c.pvsystem)
ii
c.pvsystem(ii).daily='loadShape_var';
res = dssSimulation_simple(c, conf.mode, t, tDay, [],0);
%get equation relating to voltage vs loading
parfor jj=1:size(res.Voltage,2)
PTDF_pv(ii,jj,:)=polyfit(c.loadshape(2).mult(1:50),res.Voltage(1:end,jj),3);
end
c.pvsystem(ii).daily='loadshape_unity';
end
%%
for ii=1:length(c.load)
ii
c.load(ii).daily='loadShape_var';
res = dssSimulation_simple(c, conf.mode, t, tDay, [],0);
%get equation relating to voltage vs loading
parfor jj=1:size(res.Voltage,2)
PTDF_l(ii,jj,:)=polyfit(c.loadshape(2).mult(1:50),res.Voltage(1:end,jj),3);
end
c.load(ii).daily='loadshape_unity';
end
PTDF_l_real=PTDF_l;
PTDF_pv_real=PTDF_pv;
toc
save('Sensitivy_file_Alpine_load_pv_double.mat','PTDF_l_real','PTDF_pv_real','V_o')