Tuesday, May 6, 2025

Supply Chain and Inventory Management – Safety Stock Calculator

 


Notes:

  • Problem Solved: Calculates optimal safety stock based on demand variability and lead time.

  • Benefits: Prevents stockouts by ensuring buffer inventory, minimizing lost sales.

  • Adoption: Businesses can plug this into ERP systems to auto-adjust inventory reorder levels.

Python Code:


import math


class SafetyStockCalculator:

    def __init__(self, z_score, std_dev_demand, lead_time_days):

        self.z_score = z_score

        self.std_dev_demand = std_dev_demand

        self.lead_time_days = lead_time_days


    def calculate_safety_stock(self):

        return round(self.z_score * self.std_dev_demand * math.sqrt(self.lead_time_days), 2)


# Example parameters

z_score = 1.65  # 95% service level

std_dev_demand = 20  # Standard deviation of daily demand

lead_time_days = 7  # Lead time in days


calculator = SafetyStockCalculator(z_score, std_dev_demand, lead_time_days)

safety_stock = calculator.calculate_safety_stock()


print(f"Recommended Safety Stock: {safety_stock} units")


No comments:

Post a Comment

IoT (Internet of Things) Automation - Smart Energy Usage Tracker

  Notes: Problem Solved: Logs and analyzes power usage from smart meters. Customization Benefits: Track per-device energy and set ale...