Dynamic cohorts with stock change

A place for Ventity software questions & answers
Post Reply
cobleg
Member
Posts: 21
Joined: Wed Oct 06, 2021 6:28 am
Vensim version: Ventity

Dynamic cohorts with stock change

Post by cobleg »

I've been developing an electric vehicle forecast model in Ventity using the dynamic cohort pattern. I have two entities defined: LGA; and VehicleCohort. LGA represents spatial areas, namely local government areas. VehicleCohort contains information about the age of each cohort, number of registered vehicles by cohort and vehicle range.

I managed to get this working the way I want it, but I have a feeling there is a better way to implement the logic. In particular, the way I increase the Range attribute (actually a stock) in the create cohort action. Is there a more elegant way to implement this? I intend to add more complex logic, but wanted to build on the best foundation possible.

I have attached the model CarsByLGA2.zip for your reference. Thanks.
Attachments
CarsByLGA2.zip
(24.03 KiB) Downloaded 268 times
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Dynamic cohorts with stock change

Post by tomfid »

This looks fine to me. The only thing I might do differently is keep the range dynamics in the entity rather than the action. In otherwords, compute "create cohort.change" in the LGA entitytype, and then just reference the value in the action (via parent.change or invoker.change). No difference in the result, but it might be easier to debug.
cobleg
Member
Posts: 21
Joined: Wed Oct 06, 2021 6:28 am
Vensim version: Ventity

Re: Dynamic cohorts with stock change

Post by cobleg »

Cheers, thanks for the advice!
Post Reply