Simulation with AnyLogic/Discrete Event Simulation/Ophthalmology Department Model/Step 4. Defining the network and resources

Step 4. Defining the Network and Resources
Now we will add objects describing the network and resources available in it.

Define the model network
 * 1) Add Network object onto the diagram. To add a object of the library on the diagram, first open the library palette (Enterprise Library stencil of the Palette view), then click on the object in the library stencil and finally, click in the graphical editor where you want to place the object. [[File:Step 4. Defining the network and resources 1.png]]
 * 2) Network object defines the network. Please refer to Enterprise Library Reference Guide for the description of all the Enterprise Library objects. You can find there all object functions and their parameters. To open Enterprise Library Reference Guide, choose the corresponding item from the AnyLogic Help. To open Help window, choose Help|Help Contents from AnyLogic menu.
 * 3) Set the object properties. Specify the group containing shapes standing for network nodes and links. Thus we associate the defined network structure with this Network object. Choose networkGroup as the Group of network shapes: [[File:Step 4. Defining the network and resources 2.png]]

Now we will add library objects defining pools of network resources. The resources may be of three types: moving, portable and static. In our example, doctors are moving resources, scopes are portable resources, and procedure rooms are the static ones.

Define doctor resources pool
 * 1) Add NetworkResourcePool object on the diagram. NetworkResourcePool describes resources of a particular type. This one will describe doctor resources. Set the following object properties: [[File:Step 4. Defining the network and resources 3.png]]
 * 2) Name the object doctor.
 * 3) Specify the number of resource units in the Capacity edit box: 5.
 * 4) Specify the home location of the resource. Moving resource unit returns there if it gets idle. In our model doctors spare one private office space, so we leave the default value of the Home defined by property (Single node) unchanged.
 * 5) Type staffRooom (the name of the rectangle representing the staffroom) in the Home node edit box.
 * 6) Set shapeDoctor as Idle unit animation shape and Busy unit animation shape.

Define procedure room resources pool
 * 1) Add one more NetworkResourcePool object to describe procedure room resources. Set the following object properties: [[File:Step 4. Defining the network and resources 4.png]]
 * 2) Name the object procRoom.
 * 3) Change the Resource type to Static.
 * 4) A static resource always resides at its home location. There can be a number of resource home locations. In this case you need to draw a polyline with points lying in the corresponding rectangles and specify it as the object’s Home path. We have three procedure rooms in our model, so we should use this approach.
 * 5) Choose Path across nodes in the Home defined by property.
 * 6) In the Home path edit box, specify roomsLocation polyline created beforehand for this purpose.
 * 7) Specify that the resource object has the number of resource units equal to the number of points of the specified polyline. Therefore, choose By home shape option in the Capacity defined property.

Define scope resources pool
 * 1) In the same way, add NetworkResourcePool object to describe ophthalmoscope resources. Set the following object properties: [[File:Step 4. Defining the network and resources 5.png]]
 * 2) Name the object scope.
 * 3) Change the Resource type to Portable.
 * 4) Specify the number of resource units in the Capacity edit box: 5.
 * 5) Specify the home location of the resource. Portable resource unit are placed there at the model startup. Leave the default value of the Home defined by property (Single node) unchanged.
 * 6) Type storageRooom (the name of the rectangle representing the storage room) in the Home node edit box.
 * 7) Set shapeScope as Idle unit animation shape and Busy unit animation shape.

Connect NetworkResourcePool objects with Network
 * 1) To add the defined resources into the network, you should connect ports of NetworkResourcePool objects with the port of the Network object. Connect them as shown in the figure: [[File:Step 4. Defining the network and resources 6.png]]
 * 2) To connect ports of objects, double-click the first port, then optionally click at each connector's turning point on the diagram, and finally click the second port. The connector linking two ports appears. [[File:Step 4. Defining the network and resources 7.png]]
 * 3) Cyan points inside ports indicate the correct connection. In the case you do not see cyan circles, it probably means that you put connector's point close by a port and you need to move it onto it.