Hi, I am struggling with the ERROR message saying Subscript Range - XXX - appears on the right, but not left.
Vensim Help does say that "The most important subscript rule is that a subscript appearing on the right hand side of an equation must also appear on the left hand side. "
However, the AGE model in the EXTRA folder of sample models of Vensim (version Vensim Pro 7.1) seems to be against this rule. The level variable Population is defined as:
Population [all but youngest] = aging [previous cohort] - aging [all but youngest]. This model is working properly. It is attached here.
But, I have developed a model in which a variable is defined in a similar way to the Population in the AGE model, i.e. the subscript on its equation's right hand side does NOT appear on its left side. However, the ERROR message prompts.
So what is the reason? Is there any way around the restriction of the rule?
Thank you so much.
WZ
Subscript rule - subscripts on right hand side and left hand side
-
- Senior Member
- Posts: 105
- Joined: Wed Oct 25, 2017 3:52 pm
- Vensim version: PRO
Subscript rule - subscripts on right hand side and left hand side
- Attachments
-
- AGE.MDL
- (3.07 KiB) Downloaded 250 times
-
- Super Administrator
- Posts: 4589
- Joined: Wed Mar 05, 2003 3:10 am
Re: Subscript rule - subscripts on right hand side and left hand side
The model you've uploaded works fine for me. Where is the error?
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Super Administrator
- Posts: 4589
- Joined: Wed Mar 05, 2003 3:10 am
Re: Subscript rule - subscripts on right hand side and left hand side
The age model is not against the rule, it uses subscript mapping.
It's not really a "rule" either. For example, if you have a subscript range "company" and are looking at sales, you might have
sales[company,widget] = number of widgets sold[company,widgets] * cost per widget[widget]
If you want the total sales for the company, you would use
total sales[company] = sum ( sales[company,widget!] )
I cannot do
total sales[company] = sales[company,widget]
as I haven't done anything with the "widget" subscript range. I need to sum over the range, or get the max/min/whatever. If it's on the right of the equation, it must also appear on the left.
Hope this makes sense.
It's not really a "rule" either. For example, if you have a subscript range "company" and are looking at sales, you might have
sales[company,widget] = number of widgets sold[company,widgets] * cost per widget[widget]
If you want the total sales for the company, you would use
total sales[company] = sum ( sales[company,widget!] )
I cannot do
total sales[company] = sales[company,widget]
as I haven't done anything with the "widget" subscript range. I need to sum over the range, or get the max/min/whatever. If it's on the right of the equation, it must also appear on the left.
Hope this makes sense.
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Senior Member
- Posts: 105
- Joined: Wed Oct 25, 2017 3:52 pm
- Vensim version: PRO
Re: Subscript rule - subscripts on right hand side and left hand side
Thanks a lot. The example given by you is clear, and explains the issue. However, in the above-mentioned AGE model, I cannot see where the subscript mapping has been done. Please could you enlighten me a bit further? Thanks.
Administrator wrote:The age model is not against the rule, it uses subscript mapping.
It's not really a "rule" either. For example, if you have a subscript range "company" and are looking at sales, you might have
sales[company,widget] = number of widgets sold[company,widgets] * cost per widget[widget]
If you want the total sales for the company, you would use
total sales[company] = sum ( sales[company,widget!] )
I cannot do
total sales[company] = sales[company,widget]
as I haven't done anything with the "widget" subscript range. I need to sum over the range, or get the max/min/whatever. If it's on the right of the equation, it must also appear on the left.
Hope this makes sense.
-
- Super Administrator
- Posts: 4589
- Joined: Wed Mar 05, 2003 3:10 am
Re: Subscript rule - subscripts on right hand side and left hand side
It's all in the help system,
http://www.vensim.com/documentation/ind ... apping.htm
http://www.vensim.com/documentation/ind ... apping.htm
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Senior Member
- Posts: 105
- Joined: Wed Oct 25, 2017 3:52 pm
- Vensim version: PRO
Re: Subscript rule - subscripts on right hand side and left hand side
Thanks a lot. I missed the function of "->" in the sample model, which is the key to make possible the mapping.
Administrator wrote:It's all in the help system,
http://www.vensim.com/documentation/ind ... apping.htm
Re: Subscript rule - subscripts on right hand side and left hand side
The enhanced rule is,
Anything that appears on the right:
- must appear on the left, or
- map to something on the left with ->
- be in a vector function like SUM with !
Anything that appears on the right:
- must appear on the left, or
- map to something on the left with ->
- be in a vector function like SUM with !
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/