# Twinworks Factory Simulation > Simulate a production line: throughput, lead time, WIP, OEE and the bottleneck, with CIs. Runs the Twinworks discrete-event simulation on a factory model (sources, buffers, machines with failures and setups, assembly, conveyors, quality checks, operators and shift calendars). Returns throughput per hour, lead time, WIP with a Little’s-law check, per-station states and OEE, the bottleneck and a cost per good part, with Student-t confidence intervals across seeded replications. Part of usefulweb.site (https://usefulweb.site/). Results are deterministic calculations from the inputs and the listed assumptions; the API returns exactly what the web page shows. ## Use it - Human interface: https://twinworkssimulate.usefulweb.site/ (interactive tool at https://twinworkssimulate.usefulweb.site/tool) - JSON API: POST https://twinworkssimulate.usefulweb.site/api/v1/calculate with a JSON object of inputs (schema: https://twinworkssimulate.usefulweb.site/api/v1/tool) - OpenAPI: https://twinworkssimulate.usefulweb.site/openapi.json - MCP (Streamable HTTP): https://twinworkssimulate.usefulweb.site/mcp - tool `twinworks_simulate` ## Inputs - model (textarea): Model or project JSON - A Twinworks project (.twinworks.json, format "twinworks-project") or a bare model with "nodes" and "links". Times in seconds, lengths in metres. Leave empty and pick a template instead. - template (select): Or start from a template - horizonHours (number): Run length per replication - Overrides the model setting (includes the warm-up). - warmupMinutes (number): Warm-up - Statistics are reset after the warm-up. Overrides the model setting. - seed (integer): Random seed - Same seed → same result. Replication r uses a seed derived from it. - replications (integer): Replications - Independent runs with different seeds; used for the confidence intervals. - confidence (select): Confidence level ## Method - Discrete-event simulation with a binary-heap event calendar; ties are processed in (time, priority, insertion order) so every run is reproducible. - Parts are pushed downstream with blocking after service: a machine that cannot hand its part on is “blocked”; a machine without parts is “starved/idle”. - Each random quantity (arrivals, cycle times, failures, routing choices) has its own seeded stream, so scenario changes do not shift other random numbers (common random numbers). - Statistics are reset after the warm-up. Replications use derived seeds; intervals are Student-t intervals of the replication means. - Little’s law is checked as L (time-average WIP) versus λ·W (departure rate × mean time in system); differences above 5 % signal a non-stationary system or too short a run. - OEE = availability × performance × quality with planned time = time on shift minus planned maintenance; availability losses = breakdowns + setups; performance = ideal cycle time × parts ÷ run time (starving and blocking reduce it); quality = good ÷ processed. - Bottleneck: active-period method (Roser et al.) — at each moment the station with the longest uninterrupted active period (working, setup, repair, maintenance, waiting for an operator) is the bottleneck; overlaps between consecutive bottlenecks count as shifting. ## Limits - A simulation is only as good as its input data. Validate cycle times, failure data and routings against your shop floor before making investment decisions.