subsets in equations

Hi All,

I am having problems in defining the subsets in the equations because I never did this.
I wrote:

sets

j components /elem1, elem2, elem3/
g(j) gas components /elem1, elem2/

Positive Variables
yout(g) outlet molar mass in the gas phase
youtt(g) total molar fraction of gas phase

Equations
youttotal(g) total mol fraction of gas phase


youttotal(g)… youtt(g) =e= sum(g, yout(g))+1 ;

The error that appear is: error 125 - The set is under control already.

Can you advice me in what should I do?

Thanks a lot for your help! :slight_smile:

Regards from Portugal,
Inês


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Hi Ines

This has nothing to do with subsets. You defined the equation youttotal over the set g and then in the equation itself you sum over g. The set g is under control for the equations (you will have equations for all elements of g), so Gams starts writing down the equation for the first element. By summing over g in the equation itself you are using g again, but in another way. Now you want to sum over all the elements (I assume), but Gams is working with g equal to the first element for the equation itself and now it should use in the sum suddenly all elements of g.

If you would like to sum over all the elements of g, you should use an alias for g (for example ag):



Alias(g,ag);

youttotal(g)… youtt(g) =e= sum(ag, yout(ag))+1 ;



although, I can’t imagine that this makes sense, as youtt(g) will have the same value for all g…



Cheers

Renger





From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Ines Vilarinho
Sent: Dienstag, 14. Mai 2013 12:06
To: gamsworld@googlegroups.com
Subject: subsets in equations




Hi All,

I am having problems in defining the subsets in the equations because I never did this.
I wrote:

sets

j components /elem1, elem2, elem3/
g(j) gas components /elem1, elem2/

Positive Variables
yout(g) outlet molar mass in the gas phase
youtt(g) total molar fraction of gas phase

Equations
youttotal(g) total mol fraction of gas phase


youttotal(g)… youtt(g) =e= sum(g, yout(g))+1 ;

The error that appear is: error 125 - The set is under control already.

Can you advice me in what should I do?

Thanks a lot for your help! :slight_smile:

Regards from Portugal,
Inês


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Hi Renger,

Thank you very much for your reply.

Actually my yout(g) is a number but as it is defined by sum of all yout(g) I thought I had to put the subset but if not great :slight_smile:.

If I understand correctly the alias will say that I only want to use the elements and not g right? And do I need to define ag?

If not, maybe the best way to write is:

Alias(g,ag);
youttotal… youtt =e= sum(ag, yout(ag))+1 ;

what do you think?

Thanks again.
Inês




On Tuesday, 14 May 2013 11:16:36 UTC+1, Renger van Nieuwkoop wrote:

Hi Ines

This has nothing to do with subsets. You defined the equation youttotal over the set g and then in the equation itself you sum over g. The set g is under control for the equations (you will have equations for all elements of g), so Gams starts writing down the equation for the first element. By summing over g in the equation itself you are using g again, but in another way. Now you want to sum over all the elements (I assume), but Gams is working with g equal to the first element for the equation itself and now it should use in the sum suddenly all elements of g.

If you would like to sum over all the elements of g, you should use an alias for g (for example ag):



Alias(g,ag);

youttotal(g)… youtt(g) =e= sum(ag, yout(ag))+1 ;



although, I can’t imagine that this makes sense, as youtt(g) will have the same value for all g…



Cheers

Renger





From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Ines Vilarinho
Sent: Dienstag, 14. Mai 2013 12:06
To: gams...@googlegroups.com
Subject: subsets in equations




Hi All,

I am having problems in defining the subsets in the equations because I never did this.
I wrote:

sets

j components /elem1, elem2, elem3/
g(j) gas components /elem1, elem2/

Positive Variables
yout(g) outlet molar mass in the gas phase
youtt(g) total molar fraction of gas phase

Equations
youttotal(g) total mol fraction of gas phase


youttotal(g)… youtt(g) =e= sum(g, yout(g))+1 ;

The error that appear is: error 125 - The set is under control already.

Can you advice me in what should I do?

Thanks a lot for your help! :slight_smile:

Regards from Portugal,
Inês


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

You are right, just use alias
r

Sent from my iPhone

Am 14.05.2013 um 12:43 schrieb “Ines Vilarinho” :

Hi Renger,

Thank you very much for your reply.

Actually my yout(g) is a number but as it is defined by sum of all yout(g) I thought I had to put the subset but if not great :slight_smile:.

If I understand correctly the alias will say that I only want to use the elements and not g right? And do I need to define ag?

If not, maybe the best way to write is:

Alias(g,ag);
youttotal… youtt =e= sum(ag, yout(ag))+1 ;

what do you think?

Thanks again.
Inês

On Tuesday, 14 May 2013 11:16:36 UTC+1, Renger van Nieuwkoop wrote:

Hi Ines

This has nothing to do with subsets. You defined the equation youttotal over the set g and then in the equation itself you sum over g.  The set g is under control for the equations (you will have equations for all elements of g), so Gams starts writing down the equation for the first element. By summing over g in the equation itself you are using g again, but in another way. Now you want to sum over all the elements (I assume), but Gams is working with g equal to the first element for the equation itself and now it should use in the sum suddenly all elements of g.

If you would like to sum over all the elements of g, you should use an alias for g (for example ag):



Alias(g,ag);

youttotal(g).. youtt(g) =e= sum(ag, yout(ag))+1 ;



although, I can’t imagine that this makes sense, as youtt(g) will have the same value for all g…



Cheers

Renger





From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Ines Vilarinho
Sent: Dienstag, 14. Mai 2013 12:06
To: gams...@googlegroups.com
Subject: subsets in equations




Hi All,

I am having problems in defining the subsets in the equations because I never did this.
I wrote:

sets

j components /elem1, elem2, elem3/
g(j) gas components /elem1, elem2/

Positive Variables
yout(g) outlet molar mass in the gas phase
youtt(g) total molar fraction of gas phase

Equations
youttotal(g) total mol fraction of gas phase


youttotal(g).. youtt(g) =e= sum(g, yout(g))+1 ;

The error that appear is: error 125 - The set is under control already.

Can you advice me in what should I do?

Thanks a lot for your help! :slight_smile:

Regards from Portugal,
Inês

--
To unsubscribe from this group and stop receiving emails from it, send an email to <gamsworld+unsubscribe@googlegroups.com>.
To post to this group, send email to <gamsworld@googlegroups.com>.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Thank you!

Inês

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\