How do I model a machine that wears out?¶
A machine that wears out fails at about the same age, while a memoryless machine fails at any age. Weibull with a shape above 1 is the wear-out case. The script gives a press a Weibull uptime and an exponential one with the same 100-minute mean.
from nagasim import build as nb
def breakdown_run(uptime):
m = nb.Model(time_limit=2000, warmup=0)
m.add_resource(name="Press")
arrive = m.create(distribution=nb.Exponential(rate=0.5))
arrive >> m.process(resource_name="Press", distribution=nb.Exponential(rate=1.0)) >> m.dispose()
m.add_failure(name="Wear", resources=["Press"], uptime=uptime,
downtime={"distribution": "Constant", "dist_params": {"value": 20}})
return m.run(replications=10, seed=1)
# Both uptimes average 100 minutes. Weibull shape 3 is wear-out: failures bunch around 100 minutes,
# while the exponential's scatter from almost 0 to over 400.
wear_out = {"distribution": "Weibull", "dist_params": {"scale": 112, "shape": 3}}
memoryless = {"distribution": "Exponential", "dist_params": {"rate": 0.01}}
for label, uptime in (("Weibull shape 3", wear_out), ("Exponential", memoryless)):
results = breakdown_run(uptime)
print(f"{label:<16} mean wait {results.kpi('resource/Press/Time in Queue Avg'):5.1f} minutes")
Save it as recipe-weibull-wear-out.py and run it with python. The script seeds itself, so the numbers below are the same on your machine.
Weibull shape 3 mean wait 4.6 minutes
Exponential mean wait 5.5 minutes
How it works¶
Weibull(scale, shape)withshape = 3bunches failures around the mean;shape = 1is the exponential.add_failuretakes the uptime and downtime as distributions, so any family in the reference can drive a breakdown.- Both presses fail 100 minutes apart on average, and the regular failures cost a little less waiting.
Elements used¶
- Distributions: Weibull, Exponential, Constant.
- Blocks: CREATE, PROCESS, DISPOSE.
- Model-file sections:
failures. - Python:
Model.
Back to all recipes.