Sum of a decision variable within an equation

I need the number of z(s)>0 in “equation”.
But z(s) is a variable and is also part in other equations of the same model.

My first idea was the following (shorter version):

Equation     ..      sum( (s)$(z(s) > 0 ) ,1)
                         	=l= card(VN);

But it leads to an error:
57 VAR operands relational or boolean

Is it possible to solve this without introducing a binary variable?

Hi MES,

Can you please share the solution to your question, in case you have found it.

Best regards,
Snigdh

I decided to use a binary variable instead, because I couldn’t find another solution.


z(s)=sum(zue, bV(s,zue) * zue(s))
with bV(s)=1 if zue has a value, bV(s)=0 else
and with zue > 0, which presents the value


therefore the sum in the equation is

sum(s, bV(s));