Comparing the value of a previous time step.

Use this forum to post Vensim related questions.
Post Reply
nikvyas
Senior Member
Posts: 112
Joined: Mon Apr 24, 2006 3:17 pm

Comparing the value of a previous time step.

Post by nikvyas »

Hello.

I have a variable that outputs a series of irregular pulses - for example:
01010011011100 - the time step is 1 hour.

However, I don't want 2 consecutive 1's - so I want the above series to read:
01010010010000

What I was thinking was, is there any way of comparing the previous time step value to the current time value so that if they are both 1, the current time value becomes 0? I have tried using the Time Shift function, but it only appears to work with Data and Constant values (and not Auxillary).

Thanks in advance.
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

0 and 1

Post by LAUJJL »

Hi

Here is a model joined that does the job
regards.
JJ
Attachments
compare.mdl
(2.04 KiB) Downloaded 321 times
nikvyas
Senior Member
Posts: 112
Joined: Mon Apr 24, 2006 3:17 pm

Post by nikvyas »

Thanks a lot LAUJJL - worked a treat!
Post Reply