Skip to main content

Build the Analyzer Check Sheet

Reference Materials: Check Sheet Settings, including Issue Check Sheet and Notifications

Check Sheet Settings​

Configure Check Sheets

  • Enabled: Enable or disable a check sheet.
  • Sign Off Required: Require a sign off for approval. If unchecked a submitted check sheet is automatically moved to the 'Approved' status. Only approved checks are used in SPC analysis.
  • Auto: Indicate that this check sheet only contains checks whose values will be automatically captured when the check sheet is triggered. Add Check leaves Auto check sheets out of its list unless Include Auto Checks is ticked.
  • Folder: Saves the check sheet in a specific folder.
  • Asset Required: Determines if an asset must be selected for this check sheet.
  • Item Required: Determine if an items must be selected for this check sheet.
  • Issue Check Sheet: Choose a check sheet to schedule immediately upon test failure.
  • Notifications: Select a team or user for email notifications on test failure.
  • Sync Date: The 'Taken Date' of the Check Sheet by default is the date the check sheet is submitted. You can override this to force all check items and the check sheet itself to use the datetime picked for a check that is of datetime data type. This can be used when all check items are to be referenced to say the 'code time' printed on a product. To use this feature, simply create a check item that is of data type 'datetime' and then select it in this dropdown. When the user selects the date time, it will now be used for the 'Taken Time'.

QA Station analyzer tags

qaStationTags.json: a QA Station folder with simulated analyzer tags qds/particleSize and qds/density.

Create the QA Station asset and tags
  1. Navigate to Configuration → Ops → Assets
  2. Under CoreForge\Philadelphia\Finishing, add an asset named QA Station of type Line. Leave OEE disabled; the QA Station doesn't produce anything.
  3. In Ignition Designer, in the Kanoa tag provider, select the CoreForge/Philadelphia/Finishing folder and import qaStationTags.json (downloaded above). The file creates QA Station/qds.
  4. Confirm particleSize and density are changing.

A test fail action runs when a check fails. It can email a person or team, or issue another check sheet. A follow-up check gives failure handling a structure, such as a photo, a disposition, or a corrective action, rather than relying on a comment.

Build the Retest check sheet
  1. In Configuration → Quality → Check Sheets, add QA Station Inspection Failure in the CoreForge\Operations folder.
  2. Add one check item, Inspection Image: Type Check, Data Type Image, Enabled and Required.
  3. Close the editor and release the sheet. Only released sheets can be issued by a test fail action.
Optional: Download and import QA Station Inspection Failure

Create the analyzer attributes
  1. In Configuration → Quality → Attributes, create a QA folder under CoreForge, with the attributes Particle Size and Particle Density.
  2. Give Particle Size a data source on asset QA Station with tag qds/particleSize, and Particle Density one with tag qds/density. Enable both and save.

Create the Offline Lab Inspection
  1. In Configuration → Quality → Check Sheets, add Offline Lab Inspection in the CoreForge\Operations folder.

  2. On the Settings tab:

    • Select Asset Required and choose QA Station.
    • Select Sign Off Required.
    • Set Issue Check Sheet to QA Station Inspection Failure. Leave Notifications empty.
  3. On the Checks tab, rename the default group Main to Analyzer, and add these items to it. All are Enabled.

    Check itemTypeData typeRequiredSettings
    Get Analyzer DataTriggerBooleanNo
    Particle SizeCheckFloatYesAttribute Particle Size, units nm, trigger Get Analyzer Data
    Particle DensityCheckFloatYesAttribute Particle Density, units %, format 0.0, trigger Get Analyzer Data
    Standard DeviationCalculatedFloatNoAggregate: standard deviation of Particle Size and Particle Density
    CoverageCalculatedFloatNoEval: 'Analyzer\Particle Size'*'Analyzer\Particle Density'
  4. Add a group named Calibration with one item, Analyzer Calibration Date: Type Check, Data Type Datetime, Required and Persistent.

  5. Save and release.

Optional: Download and Import Offline Lab Inspection check sheet

