How to model this constraint in CVX?

You should first help your self by having a consistent problem statement and code.

presume T = sqrt(P_max). And why do you have P(17,1)=P(18,1)=⋯=P(32,1)=x, i don’t see that in the constraint you stated, so I will presume there is no such constraint. In that case, and presuming 0 is a lower bound for P, your code seems to correspond to the constraint you stated. if you think it doesn’t, you need to explain why.

Perhaps the first constraint in your code can be vectorized using the techniques in How to vectorize most constraint loops in CVX , but vextorization is not necessary if the CVX constraint building process is fast enough for you. In any event, I’ll leave that to others to address. I believe the second constraint in your code can be removed from the for loops and stated simply as P >= 0, or declaring P as nonnegative.

If my assumptions are not correct, you will need to clarify.