Hello Dear users
I am trying to start a project about phase equilibria so I choose gams as a powerfull tool for optimization and solving nonlinear equation system,
but at first step of testing NLP gams solver, I have a trouble with solving the following code has been written in GAMS to solve one unknown-one equation system:
=======================================================================
- a hydrocarbon mixture with the following overall composition is flashed in a
- separator at 50 psia and 100 F
set i components /c3,ic4,nc4,ic5,nc5,c6/;
alias (i,j);
scalar ptotal,T;
ptotal=50;T=100;
===============================================================================
parameter Z(i) overall composition
/c3 0.20
ic4 0.10
nc4 0.10
ic5 0.20
nc5 0.20
c6 0.20/;
Z(i)=z(i)/sum(j,z(j));
parameter psat(i) vapor pressure at T from cox chart
/c3 190
ic4 72.2
nc4 51.6
ic5 20.44
nc5 15.57
c6 4.956/;
parameter Kvalue(i);
Kvalue(i)=psat(i)/Ptotal;
display kvalue;
===============================================================================
variable nv;
equation E1;
E1…sum( i, z(i)(Kvalue(i)-1)/(nv(Kvalue(i)-1))+1 ) =e=0;
parameter A,B;
A=sum(i,z(i)(Kvalue(i)-1));B=sum(i,z(i)(Kvalue(i)-1)/Kvalue(i));
model flash /All/;
nv.l=A/(A-B);
nv.lo=0;
nv.up=1;
*option nlp=minos
SOLVE flash USING nlp MINIMIZING nv;
=======================================================
How can I modify above code to solve it??
cheers
–
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.
For more options, visit https://groups.google.com/groups/opt_out.
Hi Mrtz Manesh
You initialize nv to a value computed from your data and I assume that you think this should be the solution. However, the equation listing shows that the equation is quite infeasible:
---- E1 =E=
E1… - (219.35663064419)*nv =E= -6 ; (LHS = 14.8106931182909, INFES = 20.8106931182909 ****)
I have removed your bounds on nv and the model solves and gives nv = -0.1667
I will guess that you have your parenthesis wrong in equation e1.
Regards
Arne
\
Arne Stolbjerg Drud
ARKI Consulting & Development A/S
Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark
Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: adrud@arki.dk
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Mrtz manesh
Sent: Thursday, November 21, 2013 12:53 AM
To: gamsworld@googlegroups.com
Subject: one unknown-one equation
Hello Dear users
I am trying to start a project about phase equilibria so I choose gams as a powerfull tool for optimization and solving nonlinear equation system,
but at first step of testing NLP gams solver, I have a trouble with solving the following code has been written in GAMS to solve one unknown-one equation system:
\
- a hydrocarbon mixture with the following overall composition is flashed in a
- separator at 50 psia and 100 F
set i components /c3,ic4,nc4,ic5,nc5,c6/;
alias (i,j);
scalar ptotal,T;
ptotal=50;T=100;
===============================================================================
parameter Z(i) overall composition
/c3 0.20
ic4 0.10
nc4 0.10
ic5 0.20
nc5 0.20
c6 0.20/;
Z(i)=z(i)/sum(j,z(j));
parameter psat(i) vapor pressure at T from cox chart
/c3 190
ic4 72.2
nc4 51.6
ic5 20.44
nc5 15.57
c6 4.956/;
parameter Kvalue(i);
Kvalue(i)=psat(i)/Ptotal;
display kvalue;
===============================================================================
variable nv;
equation E1;
E1…sum( i, z(i)(Kvalue(i)-1)/(nv(Kvalue(i)-1))+1 ) =e=0;
parameter A,B;
A=sum(i,z(i)(Kvalue(i)-1));B=sum(i,z(i)(Kvalue(i)-1)/Kvalue(i));
model flash /All/;
nv.l=A/(A-B);
nv.lo=0;
nv.up=1;
*option nlp=minos
SOLVE flash USING nlp MINIMIZING nv;
How can I modify above code to solve it??
cheers
–
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.