What each new feature does:

  • Trigger item: works like a button in the check. Every item whose trigger is Get Analyzer Data reads its attribute's data source at the same moment.
  • Calculated items: store derived values in the check, either an aggregate across items or a formula. In a formula, refer to items by group and name.
  • Groups: split a long check into tabs.
  • Persistent: fills in the value entered last time, which suits a calibration date that only changes occasionally.
  • Sign Off Required: a submitted check waits in Submitted until someone with the Approve Checks function approves it.
Reference Materials: Calculated Check Items

Check Item Settings - Calculator​

When a Check Item is of type 'Calculated', you can apply a mathematical formula or a custom python script to any number of check item values in the check sheet.

Configure Check Sheets

Aggregates​

Select Average, Sum, Range, Min, Max or Standard Deviation from the drop down and then select check items from the table to calculate the aggregated value. Note only check items with a numeric data type are shown in the table.

Eval​

Selecting 'Eval' allows check item values to be included into a formula. This option implements the python eval() function allowing formulas such as ('Check Item 1' + 'Check Item 2') / 'Check Item 3'. See python eval function for help on this.

Custom Scripts​

Custom scripts can be written in python unleashing the power of python and Ignition to perform any type of calculation desired.

Select the script option and then select the script you want to run against the selected check items.

Custom scripts can be created in the KANOA_SCRIPTS project. Simply create your function and add any entry in the calcList of the getCalculators() function.

The paramsDict parameter passed to the custom function passes a dictionary containing the chkItemName and list of measurement values for that chkItem.

