Feeding data to Stocks vs Auxiliaries

A place for Ventity software questions & answers
timandersonkfbs
Junior Member
Posts: 3
Joined: Wed Mar 08, 2017 7:21 pm
Vensim version: Ventity

Feeding data to Stocks vs Auxiliaries

Postby timandersonkfbs » Wed Mar 08, 2017 7:45 pm

I'll preface the question by saying I'm not 100% sure I yet fully grasp the power of Ventity and exactly how Entities work...so forgive the ignorance.

I'm trying to build a model with both historic data and a forecast. I have a bunch of data in an Excel sheet feeding Ventity...providing data to both Stocks and Auxiliaries in a couple different Entities.

My thinking is that in the spreadsheet I send Ventity data at time zero to establish the historic portion...then at time X ('present) the spreadsheet sends new data to reset the model for the forecast. I recognize that I should be building the model such that it's one flow from history to forecast, but for now I want to examine the discontinuities that occur between my modeling of history and where we are today.

Anyhow...my question...the best I can tell only Stocks can be updated at time X via external data, the Auxiliaries keep the value provided at time zero. Is this the expected behavior? (The checkbox calls it a "Constant" so my hunch is that it's not suppose to change...but just wondering)

For example, looking at your Cow/Pasture model...what if I want to change a Cow's actual consumption rate at time 10?

Thoughts? Thanks.

tomfid
Administrator
Posts: 2014
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

Re: Feeding data to Stocks vs Auxiliaries

Postby tomfid » Wed Mar 08, 2017 11:58 pm

Updating stocks with redundant initialization data is actually not the intended use of the Initialization Data, so I think the stock updates you're getting are a bug. (The intended behavior is for new data with a key matching something already seen to overwrite the previous instance. That way you can load a set of default entities, then selectively override some with different parameters.)

The right way to do this is to use Time Series Data, which works much like it does in Vensim. The Help is a bit sketchy on that, so I'll post our draft documentation ASAP. Time series data won't update a stock for you, but you can write an equation or action to do that.
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/

timandersonkfbs
Junior Member
Posts: 3
Joined: Wed Mar 08, 2017 7:21 pm
Vensim version: Ventity

Re: Feeding data to Stocks vs Auxiliaries

Postby timandersonkfbs » Thu Mar 09, 2017 4:25 pm

Thanks for the quick reply...again newbie here, so apologies up front, if I get off base.

I built a very simple example so that I could better understand your response. The attached model has one Entity type; cows, with one Stock; weight, and one Auxiliary; grazing. The XLSX file sets four cows [C1:c4] at time zero with different weights and grazing. At time 20, the sheet changes the weight of C1 to 2000 pounds, and tries to change the grazing to 200. The model takes the new weight but not the new grazing number.

It's the grazing number that I'm looking at. From your response it sounds like I should be able to overwrite the previous parameters for C1, but it seems that it only overwrites if the variable type is a stock?
Attachments
SimpleCowModel.zip
(11.12 KiB) Downloaded 19 times

tomfid
Administrator
Posts: 2014
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

Re: Feeding data to Stocks vs Auxiliaries

Postby tomfid » Thu Mar 09, 2017 4:52 pm

This is tricky, and clearly my answer was clear as mud.

You have the following initialization data:

Code: Select all

Enabled   Time   CalendarTime   CowsID   Weight   Grazing
TRUE      0      C1   1000   100
TRUE      0      C2   1100   110
TRUE      0      C3   1200   120
TRUE      0      C4   1300   130
TRUE      20      C1   2000   200
TRUE      40      C1   4000   400


There are several ways to interpret this. Two possibilities:
1. Create C1 at time 0 with weight 1000 and grazingRate 100, then change C1's weight and grazingRate at time 20
2. Consolidate all the data before the run, with last-in-wins, so that C1 is created at time 40 with weight 4000 and grazingRate 400

The intended behavior is #2, for the following case:

1. I supply a set of generic cows in File1:

Code: Select all

Enabled   Time   CalendarTime   CowsID   Weight   Grazing
TRUE      0      C1   1000   100
TRUE      0      C2   1000   100
TRUE      0      C3   1000   100
TRUE      0      C4   1000   100
TRUE      0      C5   1000   100
TRUE      0      C6   1000   100


2. For a policy experiment, I want to introduce a super-cow. But I don't want to recreate the whole dataset, so I supply a second dataset that overwrites one cow:

Code: Select all

Enabled   Time   CalendarTime   CowsID   Weight   Grazing
TRUE      20      C1   _   10000

This changes the injection time and grazingRate of C1, rather than changing C1 on the fly, which would potentially be unphysical (i.e. bad modeling).

This kind of situation is actually fairly common in Vensim. The trick is to supply a lengthy changes file filled with default values (zero.cin), then overwrite particular values with a much shorter list of specific changes (actual.cin).

For the moment, I would not rely on state changes from initialization data - assume it's immutable, and use Time Series Data instead.
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/

timandersonkfbs
Junior Member
Posts: 3
Joined: Wed Mar 08, 2017 7:21 pm
Vensim version: Ventity

Re: Feeding data to Stocks vs Auxiliaries

Postby timandersonkfbs » Thu Mar 09, 2017 6:19 pm

That's helpful...thanks.

I confused myself into seeing Entity Initialization as time series data...but it makes sense that the system would read in all of the data at the beginning of the run and just use the last instance of a certain record ID.

Regarding Time Series data...I'll make a request. The "Generate External File Template" feature under Entity Initialization Data >> Data Sources is a great feature for someone learning the tool. Would love to see a similar feature under Time Series Data >> Data Sources.

Thanks again for the quick response!

tomfid
Administrator
Posts: 2014
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

Re: Feeding data to Stocks vs Auxiliaries

Postby tomfid » Thu Mar 09, 2017 7:20 pm

Shoot me a note at info@ventity.biz and I'll send you a draft of the Time Series help.
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/


Return to “Ventity”

Who is online

Users browsing this forum: No registered users and 1 guest