Mapping of Subscript Ranges

Use this forum to post Vensim related questions.
Post Reply
lynchyml
Senior Member
Posts: 70
Joined: Wed Aug 26, 2009 8:36 am

Mapping of Subscript Ranges

Post by lynchyml »

I have read the example, did not get how to do it (avoid the error:typically that a Subscript Range appears on the right, but not on the left, of an equation)



In many practical situations, it is desirable to use different subscript families to mean the same thing. If no special preparation is made, this leads to an error message (typically that a Subscript Range appears on the right, but not on the left, of an equation). Mapping allows you to do this sort of thing when you are very sure that you want to override the exact correspondences normally enforced.






In many practical situations, it is desirable to use different subscript families to mean the same thing. If no special preparation is made, this leads to an error message (typically that a Subscript Range appears on the right, but not on the left, of an equation). Mapping allows you to do this sort of thing when you are very sure that you want to override the exact correspondences normally enforced. Mapping is usually safer than using the VECTOR ELM MAP function because changes you might make to Subscripts that would invalidate an equation are more likely to trigger error messages.

It is worth noting that the function VECTOR SELECT can also be used to accomplish many of the same things as mapping can. See the discussion in Chapter 4 for details on VECTOR SELECT.

Quite simply a mapping is an indication to Vensim that a Subscript that appears on the right but not the left of an equation has a valid interpretation. Normally, an equation such as

Quality[product] = work quality[worker type]

would generate an error. If, however each product is made by a single worker type then the equation does have a sensible interpretation. To signal this to Vensim we would use a Subscript Mapping as in:

worker type : wtclay, wtplastic, wtwood -> product

where

product : clay,plastic,wood

In this case the equation for Quality would not cause an error and the quality of the clay product would be the work quality of wtclay and so on. This mapping works because both the order and number of subscripts match up. In practice, this is often the case, but the more general mapping formulation is:

Rhsub:rh1,rh2->(Lhsub:lh1,lh2), (Lhbigger:Lhbsubr1,Lhbsubr2), (lhopposite:lho2,lho1)

Where

Lhsub : lh1,lh2,

Lhbigger : lhb1,lhb2,lhb3,lhb4

Lhsubr1 : lhb1,lhb3

Lhsubr2 : lhb2,lhb4

Lhopposite: lho1,lho2

In this we use commas to delimit the lists of map-to choices. There is no limit on the number of map-to choices, but it is most common to just have one or two. The map-to choices consist of the name of the map-to subscript range, followed by a colon : and the elements or subranges in the order the mapping should occur. The number of elements or subranges must match the number of elements in the definition for the subscripts.

[Edited on 10-18-2009 by lynchyml]
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Chapter 17 of the User's Guide develops an example using mapping.
Post Reply