Simulation and Modeling (Unit - 5)
Simulation and Modeling (Unit - 5)
------------------------------------------------------------------------------------
Simulation of PERT Network in Simulation and Modeling
Program Evaluation and Review Technique (PERT) is a project management tool
used to schedule, organize, and coordinate tasks within a project. In simulation,
PERT networks help in modeling uncertain task durations.
Activity A may start immediately. Hence, the earliest date for its start is zero i.e.
ES(A) = 0. It takes 6 weeks to complete its execution. Hence, earliest it can finish is
week 6 i.e. EF(A) = 6.
Activity B may start immediately. Hence, the earliest date for its start is zero i.e.
ES(B) = 0. It takes 4 weeks to complete its execution. Hence, the earliest it can
finish is week 4 i.e. EF(B) = 4.
Activity F may start immediately. Hence, the earliest date for its start is zero i.e.
ES(F) = 0. It takes 10 weeks to complete its execution. Hence, the earliest it can
finish is week 10 i.e. EF(F) = 10.
Activity C starts as soon as Activity A completes its execution. Hence, the earliest
week it can start its execution is week 6 i.e. ES(C) = 6. It takes 3 weeks to complete
its execution. Hence, the earliest it can finish is week 9 i.e. EF(C) = 9.
Activity D starts as soon as Activity B completes its execution. Hence, the earliest
week it can start its execution is week 4 i.e. ES(D) = 4. It takes 4 weeks to complete
its execution. Hence, the earliest it can finish is week 8 i.e. EF(D) = 8.
Activity E starts as soon as Activity B completes its execution. Hence, the earliest
week it can start its execution is week 4 i.e. ES(E) = 4. It takes 3 weeks to complete
its execution. Hence, the earliest it can finish is week 7 i.e. EF(E) = 7.
Activity G starts as soon as activity E and activity F completes their execution.
Since the activity requires the completion of both for starting its execution, we
would consider the MAX(ES(E), ES(F)). Hence, the earliest week it can start its
execution is week 10 i.e. ES(G) = 10. It takes 3 weeks to complete its execution.
Hence, the earliest it can finish is week 13 i.e. EF(G) = 13.
Activity H starts as soon as activity C and activity D completes their execution.
Since the activity requires the completion of both for starting its execution, we
would consider the MAX(ES(C), ES(D)). Hence, the earliest week it can start its
execution is week 9 i.e. ES(H) = 9. It takes 2 weeks to complete its execution.
Hence, the earliest it can finish is week 11 i.e. EF(H) = 11.
Backward Pass in Critical path in project management:
The backward pass is carried out to calculate the latest dates on which each
activity may be started and finished without delaying the end date of the project.
Assumption: Latest finish date = Earliest Finish date (of project).
Activity G’s latest finish date is equal to the earliest finish date of the precedent
activity of finish according to the assumption i.e. LF(G) = 13. It takes 3 weeks to
complete its execution. Hence, the latest it can start is week 10 i.e. LS(G) = 10.
Activity H’s latest finish date is equal to the earliest finish date of the precedent
activity of finish according to the assumption i.e. LF(H) = 13. It takes 2 weeks to
complete its execution. Hence, the latest it can start is week 11 i.e. LS(H) = 11.
The latest end date for activity C would be the latest start date of H i.e. LF(C) = 11.
It takes 3 weeks to complete its execution. Hence, the latest it can start is week 8
i.e. LS(C) = 8.
The latest end date for activity D would be the latest start date of H i.e. LF(D) = 11.
It takes 4 weeks to complete its execution. Hence, the latest it can start is week 7
i.e. LS(D) = 7.
The latest end date for activity E would be the latest start date of G i.e. LF(G) = 10.
It takes 3 weeks to complete its execution. Hence, the latest it can start is week 7
i.e. LS(E) = 7.
The latest end date for activity F would be the latest start date of G i.e. LF(G) = 10.
It takes 10 weeks to complete its execution. Hence, the latest it can start is week 0
i.e. LS(F) = 0.
The latest end date for activity A would be the latest start date of C i.e. LF(A) = 8. It
takes 6 weeks to complete its execution. Hence, the latest it can start is week 2 i.e.
LS(A) = 2.
The latest end date for activity B would be the earliest of the latest start date of D
and E i.e. LF(B) = 7. It takes 4 weeks to complete its execution. Hence, the latest it
can start is week 3 i.e. LS(B) = 3.
Identifying Critical Path: The critical path is the path that gives us or helps us
estimate the earliest time in which the whole project can be completed. Any delay
to an activity on this critical path will lead to a delay in the completion of the
entire project. To identify the critical path, we need to calculate the activity float
for each activity. Activity float is the difference between an activity’s Earliest start
and its latest start date or the difference between the activity’s Earliest finish and
its latest finish date, and it indicates how much the activity can be delayed
without delaying the completion of the entire project. If the float of an activity is
zero, then the activity is critical and must be added to the critical path of the
project network. In this example, activities F and G have zero float and hence, are
critical activities.
Key Terms:
Resource: An item or entity that is needed to perform a task or activity in the
simulation. For example, machines, vehicles, or workers.
Entities: The objects or individuals requiring resources to complete their tasks.
Queue: A line where entities wait until resources are available.
Utilization: The percentage of time a resource is in use.
2. Considerations for Resource Allocation in Simulation:
While allocating resources in simulation models, certain factors need to be
considered:
Availability of Resources: Resources must be available in sufficient quantity to
meet demand.
Capacity Limitations: Each resource has a capacity, such as the number of people
or amount of time it can provide.
Priority Rules: Certain entities may have priority over others for accessing
resources. For example, emergency tasks may be given priority over regular tasks.
Bottlenecks: A bottleneck occurs when the demand for a resource exceeds its
availability, leading to delays and inefficiencies.
3. Strategies for Resource Allocation:
There are different strategies for allocating resources in simulation models:
First Come, First Served (FCFS): Entities are served in the order they arrive.
Shortest Processing Time (SPT): Entities with the shortest processing time are
given priority.
Priority-Based Allocation: Resources are allocated based on the priority of the
tasks or entities.
4. Resource Allocation Example in Simulation:
Example Scenario: Consider a manufacturing plant with three machines (M1, M2,
and M3) that produce parts. Each machine has a specific time to process a part,
and there are multiple orders that need to be completed.
Machine M1 takes 5 minutes to process a part.
Machine M2 takes 3 minutes.
Machine M3 takes 7 minutes.
There are 10 orders waiting for processing.
In this simulation model, the plant manager must decide how to allocate these
machines to maximize throughput and minimize waiting time.
Simulation Languages
In the field of simulation and modeling, simulation languages are specialized
programming languages or tools designed specifically for creating and running
simulation models. These languages help model complex systems, handle discrete
events, and simulate real-world scenarios more efficiently than general-purpose
programming languages like C++ or Java.
Event Handling: Simulation languages are designed to easily manage and simulate
events happening at different time intervals.
Random Number Generation: Most simulations require the generation of random
variables, which these languages support natively.
Time Flow Management: They provide control over how time is advanced in the
simulation (e.g., step-wise or event-driven).
Statistical Reporting: Simulation languages include tools to collect data such as
throughput, resource utilization, and waiting times, which can be used to analyze
system performance.
Object-Oriented Simulation
Object-Oriented Simulation (OOS) combines object-oriented programming (OOP)
principles with simulation modeling. In OOS, the system is modeled as a collection
of interacting objects, each representing a distinct entity or component within the
system. These objects have their own attributes (data) and behaviors (methods),
making it easier to model complex systems with reusable and modular code.
Class Definitions:
Class Patient: Represents a patient with attributes like ID, illness type, and
treatment time.
Class Doctor: Represents a doctor with methods to treat patients.
Class Nurse: Represents a nurse who assists with patient care.
class Patient:
def __init__(self, patient_id, illness_type):
self.patient_id = patient_id
self.illness_type = illness_type
self.treatment_time = 0
def set_treatment_time(self, time):
self.treatment_time = time
class Doctor:
def __init__(self, doctor_id, specialization):
self.doctor_id = doctor_id
self.specialization = specialization
class Nurse:
def __init__(self, nurse_id):
self.nurse_id = nurse_id
Output:
Nurse 1 assisting Patient 1
Patient 1 treatment time: 30 minutes
Key Considerations in Object-Oriented Simulation:
Object Interactions: Understanding how objects (entities) interact with
each other is crucial. In the hospital example, patients interact with
doctors and nurses.
State Management: Objects may change state during the simulation.
For example, a patient’s state may change from waiting to being
treated.
Time Progression: OOS can be event-driven, where objects change their
state based on events that occur at specific times.
-------------------------------------------------------------------------------------------