<< Click to Display Table of Contents >> 6. Use Related Entities' Information |
|
Show/Hide Hidden Text |
In the previous two exercies, we associated each cow with its pasture. We also calculated the total grass consumption in each pasture, by giving each pasture entity a reference to its particular collection of cows. In this run, we will make each cow entity aware of how much grass is left in its pasture, to prevent Ventity from giving cows more grass than the pasture can provide.
This exercise is featured along with the previous two exercises in this video:
Stages of Ventity™ Modeling |
In this run, we will ... |
Stage 1 - Define entity types
|
... change the cow entity type definition to use the grass available in each pasture as an input to how much grass each cow can eat. |
Stage 2 - Initialize the model
|
(No changes from previous run.)
|
Stage 3 - Run the model Configure time settings and perform calculations
|
(No changes from previous run.)
|
Stage 4 - Examine results See model behavior in graphs and tables
|
... see how the pasture information keeps each cow entity from eating negative grass, and each pasture from growing negative grass. Add a legend to charts and use the legend to control which data are shown or hidden. |
This step will continue with the finished model from the previous run or, if you haven't completed that exercise yet, with the model Exercise 5 Complete found [here].
We want to address the issue that arose in the previous run, namely, that in the current model, grazing is not limited to the amount of grass that's actually in each pasture.
To tackle that, we first need to address a units issue: cows are consuming grass in pounds per day, while pastures are growing grass in centimeters per day. To bridge this distinction, it will be easiest if each pasture entity computes its available pounds of grass. In the pasture diagram,
1.Add an auxiliary "grass mass", equal to the product of area, density, and grass height, with units pounds. You might choose to reposition area and density to do this.
Now, let's limit grass consumption to what's actually available.
2. On the cow diagram, rename "consumption rate" as "desired consumption rate". Add to the description that this is the rate at which a cow will eat, if there's enough grass.
3. Create a new variable called "available consumption rate."
4. To compute the available grass, notice in the cow entity diagram below that each cow has a pasture attribute (a descriptive property, saying which pasture the cow is in) that appears in the attribute grid (1). That attribute is also a reference to each cow's pasture entity, appearing in the reference grid (2). The reference means that the properties of each cow's pasture are available to use in each cow's calculations. The pasture's properties appear in the reference tab of the cow inspector (3). Drag the pasture.grass mass variable from the reference tab of the cow inspector to the cow diagram.
5. Grass mass will also be an input to available consumption, so draw an arrow.
6. The most that can be eaten is all the grass in one day, so create another auxiliary called "one day" and set it equal to 1, with units "day".
Of course, each cow does not have the entire pasture to herself. How much is available for her to eat depends on how fast the other cows in the pasture are eating. So we need to know the total of the desired consumption rates in the pasture. We defined that variable as part of the cow[pasture] collection in the last exercise, but we were not yet distinguishing between desired consumption and actual.
7. Returning to the cow[pasture] collection, create an aggregate and set it to the sum of the desired consumption rates.
8. For each cow to use "sum desired consumption" in her computations, we need to create a reference from each cow to the collection of cows in her pasture. On the cow Entity Type Inspector, on the reference tab, click "new reference" , and create a reference to the cow[pasture] collection. Call it "cows here", since for each cow, this reference will point to the subcollection of cows that are in the same pasture. For "Target Type", choose "cow[pasture]". Under "Conditions", set "Value to Match" to "pasture". This tells Ventity that "cows here" refers to the group of cows in the pasture that matches the pasture attribute of the current cow.
11.The reference "cows here" will now appear on the reference tab. Click the arrow to show the properties of that collection and drag "sum desired consumption" to the cow diagram.
12. Define available consumption rate so each cow gets an amount proportional to her desired consumption:
13. Create auxiliary "actual consumption rate", and define it to be the minimum of the desired and actual consumption rates:
14. The grazing in each pasture is the actual consumption of the cows, not the desired consumption. Returning to the cow[pasture] collection, create another aggregate variable to compute the total actual consumption.
15. Finally, use that new aggregate to set the amount of grazing in the pasture entity, by dragging it onto the pasture diagram and revising the grazing equation:
That should do it - the grazing is now a function of what cows actually eat, which is limited by how much grass is available.
|
No changes are needed from the previous run.
|
No changes are needed from the previous run. Run the model!
If you have the console open (which you can do from the View menu), you will see warnings that say,
07/02/2015 05:26:12: Warning in model Cows3 : [0]08/14/2014 Unable to reference Entity Type [pasture] from cow [cow-13] using Attribute [pasture] = "thistle hill" 07/02/2015 05:26:12: Warning in model Cows3 : [0]08/14/2014 Undefined value for variable [available consumption rate] in cow-13.
There's a similar warning for cow-14. These are referring to the two cows (numbers 13 and 14) from the Thistle Hill pasture. Since we did not include Thistle Hill in our input list of pastures, Ventity has no information about the area, density or grass height of that pasture, so there is no way compute a constrained consumption rate for those two cows.
|
9. From the pasture diagram, plot the Grass Height of the pastures.
Green Gables decreases to near zero and then stays there as cows eat the grass as fast as it can grow.
10. From the cow diagram, make a line chart of constrained consumption rate, then right-click on the graph and choose "Edit Chart Properties". This will open the Chart Properties Dialog box. Next, click on "Legend" and check the box that says "Visible". You might want to take a moment to adjust the Alignment to make the graph appear as shown, but that's left up to whatever you feel is most aesthetic. None of these options will effect the results displayed. Click the "Use Checkboxes" button before you click "Finish" to apply the changes.
You can add or remove lines from the graph using the checkboxes. Right-clicking the legend also provides options to run causal tracing, plot causes and uses, view data and more.
Notice in the graph that two of the cows, numbers 13 and 14, do not display. These are the two cows from the Thistle Hill pasture, which does not exist in the model. Ventity has not plotted them since there is no pasture information available to compute their constrained consumption rate. You can click the checkboxes next to any of the cow-entities to toggle whether or not they're displayed to make it easier to see this result.
Notice also the four cows whose consumption rate drops sharply. These are the cows from the Green Gables pasture, which runs out of grass shortly before the end of the run. Once the grass is gone, these cows are limited to eating only the new growth each day.
Summary: In this run, we allowed each cow entity to use information from its pasture entity and from the collection of all the cows in its pasture to determine the available resource (grass) and its proportional share of those resources. We also saw how to add a legend to the graph and use it to control which outputs are plotted.
|