Is it possible to divide a resource from a resource pool into different percentages?

33 views (last 30 days)
Suppose there is a resource pool "trucks" which transports different materials to another location. While transporting, I want to fill a truck with 20% a, 30% b and 50 % c. The truck will transport the materials, get empty and then become available again.

Answers (1)

Pramil
Pramil on 26 Nov 2024 at 5:33
Edited: Pramil on 26 Nov 2024 at 5:35
Hello Prashant,
Since your resource is the "trucks", you can define an "Entity Generator" block that mimics the loading behaviour for the "truck".
Here is how you can achieve this:
  • Add an "Resource Pool" block namely "truck" along with an "Entity Generator" block and open it's dialog box.
  • Set the "Generation method" to "Time-based" and set a "Period", time required to load the "truck".
  • Navigate to "Entity type" and create attributes for each material "a","b" and "c" with initial value set to "0". Add an additional attribute say "plate" to identify different "trucks".
  • Navigate to "Event actions", under "Generation action" and add the following code:
persistent number_plate
if isempty(number_plate)
number_plate = 1;
end
entity.Plate = number_plate;
entity.a = 20; % modify the quatity as per requirement ...
entity.b = 30; % as well as you can add any logic or create an array for different timestep ...
entity.c = 50; % where index could be number_plate having different composition of materials.
number_plate = number_plate + 1;
  • Add other blocks like "Resource Acquirer", "Entity Server" etc as per your modelling requirements.
  • At last unload the "truck" using an "Entity Terminator" block.
I have attached an example model that I have created for your reference.

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!