Auxiliary variable to keep the smaller value...

Use this forum to post Vensim related questions.
Post Reply
CLAUDIO
Member
Posts: 26
Joined: Tue Jun 13, 2006 4:37 pm

Auxiliary variable to keep the smaller value...

Post by CLAUDIO »

Dears

I do need to create a auxiliary variable "X2" that simply repeat the smaller values of auxiliary "X1" by time, trough comparing the value of an year with the value of the previous year, hence always having as output the smaller value of the auxiliary "X1" during the time...
i.e:
Year Y1 - Y2 - Y 3 - Y4 - Y5 - Y 6 - Y7 - Y8 - Y 9 - Y10 - Y11 - Y12
"X1" 20 19 18 16 17 18 17 15 14 13 14 14
"X2" 20 19 18 16 16 16 16 15 14 13 13 13

Somebody could give me a clue?

Tks

Claudio
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

auxiliary

Post by LAUJJL »

Hi Claudio

The model joined may eventually do the job.
Regards.
JJ

[Edited on 18-11-2008 by LAUJJL]
Attachments
auxiliary.mdl
(2.03 KiB) Downloaded 435 times
CLAUDIO
Member
Posts: 26
Joined: Tue Jun 13, 2006 4:37 pm

Post by CLAUDIO »

Dear JJ

Thank you very much for your prompt help.

Another point in my model that I've got staked is the attempting to represent a kind of model behavior that is also based in the smaller value by the time, but extracting those just from one auxiliary variable, so, not comparing that with another one.
i.e:
If I have got a set of values from an auxiliary variable that also could be:
20 19 18 16 17 18 17 15 14 13 14 14
I would need a reference equation that only consider the smaller value by time:
20 19 18 16 16 16 16 15 14 13 13 13

Could you help me on that, please?

Thank you

Claudio
Lee Jones

Post by Lee Jones »

Try the attached model, it uses Sample_if_true and will give the behaviour you require.

Lee
Attachments
sampleiftrue.mdl
(1.41 KiB) Downloaded 430 times
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

auxiliary

Post by LAUJJL »

Hi

Sample if true does exactly the same job that my first model, see the second model where it is implemented, but I did not know if the sample if true function is implemented in PLE or PLE plus. In the documentation it says that it is not implemented. If it is not implemented you then have another alternative to do the job. Ti shows too how the sample if true function works.
Regards.
JJ
Attachments
auxiliary2.mdl
(2.25 KiB) Downloaded 462 times
CLAUDIO
Member
Posts: 26
Joined: Tue Jun 13, 2006 4:37 pm

Post by CLAUDIO »

Lee and JJ

Thank you both for the support.

My Vensim is a Standard Version 5.6d

The model auxiliary2.mdl is running perfectly.

While running the model Sample_if_true it came out with the following warning message:

WARNING: At 12 Above -#x1#- computing -x1-.

I did not understand why it came out if the model running ok. The message seems that is the logical syntax of the own function of the model.

Do you have some comments about that? Could I avoid that message?

Rgrds

Cláudio
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

auxiliiary

Post by LAUJJL »

Hi

X1 is not defined by the lookup at time 12, it then keeps the same value than at time 11, but with a warning.
To avoid the warning, just define x1 at time 12. See model attached with the slight modification.
Regards.
JJ
Attachments
sampleiftrue_2.mdl
(1.42 KiB) Downloaded 471 times
CLAUDIO
Member
Posts: 26
Joined: Tue Jun 13, 2006 4:37 pm

Post by CLAUDIO »

Hi JJ!

That is OK!

Thank you very much!

Best Regards

Cláudio
Post Reply