I wrote the sample code with variable length of 10 and the solver solved it. Using the same code I then increased my data points to 8760 and now i get
’Error using * (line 41)
Inner matrix dimensions must agree
Error in minimize (line 14)
x = evalin( ‘caller’, sprintf( '%s ', varargin{:} ) );
Error in tempimport (line 95)
minimize Price*P’
Tamb, Price are 8760x1 data set
The code is as
Q=-100.5*(1-exp(-15/434));Q1=exp(-15/434);Q2=(1-exp(-15/434)); % Check 100.5 value for C/W
Price= reshape(price,[8760,1]);
P_ac=5;
To=Tamb; % Temp outside
Tmin=71;Tmax=75;Tint=[74;73;72];
cvx_begin
cvx_solver gurobi
variables T1(8761) T2(8761) T3(8761) P(8760);
variable W1(8760) integer;
variable W2(8760) integer;
variable W3(8760) integer;
minimize Price*P
for Wn=1:1:1
T1((Wn-1)*0+1)==Tint(1);
T2((Wn-1)*0+1)==Tint(2);
T3((Wn-1)*0+1)==Tint(3);
for i=2:8761;
T1(i)==To*Q2+W1(i-1)*Q+T1(i-1)*Q1;
T2(i)==To*Q2+W2(i-1)*Q+T2(i-1)*Q1;
T3(i)==To*Q2+W3(i-1)*Q+T3(i-1)*Q1;
end
end
Tmin<=T1<=Tmax;
Tmin<=T2<=Tmax;
Tmin<=T3<=Tmax;
P==[W1]*P_ac+[W2]*P_ac+[W3]*P_ac;
0<=W1<=1;
0<=W2<=1;
0<=W3<=1;
cvx_end