Functional Weave
Code in Python

manufacturing.oee@1.0.0

vectors.json

3,642 bytes · view raw

[
  { "name": "the oee.com worked example: 420 min planned, 47 down, 1.0 s cycle, 19271 made, 18848 good", "args": [25200, 2820, 1000, 19271, 18848, "half-up"], "expect": { "availability": 8881, "performance": 8611, "quality": 9780, "oee": 7479, "runSeconds": 22380 } },
  { "name": "OEE is 76.5625% exactly, so 7656; multiplying the rounded factors 8750 x 8929 x 9800 would give 7657", "args": [28800, 3600, 1500, 15000, 14700, "half-up"], "expect": { "availability": 8750, "performance": 8929, "quality": 9800, "oee": 7656, "runSeconds": 25200 } },
  { "name": "the same shift rounded down", "args": [28800, 3600, 1500, 15000, 14700, "down"], "expect": { "availability": 8750, "performance": 8928, "quality": 9800, "oee": 7656, "runSeconds": 25200 } },
  { "name": "the same shift rounded up", "args": [28800, 3600, 1500, 15000, 14700, "up"], "expect": { "availability": 8750, "performance": 8929, "quality": 9800, "oee": 7657, "runSeconds": 25200 } },
  { "name": "an exact half basis point, 6500.5, goes to the even 6500 under half-even", "args": [20000, 0, 1000, 13001, 13001, "half-even"], "expect": { "availability": 10000, "performance": 6500, "quality": 10000, "oee": 6500, "runSeconds": 20000 } },
  { "name": "the same half goes up to 6501 under half-up", "args": [20000, 0, 1000, 13001, 13001, "half-up"], "expect": { "availability": 10000, "performance": 6501, "quality": 10000, "oee": 6501, "runSeconds": 20000 } },
  { "name": "a sub-second ideal cycle set too slow: performance over 100% is reported, not capped", "args": [28800, 0, 500, 60000, 60000, "half-up"], "expect": { "availability": 10000, "performance": 10417, "quality": 10000, "oee": 10417, "runSeconds": 28800 } },
  { "name": "an hour with 10 minutes down, a 2 s cycle, 1600 made and 1500 good", "args": [3600, 600, 2000, 1600, 1500, "half-up"], "expect": { "availability": 8333, "performance": 10667, "quality": 9375, "oee": 8333, "runSeconds": 3000 } },
  { "name": "down for the whole planned time: every factor is zero", "args": [3600, 3600, 1000, 0, 0, "half-up"], "expect": { "availability": 0, "performance": 0, "quality": 0, "oee": 0, "runSeconds": 0 } },
  { "name": "running but nothing made: quality is zero, not a division by zero", "args": [3600, 0, 1000, 0, 0, "half-up"], "expect": { "availability": 10000, "performance": 0, "quality": 0, "oee": 0, "runSeconds": 3600 } },
  { "name": "more good units than made is an error", "args": [3600, 0, 1000, 100, 101, "half-up"], "expectError": "goodCount must be from 0 to totalCount" },
  { "name": "more downtime than planned time is an error", "args": [3600, 3601, 1000, 0, 0, "half-up"], "expectError": "downtimeSeconds must be from 0 to plannedSeconds" },
  { "name": "zero planned time is an error", "args": [0, 0, 1000, 0, 0, "half-up"], "expectError": "plannedSeconds must be from 1 to 10^11" },
  { "name": "a zero ideal cycle time is an error", "args": [3600, 0, 0, 10, 10, "half-up"], "expectError": "idealCycleMillis must be greater than zero" },
  { "name": "units counted with no run time is an error", "args": [3600, 3600, 1000, 5, 5, "half-up"], "expectError": "no units can be made with no run time" },
  { "name": "a negative total count is an error", "args": [3600, 0, 1000, -1, 0, "half-up"], "expectError": "totalCount must not be negative" },
  { "name": "a fractional count is an error", "args": [3600, 0, 1000, 10.5, 10, "half-up"], "expectError": "totalCount must be a whole number" },
  { "name": "counts too large to compute exactly are an error", "args": [100000000000, 0, 1000000, 1000000000, 0, "half-up"], "expectError": "totalCount and idealCycleMillis are too large" }
]