Main Content

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.

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

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

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

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

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

    Snapshot of block diagram showing the following connections: Resource Pool block containing the resource, water connected to a Scope block. Below these two blocks, an Entity Generator block connects to a Resource Acquirer block that, in turn, connects to an Entity Server block. The Entity Server block connects to an Entity Terminator block that displays output through a Scope block.

  6. Simulate the model and observe the amount of resources in use (Scope).

See Also

| |