Looping problem

Problems with modeling
Post Reply
Nadhita.C
User
User
Posts: 3
Joined: 1 week ago

Looping problem

Post by Nadhita.C » 1 week 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 1 time
binary05.gms
(6.55 KiB) Downloaded 1 time

User avatar
Renger
Posts: 305
Joined: 2 years ago

Re: Looping problem

Post by Renger » 1 week 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: The lazy economist

Post Reply