Looping problem

Problems with modeling
Post Reply
Nadhita.C
User
User
Posts: 3
Joined: 4 years ago

Looping problem

Post by Nadhita.C »

Hi all,

I'm modelling the liquid-liquid binary phase diagram for water-butanol. The temperature is input as a loop. The problem I faced is that all the result (x - component composition) for every temperature is exactly the same even though I clear the result (option clear=[variable]) before starting the new temperature calculation. When I excluded the loop from the model and manually change the temperature the result is what I expected.

I attached the loop file (binary05) and no loop file (binary373) where the temperature was input at 373 K.

Any suggestion for the problem?
Attachments
binary373.gms
(6.5 KiB) Downloaded 173 times
binary05.gms
(6.55 KiB) Downloaded 171 times
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Looping problem

Post by Renger »

Hi
Your change in T is reflected in WW, however, you do not initialize it again in the loop, so you should add this line in the loop

Code: Select all

loop(ttt,
	...
	T=Tnew(ttt);
	WW(mk,k) = exp(-((ap(mk,k)/T)+bp(mk,k)+(cp(mk,k)*T)));
       ....
)

Cheers

Renger

Enjoy modeling even more: The lazy eoconomist
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply