Hello.

I'm trying to put a if statement in a constraint but i can't

I'm trying with:

economic31(MW12, I1)$(FM2_2.L>0).. OpC31(MW12,I1)=E= (g*((HI1(I1)-HMW12(MW12))))+(OpF4*Dist31(MW12,I1)*(FM2_2(MW12,I1)**2));

** Error 148 Dimension different

economic31(MW12, I1)$((FM2_2(MW12,I1).L)>0).. OpC31(MW12,I1)=E= (g*((HI1(I1)-HMW12(MW12))))+(OpF4*Dist31(MW12,I1)*(FM2_2(MW12,I1)**2)); (this one is illogical but i have to try)

** Error 8 ')' expected, Error 36

economic31(MW12, I1)$(FM2_2(MW12, I1)>0).. OpC31(MW12,I1)=E=(g*((HI1(I1)-HMW12(MW12))))+(OpF4*Dist31(MW12,I1)*(FM2_2(MW12,I1)**2));

** Error 52 Endogenous '$- control operations not allowed

HELP!

Thanks

## I need help with a if sentence

### Re: I need help with a if sentence

Hi

Note that you can't use variables in $-conditions in your equations as shown in the last error "Endogenous '$- control operations not allowed "

The dimension error is caused by FM2_2.L>0. Here you forgot to add the dimensions of FM2_2, but again, endogenous $-control operations are not allowed.

You will have to find a way to write this condition as an extra constraint.

CHeers

Renger

Note that you can't use variables in $-conditions in your equations as shown in the last error "Endogenous '$- control operations not allowed "

The dimension error is caused by FM2_2.L>0. Here you forgot to add the dimensions of FM2_2, but again, endogenous $-control operations are not allowed.

You will have to find a way to write this condition as an extra constraint.

CHeers

Renger