Set Resource Amount with Attributes
Use the Selected Resources table of the Resource Acquirer block to receive the resource amount definition from the block dialog box or an entity attribute. Using attributes as the source for the resource requires synchronicity between these blocks:
Entity Generator block with the attribute definition that Resource Acquirer wants to supply the source amount
Resource Pool block that defines the resource
Resource Acquirer block the acquires the resource
This example shows this synchronicity.
Open a new model and add Resource Pool, Entity Generator, and Resource Acquirer blocks. For the Resource Pool block:
Set Resource name to
water
.Set Resource amount to
20
.In the Statistics tab, select Amount in use, #u.
In the Entity Generator block dialog box, click the Entity type tab and in the Define attributes table:
Enter the attribute name,
water_amount
, to indicate that the attribute defines the amount of the resource.Set the value to
10
.
In the Resource Acquirer block dialog box, click the Entity type tab and under Available Resources, select
water
and move it to the Selected Resources table.In the Selected Resources table, in the
water
entry:For Amount Source, select
Attribute
.For Amount, enter
water_amount
to match the attribute name defined in the Entity Generator block.
To complete the model, add the following blocks and connect them as shown in the figure:
Entity Terminator (select the Statistics tab Number of entities arrived, #a check box)
Two Scope blocks
Simulate the model and observe the amount of resources in use (Scope).