कार असेंबली लाइन: non-deterministic इवेंट जोड़ना
यह अभ्यास SimPy का उपयोग किए बिना non-deterministic प्रक्रियाओं पर केंद्रित है. अगले अभ्यास में, हम SimPy पर ध्यान देंगे.
आपसे कार प्रोडक्शन लाइन के पिछले discrete-event मॉडल में प्रक्रियाओं की अवधि में होने वाली variability को शामिल करने के लिए कहा गया है. पहले पहचाने गए प्रक्रियाओं के समूह हैं: (1) "Welding and painting" और (2) "Assembly of parts and testing". याद करें कि इन प्रत्येक समूहों में कई उप-प्रक्रियाएँ और tasks शामिल हैं, लेकिन फिलहाल, आप अपने मॉडल के पहले संस्करण को उच्च-स्तर पर कोड करने पर केंद्रित हैं.
पहले, आपने निर्धारित किया था कि welding और painting को पूरा होने में औसतन 15 घंटे लगते हैं, जबकि parts की assembly और testing को खत्म होने में औसतन 24 घंटे लगते हैं.
अब, आपने इन प्रक्रियाओं की अवधि में variability का अध्ययन करने के लिए अतिरिक्त research और monitoring की. आपका निष्कर्ष है कि welding और painting में 5 घंटे तक (ऊपर या नीचे) बदलाव हो सकता है, और parts की assembly की अवधि में 6 घंटे तक (ऊपर या नीचे) बदलाव हो सकता है.
इन इवेंट्स की अवधि में होने वाले variations को शामिल करने के लिए अपने discrete-event मॉडल को अपडेट करें.
random पैकेज आपके लिए लोड कर दिया गया है.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Discrete Event Simulation
अभ्यास निर्देश
randomपैकेज की वह method उपयोग करते हुए जो रैंडम पूर्णांक बनाती है, नई variability जानकारी को ध्यान में रखकर "Welding and painting" प्रक्रिया की अवधि clock-in करें.randomपैकेज की वह method उपयोग करते हुए जो रैंडम पूर्णांक बनाती है, नई variability जानकारी को ध्यान में रखकर "Assembly of parts and testing" प्रक्रिया की अवधि clock-in करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
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)