main content

using custom visualization for entities -凯发k8网页登录

overview

these examples show how you can create matlab®-based custom visualization for entities. the example illustrates the visualization of a restaurant layout with customer entities entering, dining, and leaving.

structure of model

the model contains the following major components:

  • the resource pool block models the tables in the restaurant. since there are 10 tables in the restaurant, the resource amount is 10.

  • the entity generator block (patron enter) generates entities representing customers. they enter a waiting area, represented by a resource acquire. here they wait for a free table.

  • when a table is available for a customer, he can move to the entity server block which models the duration of eating.

  • when the customer is done eating, he releases the table back to the pool and exits the restaurant.

modelname = 'secustomvisualization';
open_system(modelname);

visualizing the restaurant

serestaurantanimator visualizes the restaurant as follows:

  • serestaurantanimator provides the visualization of the restaurant layout for the model.

  • it generates the figure containing the layout of a restaurant with an entrance, a waiting area, 10 dining tables, and an exit.

  • as entities move during the simulation, it creates a marker (glyph) for each entity in the figure and programs motion for the marker so that it appears to move from one point to another.

  • the animator assigns a table id for each waiting customer and shows the customer moving to the table.

  • to inspect the attributes of the customer entity, pause the model and click on a customer entity glyph. the figure displays the timetodine attribute.

  • to make the motion appear continuous, it uses a matlab timer to periodically execute a function that incrementally moves each entity towards its destination.

  • it uses matlab graphics to display statistics on the figure about the number of entities entering, waiting, and leaving.

  • clicking an entity in the visualization displays the attributes that it contains. it uses a matlab graphics callback to program a buttondownfcn on each entity marker.

animator = serestaurantanimator;

to simulate the model, enter:

  sim(modelname);

close(animator.getfigurehandle);
close_system(modelname);
clear modelname animator

see also

| |

related topics

    网站地图