-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAddPropertyToPLEXOSFile.m
148 lines (140 loc) · 6.31 KB
/
AddPropertyToPLEXOSFile.m
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
%Michael Craig
%January 18, 2015
%Script for adding row(s) of information to the Property sheet in a file
%for importing to PLEXOS
function [propertiesdata] = AddPropertyToPLEXOSFile(propertiesdata,parentclass,childclass,parentobj,...
childobj, propertyname, propertyvalue, filename, scenarioname, datefrom, dateto)
%Get collection based on childclass
if strcmp(childclass,'Fuel')
collection='Fuels';
elseif strcmp(childclass,'Generator')
collection='Generators';
elseif strcmp(childclass,'Node')
collection='Nodes';
elseif strcmp(childclass,'Data File')
collection='Data Files';
propertyvalue=0;
elseif strcmp(childclass,'Zone')
collection='Zones';
elseif strcmp(childclass,'Emission')
collection='Emissions';
elseif strcmp(childclass,'Reserve')
collection='Reserves';
elseif strcmp(childclass,'Constraint')
collection='Constraints';
elseif strcmp(childclass,'Storage')
collection='Storages';
elseif strcmp(childclass,'Region')
collection='Regions';
else
collection=childclass; %works for zone & region at least
end
%Set property value to 0 and final column to 0 if setting up a datafile
if strcmp(propertyname,'Filename')
propertyvalue=0;
end
%Also set property value to 0 if setting up a Zone-Load association. Need
%to filter out 'Region' load entries, since input a load value of -1 for
%regions and want that property value to be passed through.
if strcmp(propertyname,'Load') && strcmp(childclass,'Region')==0
propertyvalue=0;
end
if strcmp(propertyname,'Production Rate')==0 %if not production rate
%Add row to bottom of propertiesdata
propertyrow=size(propertiesdata,1)+1;
propertiesdata{propertyrow,1}=parentclass; %parent class
propertiesdata{propertyrow,2}=childclass; %child class
propertiesdata{propertyrow,3}=collection; %collection
propertiesdata{propertyrow,4}=parentobj; %parent obj
propertiesdata{propertyrow,5}=childobj; %child obj
propertiesdata{propertyrow,6}=propertyname; %property
propertiesdata{propertyrow,7}=1; %band ID
propertiesdata{propertyrow,8}=propertyvalue; %value
%units
if strcmp(propertyname,'Max Capacity') || strcmp(propertyname,'Min Stable Level') || ...
strcmp(propertyname,'Min Stable Level')
propertiesdata{propertyrow,9}='MW';
elseif strcmp(propertyname,'Max Ramp Up') || strcmp(propertyname,'Max Ramp Down')
propertiesdata{propertyrow,9}='MW/min.';
elseif strcmp(propertyname,'Heat Rate')
propertiesdata{propertyrow,9}='GJ/MWh';
elseif strcmp(propertyname,'Load') || strcmp(propertyname,'Load Participation Factor') || ...
strcmp(propertyname,'Filename')
propertiesdata{propertyrow,9}='-';
elseif strcmp(propertyname,'VO&M Charge')
propertiesdata{propertyrow,9}='$/MWh';
elseif strcmp(propertyname,'Start Cost')
propertiesdata{propertyrow,9}='$';
elseif strcmp(propertyname,'Rating Factor')
propertiesdata{propertyrow,9}='%';
elseif strcmp(propertyname,'Min Down Time')
propertiesdata{propertyrow,9}='hrs';
elseif strcmp(propertyname,'Max Energy Month')
propertiesdata{propertyrow,9}='GWh';
elseif strcmp(propertyname,'Fuel Price')
propertiesdata{propertyrow,9}='$/GJ';
elseif strcmp(propertyname,'Timeframe')%reserves
propertiesdata{propertyrow,9}='sec';
elseif strcmp(propertyname,'Min Provision')%reserves
propertiesdata{propertyrow,9}='MW';
elseif strcmp(propertyname,'Type')%reserves
propertiesdata{propertyrow,9}='-';
elseif strcmp(propertyname,'Pump Units') || strcmp(propertyname,'Units')
propertiesdata{propertyrow,9}='-';
elseif strcmp(propertyname,'Pump Load')
propertiesdata{propertyrow,9}='MW';
elseif strcmp(propertyname,'Pump Efficiency')
propertiesdata{propertyrow,9}='%';
elseif strcmp(propertyname,'Max Volume')
propertiesdata{propertyrow,9}='GWh';
elseif strcmp(propertyname,'Initial Volume')
propertiesdata{propertyrow,9}='GWh';
elseif strcmp(propertyname,'End Effects Method')
propertiesdata{propertyrow,9}='-';
elseif strcmp(propertyname,'Offer Price')
propertiesdata{propertyrow,9}='$/MW';
elseif strcmp(propertyname,'Offer Quantity')
propertiesdata{propertyrow,9}='MW';
end
propertiesdata{propertyrow,10}=datefrom; %date from
propertiesdata{propertyrow,11}=dateto; %date to
propertiesdata{propertyrow,15}=filename;
propertiesdata{propertyrow,16}=scenarioname;
if strcmp(propertyname,'Max Energy Month')
propertiesdata{propertyrow,18}=3; %period type ID - set to 3 for Max Energy Month
else
%Add blank cell at end so propertiesdata is correct size
propertiesdata{propertyrow,18}=[];
end
else
%If production (emission) rate, adding in values for each emissions rate at once,
%so need to loop over values. Values are passed in as: [NOx, SO2, CO2]
for i=1:size(propertyvalue,1)
%Add row to bottom of propertiesdata
propertyrow=size(propertiesdata,1)+1;
propertiesdata{propertyrow,1}=parentclass; %parent class
propertiesdata{propertyrow,2}=childclass; %child class
propertiesdata{propertyrow,3}=collection; %collection
if i==1
propertiesdata{propertyrow,4}='NOx'; %parent obj - here, name of emission
elseif i==2
propertiesdata{propertyrow,4}='SO2';
else
%Here, determine whether hsould add CO2 or CO2CPP based on
%parent object name which is passed in as a dummy
propertiesdata{propertyrow,4}=parentobj;
end
propertiesdata{propertyrow,5}=childobj; %child obj
propertiesdata{propertyrow,6}=propertyname; %property
propertiesdata{propertyrow,7}=1; %band ID
propertiesdata{propertyrow,8}=propertyvalue(i); %value
%units
propertiesdata{propertyrow,9}='kg/MWh';
propertiesdata{propertyrow,10}=datefrom; %date from
propertiesdata{propertyrow,11}=dateto; %date to
propertiesdata{propertyrow,15}=filename;
propertiesdata{propertyrow,16}=scenarioname;
%Add blank cell at end so propertiesdata is correct size
propertiesdata{propertyrow,18}=[];
end
end