entity actions from data

A place for Ventity software questions & answers
Post Reply
seeker
Junior Member
Posts: 8
Joined: Fri Oct 08, 2021 3:46 am
Vensim version: PRO

entity actions from data

Post by seeker »

What's the best way to calibrate with entities and time-series data in Ventity while still maintaining collections? For example, how can I use time series data in which a particular cow moves to a new pasture or dies and leaves the farm and new cows are imported?
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: entity actions from data

Post by tomfid »

Good question. I think it depends what the data looks like - do you have an example?
seeker
Junior Member
Posts: 8
Joined: Fri Oct 08, 2021 3:46 am
Vensim version: PRO

Re: entity actions from data

Post by seeker »

Thanks for the reply. Here is an example of data. We start out with 10 cattle in the first month. In the second month, a few cattle have moved pastures e.x. c001 is now in p002 and some are dead (c008 and c010), and we bought a new cow c011 to pasture p004 and pasture p003 is now empty. Let's assume the simulation plots are the number of cattle of each gender in each pasture. How do I add this time series data as a sample realization/simulation run?

Date CattleID Pasture Gender Alive
1/1/2021 C001 P002 F 1
1/1/2021 C002 P004 M 1
1/1/2021 C003 P002 M 1
1/1/2021 C004 P001 F 1
1/1/2021 C005 P003 M 1
1/1/2021 C006 P004 F 1
1/1/2021 C007 P001 F 1
1/1/2021 C008 P003 F 1
1/1/2021 C009 P001 M 1
1/1/2021 C010 P002 M 1
2/1/2021 C001 P001 F 1
2/1/2021 C002 P004 M 1
2/1/2021 C003 P001 M 1
2/1/2021 C004 P001 F 1
2/1/2021 C005 P002 M 1
2/1/2021 C006 P004 F 1
2/1/2021 C007 P001 F 1
2/1/2021 C011 P004 F 1
2/1/2021 C009 P001 M 1
seeker
Junior Member
Posts: 8
Joined: Fri Oct 08, 2021 3:46 am
Vensim version: PRO

Re: entity actions from data

Post by seeker »

Any ideas? I'm new to ventity but know how to do this in OO languages using functions.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: entity actions from data

Post by tomfid »

It looks like the data essentially matches the Tidy template, if you change "Date" to "DateTime". See Defining Entities>Data Entities>Data Sources in the Help system.

Given the data, are you looking to compare it to what the model is generating, or to use the cow location data as a driver for what happens in the pastures (for example)?
seeker
Junior Member
Posts: 8
Joined: Fri Oct 08, 2021 3:46 am
Vensim version: PRO

Re: entity actions from data

Post by seeker »

Thanks, good question. I am looking to use it as a driver for now. I anticipate I will also use it to compare what the model is generating in other models.
seeker
Junior Member
Posts: 8
Joined: Fri Oct 08, 2021 3:46 am
Vensim version: PRO

Re: entity actions from data

Post by seeker »

Thank you so much @tomfid! Data Entities is what I needed.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: entity actions from data

Post by tomfid »

I'm working on an example for you but ran into a bug so I'm not sure how long it'll take.
seeker
Junior Member
Posts: 8
Joined: Fri Oct 08, 2021 3:46 am
Vensim version: PRO

Re: entity actions from data

Post by seeker »

That's fantastic. I appreciate it-it will be very helpful.
seeker
Junior Member
Posts: 8
Joined: Fri Oct 08, 2021 3:46 am
Vensim version: PRO

Re: entity actions from data

Post by seeker »

I am getting the following exception when I try to use CalendarTime from the excel file. Is there a specific calendar format I need to be using while importing data from excel?

--------------------------------------------------------------------------------
Level 0 Exception
--------------------------------------------------------------------------------
TYPE : OverflowException
MESSAGE : Array dimensions exceeded supported range.
SOURCE : VentityGlobals
METHOD : GetActiveTimeControl
STACK TRACE : at VentityGlobals.RuntimeContext.GetActiveTimeControl(IModelRunConfig runConfig)
at VE_RuntimeManager.ModelInput.ModelTimeSeriesData.CalculateInterpolatedValues(IModelTimeSeriesData timeSeriesData, RuntimeContext runtimeContext, IModelRunConfig modelRunConfig)
at VE_RuntimeManager.ModelInput.ModelTimeSeriesData.FromScenarioTimeSeriesDataSource(RuntimeContext runtimeContext, IScenariosDataSource scenariosDataSource, IRuntimeAdapter runtimeAdapter, IModelRunConfig modelRunConfig)
at VE_RuntimeManager.ModelInput.ModelTimeSeriesDataManager.GetModelTimeSeriesData(RuntimeContext runtimeContext, String uid, IRuntimeAdapter runtimeAdapter, IModelRunConfig modelRunConfig)
at VE_RuntimeManager.FastDataManager.LoadTimeSeriesData(RuntimeContext runtimeContext, IRuntimeAdapter adapter, IModelRunConfig modelRunConfig)
at VE_RuntimeManager.RuntimeManager.CreateRunTask(RuntimeContext runtimeContext, IRuntimeAdapter adapter, IModelRunConfig modelRunConfig, Boolean baseRun)
at VE_RuntimeManager.RuntimeManager.<CreateRunTasks>d__14.MoveNext()
at VE_RuntimeManager.RuntimeManager.<Run>d__11.MoveNext()
at VentityMainForm.AppMainForm.<>c__DisplayClass394_0.<RunModel>b__2()
*** this is probably indicative of the original error ***
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: entity actions from data

Post by tomfid »

Can you share the project files?
seeker
Junior Member
Posts: 8
Joined: Fri Oct 08, 2021 3:46 am
Vensim version: PRO

Re: entity actions from data

Post by seeker »

Attached is a dummy example creating a data entity from the excel file with dates and selecting calendar time in run control.
Post Reply