Build the FAI Check Sheet
Build the First Article Inspection
Kanoa only watches assets for quality triggers when you ask it to, so it doesn't spend effort on assets that never need checks.
- Navigate to Configuration → Ops → Assets and select
CoreForge\Philadelphia\Machining\Machine 1. - Select Enable Quality Triggers and save. The option is only available on OEE-enabled assets.
- Repeat for
Machine 2throughMachine 8.
The FAI needs both an asset, to know which machine and operator it belongs to, and an item, to know which tolerance applies.
- In Configuration → Quality → Check Sheets, add
Machining - First Article Inspectionin theCoreForge\Operationsfolder. - On the Info tab, enter:
- Description:
First article inspection for machined parts at the start of a production run or after changeover. - Procedure:
Machining FAI Procedure - Document:
https://44110182.fs1.hubspotusercontent-na1.net/hubfs/44110182/Demo/workInstructionSample260120.pdf - Instructions:
Measure the first part produced after starting the run. Enter all required dimensional measurements and complete the visual defect check before continuing production.
- Description:
- On the Settings tab, select Asset Required with the
CoreForge\Philadelphia\Machiningarea, and Item Required with theCoreForge\WIP\Machinedclass.
Use Instructions for short guidance in the form, and Document to link to a controlled procedure or work instruction.
All three are Type Check, Enabled and Required.
| Check item | Data type | Measurements | Aggregation | Units | Specification |
|---|---|---|---|---|---|
Diameter | Float | 3 | Average | mm | The attribute's tolerance (below) |
Length | Float | 2 | Max | mm | Range, min 100, max 200 |
Visual Defect Check | String | 1 | Text (below) |
Diameter's specification comes from an attribute:
- Click Assign Attribute and pick
CoreForge\Machining\FAI Diameter. - Then, in the Specification section under Tolerance, choose Use Attribute Tolerance. It only shows up once the attribute is assigned. Leave Dynamic cleared.
Visual Defect Check's specification is Text, with these options:
- Pass:
No visible defects - Warning:
Minor cosmetic defect - Fail:
Burrs present,Surface damage,Incorrect finish
With more than one measurement, Kanoa keeps every reading and evaluates the aggregate. Length readings of 150 and 205 give a Max of 205, which fails.
Diameter uses the attribute because its spec changes with the part family. Length uses a fixed range on the check item because it's the same for every part.
Check Your Work
Copy this script into the Ignition Designer Script Console (Tools → Script Console) and run it. It checks that Machine 1 to Machine 8 have Enable Quality Triggers selected, the FAI's folder, Info tab, asset and item settings, and each check item's data type, measurements, aggregation, units and specification. Each check prints PASS or FAIL with what to fix. It doesn't change anything.
Show the check script
# Kanoa Quality Training - check "Build the FAI Check Sheet" (First Article Inspection, lesson 2)
#
# Run in the Ignition Designer Script Console (Tools > Script Console), in the
# project that inherits KANOA_SCRIPTS. It only reads; it changes nothing.
# Every check prints PASS or FAIL with what to fix, then a summary.
import re
MACHINES = ['CoreForge\\Philadelphia\\Machining\\Machine %d' % n for n in range(1, 9)]
SHEET = 'Machining - First Article Inspection'
FOLDER = 'CoreForge\\Operations'
AREA = 'CoreForge\\Philadelphia\\Machining'
ITEM_CLASS = 'CoreForge\\WIP\\Machined'
DOCUMENT = 'https://44110182.fs1.hubspotusercontent-na1.net/hubfs/44110182/Demo/workInstructionSample260120.pdf'
PROCEDURE = 'Machining FAI Procedure'
ATTRIBUTE = 'CoreForge\\Machining\\FAI Diameter'
VISUAL = {'PASS': ['No visible defects'], 'WARNING': ['Minor cosmetic defect'],
'FAIL': ['Burrs present', 'Incorrect finish', 'Surface damage'], 'NEUTRAL': []}
ITEMS = [
# name, data type, measurements, aggregation, units
('Diameter', 'Float', 3, 'AVG', 'mm'),
('Length', 'Float', 2, 'MAX', 'mm'),
('Visual Defect Check', 'String', 1, None, None),
]
results = []
def check(ok, what, fix=None):
results.append(bool(ok))
if ok:
print 'PASS %s' % what
else:
print 'FAIL %s' % what
if fix:
print ' -> %s' % fix
def note(what):
print 'NOTE %s' % what
def field(row, *names):
for n in names:
if n in row and row[n] is not None:
return row[n]
return None
def text(v):
return '' if v is None else unicode(v).strip()
def key(v):
return ' '.join(text(v).lower().split())
def truthy(v):
return str(v).lower() in ('true', '1', 'yes')
def num(v):
try:
return float(v)
except:
return None
def rows(data):
# Kanoa returns a dataset, a list of dictionaries, or None
if data is None:
return []
if hasattr(data, 'getRowCount'):
cols = list(data.getColumnNames())
return [dict((c, data.getValueAt(i, c)) for c in cols) for i in range(data.getRowCount())]
return [dict(r) for r in data]
def findSheet(name):
"""All versions of a check sheet, and the one to check: the Released version, or else the newest.
A revision renames the archived version '<name> - N' and the open one '<name> - In Revision',
so the other versions are found by their master sheet, not by name."""
sheets = rows(system.kanoa.quality.sheet.getSheets({}))
named = [s for s in sheets if text(field(s, 'chkShtName')) == name] or \
[s for s in sheets if key(field(s, 'chkShtName')) == key(name)]
if not named:
return None, []
masters = set(text(field(s, 'masterChkShtId', 'chkShtId')) for s in named)
versions = [s for s in sheets if text(field(s, 'masterChkShtId', 'chkShtId')) in masters]
versions.sort(key=lambda s: num(field(s, 'chkShtVersionNumber')) or 0)
released = [s for s in versions if text(field(s, 'chkShtVersionStateName')) == 'Released']
return (released or versions)[-1], versions
def findItem(items, name):
exact = [i for i in items if text(field(i, 'chkItemName')) == name]
close = [i for i in items if key(field(i, 'chkItemName')) == key(name)]
return (exact or close or [None])[0]
def pickList(value):
"""The responses in each result category of a Text pick list."""
out = {}
for cat in ('PASS', 'WARNING', 'FAIL', 'NEUTRAL'):
m = re.search(r"""['"]%s['"]\s*:\s*\[(.*?)\]""" % cat, text(value))
found = re.findall(r"""'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)\"""", m.group(1)) if m else []
out[cat] = sorted(a or b for a, b in found)
return out
def spec(item):
try:
return dict(system.util.jsonDecode(text(field(item, 'specification')))) if text(field(item, 'specification')) else {}
except:
return {}
def enableQuality(assetPath):
"""The asset's Enable Quality Triggers setting, stored in its Line/Enable Quality tag."""
try:
path = system.kanoa.asset.getAssetTagPath({'assetPath': assetPath}) + '/Line/Enable Quality'
qv = system.tag.readBlocking([path])[0]
return qv.value if qv.quality.isGood() else None
except:
return None
print '=' * 70
print 'Kanoa Quality Training - Build the FAI Check Sheet check'
print '=' * 70
# 1. Quality triggers on the machines
print '\n-- Enable Quality Triggers'
off = [p.split('\\')[-1] for p in MACHINES if not truthy(enableQuality(p))]
check(not off, 'Machine 1 to Machine 8 have Enable Quality Triggers selected',
'Not selected on %s. In Configuration > Ops > Assets, select each one, select Enable Quality Triggers and save.' % ', '.join(off))
# 2. The check sheet and its settings
print '\n-- Check sheet'
sheet, versions = findSheet(SHEET)
if sheet is None:
check(False, 'Check sheet %s exists' % SHEET,
'In Configuration > Quality > Check Sheets, add %s in the %s folder.' % (SHEET, FOLDER))
else:
actual = text(field(sheet, 'chkShtName'))
check(actual == SHEET, 'Check sheet %s exists' % SHEET, "Found '%s'. Rename it to %s." % (actual, SHEET))
folder = text(field(sheet, 'chkShtTypePath'))
check(folder == FOLDER, 'It is in the %s folder' % FOLDER,
"It's in '%s'. On the Settings tab, set the folder to %s." % (folder or 'no folder', FOLDER))
missingInfo = [label for col, label in (('description', 'Description'), ('instructions', 'Instructions'))
if not text(field(sheet, col))]
if text(field(sheet, 'procName')) != PROCEDURE:
missingInfo.append('Procedure (%s)' % PROCEDURE)
if text(field(sheet, 'fileURL')) != DOCUMENT:
missingInfo.append('Document (the work instruction link)')
check(not missingInfo, 'The Info tab has the description, procedure, document and instructions',
'On the Info tab, enter %s as in the lesson.' % ', '.join(missingInfo))
chkShtId = field(sheet, 'chkShtId')
check(truthy(field(sheet, 'assetReqd')), 'Asset Required is selected', 'On the Settings tab, select Asset Required.')
assets = [text(field(r, 'assetPath')) for r in rows(system.kanoa.quality.sheet.getAssets(chkShtId))]
check(AREA in assets, 'Assets are limited to the Machining area',
'Under Asset Required, choose %s.%s' % (AREA, (' Now: %s.' % ', '.join(assets)) if assets else ''))
check(truthy(field(sheet, 'itemReqd')), 'Item Required is selected', 'On the Settings tab, select Item Required.')
classes = [text(field(r, 'itemClassPath')) for r in rows(system.kanoa.quality.sheet.getItemClasses(chkShtId))]
check(ITEM_CLASS in classes, 'Items are limited to the %s class' % ITEM_CLASS,
'Under Item Required, choose the item class %s.%s' % (ITEM_CLASS, (' Now: %s.' % ', '.join(classes)) if classes else ''))
# 3. Check items
print '\n-- Check items'
items = rows(system.kanoa.quality.config.getChecks({'chkShtId': chkShtId}))
for name, dataType, meas, agg, units in ITEMS:
item = findItem(items, name)
if item is None:
check(False, '%s exists' % name, 'On the Checks tab, add a check item named %s.' % name)
continue
problems = []
actual = text(field(item, 'chkItemName'))
if actual != name:
problems.append("rename '%s' to %s" % (actual, name))
if text(field(item, 'chkItemTypeName')) != 'Check':
problems.append('set Type to Check')
if text(field(item, 'dataTypeName')) != dataType:
problems.append("set Data Type to %s (it's %s)" % (dataType, text(field(item, 'dataTypeName')) or 'blank'))
if not truthy(field(item, 'enabled')):
problems.append('select Enabled')
if not truthy(field(item, 'required')):
problems.append('select Required')
if int(num(field(item, 'measCount')) or 1) != meas:
problems.append("set Number of Measurements to %d (it's %s)" % (meas, text(field(item, 'measCount')) or 'blank'))
if agg and text(field(item, 'measAggregate')).upper() != agg:
problems.append("set the aggregation to %s (it's %s)" % ('Average' if agg == 'AVG' else 'Max', text(field(item, 'measAggregate')) or 'blank'))
if units and text(field(item, 'engUnitName')) != units:
problems.append("set Units to %s (it's %s)" % (units, text(field(item, 'engUnitName')) or 'blank'))
check(not problems, '%s: %s, %d measurement(s)%s' % (name, dataType, meas, (', ' + units) if units else ''),
'; '.join(problems).capitalize() + '.')
s = spec(item)
if name == 'Diameter':
attr = text(field(item, 'attributePath'))
check(attr == ATTRIBUTE, 'Diameter uses the attribute %s' % ATTRIBUTE,
"Its attribute is '%s'. Under Assign Attribute, choose %s." % (attr or 'none', ATTRIBUTE))
check(text(s.get('specType')) == 'attributeTolerance', 'Diameter uses the Attribute Tolerance',
"Its specification is '%s'. Under Specification, choose Attribute Tolerance." % (text(s.get('specType')) or 'none'))
check(not truthy(field(item, 'dynamic')), 'Diameter has Dynamic cleared', 'Edit Diameter and clear Dynamic.')
elif name == 'Length':
r = dict(s.get('range') or {})
ok = text(s.get('specType')) == 'range' and num(r.get('min')) == 100 and num(r.get('max')) == 200
check(ok, 'Length uses the range 100 to 200',
'Under Specification, choose Range with min 100 and max 200.')
else:
responses = pickList(field(item, 'pickListValues'))
wrong = [cat for cat in VISUAL if responses[cat] != VISUAL[cat]]
check(text(field(item, 'pickListName')) == 'Text' and not wrong, 'Visual Defect Check has its five responses',
'Under Entry Options, choose Text: No visible defects (Pass), Minor cosmetic defect (Warning), '
'Burrs present, Surface damage and Incorrect finish (Fail).')
passed = results.count(True)
print '\n' + '=' * 70
print 'Result: %d of %d checks passed' % (passed, len(results))
if passed == len(results):
print 'All good. Your FAI check sheet is built. You add its trigger in the next lesson.'
else:
print 'Fix the FAIL items above, then run this again.'
print '=' * 70

