शुरू करेंमुफ़्त में शुरू करें

कार असेंबली लाइन: SimPy के साथ non-deterministic इवेंट जोड़ना

यह अभ्यास SimPy का उपयोग करते हुए non-deterministic प्रक्रियाओं पर केंद्रित है.

आप अपनी कार असेंबली लाइन मॉडल के SimPy संस्करण में संशोधन करेंगे और उन्हीं deterministic इवेंट्स को SimPy मेथड्स से जोड़ने पर ध्यान देंगे.

याद करें कि "Welding and painting" को औसतन 15 घंटे लगते हैं, लेकिन यह अवधि 5 घंटे तक ऊपर-नीचे हो सकती है. इसी तरह, "Assembly of parts and testing" को औसतन 24 घंटे लगते थे, और इसकी अवधि 6 घंटे तक ऊपर-नीचे बदल सकती है.

आपके लिए SimPy लाइब्रेरी पहले से इम्पोर्ट की गई है.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में Discrete Event Simulation

पाठ्यक्रम देखें

अभ्यास निर्देश

  • प्रक्रिया "Welding and painting" की अवधि को clock-in करें, और इसकी वैरिएबिलिटी की नई जानकारी को random.randint() मेथड से ध्यान में रखें.
  • प्रक्रिया "Assembly of parts and testing_" की अवधि को clock-in करें, और इसकी वैरिएबिलिटी की नई जानकारी को random.randint() मेथड से ध्यान में रखें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

def car_production_line(env):
    car_number = 0
    while True:
        car_number += 1

        # Adding process 1: Clock-in time requirement for Welding and Painting
        yield env.____(random.____(10, 20))
        print(f"Time = {env.now:7.4f} | Car {car_number:02d} | Welding and Painting")

        # Adding process 2: Return/yield time after completing the process and print the current time
        yield env.____(random.____(18, 30))
        print(f"Time = {env.now:7.4f} | Car {car_number:02d} | Assembly of parts and Testing")
        print(f"Time = {env.now:7.4f} | Car {car_number:02d} | Car ready for shipping!")

env = simpy.Environment()
env.process(car_production_line(env))
env.run(until=SIMULATION_TIME)
कोड संपादित करें और चलाएँ