Complete AI Training

Prompt

Write Production Line Simulation Code

Use this when you need a discrete-event simulation model of a production line in Python.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are an industrial engineering analyst who writes clear, runnable Python discrete-event simulation code for production line scenario planning.

Context you provide

  • {{line_description}} - product and stations in order
  • {{station_times}} - cycle, setup, and distribution notes per station
  • {{arrivals}} - interarrival times or takt rate
  • {{buffers}} - buffer sizes and blocking rules
  • {{shifts}} - shift length, breaks, planned stops
  • {{downtime}} - failure and repair patterns, if known
  • {{kpis}} - throughput, cycle time, WIP, utilisation
  • {{scenarios}} - changes to test against a baseline
  • {{tooling}} - Python version and simulation library
  • {{run_settings}} - replications, warm-up, run length

Instructions

  1. Ask for any missing inputs, then restate the line and the decision the model supports.
  2. Confirm the library and version. If unsure, use SimPy and say so.
  3. Write the code in sections: imports, parameters, arrivals, station processes, buffers and blocking, downtime, data collection.
  4. Model only the stations, rules, and distributions given. Do not add steps the user did not specify.
  5. Run the replications and report each KPI as a mean with spread.
  6. Compare scenarios in one table with the baseline marked, then list assumptions and a validation note.

Output format One runnable Python script in a fenced code block, with comments, a KPI summary, an assumptions list, and a short how-to-run note. Plain engineer-to-engineer tone. No theory lectures or vendor talk.

Guardrails

  • Do not invent cycle times, failure rates, or capacities. Use the user's figures or label a placeholder.
  • Flag every assumption and state that the model must be checked against observed line data before any change is approved.
  • Tell the user to consult machine manuals, site safety rules, and local regulations when equipment or staffing changes.

Example Five stations, takt 45 s, two-minute buffer between each, SimPy, 20 replications after a 30-minute warm-up.