Taking a value of a specific time

Use this forum to post Vensim related questions.
Post Reply
Hossein
Member
Posts: 48
Joined: Thu Sep 15, 2016 7:50 am
Vensim version: DSS

Taking a value of a specific time

Post by Hossein »

Dear Tom, Administrator,

I want to make a comparision between two consecutive value by IF THEN ELSE function. Then, I need to take these values and compare. Somthing like the following example.
IF THEN ELSE (value at Time i = value at Time i+1, 0, value at Time i+1 - value at Time i)

Could you please help me?
BR,
Hossein
Member
Posts: 48
Joined: Thu Sep 15, 2016 7:50 am
Vensim version: DSS

Re: Taking a value of a specific time

Post by Hossein »

I just solved it by constituting Time i+1 via DELAY FIXED function by one unit. Afterward, I deducted the two variables and it works! However, is there another direct solution?
Administrator
Super Administrator
Posts: 4588
Joined: Wed Mar 05, 2003 3:10 am

Re: Taking a value of a specific time

Post by Administrator »

Hossein wrote:I just solved it by constituting Time i+1 via DELAY FIXED function by one unit. Afterward, I deducted the two variables and it works! However, is there another direct solution?
This is the correct way to do it.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Hossein
Member
Posts: 48
Joined: Thu Sep 15, 2016 7:50 am
Vensim version: DSS

Re: Taking a value of a specific time

Post by Hossein »

Dear Tom, Administrator,

I want to get the value of the first time of a flow and use it as the initial value of its level (please see the attached figure) i. e. I want to use the value of "Emission rate" at the first time as the initial value of "Total emission". Could you please help?

BR,
Attachments
Untitled.png
Untitled.png (92.67 KiB) Viewed 3106 times
Administrator
Super Administrator
Posts: 4588
Joined: Wed Mar 05, 2003 3:10 am

Re: Taking a value of a specific time

Post by Administrator »

This should work, have you tried it?

total emissions = integ ( emissions rate, emissions rate).
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Hossein
Member
Posts: 48
Joined: Thu Sep 15, 2016 7:50 am
Vensim version: DSS

Re: Taking a value of a specific time

Post by Hossein »

Dear Administrator,

Thanks for your reply.
Actually, I did not try it because I thought since emission rate is changing, the initial value of total emission would also change! However, now, I tried it and worked!
Thanks again.
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Taking a value of a specific time

Post by tomfid »

Setting

Total Emissions = Emissions Rate

is dimensionally inconsistent (TonC vs. TonC/year, for example).

You probably want to include some kind of time constant on the right hand side, so for example

Total Emissions = Emissions Rate*Initial History Duration
Initial History Duration = 1 year (or whatever).
Post Reply