代写 Background

Background
To transform raw cotton into a completed order, a four-stage process is required in a cotton textile mill. The four stages are spinning, weaving, finishing and packaging. The order of processing is represented by the following diagram:
All the processes are done by machines.
The process time to spin sufficient yarn to produce a bale of finished cloth has a normal distribution with mean 180 seconds and variance 120 second2. The process times for the weaving stage and the packing stage follow exponential distributions with means 360 and 60 seconds, respectively. For the finishing stage, the process time follows a normal distribution with mean 300 seconds and variance 300 second2.
Due to a lack of queueing spaces inside the factory, the queue for spinning is initially set to 25 units and one unit will be added to it when one unit of final product is produced.
The mill operates continuous production on a three shifts a day, seven days a week basis.
RawCotton Spinning Weaving Finishing Packing FinalProduct
Problem
The management realized that if the factory is producing at its most efficient level, the overall percentage of idle time of the machines has to be minimized. The management has decided that the maximum number of machines at each stage is 10, and wishes to know the number of machines, subject to this constraint, that the factory should use at each stage in order to minimize the idle time. In addition, the management wishes to assess the queueing costs for the units waiting in the queues, for the optimal solution obtained based on minimizing idleness.
As a consultant of the factory, you decide to develop a computer simulation model to solve the problem.
** Specific instructions/requirements will be announced accordingly ** 1

Identify the states that the machines and queueing entities can be in at
any time
In this case study, the queueing entities can be in one of the following three states:
Waiting in a queue
Being processed
Not waiting in a queue nor being processed (either before arrival or fully processed)
For the machines, they can be in one of the following two states: Busy, providing the service
Idle
Mechanics of constructing and executing the model
The first step in constructing a simulation model is to express the real system in terms of its key events. An event is defined as a point in time at which changes in the characteristics of the system take place. This normally happens when one or more activities are terminated and new ones begun. In order to gather the desired output information from the simulation, it would thus suffice to observe the system at the instances when events take place.
In a queueing simulation model, usually we are concerned with two events: A queueing entity arrives
A service is completed
In this case study, when a queueing entity arrives, it can either join a queue or be processed (if any machine is available). On the other hand, when a service is completed, a unit in the queue can start to be processed; or if no one is waiting, the machine becomes idle. We can gather the necessary information by observing the various conditions that arise with the occurrence of each of the two events. For example, we can keep track of the length of the queue as follows: When an arrival occurs, the queue length is incremented by one whenever the facility is found busy. Similarly, the queue length is decreased by one when a service is completed and the waiting line is not empty.
We now show how a typical simulation model is executed. Suppose that we wish to simulate T time units of a system¡¯s operation. The simulator starts from a zero datum and locates the proper events on the time scale in chronological order. The execution of the model is achieved by ¡°jumping¡± from one event to an immediately succeeding one. At each event, records are updated to reflect possible changes in the measure of performance.
Therefore, when we want to find out what the next event is, we need to find out which event gets the earliest time. In this case study, any arrival is governed by whether a service is completed, so we are only interested in the time when a service is completed. At any point of time, we also need to find whether there are any machines have been idle since last events. If there are any, the idle time of the machines are incremented by the period between last and present event.
2

T.he following diagram represents the execution process. Each event is represented by a ¡° ¡± on the time scale.
….. event 1 event 2 event 3 event 4 event 5
The fact that the simulator ¡°jumps¡± from one event to the next event shows that the execution process occurs at discrete points in time, giving rise to the name discrete (event-type) simulation.
By the very nature of discrete simulation, we note that there is actually no relationship between the real time and the execution time of the model. Since the simulator is executed by a digital computer. The actual execution time is usually much smaller than the real time.
Assessment of queueing costs
The queueing costs are 150, 250, 350 and 400, in dollars per unit per unit time, for the four processes, respectively.
For example, if in the optimal solution the average queue length in the weaving process is 2.3 units, the average queueing cost for this process is found as: 250(2.3) in dollars per unit time. Perform similar calculations for the other three processes, and sum these costs to find the overall average queueing cost for the optimal solution.
3

Start
Flow Chart of the Model
Put all entities into null space except queue for spinning = 25
Input user¡¯s information
Start the system to work, i.e. start spinning machines to service
Get next event
Execute event routine *
No Test for end of Yes simulation
Print results
* Amplified in next diagram
Stop

Execute Event Routine
A service of stage p is complete
Record the next event time
Store the idle time
Advance the time
p is ¡°packing¡±
p is not ¡°packing¡±
Increase product by one. If there is a queue, start p to work and decrease the queue by one. (Execution of a service completed event)
Increase the queue for spinning by one. If there is any spinning machine available, start spinning to work and decrease its queue by one. (Arrival event execution)
If there is a queue, start p to work and decrease the queue by one. (Execution of a service completed event)
Increase the queue of the next stage by one. If there is any machine available at the next stage, start the next stage to work and decrease its queue by one. (Arrival event execution)

Arrival Event
Generate the next arrival, i.e., compute IAT and add it to the current simulation time
Facility Idle?
Yes
No
Generate a service time q
Put the arriving customer in the queue, and increase queue size by 1
Compute the customer¡¯s departure time = current simulation time + q
Set the status of the facility to ¡°busy¡±
Update the idle record to the facility
Return

Queue empty?
No
Yes
Departure Event
Start the first waiting customer in service, reduce queue size by 1
Set the status of the facility to ¡°idle¡±
Update waiting time record
Generate a service time q
Compute the customer¡¯s departure time = current simulation time + q
Return