Accumulating stocks for calculations during a process list action

A place for Ventity software questions & answers
Post Reply
niallnaidoo
Junior Member
Posts: 7
Joined: Fri Aug 21, 2020 11:53 am
Vensim version: Ventity

Accumulating stocks for calculations during a process list action

Post by niallnaidoo »

Hi, I've made a simpler model based on the cow and pasture example to illustrate my problem. In this modified model, a lion eats cows in the pasture till it achieves a target mass. The stock of the cow's mass flows to the lion. There is another flow to a stock of rotting cow that is in the pasture. The lion only needs a fraction of the last cow eaten to achieve its target - the uneaten carcass flows into the rotting cow stock. Therefore I need to be able to calculate the accumulated flows from each reference entity in the collection but it seems the logic doesn't allow for this - it only calculates accumulation over reference entities in the properties section of the process list action. Is there any way to do this? I've attached the simplified model to make it clearer if needed.
Thank you
Attachments
Cow and Lion.zip
(15.44 KiB) Downloaded 72 times
tomfid
Administrator
Posts: 3331
Joined: Wed May 24, 2006 4:54 am

Re: Accumulating stocks for calculations during a process list action

Post by tomfid »

Sounds delicious.

I'll take a look - there should be a way to do it.
tomfid
Administrator
Posts: 3331
Joined: Wed May 24, 2006 4:54 am

Re: Accumulating stocks for calculations during a process list action

Post by tomfid »

One option would be to give the cows an additional attribute "dead or alive" or perhaps a stock of "death date". Then the uneaten portion could simply be left in the cow in the pasture, with (potentially) more than one lion feeding on it, until the remainder was too old to eat.

It's true that internal stocks in Process List actions accumulate over the execution of one particular iteration, not over multiple triggerings of the same action. For that, the stock would have to reside in an entity.
niallnaidoo
Junior Member
Posts: 7
Joined: Fri Aug 21, 2020 11:53 am
Vensim version: Ventity

Re: Accumulating stocks for calculations during a process list action

Post by niallnaidoo »

I think I'm not understanding you on this. How does the lion keep track of the mass it has gained as it eats cows to know what fraction of the last cow to consume (calculate the quantity of the flow)? By internal stock, are you saying that any stock that exists only in the action (such as the "Pounds Consumed" stock in the model I sent) will have its value reset each time another cow in the list is processed? I don't understand what the purpose of internal stocks are in that case. If the lion mass stock(which resides in the lion entity) would update its value after the flow of each eaten cow this would solve the problem of calculating how much of the last cow it needs to consume but the before action value is used through each particular processed entity in the cow list. Hope that makes the issue clearer.
tomfid
Administrator
Posts: 3331
Joined: Wed May 24, 2006 4:54 am

Re: Accumulating stocks for calculations during a process list action

Post by tomfid »

Apparently a recent optimization of the process list created a bug in the sequencing of updates, so the mass stock is out of date, except when used in the "while" field. There's probably a workaround using a different configuration of internal stocks in the action, or I can send you a nightly build that fixes the problem shortly.
niallnaidoo
Junior Member
Posts: 7
Joined: Fri Aug 21, 2020 11:53 am
Vensim version: Ventity

Re: Accumulating stocks for calculations during a process list action

Post by niallnaidoo »

Hi Tom,

I'm open to a workaround, been trying to figure out one myself but lucked out. A fix might be a better idea overall though as I'm using this kind of functionality in two different process list actions.
Thanks
Niall
tomfid
Administrator
Posts: 3331
Joined: Wed May 24, 2006 4:54 am

Re: Accumulating stocks for calculations during a process list action

Post by tomfid »

Emailed you a link to the nightly build that fixes this.
Post Reply