reference value in MESSAGE

Use this forum to post Vensim related questions.
Post Reply
yusuke
Member
Posts: 48
Joined: Sun Apr 27, 2008 11:41 pm

reference value in MESSAGE

Post by yusuke »

I have a trouble using MESSAGE function reference value .

My easy sample is attached one.
Which has:
to show=Time+1
Start=IF THEN ELSE( start signal=Time,MESSAGE('\to show/',1) ,0)
start signal=6

I hope to return MESSAGE value "7".
But it return "6" in my environment.

I think it mean 'to show' value is previous value when 'Start' function active.

Is there a culculation order ?
I hope your support.

Yusuke tarumoto
Attachments
message.mdl
(1.61 KiB) Downloaded 249 times
Administrator
Super Administrator
Posts: 4838
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

Try
start signal=7
yusuke
Member
Posts: 48
Joined: Sun Apr 27, 2008 11:41 pm

Post by yusuke »

Thank you see my model

To show my trouble.
I attached capture of simulation.

I find to change "integration type" Euler to another
will change the message value correct one.

To use Message function, integration type selection
is important?

Yusuke tarumoto
Attachments
screen.jpg
screen.jpg (46.65 KiB) Viewed 3485 times
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Hi Yusuke,

You have uncovered an interesting deficiency in the use of the MESSAGE function. During equation ordering the displayed value coming out of the message function is not considered. This means that the variable "to show" is not computed until after "start" is already computed so the MESSAGE function get the old value for this. You can work around this by being sure that the equation with the MESSAGE function is embedded appears last alphabetically (starting with a Z if only alphabetical characters are used or you will need to just look in the variable list to see what is latest if you are using Japanese).
yusuke
Member
Posts: 48
Joined: Sun Apr 27, 2008 11:41 pm

Post by yusuke »

Thank you bob.
I can clear the problem.

Yusuke Tarumoto
Post Reply