Adding a subscript using elements of other subscript

Use this forum to post Vensim related questions.
Post Reply
sosorior
Junior Member
Posts: 16
Joined: Mon Oct 28, 2013 8:11 pm
Vensim version: DSS

Adding a subscript using elements of other subscript

Post by sosorior »

Hello
I had a subscript called TECH: hs, rr, nuc
Then i created another subscript (PDC) taking all the elements from 'TECH' and added a new one (lti), i.e., PDC: hs, rr, nuc, lti
When I run the model, i get this error: "All arrays must have same size last element for REORDER"
Before creating the subscript 'PDC', the model run perfectly.
Does anyone know what is happening?
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Adding a subscript using elements of other subscript

Post by tomfid »

Are you using a VECTOR REORDER with PDC on the LHS and Tech on the RHS of the equation?

Hard to tell without seeing the equations in question.
sosorior
Junior Member
Posts: 16
Joined: Mon Oct 28, 2013 8:11 pm
Vensim version: DSS

Re: Adding a subscript using elements of other subscript

Post by sosorior »

I did not even used the subscript 'PDC'. I just created it and I got this error
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Adding a subscript using elements of other subscript

Post by tomfid »

A function you've used may be expecting a complete range rather than a subrange, and the addition of the new subscript converts TECH to a subrange. Hard to tell without an example though.
sosorior
Junior Member
Posts: 16
Joined: Mon Oct 28, 2013 8:11 pm
Vensim version: DSS

Re: Adding a subscript using elements of other subscript

Post by sosorior »

In the following example i have a subscript tech:(p1,p3) and all the equations use tech
Then, i created the subscript 'pdc': tech, p4
If you remove it, the model works again
See the file I attach
Thank you
Attachments
subscripts and subranges.mdl
(11.5 KiB) Downloaded 193 times
sosorior
Junior Member
Posts: 16
Joined: Mon Oct 28, 2013 8:11 pm
Vensim version: DSS

Re: Adding a subscript using elements of other subscript

Post by sosorior »

It seems that VECTOR REORDER does not work with subranges... I can create a new vector PCD: hs1,rr1,nuc1,lti1 and then create a subrange let's say PDCsub: hs1,rr1,nuc1->Tech, in case i need to do some calculation with both. Do you have another suggestion?
P.s. You might add the use of subranges in this kind of function as a possible improvement
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Adding a subscript using elements of other subscript

Post by tomfid »

It may work with subranges (I don't recall), but I think that's not quite the issue. You have several instances of mixed subscript uses - for example:

vector reorder(Desired expansion x hour[HOUR,EXPN2],price order inc[HOUR,TECH])

I think it's checking the size of the TECH family (=PDC) against EXPN2, and reporting the error because this is 4 vs. 3. This could be overzealous checking - I'll have to look at the code.

I'm surprised that it worked before, because you don't have TECH mapped to EXPN2.
Post Reply