Simulation with AnyLogic/Discrete Event Simulation/Ophthalmology Department Model/Step 8. Occupying a procedure room

Step 8. Occupying a Procedure Room
At this point, all patients are examined in the first procedure room only. Moreover, several patients are examined in the same procedure room at the same time. Now we will improve our model by adding room seizing logic. We will model procedure rooms as static resources. Patients will move now to any of three procedure rooms. The room will be occupied for the examination time so that no one else can be examined there at this time.

Modify the flowchart
 * 1) Add NetworkSeize object. NetworkSeize object seizes a given set of network resources. In our case we want to seize static resources - procedure rooms. [[File:Step 8. Occupying a procedure room 1.png]]
 * 2) Set the following object properties: [[File:Step 8. Occupying a procedure room 2.png]]
 * 3) *Specify the List of resources to be seized. The list of resources is defined in the following way: you list names of NetworkResourcePool objects whose units are being seized. One unit will be seized per pool name. We need to seize one procedure room, so you should type {procRoom}
 * 4) Modify properties of the moveToProcRoom object. We want this block to move patients not to the first procedure room, but to the one that was previously seized by the patient for the examination.Set the following object properties: [[File:Step 8. Occupying a procedure room 3.png]]
 * 5) *Specify that patients will go not to the well-defined destination, but to the location of the seized resource unit (in our case - to the occupied procedure room). Choose Seized resource unit option in the Destination is property.
 * 6) *Specify the name of the seized resource unit that will serve as a destination for patients. Type procRoom in the Resource field. procRoom is the name of our NetworkResourcePool object that defines procedure room resources pool.
 * 7) NetworkRelease object releases previously seized static resources. We need this object to release the procedure room after the procedure. [[File:Step 8. Occupying a procedure room 4.png]]
 * 8) Set the following object properties: [[File:Step 8. Occupying a procedure room 5.png]]
 * 9) *Specify the resources this block releases. Instead of specifying a list of names of seized resources, simply select All seized resources in the Release property since we want to release all seized resources after the procedure will be completed.

Now you can run the model. You can see that patients are examined at any of three procedure rooms and rooms are occupied for the examination time so that no one else is examined there at the same time.