None Notebook

This notebook contains material from cbe30338-2021; content is available on Github.

< 7.3 Chemotaxis | Contents | Tag Index | 7.5 Simulating Queuing Systems >

Open in Colab

Download

7.4 Batch Chemical Process

7.4.1 Problem Statement

Schultheisz, Daniel, and Jude T. Sommerfeld. "Discrete-Event Simulation in Chemical Engineering." Chemical Engineering Education 22.2 (1988): 98-102.

Batch Process

"... a small, single-product batch chemical plant has three identical reactors in parallel, followed by a single storage tank and a batch still. Customer orders (batches) to be filled (which begin with processing in the reactor) occur every 115 ± 30 minutes, uniformly distributed. The reaction time in a given reactor is 335 ± 60 minutes, and the distillation time in the still is 110 ± 25 minutes, both times uniformly distributed. The holding capacity of the storage tank is exactly one batch. Hence, the storage tank must be empty for a given reactor to discharge its batch; if not, the reactor cannot begin processing a new batch until the storage tank becomes empty. The simulation is to be run for 100 batches. The model should have the capability to collect waiting line statistics for the queue immediately upstream of the reactor.""


You have been hired by the client as a consulting engineer. Prepare a SimPy simulation of this process to deliver to the client. The delivery should include functions to report the key performance indicators, visualize the results of the simulation, and to conduct 'what-if' studies to determine ways to improve process performance.

7.4.2 Analysis

  1. What is the purpose of the simulation? What question needs to be answered? In thinking about this, carefully consider what has been requested, what other questions are relevant to improving system performance.

  2. What are the key performance indicators? What data needs to be collected?

  3. What simulation objects should be created for this application?

  4. What classes of shared resources will be used in this model?

7.4.3 Simpy Shared Resources

We will use Stores to model the various order and equipment queues in this process.

7.4.4 Generating Customer Orders

... a small, single-product batch chemical plant has three identical reactors in parallel, followed by a single storage tank and a batch still. Customer orders (batches) to be filled (which begin with processing in the reactor) occur every 115 $\pm$ 30 minutes, uniformly distributed. The reaction time in a given reactor iis 335 $\pm$ 60 minutes, and the distillation time in the still is 110 $\pm$ 25 minutes, both times uniformly distributed. The holding capacity of the storage tank is exactly one batch. Hence, the storage tank must be empty for a given reactor to discharge its batch; if not, the reactor cannot begin processing a new batch until the storage tank becomes empty. The simulation is to be run for 100 batches. The model should have the capability to collect waiting line statistics for the queue immediately upstream of the reactor.

We begin with modeling the customer order queue. As a first step, we create an outline of the some code that will setup a dictionary to store events associated with each order,

Next we create an order generator.

7.4.5 Order Processor

... a small, single-product batch chemical plant has three identical reactors in parallel, followed by a single storage tank and a batch still. Customer orders (batches) to be filled (which begin with processing in the reactor) occur every 115 $\pm$ 30 minutes, uniformly distributed. The reaction time in a given reactor iis 335 $\pm$ 60 minutes, and the distillation time in the still is 110 $\pm$ 25 minutes, both times uniformly distributed. The holding capacity of the storage tank is exactly one batch. Hence, the storage tank must be empty for a given reactor to discharge its batch; if not, the reactor cannot begin processing a new batch until the storage tank becomes empty. The simulation is to be run for 100 batches. The model should have the capability to collect waiting line statistics for the queue immediately upstream of the reactor.

As a first step we create a set of Stores to contain the reactor, storage tank, and still resources. Although the problem only specifiies one tank and one still, we anticipate the need for "what if" questions to address ways to increase process throughput using capital expenditures.

Next we add an order processor. An order processor is created for each order to marshall the equipment needed to process the order.

The final step is to create a Simpy process to handle individual order as they arrive to the plant. We do this in the order generator. For coding convenience, we move the all of the recording functions to the order processor.

7.4.6 Analysis

To facilitate analysis, we do some post-processing of the simulation data. Here we subtract the start time for each order from all of the other data to track the progress of orders through the process.

Most, but not all, runs of the simulation show elapsed times that increase for later arriving orders. In statistical terms, this is an example of "non-stationary" behavior. In other words, waiting times within the process are increasinig over time. This is highly undesireable behavior indicating the presence of a process "bottleneck".

In the case, it appears orders are waiting for an available reactor. What process modifications would you recommend to accommodate the flow of orders to this plant?

7.4.7 Completed Model

To facilitate "what-if" analyses, we consolidate the code into a single function performiing all required computations. A UI could be added if this were a project to be delivered to client.

7.4.8 Tuning the process

< 7.3 Chemotaxis | Contents | Tag Index | 7.5 Simulating Queuing Systems >

Open in Colab

Download