Dear AIMMS Team,

Trust this meets you well? Kindly assist on the problem explained below and find attached the AIMMS file I am working with.

I have a variable StateofCharge(t) in which t is 1 to 24.

I want to place StateofCharge(t) at t = 1 or StateofCharge(01) on the conditional statement below.

*if ( (Charging_Power_kW(01) + SoCMin) > SoCMax) then SocMax else*

*Charging_Power_kW(01) + SoCMinendif;*

**Note: Charging_Power_kW(01) is put as the value of variable Charging_Power_kW(t) at t=1**

While StateofCharge(t) at t = 2,….24 should have the conditional statement below. The index t in the statement applies only from t = 2,….24.

*If Energy_Difference_kW(t) > 0 then if (StateofCharge(t-1) + Charging_Power_kW(t)) > SoCMax SoCMax else StateofCharge(t-1) + Charging_Power_kW(t) elseif (Energy_Difference_kW(t)) < 0 then if (StateofCharge(t-1) - SoCMin) > Discharging_Power_kW(t) else SoCMinendif;*

Also, if I have a parameter/variable, P(t), t=1,...24, how can I extract a cell? For example: P(5) or a parameter/variable with a double index P(t, k), t=1,..24 and k=1,...5, how can I write P(2,4)?

Thank you.

Kind regards.

**Best answer by Marcel Hunting**