Looping problem

Problems with modeling
Post Reply
Nadhita.C
User
User
Posts: 3
Joined: 10 months ago

Looping problem

Post by Nadhita.C » 10 months ago

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 21 times
binary05.gms
(6.55 KiB) Downloaded 20 times

User avatar
Renger
Posts: 545
Joined: 3 years ago

Re: Looping problem

Post by Renger » 10 months ago

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