โ† QueueSim home  ยท  All models

Machine Breakdowns โ€” README

Machine with Breakdowns

Simulates a production machine subject to stochastic failures and repairs, featuring preemption of in-progress work.

Problem

A single machine processes jobs that arrive and are served according to uniform distributions. However, the machine is subject to breakdowns occurring at exponential intervals. When a breakdown occurs, it preempts whatever job is currently in service. The machine is then occupied by a repair process for a random duration. Once the repair is complete, the preempted job resumes from the exact point it was interrupted.

This model highlights the difference between "effective" utilization (time spent on actual work) and "availability" (time the machine is not broken).

This is based on Example 10 of the Schriber-GPSS/H textbook.

Model in this directory

The model uses a specialized priority system to handle disruptions:

Why this shape

The la-preemption pattern is the core of this model. Instead of having the Job puck check for a breakdown flag, the Breakdown puck actively "steals" the resource. This is the most accurate way to model a hardware failure that happens independently of the work being performed.

To maintain accurate statistics, the model carefully manages busy_time. When a job is preempted, the unused portion of its planned advance is subtracted from the total busy time (line 121) to ensure that "busy time" only counts minutes spent actually processing a part.

Alternatives considered

What this example teaches

Running it

odin run examples/machine_breakdowns

CLI

./machine_breakdowns [options]

Add --json to emit the uniform envelope (metadata, execution_stats, metrics, details) instead of the default text output.

Flag Type Default Description
--json bool false Emit uniform JSON envelope instead of text.

Example runs:

./machine_breakdowns           # default text run
./machine_breakdowns --json    # uniform envelope

See also