Hi there,
I'm having an issue trying to build a model with multiple ranges of subscripts.
I have a variable, call it "variable" which has two subscript ranges, "A" and "B" attached to it, such that:
"variable"[A,B]
Within the two subscript ranges are a number of distinct elements, call them "A1", "A2", "B1" and "B2". These are defined in variables, "variable A1", ..., "variable B2"
The value of these variables are combined into two variables (one for each range), "variable A" and "variable B", such that
Eqn 1: "variable A"[A1] = "variable A1"
...
Eqn 4: "variable B"[B2] = "variable B2"
I now want to combine the two variables, "variable A" and "variable B", into "variable" using a similar method:
Eqn 1: "variable"[A] = "variable A"
Eqn 2: "variable" = "variable B"
However, when I try to do this in the equation editor, it removes one of the subscript ranges assigned to "variable" and when checking the model I get the error message:
"Subscript 1 of variable -variable- is a member of -B- family when it should be a member of the -A- family."
Am I using completely the wrong method to assign ranges to different Equations for a variable? Is it not allowed to have different equations within the same variable using different subscript ranges?
I'm lost and would really appreciate any help anyone can offer.
Cheers,
Mik
Subscript range
-
- Super Administrator
- Posts: 4838
- Joined: Wed Mar 05, 2003 3:10 am
Re: Subscript range
If you want to combine the two ranges into a single range, you will need to define it something like
a and b : "A1", "A2", "B1" , "B2"
Then your syntax for the following would be correct
Eqn 1: "variable"[A] = "variable A"
Eqn 2: "variable" = "variable B"
Hope this makes sense.
a and b : "A1", "A2", "B1" , "B2"
Then your syntax for the following would be correct
Eqn 1: "variable"[A] = "variable A"
Eqn 2: "variable" = "variable B"
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
Re: Subscript range
To simplify maintenance a bit, you can build up your ranges hierarchically, like
This really only makes sense if a and b represent subsets of the same kind of thing, like cities in France, and cities in England. If what you're really after is a two-dimensional matrix, where A=product and B=market, for example, then a different approach is needed.
Code: Select all
a : a1,a2
b : (b1-b10)
a and b : a, b
/*
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
*/