The three constraints are able to solve the problem individually, but when I combine all three it fails to give a solution. could you please help me with this
cvx_begin quiet
variables T(K+1,n1) Tw(K+1,n1) Qdotc(K,n1) p2(K,n1) e(K+1,n2) ph(K,n2) pw(K,n2) pd(K,n2)
expressions p1(K,n1) % intermediate variables (these are just placeholders for text expressions)
p1 = Qdotc./eta1 + (1-1./eta1).pos(Qdotc - eta1.pMax1); % thermal → electric power map (note assignment (=) vs. equality (==) operator)
minimize( pidmax(P + sum(p1,2)+ sum(p2,2) + sum(ph - atHome.pd,2))… % home neighborhood peak
+ pidmax(0,max(pWorkBase + sum(pw - atWork.pd,2)) - max(pWorkBase))… % work neighborhood peak
+ piesum(P + sum(p1,2) + sum(p2,2) + sum(ph + pw,2))… % energy
+ pic(sum(sum(abs(T-Tset))) - sum(sum(abs(Tbase2-Tset)))) …
+ pic*(sum(sum(abs(Tw-Tsetw))) - sum(sum(abs(Tbasew-Tsetw))))) % discomfort
% discomfort
subject to % constraints
%heat pump
T(1, == Tset(1,:); % initial condition
T(K+1, == Tset(K+1,:); % final condition: return to setpoint
T(2:K+1, == repmat(a1,K,1).T(1:K,:)…
+ (1-repmat(a1,K,1)).(repmat(theta,1,n1) + repmat(R,K,1).*(Qdotc + qe));
zeros(K,n1) <= Qdotc <= (eta1.*pMax1 + pMaxAux).*ones(K,n1) % heat pump electric power capacity limits
abs(T - Tset) <= dT
%heat pump water heater
% building temperature
Tw(1, == Tsetw(1,:); % initial condition
Tw(K+1, == Tsetw(K+1,:); % final condition: return to setpoint
Tw(2:K+1, == repmat(aw,K,1).Tw(1:K,:)…
+ (1-repmat(aw,K,1)).(repmat(thetaw,1,n1) + repmat(Rw,K,1).*(etaw.*p2 - ww));
abs(Tw - Tsetw) <= dT
% heat pump power
zeros(K,n1) <= p2 <= pMaxR
% EV energy
e(1, == e0 % initial condition
e(K+1, == e(1,
% terminal condition: return to initial charge
e(2:K+1, == repmat(a2,K,1).e(1:K,:)…
+ (1-repmat(a2,K,1)).repmat(tau,K,1).…
(repmat(etac,K,1).(ph + pw) - pd./repmat(etad,K,1))
repmat(eMin,K+1,1) <= e <= repmat(eMax,K+1,1)
% EV power
zeros(K,n2) <= ph <= repmat(pcMax,K,1)
zeros(K,n2) <= pw <= repmat(pcMax,K,1)
zeros(K,n2) <= pd <= repmat(pdMax,K,1)
for i=1:n2
pd(mod(t,24)==tw(i),i) == etad(i)*ec(i)/dt % commute to work
pd(mod(t,24)==th(i),i) == etad(i)*ec(i)/dt % commute to home
end
ph(~atHome) == 0 % at-home charging
pw(~atWork) == 0 % at-work charging
cvx_end