As the other answers already suggest you use an endogenous variable in a () expression. This is not possible, because the () is evaluated at model generation time and not passed on to the solver. You need to write this differently. What you try to express is

EGr(t,“wind”) > sum(u,v(t,u)) <=> B(t,s) = 1

If you want to have a linear the implementation of such a logical expression this is more work, if the model is already non-linear you can easily write this as:

Charging (t,s) … B(t,s)=e= ifThen(EGr(t,“wind”) >= sum(u,v(t,u)), 1, 0);

Some solvers like Lindo can linearize this internally.

The following reformulations are part of the optimization folklore and can it’s not always easy to give a proper reference. A general reference could be the book by HP Williams (https://www.amazon.com/Model-Building-Mathematical-Programming-Williams/dp/1118443330).

Charging(t,s)… EGr(t,‘Wind’) =g= sum(u, v(t,u)) - (1-B(t,s))*bigM;

So if B(t,s) is 1 the second term becomes 0 and the constraint enforces “EGr(t,“wind”) >= sum(u,v(t,u))”, so this implements one part of the equivalence: EGr(t,“wind”) > sum(u,v(t,u)) <= B(t,s) = 1. Very often the other part of the equivalence is not important or implicitly fulfilled. Leaves us with the calculation of bigM. Some lazy modellers just make this a big number (1e9) and hope for the best. Unfortunately, this gets the solver frequently in trouble. One should aims for the smallest possible bigM. We need to ensure that with any setting of EGr(t,‘Wind’) and sum(u,v(t,u)) this constraint is feasible (with either B(t,s)=0 or 1). So if we set bigM as the maximum of sum(u,v(t,u)) over all possible settings of v minus the minimum of EGr(t,‘Wind’) over all possible setting of EGr you are on the safe side.

-Michael