-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCalcSensitivities_new_mod.m
More file actions
105 lines (89 loc) · 2.66 KB
/
CalcSensitivities_new_mod.m
File metadata and controls
105 lines (89 loc) · 2.66 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
93
94
95
96
97
98
99
100
101
102
103
104
105
clear
% p='c:\users\zactus\feederReduction\Alp_mod_2.dss';
p='c:\users\zactus\feederReduction\Alpine_SI.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);
k=load('Alpine_SI_orig_circuit')
All=strtok(circuit_orig.pvsystem(:).bus1,'.');
for ii=1:length(k.circuit.pvsystem)
New=strtok(k.circuit.pvsystem(ii).bus1,'.');
Inds=find(ismember(All,New));
Map(Inds)=ii;
end
save('CircuitRed.mat')
else
load('CircuitRed.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';
% c.load(ii).kw=c.load(ii).kw*4;
% c.load(ii).model=1;
% c.load(ii).daily='loadshape_var';
end
for ii=1:length(c.pvsystem)
c.pvsystem(ii).daily='loadshape_unity';
c.pvsystem(ii).irradiance=1;
% c.pvsystem(ii).model=1;
% c.pvsystem(ii).pmpp=c.pvsystem(ii).pmpp*4;
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(2:50),res.Voltage(2: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(2:50),res.Voltage(2: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_mod_3.mat','PTDF_l_real','PTDF_pv_real','V_o')