Page 1 of 1

Using more than two Subscripts

Posted: Mon Aug 26, 2019 1:48 am
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.

Re: Using more than two Subscripts

Posted: Mon Aug 26, 2019 7:26 am
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

Re: Using more than two Subscripts

Posted: Mon Aug 26, 2019 8:09 am
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

Re: Using more than two Subscripts

Posted: Mon Aug 26, 2019 9:01 am
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).

Re: Using more than two Subscripts

Posted: Mon Aug 26, 2019 2:15 pm
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.

Re: Using more than two Subscripts

Posted: Mon Aug 26, 2019 2:18 pm
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

Re: Using more than two Subscripts

Posted: Tue Aug 27, 2019 2:43 am
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!