Getting Started

Set up the environment

Clone the repository and let uv create the environment from uv.lock:

uv sync
uv run python examples/single_machine.py
uv run pytest

To add the package to another uv-managed project:

uv add "manufacturing-sim-s @ git+https://github.com/SHAFNehal/manufacturing_sim_s.git"

In Colab, the course notebooks install directly from the GitHub repository in their first code cell.

Understand the model

from manufacturing_sim_s import Plant, Source, Machine, Sink, Worker, Product

plant = Plant("Lab Plant", width=80, height=40)
worker = Worker("Worker 1", position=(2, 2), skills="all")
source = Source("Raw Material", (5, 15), 8, 8, arrivals=60)
machine = Machine("Machine 1", (30, 15), 10, 8,
                  processing_time=120, worker=worker)
sink = Sink("Shipping", (60, 15), 8, 8)
product = Product("Product A", [source, machine, sink])

plant.add(source, machine, sink, worker, product)
plant.connect(source, machine, worker=worker)
plant.connect(machine, sink, worker=worker)
print(plant.validate())
result = plant.run(duration=3600, seed=42)
result.report()

The model has three layers:

  1. Layout: Plant plus the position and footprint of every physical component.
  2. Process: each Product.route says where a Part goes, in order.
  3. Movement: each Plant.connect says how a Part travels between two route locations.

A connection needs a Worker for manual carrying, a Worker plus Forklift, or an autonomous AGV. Call plant.validate() before every run; it catches out-of-bounds footprints, clearance conflicts, missing route connections, and invalid resource assignments.

Outputs

plant.visualize()
result.plot_wip()
result.plot_lead_times()
result.export_csv("outputs/csv")
plant.animate()  # displays and writes GIF + MP4

Generated plots, animations, CSV files, and JSON configurations belong in their matching outputs/ subdirectories.

Next, follow Create a Complete Layout to build a model from a blank floor plan. Use the tutorial overview to jump to a specific topic.