Monthly Counter

Use this forum to post Vensim related questions.
Post Reply
JoseG
Junior Member
Posts: 7
Joined: Mon Jul 06, 2020 8:19 am
Vensim version: PLE+

Monthly Counter

Post by JoseG »

Hello,

I am trying to create a variable that accounts for the number of the month as in the following table:

time step -> monthly counter
1-> 1
2 -> 2
3 -> 3
4 -> 4
5 -> 5
6 -> 6
7 -> 7
8 -> 8
9 -> 9
10 -> 10
11 -> 11
12 -> 12
13 -> 1
14 -> 2
15 -> 3
...

My simulation runs for 1200 months at time steps of 1 month. The lookup could work for small runs but I think it is not feasible for the length of my simulation

I am using Vensim PLE version.

Any advice?

Many thanks in advance

José
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Monthly Counter

Post by Administrator »

Can you use the MODULO function?
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: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Monthly Counter

Post by tomfid »

Something like:
Month Index = Modulo(Time,One Month)+1 ~ dmnl
One Month == 1 ~ months
JoseG
Junior Member
Posts: 7
Joined: Mon Jul 06, 2020 8:19 am
Vensim version: PLE+

Re: Monthly Counter

Post by JoseG »

Thank you guys, I think it works with the MODULO function
Post Reply