Creating an "evolving" subscript or subrange?

Use this forum to post Vensim related questions.
Post Reply
Brunilde
Junior Member
Posts: 7
Joined: Tue Jul 14, 2020 11:20 am
Vensim version: PRO

Creating an "evolving" subscript or subrange?

Post by Brunilde »

Good morning or afternoon,

My apologies if this was already treated, but I couldn't find easily an answer. Is there any possibility to define a subrange, or a new subscript, that would automatically modify its elements, in case the variables subscripted with the first subscript answer certain conditions during the simulation?

General example: I need only some elements of a subscript S (a subrange SR) to use in a new calculation in the model. But the elements selected to be included in SR are conditional. Sometimes I will need such selected subscripts elements, and sometimes others.

More illustrative example: I want to calculate the money required for candies selected at the store. But the candies selection is evolving during the simulation. If I use a simple conditional IF THEN ELSE, I don't know how to avoid having to attribute a price anyway to the candies not selected.

Thank you very much in advance!
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Creating an "evolving" subscript or subrange?

Post by tomfid »

You may be able to do what you need with VECTOR SELECT or VECTOR ELM MAP. For really dynamic lists, you need Ventity instead.
Brunilde
Junior Member
Posts: 7
Joined: Tue Jul 14, 2020 11:20 am
Vensim version: PRO

Re: Creating an "evolving" subscript or subrange?

Post by Brunilde »

Thank you Tom, I think Ventity may well be the answer in this case, so for now I'll try to find an alternative modeling path to represent as closely as possible the process in Vensim (^^).
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Creating an "evolving" subscript or subrange?

Post by tomfid »

In Vensim, you can still do this, just at the cost of running some subscript elements that are empty (0) part of the time. Example:
candy 1.mdl
(5.48 KiB) Downloaded 188 times
Post Reply