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.
|