function to retain another variable at time T-1

Use this forum to post Vensim related questions.
Post Reply
thrillz84
Junior Member
Posts: 14
Joined: Thu Apr 11, 2013 4:53 pm
Vensim version: PLE

function to retain another variable at time T-1

Post by thrillz84 »

Hi there,

Please is there any technique or function I can use to hold the value of a variable such that variable "A" at time T or T+1 will have the value of a variable "B" at that "T" or "T-1" respectively. Many thanks

Olu
Administrator
Super Administrator
Posts: 4847
Joined: Wed Mar 05, 2003 3:10 am

Re: function to retain another variable at time T-1

Post by Administrator »

Take a look at SAMPLE IF TRUE or DELAY FIXED. One of these should do what you need.

Tony.
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
thrillz84
Junior Member
Posts: 14
Joined: Thu Apr 11, 2013 4:53 pm
Vensim version: PLE

Re: function to retain another variable at time T-1

Post by thrillz84 »

perhaps mixed it up..I need a function that can perform the opposite of the delay function i.e a function that will let a variable "A" at time T to hve a value of a variable "B" t time T+1
tomfid
Administrator
Posts: 4000
Joined: Wed May 24, 2006 4:54 am

Re: function to retain another variable at time T-1

Post by tomfid »

Vensim (and reality) is causal - that is, no variable can use information about the future.

Can you say more about the reason for this approach?
thrillz84
Junior Member
Posts: 14
Joined: Thu Apr 11, 2013 4:53 pm
Vensim version: PLE

Re: function to retain another variable at time T-1

Post by thrillz84 »

cheers Tom, in the attache model for example, I need a function that will let variable "y" have values of 0.94, 0.909651...at times t= 1 and 2 ....theoretically i know it isnt right but I need it or some analysis...tnx
Attachments
example.mdl
(15.1 KiB) Downloaded 475 times
Administrator
Super Administrator
Posts: 4847
Joined: Wed Mar 05, 2003 3:10 am

Re: function to retain another variable at time T-1

Post by Administrator »

There is no function that can do that. You can try using FORECAST or TREND. Otherwise, you would need to calculate the model a time step in the future.
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
tomfid
Administrator
Posts: 4000
Joined: Wed May 24, 2006 4:54 am

Re: function to retain another variable at time T-1

Post by tomfid »

There is a trick you could do though - cumbersome in general, but feasible in a simple model. Create an auxiliary that calculates the value of the stocks ahead a unit of time (assuming Euler integration):

future bad code = bad code + roc*TIME STEP

Then use can use the "future" stocks to calculate other future variables.
thrillz84
Junior Member
Posts: 14
Joined: Thu Apr 11, 2013 4:53 pm
Vensim version: PLE

Re: function to retain another variable at time T-1

Post by thrillz84 »

cheers Tom!!!should have thought of that
tomfid
Administrator
Posts: 4000
Joined: Wed May 24, 2006 4:54 am

Re: function to retain another variable at time T-1

Post by tomfid »

The other possibility is to just put minus signs in all your integrations, and run the whole model backwards. :mrgreen:
thrillz84
Junior Member
Posts: 14
Joined: Thu Apr 11, 2013 4:53 pm
Vensim version: PLE

Re: function to retain another variable at time T-1

Post by thrillz84 »

:D splendid!!
Post Reply