Special subscript values

Use this forum to post Vensim related questions.
Post Reply
pdiazs
Junior Member
Posts: 3
Joined: Sun Mar 11, 2012 8:52 pm

Special subscript values

Post by pdiazs »

I`m working with a subscript variable that includes population for different areas.

In order to develop easy equations i am thinking to include n subscripts (for n areas) + a total additional value at the end.

A) is it possible to populate the variable in three steps?

1 POP(1,2.....n)
2 Total = sum POP(1,n)
3 POP(n+1) = Total

B Is it possible to use partial values of the variable subscripts?

1 Pop(1,2......n,totP)
2 MktCuota (1,2.....n,n+1)
3 MktCuota(n+1)= Pop(1....n) * MktCuota(1,... n)/Pop(n+1)

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

Re: Special subscript values

Post by LAUJJL »

Hi

Thhere is no restriction to anything as long as it works. But the problem is that you will have variables that have different meaning depending on the value of the subscript, a very bad practice, one of the very good practive of SD being the correct and unambiguous naming of variables!

Regards.

JJ
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: Special subscript values

Post by Administrator »

One other thing to remember. Your profile indicates that you are a PLE user, subscripts are not possible with PLE.
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: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Special subscript values

Post by tomfid »

A) It would be better to write:

Code: Select all

category : (c1-c10) ~~ population categories (age cohorts?)
population[category] = ... ~ people ~ (dynamics of population go here)
total population = SUM(population[category!]) ~ people
B) Subranges are easy:

Code: Select all

subcategory : c1, c3, c5
total subcat population = SUM(population[subcategory!]) ~ people
See http://www.vensim.com/documentation/usr17.htm and http://www.vensim.com/documentation/exc ... ations.htm
Post Reply