paramsDict = {'values': {'QR Scan': ['PIC3012017182#2237918#24011503']}

The return value from you custom script must be a tuple containing the returned value and a string message. Return None for a successfully executed script. Return a string to display an error to the user.

example return 'Hello World', None or '', 'An error occurred'

Configure Check Sheets

Testing Your Calculated CheckItem​

Dummy values are entered for check item values to verify correct syntax for calculations.

Configure Check Sheets


Check your work

Copy this script into the Ignition Designer Script Console (Tools → Script Console) and run it. It checks the QA Station asset and its analyzer tags, the QA Station Inspection Failure sheet, the Particle Size and Particle Density data sources, and the Offline Lab Inspection settings, groups and check items, including the triggers, calculations and the Persistent calibration date. Each check prints PASS or FAIL with what to fix. It doesn't change anything.

Show the check script
checkLesson-labBuild.py
# Kanoa Quality Training - check "Build the Analyzer Check Sheet" (Offline Lab 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 time

ASSET = 'CoreForge\\Philadelphia\\Finishing\\QA Station'
TAG_FOLDER = '[Kanoa]CoreForge/Philadelphia/Finishing/QA Station/qds'
FOLDER = 'CoreForge\\Operations'
HELPER = 'QA Station Inspection Failure'
SHEET = 'Offline Lab Inspection'
ATTRIBUTES = [
# attribute path, data source tag under the QA Station folder
('CoreForge\\QA\\Particle Size', 'qds/particleSize'),
('CoreForge\\QA\\Particle Density', 'qds/density'),
]
GROUPS = ['Analyzer', 'Calibration']
ITEMS = [
# group, name, type, data type, required
('Analyzer', 'Get Analyzer Data', 'Trigger', 'Boolean', False),
('Analyzer', 'Particle Size', 'Check', 'Float', True),
('Analyzer', 'Particle Density', 'Check', 'Float', True),
('Analyzer', 'Standard Deviation', 'Calculated', 'Float', False),
('Analyzer', 'Coverage', 'Calculated', 'Float', False),
('Calibration', 'Analyzer Calibration Date', 'Check', 'Datetime', True),
]
COVERAGE = "'Analyzer\\Particle Size'*'Analyzer\\Particle Density'"

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 calc(item):
try:
return dict(system.util.jsonDecode(text(field(item, 'calculation')))) if text(field(item, 'calculation')) else {}
except:
return {}

def squash(v):
return ''.join(text(v).split()).replace('\\\\', '\\')

def exists(path):
try:
return bool(path) and system.tag.exists(path)
except:
return False

def normTag(path):
return text(path).replace('\\', '/').strip('/').lower()

def sheetBasics(name, sheet):
actual = text(field(sheet, 'chkShtName'))
check(actual == name, 'Check sheet %s exists' % name, "Found '%s'. Rename it to %s." % (actual, name))
folder = text(field(sheet, 'chkShtTypePath'))
check(folder == FOLDER, '%s is in the %s folder' % (name, FOLDER),
"It's in '%s'. On the Settings tab, set the folder to %s." % (folder or 'no folder', FOLDER))
state = text(field(sheet, 'chkShtVersionStateName'))
check(state == 'Released', '%s is Released' % name,
"It's %s. Close the editor and change its status to Released." % (state or 'not set'))

print '=' * 70
print 'Kanoa Quality Training - Build the Analyzer Check Sheet check'
print '=' * 70

# 1. The QA Station asset and its tags
print '\n-- QA Station'
assets = dict((text(field(r, 'assetPath', 'path')), r) for r in rows(system.kanoa.asset.getAssets({})))
station = assets.get(ASSET)
check(station is not None, 'QA Station exists under Finishing',
'In Configuration > Ops > Assets, add an asset named QA Station of type Line under CoreForge\\Philadelphia\\Finishing.')
if station is not None:
assetType = text(field(station, 'assetTypeName')).lower()
check(assetType == 'line', 'QA Station is a Line', "It's a '%s'. Open it and set its type to Line." % (assetType or 'blank'))
if truthy(field(station, 'oeeEnabled', 'oeeEnable')):
note("QA Station is OEE Enabled. The lesson leaves OEE disabled because it doesn't produce anything.")

tags = [TAG_FOLDER + '/' + n for n in ('particleSize', 'density')]
missing = [t.split('/')[-1] for t in tags if not exists(t)]
check(not missing, 'The analyzer tags exist (%s)' % TAG_FOLDER,
'Missing: %s. In the Designer, select CoreForge/Philadelphia/Finishing in the Kanoa provider and import qaStationTags.json.' % ', '.join(missing))
if not missing:
first = system.tag.readBlocking(tags)
time.sleep(2)
second = system.tag.readBlocking(tags)
still = [t.split('/')[-1] for t, a, b in zip(tags, first, second) if not a.quality.isGood() or a.value == b.value]
check(not still, 'The analyzer tags are changing', "%s didn't change in 2 seconds. Check they imported as expression tags." % ', '.join(still))

# 2. The helper check sheet
print '\n-- %s' % HELPER
helper, helperVersions = findSheet(HELPER)
if helper is None:
check(False, 'Check sheet %s exists' % HELPER, 'In Configuration > Quality > Check Sheets, add %s in the %s folder.' % (HELPER, FOLDER))
else:
sheetBasics(HELPER, helper)
image = findItem(rows(system.kanoa.quality.config.getChecks({'chkShtId': field(helper, 'chkShtId')})), 'Inspection Image')
ok = image is not None and text(field(image, 'dataTypeName')) == 'Image' and truthy(field(image, 'enabled')) and truthy(field(image, 'required'))
check(ok, 'It has an enabled, required Image item named Inspection Image',
'Add a check item Inspection Image: Type Check, Data Type Image, Enabled and Required.')

# 3. The analyzer attributes
print '\n-- Analyzer attributes'
attrs = rows(system.kanoa.quality.config.getAttributes({}))
for path, tag in ATTRIBUTES:
name = path.split('\\')[-1]
attr = ([a for a in attrs if text(field(a, 'path')) == path] or [None])[0]
if attr is None:
check(False, 'Attribute %s exists' % path, 'In Configuration > Quality > Attributes, add a QA folder under CoreForge and create %s in it.' % name)
continue
sources = [s for s in rows(system.kanoa.quality.config.getDataSource({'attributeId': field(attr, 'attributeId')}))
if text(field(s, 'assetPath')) == ASSET]
source = normTag(field(sources[0], 'sourceTagPath')) if sources else ''
ok = sources and (source == normTag(tag) or source.endswith('/' + normTag(tag))) and truthy(field(sources[0], 'enabled'))
check(ok, '%s reads %s on QA Station' % (name, tag),
("Its data source is '%s'%s. " % (text(field(sources[0], 'sourceTagPath')), '' if truthy(field(sources[0], 'enabled')) else ', disabled') if sources else '') +
'On its Data Source tab, add asset QA Station with tag %s, enabled.' % tag)

# 4. The Offline Lab Inspection
print '\n-- %s' % 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:
sheetBasics(SHEET, sheet)
chkShtId = field(sheet, 'chkShtId')
linked = [text(field(r, 'assetPath')) for r in rows(system.kanoa.quality.sheet.getAssets(chkShtId))]
check(truthy(field(sheet, 'assetReqd')) and ASSET in linked, 'Asset Required is selected with QA Station',
'On the Settings tab, select Asset Required and choose QA Station.')
check(truthy(field(sheet, 'signOffReqd')), 'Sign Off Required is selected', 'On the Settings tab, select Sign Off Required.')
helperIds = [field(v, 'chkShtId') for v in helperVersions]
check(field(sheet, 'reTestChkShtId') is not None and field(sheet, 'reTestChkShtId') in helperIds,
'Issue Check Sheet is %s' % HELPER, 'On the Settings tab, set Issue Check Sheet to %s.' % HELPER)

print '\n-- Groups and check items'
groups = [text(field(g, 'chkItemGroupName')) for g in rows(system.kanoa.quality.config.getGroups({'chkShtId': chkShtId}))]
missingGroups = [g for g in GROUPS if g not in groups]
check(not missingGroups, 'It has the groups Analyzer and Calibration',
'Missing %s. Rename the default group Main to Analyzer, and add a group named Calibration. Groups now: %s.'
% (', '.join(missingGroups), ', '.join(groups) or 'none'))

items = rows(system.kanoa.quality.config.getChecks({'chkShtId': chkShtId}))
trigger = findItem(items, 'Get Analyzer Data')
for group, name, itemType, dataType, required in ITEMS:
item = findItem(items, name)
if item is None:
check(False, '%s exists' % name, 'Add %s to the %s group.' % (name, group))
continue
problems = []
actual = text(field(item, 'chkItemName'))
if actual != name:
problems.append("rename '%s' to %s" % (actual, name))
if text(field(item, 'chkItemGroupName')) != group:
problems.append("move it to the %s group (it's in %s)" % (group, text(field(item, 'chkItemGroupName')) or 'none'))
if text(field(item, 'chkItemTypeName')) != itemType:
problems.append("set Type to %s (it's %s)" % (itemType, text(field(item, 'chkItemTypeName')) or 'blank'))
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 truthy(field(item, 'required')) != required:
problems.append('select Required' if required else 'clear Required')
if name == 'Particle Size' or name == 'Particle Density':
attr = 'CoreForge\\QA\\' + name
if text(field(item, 'attributePath')) != attr:
problems.append("assign the attribute %s (it's %s)" % (name, text(field(item, 'attributePath')) or 'none'))
units = 'nm' if name == 'Particle Size' else '%'
if text(field(item, 'engUnitName')).lower() != units:
problems.append("set Units to %s (it's %s)" % (units, text(field(item, 'engUnitName')) or 'blank'))
if name == 'Particle Density' and text(field(item, 'format')) != '0.0':
problems.append("set Format to 0.0 (it's %s)" % (text(field(item, 'format')) or 'blank'))
if trigger is None or field(item, 'chkItemTriggerId') != field(trigger, 'chkItemId'):
problems.append('set its trigger to Get Analyzer Data')
elif name == 'Standard Deviation':
c = calc(item)
vals = squash(c.get('values'))
if text(c.get('formulaType')).upper() != 'STDDEV' or 'ParticleSize' not in vals or 'ParticleDensity' not in vals:
problems.append('set the calculator to the standard deviation aggregate of Particle Size and Particle Density')
elif name == 'Coverage':
c = calc(item)
if text(c.get('formulaType')).upper() != 'EVAL' or squash(c.get('values')) != squash(COVERAGE):
problems.append("set the calculator to Eval with %s (it's %s)" % (COVERAGE, text(c.get('values')) or 'blank'))
elif name == 'Analyzer Calibration Date' and not truthy(field(item, 'persistence')):
problems.append('select Persistent')
check(not problems, '%s\\%s is set up' % (group, name), '; '.join(problems).capitalize() + '.')

passed = results.count(True)
print '\n' + '=' * 70
print 'Result: %d of %d checks passed' % (passed, len(results))
if passed == len(results):
print 'All good. Both lab check sheets are built and released.'
else:
print 'Fix the FAIL items above, then run this again.'
print '=' * 70