Car Assembly line: adding non-deterministic events
This exercise focuses on non-deterministic processes without using SimPy. In the next exercise, we will focus on SimPy.
You have been asked to account for variability in the duration of processes in the previous discrete-event model of a car production line. The groups of processes identified before are (1) "Welding and painting" and (2) "Assembly of parts and testing". Recall that each of these groups of processes involves many sub-processes and tasks, but for now, you are focused on coding the first version of your model at a high level.
Previously, you had determined that welding and painting took an average of 15 hours complete, while the assembly of parts and testing took an average of 24 hours to finish.
Now, you did additional research and monitoring to study the variability in the duration of these processes. You concluded that welding and painting could vary by five hours (up or down), and the duration of the assembly of parts could vary by six hours (up or down).
Update your discrete-event model to account for variations in the duration of these events.
The random
package has been loaded for you.
This exercise is part of the course
Discrete Event Simulation in Python
Exercise instructions
- Clock-in the duration of the process "Welding and painting", taking into account the new information about variability using a method from the
random
package that generates random integer numbers. - Clock-in the duration of the process "Assembly of parts and testing", taking into account the new information about variability using a method from the
random
package that generates random integer numbers.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
def car_production_line(SIMULATION_TIME):
car_number, time = 0, 0
while time < SIMULATION_TIME:
car_number += 1
# Clock the time requirement for: Welding and Painting
time += ____
if time >= SIMULATION_TIME: break
print(f"Time = {time:7.4f} | Car {car_number:02d} | Welding and Painting")
# Clock the time requirement for: Assembly of parts and Testing
time += ____
if time >= SIMULATION_TIME: break
print(f"Time = {time:7.4f} | Car {car_number:02d} | Assembly of parts and Testing")
print(f"Time = {time:7.4f} | Car {car_number:02d} | Car ready for shipping!")
car_production_line(SIMULATION_TIME)