Task 1.2 - Create Custom Logic
Task Overview
In this tutorial task, you'll build more of the patient track for the emergency room model to get some additional practice using the people-based objects and activities.
In the first tutorial task, you learned how to use one of the activity sets to quickly set up the logic of your patient track. In this tutorial task, you'll learn how to build your own block of activities to create custom logic. Building a custom block of activities will help you better understand how the logic in people-based models works.
You'll also get more practice learning how to add staff and location objects to your simulation model and you'll learn how to use the A* navigation system to prevent staff and patients from walking through objects and your floor plan's walls.
When you're finished, your simulation model should look similar to the following image:
Step 1 Add a Custom Set of Activities
Up to this point, you've learned how to use one of the activity sets to create the logic for your patient track. In this step, you'll learn how to add activities from scratch to create custom logic. Your goal will be to create a triage phase in the PatientTrack process flow. In this phase, you'll design the logic that will instruct a nurse to come take the patient to the triage area.
When you're finished, your process flow will look similar to the following image:
For now, you'll merely add and connect these activities to the two process flows. You'll edit the properties to add logic in a later step.
To add and connect these activities:
- Make sure the PatientTrack person flow is open and active.
- In the Library under Flowchart, add another Process shape. Rename this shape Triage.
- In the Triage shape, add an Acquire Location activity (under People Resources).
- Add the following activities to create a separate stacked block:
- An Acquire Staff activity (under People Resources)
- An Escort Person activity (under People Sub Flows)
- A Process activity (under People Basic)
- A Release Location activity (under People Resources)
- Rename the new activities as follows:
- To the right of these activities, add the following activities to create a stacked
block:
- An Acquire Location activity (under People Resources)
- A Walk activity (under People Sub Flows)
- An Acquire Location activity (under People Resources)
- A Release Location activity (under People Resources)
- Rename the new activities as follows:
- Add the following shared assets to the shape:
- 2 Location Resource shared assets (under People Resources)
- A Staff Resource shared asset (under Staff Resources)
- Rename the shared assets as follows:
- Create a connector from the following activities:
- From the Release Registration activity to the Acquire Triage activity
- From the Acquire Triage activity to the Acquire Triage RN activity
- From the Acquire Triage activity to the Acquire Wait Area activity
- From the Release Wait Area activity to the Acquire Triage RN activity
- Click the first Acquire Triage activity to select it. Confirm that connector 1 is going to the Acquire Triage RN activity and that connector 2 is going to the Acquire Wait Area activity. If not, delete the connectors and reconnect them in the appropriate order or re-rank the connections. See Changing the Rank Number or Name of Outgoing Connectors for more information.
Activity | New Name |
---|---|
Acquire Location | Acquire Triage |
Acquire Staff | Acquire Triage RN |
Escort Person | Escort Patient to Triage |
Process | Triage Patient |
Release Location | Release Triage |
Activity | New Name |
---|---|
Acquire Location (first one) | Acquire Wait Area |
Walk | Walk to Wait Area |
Acquire Location (second one) | Acquire Triage |
Release Location | Release Wait Area |
Activity | New Name |
---|---|
Location Resource (first one) | Wait Area |
Location Resource (second one) | Triage |
Staff Resource | Triage RNs |
Check that your process flow looks similar to the image at the beginning of this step.
Step 2 Edit the Custom Activity Logic
Since you built your own custom set of activities in the previous step, not all of the properties will be automatically set up the way they were when you used an activity set. Activity sets are a great way to cut down the time it takes to build the logic for a people-based model. However, it's also a good idea to understand how to set up activity logic yourself so that you can create your own custom logic if needed. This step will teach you how to set up this kind of logic.
In this step, you'll create the logic for the triage phase of the patient track. If the triage area is available, a nurse will escort the patient to the triage area and measure the patient's vitals. If the triage area is not available, the patient will wait in the waiting area.
The following is an overview of how each activity in the Triage phase of the process flow will function:
Activity or Shared Asset | Explanation |
---|---|
Wait Area | This shared asset will link to the WaitAreas group that you created in an earlier step. |
Triage | This shared asset will link to the TriageChair1 location in the 3D model. |
Triage RNs | This shared asset will link to the RNs group that you created in an earlier step. |
Acquire Triage | This activity will attempt to acquire the TriageChair1 location. If another patient is using the TriageChair1 location, the token will move to the Acquire Wait Area activity and the patient will find a chair in the waiting room. If the TriageChair1 location is acquired, the token will move to the Acquire Triage RN activity instead. |
Acquire Wait Area | This activity will attempt to acquire one of the chairs in the WaitingArea1 multi-location. When the location is free, the patient token will move to the Walk to Wait Area activity. |
Walk to Wait Area | Once a chair in the WaitingArea1 multi-location has been acquired, this activity will tell the patient to walk to the specific chair it acquired. |
Acquire Triage | This activity is almost identical to the previous Acquire Triage activity. It will attempt to acquire the TriageChair1 location for the patient. If the location is not free, the token will wait at this activity until it becomes available. When the location is free, the token will move to the Release Wait Area activity. |
Release Wait Area | This activity will release the specific chair from the WaitingArea1 location so that it is free for other patients to acquire. |
Acquire Triage RN | This activity will acquire a member of the RNs group. If all members of the RNs group are busy working on other tasks, the token will wait at this activity until an RN is free. |
Escort Patient to Triage | The triage nurse will then escort the patient to the triage area. You'll need to link this activity to the acquired triage chair and the triage nurse in order to tell the patient where to go and with whom. |
Triage Patient | This activity will represent the amount of time it takes the patient to complete the triage process. You'll set that time to 20 seconds for now. |
Release Triage | This activity will release the TriageChair1 location so that it is free for other patients to acquire. |
To edit the activity properties:
- In the PatientTrack process flow, click the Wait Area shared asset to select it. In Quick Properties next to the Location box, click the Sampler button to enter sampling mode.
- In the 3D model, click the WaitingChairs1 object to open a menu. Select WaitAreas group from the menu to sample it.
- Click the Triage shared asset to select it. In Quick Properties next to the Location box, click the Sampler button to enter sampling mode.
- In the 3D model, click the TriageChair1 to sample it.
- Click the Triage RNs shared asset to select it. In Quick Properties, click the arrow next to the Staff box to open a menu. Point to Staff Groups, then select RNs.
- Click the first Acquire Triage activity to select it. Click the No Link icon next to this activity to enter sampling mode.
- Click the Triage shared asset to sample it. A blue line will appear to indicate this activity is now linked to the shared asset.
- Make sure the first Acquire Triage activity still selected. In Quick Properties, check the Max Wait Timer check box.
- Next to the OnWaitTimerFired box, click the
Edit Properties button
to open a picklist window. In the
Destination box, delete the current number and type
2
. - Click the Acquire Wait Area activity to select it. Click the No Link icon next to this activity to enter sampling mode.
- Click the Wait Area shared asset to sample it. A blue line will appear to indicate this activity is now linked to the shared asset.
- Click the Walk to Wait Area activity to select it. In Quick Properties next to the Destination box, click the Sampler button to enter sampling mode.
- Click the Wait Area shared asset to sample it.
- Click the second Acquire Triage activity to select it. Click the No Link icon next to this activity to enter sampling mode.
- Click the Triage shared asset to sample it. A blue line will appear to indicate this activity is now linked to the shared asset.
- Click the Release Wait Area activity to select it. Click the No Link icon next to this activity to enter sampling mode.
- Click the Acquire Triage RN activity to select it. Click the No Link icon next to this activity to enter sampling mode.
- Click the Triage RNs shared asset to sample it. A blue line will appear to indicate this activity is now linked to the shared asset.
- Click the Escort Patient to Triage activity to select it. In Quick Properties next to the Destination box, click the Sampler button to enter sampling mode.
- Click the Triage shared activity to select it.
- Next to the Staff box, click the Sampler button to enter sampling mode.
- Click the Triage RNs shared activity to select it.
- Click the Triage Patient activity to select it. In the
Process Time box, delete the current text and type
20.00
. - Click the second Release Triage activity to select it. Click the No Link icon next to this activity to enter sampling mode.
- Click the Triage shared asset to sample it. A blue line will appear to indicate this activity is now linked to the shared asset.
Consider saving your simulation model at this point.
Step 3 Test Your Model
As was mentioned in the previous tutorial task, it's a good practice to test your model periodically. In general, it's a good idea to run the simulation model after you've built out a small portion of the model to test that everything is working as you expected it to work.
Both of the two phases of the patient involve having patients wait in line or go to the waiting area if certain resources aren't available. In order to test whether those pieces of logic are working correctly, you'll need to add more than one patient to the model at a time. In this step, you'll adjust the Patient Arrivals process flow so that it introduces two patients at a time rather than only one.
- Make sure the PatientArrivals process flow is open and active.
- Click the Source: Simulation Starts activity to select it. In Quick Properties, click the Edit Arrivals button to open a new window.
- In the first row under the Quantity column, delete the
current number and change it to
2
.
Now reset and run the simulation model:
As you watch the model run, notice that the first and second patient each enter and walk to the waiting line. While the first patient registers, the second patient waits in line. While the first patient is escorted by a nurse to the triage area, the second patient enters the waiting room.
Notice also that the nurse and patients walk through the floor plans walls, taking the shortest distance between two points. You'll fix this problem in a later step.
Step 4 Add Additional Locations and Staff
In this step, you'll build out a little more of the 3D objects in the emergency room by adding some more people-based locations and staff objects to the model. In this step, you'll see what it's like to add several copies of the same object at the same time using the Create Objects mode.
When you're finished, your model should look similar to the following image:
To add these additional 3D objects:
- In the Library under the People group, click the Location object to open a menu. Click (don't drag) the Exam Table to enter Create Objects mode. Your mouse pointer will change to the Create Objects icon when you're in Create Objects mode. Click the area in the model where you want to add the first exam table. (Use the image at the beginning of this step to guide you on the placement of objects.)
- While still in Create Objects mode, click inside the model to add a second Exam Table.
- Repeat the previous step to add more Exam Tables until there are a total of 6 tables in the model. Press Esc or right click to exit Create Objects mode.
- Click Exam Table 3 to select it. In Quick Properties,
change the Z-rotation to
180.00
. Repeat this step for Exam Table 4 as well. - In the Library under the People group, click the Location object to open a menu. Click the Computer Desk to enter Create Objects mode. Click the area in the model where you want to add the desk.
- While still in Create Objects mode, click inside the model to add a second Computer Desk. Press Esc or right click to exit Create Objects mode.
- Click Computer Desk 2 to select it. In Quick
Properties, change the Z-rotation to
-90.00
. - Move RN1 and RN2 a little to the right in the 3D model. (See the image at the beginning of this step for guidance on object placement.)
- In the Library under the People group, click the Staff object to open a menu of staff objects. Drag a Male into the model.
- Repeat the previous step to drag a Female into the model.
- Click Male1 to select it. In Quick Properties, rename it as MD1.
- Click Female1 to select it. In Quick Properties, rename it as MD2.
- Change the color of MD2 to white.
Check to make sure your simulation model looks similar to the image at the beginning of this step.
Step 5 Create Additional Object Groups
Since you added several new 3D objects to your simulation model in the previous step, you need to create object groups for those new objects in order to make your model scale well. In this step, you'll create a location group named ExamRooms for the new exam tables and you'll create a staff group named MDs for the MD staff members.
To create additional object groups:
- Press and hold down the Shift key while using your mouse to draw a box around all six of the new ExamTable objects you added to your model in the previous step. A red box will appear around the ExamTables to show they are selected.
- Right-click ExamTable1 to open a menu. Point to Location Groups, then select Add to New Group to open a group properties window.
- In the name box, delete the current text and rename the group ExamRooms.
- Confirm that all six of the ExamTables are members of the group. Close the group window.
- Press and hold down the Shift key while clicking a blank area in the 3D model with your mouse to de-select the ExamTables.
- Right-click MD1 to open a menu. Point to Staff Groups, then select Add to New Group to open a group properties window.
- In the name box, delete the current text and rename the group MDs.
- Click the Sampler button to enter sampling mode.
- In the 3D model, click MD2 to sample it.
- Close all the group properties windows.
Consider saving your simulation model at this point.
Step 6 Add A* Navigation
In this step, you'll add some A* navigation to the model. A* is a tool that calculates the most logical path a person should use when walking from one object to another. You can place barriers to prevent a person from walking through an area that they shouldn't walk through (such as walking through an object or the wall of a room). The A* Navigator will take these barriers into account when calculating the best path for a person to travel.
In this step, you'll connect most of the model's objects to the A* Navigator and you'll create barriers to represent the walls in the emergency room. This will prevent staff and patients from walking through walls and objects, which reduces the model's accuracy.
When the model's A* visual settings are turned on, it will look similar to the following image:
To make these changes:
- Make sure the 3D model is open and active. In the Library, expand the A* Navigation group. Drag an A* Navigator into the model, placing it somewhere outside the floor plan.
- Press and hold the A key to enter connection mode. When you are in connection mode, your mouse pointer will change to a plus sign with chain link symbol next to it:
- Once you are in connection mode, click the A* Navigator. Click WaitingArea1 to create a connection between the two objects.
- Repeat the previous steps to create port connections (A-connects) from the
A* Navigator to all of the 3D objects in the model
(including the staff objects) EXCEPT for the following objects:
- Entrance1
- Exit1
- WaitingLine1
- In the Library, click the Divider object to enter Create Divider mode. Your mouse pointer will change to the Dividers icon to show that you are in Create Dividers mode.
- Find the position in your simulation model where you want to place the beginning corner of a divider. When you click on that position in the model and start moving the mouse pointer in a different direction, you'll notice that it begins creating a divider. Reposition the mouse pointer until the divider's end is at the approximate length, angle, and radius you want it to be relative to the start. Click the mouse again to finish creating the divider. Press Esc to exit Create Divider mode.
- These dividers will act as walls in the simulation model. Start by creating the outer walls on the floor plan (the ones surrounding the whole building). If you need to move or resize a divider, click the end points and drag them to a different position.
- Before adding dividers to the interior walls, double-click the
A* Navigator to open its properties window. In the
General tab, reduce the Node
Spacing to
0.5
. - On the Visual tab, check the Show Grid and Show Travel Threshold checkboxes.
- Click the OK button to save changes and close the window.
- Click a blank area in the 3D model so that nothing is selected. In Quick Properties under View Settings, clear the Show Grid checkbox.
- Click the Reset button on the simulation control bar to ensure that the visual changes take effect. (Repeat this step if dividers appear to be too large when you're drawing them.)
- Add more dividers for the interior walls of the building. Don't worry about putting the dividers exactly over the floor plan's walls. It's more important to try to put dividers in between the yellow A* grid lines if possible. These dividers will prevent movement from one point on the grid to another so it will work better if placed in between the grid rather than over it.
- Click the TriageChair1 to select it. Notice that you can now see the chair's travel threshold, represented by several red dots surrounding the chair. Depending on how your chair is placed, there might also be blue dots surrounding those dots.
- Check to ensure that the none of the red travel threshold dots go beyond the dividers. (It is fine if the blue dots extend beyond the dividers.) For example, the following image shows a chair's red travel threshold that extends past a divider:
- Drag the TriageChair1 so that it is a little further away from the divider and none of the red travel thresholds extend beyond the divider. Be aware that there will also not be any problems if the red travel thresholds are exactly inside a divider.
- Repeat the previous steps with all of Exam Tables to ensure their red travel threshold dots do not extend beyond the each room's walls.
- You might actually want to make sure the WaitingArea1 is right up against the surrounding dividers so that persons won't try to walk behind them or try to squeeze into small gaps between the objects.
- If you decide to place a divider in front of the Registration1 object, you might want to make sure that the desk's travel threshold extends past the divider so that the patients can reach it without having to go around the divider.
- If you would like to turn off the visual guides for the A* Navigation system, double-click the A* Navigator to open its properties window. On the Visual tab, clear all the checkboxes.
Reset and run the simulation:
Now when you run the model, the patients and the RNs no longer walk through objects or walls. Notice that the RN walks around the desks and the walls in the floor plan while traveling to the triage area with the patient.
Step 7 Add an Escort to Exam Room Phase
In this step, you'll add another activity set to the patient track. This activity set is called Escort then Process (or go to waiting area). You'll use this activity to have a nurse escort the patient to an exam room if one is available. You'll need to make a few customizations to this activity set so you'll add and remove a few activities in this step.
When you're finished, the process flow will look similar to the following image:
For now, you'll merely add and connect these activities to the process flow. You'll edit the properties to add logic in a later step.
To add and connect these activities:
- Make sure the PatientTrack process flow is open and active.
- From the Library under People Activity Sets, add an Escort then Process (or go to waiting area) activity set to the process flow.
- Rename this shape as Escort to Exam Room.
- In the activity block on the right of this shape, press and hold the Ctrl key. Click the Walk to Wait Area activity and move it from the stacked block to another space in the process flow.
- Delete the Walk to Wait Area activity.
- Repeat that process to delete the following activities from the activity block on
the left of this shape:
- Process
- Release Location
- From the Library under the People Sub Flows group, add an Escort Person activity and insert it after the Acquire Wait Area activity in the block of activities on the right.
- From the Library under the People Resources group, add a Release Staff activity and insert it after the Escort Person activity in the block of activities on the right.
- Press and hold the Ctrl key. Click the Acquire Staff activity in the stacked block on the left and move it to the end of the stacked block on the right.
- Click the stacked block on the left to select it. (It should have two activities: an Escort Patient and a Release Staff activity.) Press Ctrl+C to copy the stacked block. Press Ctrl+V to paste the stacked block.
- Add the newly copied stacked block to the end of the stacked block on the right.
- Rename the activities and shared assets as follows:
- Create a connector from the Release Triage activity in the Triage shape to the Acquire Exam Room activity.
- Click the first Acquire Exam Room activity to select it. Confirm that connector 1 is going to the Escort Patient to Exam Room activity and that connector 2 is going to the Acquire Wait Area activity. If not, delete the connectors and reconnect them in the appropriate order.
- Delete the connector going from the end of the stacked block on the right to the stacked block on the left.
Activity or Shared Asset | New Name |
---|---|
Waiting Area | Wait Area Return |
Location | Exam Rooms |
Staff | Exam RNs |
Acquire Location (on the left) | Acquire Exam Room |
Escort Patient (on the left) | Escort Patient to Exam Room |
Release Staff (on the left) | Release Triage RN |
Escort Patient (first on the right) | Escort Patient to Wait Area |
Release Staff (on the right) | Release Triage RN |
Acquire Location (on the right) | Acquire Exam Room |
Acquire Staff | Acquire Exam RN |
Escort Patient (second on the right) | Escort Patient to Exam Room |
Release Staff | Release Exam RN |
Check that your process flow looks similar to the image at the begining of this step.
Step 8 Edit the Escort to Exam Activities
In this step, you'll edit the properties for the new activities you added in the previous step. Because this is an activity set, most of the activities are already set up to work correctly already. However, you will need to make a few changes, especially for the new activities you added in the previous step.
The following is an overview of how the activities or shared assets will function:
Activity or Shared Asset | Explanation |
---|---|
Wait Area Return | This shared asset will link to the WaitAreas location group. |
Exam Rooms | This shared asset will link to the ExamRooms location group. |
Exam RNs | This shared asset will link to the RNs staff group. |
Acquire Exam Room (on the left) | This activity will attempt to acquire one of the Exam Room locations. If patients are currently using all of the Exam Room locations, the token will move to the Acquire Wait Area activity and the patient will find a chair in the waiting room. If one of the Exam Room locations is acquired, the token will move to the Escort Patient to Exam Room activity instead. |
Acquire Wait Area | This activity will attempt to acquire one of the chairs in the WaitingArea1 multi-location. When the location is free, the patient token will move to the Escort Patient to Wait Area activity. |
Escort Patient to Wait Area | Once a chair in the WaitingArea1 multi-location has been acquired, this activity will tell the previously acquired Triage RN to escort the patient back to the waiting area. |
Release Triage RN (on the right) | This activity will release the Triage RN that was acquired earlier in the process flow. Afterwards, the RN will then be free to work on other tasks or to be acquired by other patients. |
Acquire Exam Room (on the right) | This activity will be identical to the Acquire Exam Room activity on the left except that it won't use a Max Wait Timer. |
Release Wait Area | This activity will release the specific chair from the WaitingArea1 location so that it is free for other patients to acquire. |
Acquire Exam RN | This activity will acquire a member of the RNs group. If all members of the RNs group are busy working on other tasks, the token will wait at this activity until an RN is free. |
Escort Patient to Exam Room (on the right) | The Exam RN will then escort the patient to an exam room. |
Release Exam RN | This activity will release the Exam RN that was acquired earlier in the process flow. Afterwards, the RN will then be free to work on other tasks or to be acquired by other patients. |
Escort Patient to Exam Room (on the left) | This activity will be nearly identical to the Escort Patient to Exam Room on the right. However, the Triage RN will escort the patient instead. |
Release Triage RN (on the left) | This activity will be identical to the Release Triage RN activity on the right. |
To build this logic:
- In the Escort to Exam Room shape, click the Wait Area Return shared asset to select it. In Quick Properties, click the arrow next to the Location box to open a menu. Point to Location Groups, then select WaitAreas.
- Click the Exam Rooms shared asset to select it. In Quick Properties, click the arrow next to the Location box to open a menu. Point to Location Groups, then select ExamRooms.
- Click the Exam RNs shared asset to select it. In Quick Properties, click the arrow next to the Staff box to open a menu. Point to Staff Groups, then select ExamRNs.
- Click the Escort Patient to Wait Area activity to select it. In Quick Properties next to the Destination box, click the Sampler button to enter sampling mode.
- Click the Wait Area Return shared asset to sample it.
- In Quick Properties next to the Staff box, click the click the Sampler button to enter sampling mode.
- Click the Triage RNs shared asset in the Triage shape to sample it.
- Click the Release Triage RN activity in the right activity block to select it. In Quick Properties next to the Staff Resource box, click the Sampler button to enter sampling mode.
- Click the Triage RNs shared asset in the Triage shape to sample it.
- Repeat the previous steps for the Release Triage RN activity in the activity block on the left.
- Click the Escort Patient to Exam Room in the activity block on the left to select it. In Quick Properties next to the Staff Resource box, click the Sampler button to enter sampling mode.
- Click the Triage RNs shared asset in the Triage shape to sample it.
Reset and run the model:
After finishing the triage process and returning to the waiting room, the nurse will take the patients to an exam room.
Conclusion
Up to this point, you've created a simulation model of an emergency room in which a patient completes the registration and check in process. In the next tutorial task, you'll learn how to make a custom location object. Continue on to Tutorial Task 1.3 - Add a Custom Location Object.