Using more than two Subscripts

Use this forum to post Vensim related questions.
Post Reply
monica16
Junior Member
Posts: 3
Joined: Fri Aug 23, 2019 7:10 am
Vensim version: PRO

Using more than two Subscripts

Post by monica16 »

Hi everyone,

I have been struggling with adding three subscripts to a variable. When I run the simulation it gives me the following errors:

1) More than two subscripts are Subscript Ranges
2)Ilegal constant equation

I attached the model for more details and also the picture of the errors. I would appreciate any suggestions to eliminate the errors.
Attachments
vensim error.jpg
vensim error.jpg (273.23 KiB) Viewed 676 times
190822 Integrated model v18.zip
(7.01 KiB) Downloaded 36 times

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

Re: Using more than two Subscripts

Post by Administrator »

You will need to use a CIN file to store the constants.

Enter the value 0 for "Bed Utilization in 2016", this will be the default value. Now create a text file called "constants.cin" and enter the text below (but change the values to the ones you want to use). Now click Model->Simulate, click "Changes" and then "Load changes from...". Select the file constants.cin and click "Simulate". The values should be used when you run the model.

Bed Utilization in 2016[UB,LM] = 0.94
Bed Utilization in 2016[UB,MH] = 0.94
Bed Utilization in 2016[UB,SH] = 0.94
Bed Utilization in 2016[UB,CL] = 0.94
Bed Utilization in 2016[CH,LM] = 0.94
Bed Utilization in 2016[CH,MH] = 0.94
Bed Utilization in 2016[CH,SH] = 0.94
Bed Utilization in 2016[CH,CL] = 0.94
Bed Utilization in 2016[WJ,LM] = 0.94
Bed Utilization in 2016[WJ,MH] = 0.94
Bed Utilization in 2016[WJ,SH] = 0.94
Bed Utilization in 2016[WJ,CL] = 0.94
Bed Utilization in 2016[GN,LM] = 0.94
Bed Utilization in 2016[GN,MH] = 0.94
Bed Utilization in 2016[GN,SH] = 0.94
Bed Utilization in 2016[GN,CL] = 0.94
Bed Utilization in 2016[DH,LM] = 0.94
Bed Utilization in 2016[DH,MH] = 0.94
Bed Utilization in 2016[DH,SH] = 0.94
Bed Utilization in 2016[DH,CL] = 0.94
Bed Utilization in 2016[SC,LM] = 0.94
Bed Utilization in 2016[SC,MH] = 0.94
Bed Utilization in 2016[SC,SH] = 0.94
Bed Utilization in 2016[SC,CL] = 0.94
Bed Utilization in 2016[JC,LM] = 0.94
Bed Utilization in 2016[JC,MH] = 0.94
Bed Utilization in 2016[JC,SH] = 0.94
Bed Utilization in 2016[JC,CL] = 0.94
Bed Utilization in 2016[EL,LM] = 0.94
Bed Utilization in 2016[EL,MH] = 0.94
Bed Utilization in 2016[EL,SH] = 0.94
Bed Utilization in 2016[EL,CL] = 0.94
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

monica16
Junior Member
Posts: 3
Joined: Fri Aug 23, 2019 7:10 am
Vensim version: PRO

Re: Using more than two Subscripts

Post by monica16 »

Hi, Thank you for your quick answer. However, I'm also interested in other errors:

1) More than two subscripts are Subscript Ranges
2)Ilegal constant equation
Attachments
vensim error.jpg
vensim error.jpg (211.34 KiB) Viewed 670 times

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

Re: Using more than two Subscripts

Post by Administrator »

These are all the same error, you need to put the constants into a separate file (as in the example I gave above).
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: 3047
Joined: Wed May 24, 2006 4:54 am

Re: Using more than two Subscripts

Post by tomfid »

In both of your screenshots, you have 2 dimensions, but only 1 row of data. That will never work.

If you have 1 dimension:
0, 0, 0

2 dimensions:
0, 0, 0;
1, 1, 1;

For 3 or more dimensions, you can use element-by-element definitions. For example, if you have:
X : a, b
Y : y1,y2
Z : z1,z2

you can define:
[a,y,z] =
0, 1;
2, 3;
[b,y,z] =
4, 5;
6, 7;

See also TABBED ARRAY in the help system.

tomfid
Administrator
Posts: 3047
Joined: Wed May 24, 2006 4:54 am

Re: Using more than two Subscripts

Post by tomfid »

If most of your values are 0, you can put 0 in the equation,
const[x,y,z] = 0

Then use a .cin file to override the few nonzero values:
const[b,y2,z1] = 3.141

monica16
Junior Member
Posts: 3
Joined: Fri Aug 23, 2019 7:10 am
Vensim version: PRO

Re: Using more than two Subscripts

Post by monica16 »

Administrator wrote:
Mon Aug 26, 2019 9:01 am
These are all the same error, you need to put the constants into a separate file (as in the example I gave above).
Thank you!!! I solved the issues with this.

Regards!

Post Reply