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.
Using more than two Subscripts
Using more than two Subscripts
- Attachments
-
- vensim error.jpg (273.23 KiB) Viewed 2775 times
-
- 190822 Integrated model v18.zip
- (7.01 KiB) Downloaded 181 times
-
- Super Administrator
- Posts: 4610
- Joined: Wed Mar 05, 2003 3:10 am
Re: Using more than two Subscripts
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
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Using more than two Subscripts
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
1) More than two subscripts are Subscript Ranges
2)Ilegal constant equation
- Attachments
-
- vensim error.jpg (211.34 KiB) Viewed 2769 times
-
- Super Administrator
- Posts: 4610
- Joined: Wed Mar 05, 2003 3:10 am
Re: Using more than two Subscripts
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Using more than two Subscripts
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.
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.
/*
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
*/
Re: Using more than two Subscripts
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
const[x,y,z] = 0
Then use a .cin file to override the few nonzero values:
const[b,y2,z1] = 3.141
/*
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
*/
Re: Using more than two Subscripts
Thank you!!! I solved the issues with this.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).
Regards!