Good morning all,

Please, can someone tell me why I keep getting this error ? Both SOC(agg,t) and P_Charging(agg,t) are variables.

Thanks so much.

Good morning all,

Please, can someone tell me why I keep getting this error ? Both SOC(agg,t) and P_Charging(agg,t) are variables.

Thanks so much.

Page 1 / 1

The problem is with your “else” block. This is a constraint and not a variable definition, so

`else`

`P_Charging(agg, t)`

`endif`

does not make any sense. You can simply have

`IF SOC(agg, t-1) > 0.949 THEN`

`P_Charging(agg, t) = 0`

`ENDIF`

Thanks

Thanks

I tried that suggestion and it still gives error of missing “ELSE” part. Sincerely this looks so simple to tackle personally considering what I have done in AIMMS but I really dont know why I cant resolve it. Any further help would be greatly appreciated.

Thanks

Hello

Apologies, I missed that AIMMS requires IF blocks in constraints to have ELSE conditions too.

You have two options -

- Create another variable with same index domain as P_Charging(agg, t), call is temp_Charging(agg, t). Give it the below definition
`IF SOC(agg, t-1) > 0.949 THEN`

0

ELSE

P_Charging(agg, t)

ENDIF

Use temp_Charging(agg, t) in the objective function or other constraints/definitions instead of P_Charging. - Use the modelling trick described in section 7.4 of the AIMMS Optimization Modelling guide.

Your requirement is SOC(agg, t-1) > 0.949, then P_Charging(agg, t) must be 0 → which is equivalent to only one of SOC(agg, t-1) <= 0.949 and P_Charging(agg, t) <= 0 can be true.

use a binary variable Y(agg, t) and upper limits for SOC - U1 and upper limit for P_Charging - U2. Introduce two constraints with index domain (agg, t)`constraint1`

SOC(agg, t-1) <= 0.949 + U1 * Y(agg, t)

constraint2

P_Charging(agg, t) <= 0 + U2 * (1 - Y(agg, t))

If SOC(agg, t-1) needs to be greater than 0.949, Y(agg, t) must be 1 which will force the second constraint to become P_Charging(agg, t) <= 0 + 0 = 0 (assuming the range of P_Charging is nonnegative).

I hope this helps.

Hello

Thanks for your response. My system went for some maintenance and just returned with it. I will let you know if your suggestion solves my problem.

Thanks again

Olusegun

Hi

Sorry to bother you again on the above subject.

Please I want to ask what happens if range of P_Charging is nonpositive, that is it must be negative or zero?

Please, what will now be U2?

Thanks in advance for your prompt response.

Olusegun

`P_Charging(agg, t) <= 0 + U2 * (1 - Y(agg, t))`

will become something like

`P_Charging(agg, t) >= L2 * (1 - Y(agg, t))`

When Y is 0, this will be P_Charging >= L2 and when Y = 1 - P_Charging >= 0 which will force it to be P_charging = 0 because of the range L2 <= P_Charging <= 0

Already have an account? Login

**Please use your business or academic e-mail address to register**

No account yet? Create an account

Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

Didn't find what you were looking for? Try searching on our documentation pages: