A New Press
Injection Press 1 arrives with its configuration already worked out by CoreForge's engineers: the new Molding area, the press itself, the two end caps it will make, and its production rates. In this lesson you'll import that, turn on tooling for the press, and connect it to the simulator.
Import Injection Press 1
The asset model file holds more than the press. An asset import brings in everything in the file, so importing it adds:
- The
Moldingarea, withInjection Press 1in it. The press is OEE-enabled, with its modes and the 4 default states. - Two new items, the end caps
EC-25andEC-32, in a newCoreForge\WIP\Moldeditem class. - A production rate on
Injection Press 1for each cap.
- Download
coreforge-press-1-asset-model.json. - Navigate to Configuration → Ops → Assets and import it with the import/export button.
- In the asset tree, expand
CoreForge\Philadelphia. It now has aMoldingarea withInjection Press 1in it. - Select
Injection Press 1. It's OEE-enabled and isn't in an asset group. It has only the 4 default states, not the downtime states you linked toMachine 1; that's all this course needs. - Navigate to Configuration → Ops → Materials. The Items tab has
EC-25andEC-32in theMoldeditem class, and on Production Rates,Injection Press 1has a rate for each cap.
Injection Press 1's rates for the two caps:
| Item | Standard Rate | Scheduled Rate | Infeed / Outfeed Units | Package Count |
|---|---|---|---|---|
EC-25 | 20 a minute | 18 | units | 1 |
EC-32 | 8 a minute | 7 | units | 1 |
These are the rates from the press maker's quote, before the molds arrived. Injection Press 1 is measured in caps going in and caps coming out, so its package count is 1. Once a mold is mounted, its rate takes over from these.
A mold's cavities always count parts. If a press were rated in pounds of resin going in instead, the Package Count of its rate (the pounds of resin in one cap) would convert the mold's caps into pounds. See Cycle Rates and Item Rates.
Let Injection Press 1 Use Tooling
A tool can only be mounted on a machine that has Uses tooling turned on, and only OEE-enabled machines can have it.
- In Configuration → Ops → Assets, select
Injection Press 1. - On the info tab, next to OEE Enabled, tick Uses tooling and save.
- In the Designer's Tag Browser, expand the
[Kanoa]provider'sCoreForge/Philadelphia/Molding/Injection Press 1folder. Next to theLinetags there's now aToolingfolder.
The Tooling folder is an instance of the assetTooling UDT. Its Inputs let a PLC mount molds, block cavities and
count shots; the rest shows what's mounted.
Connect Injection Press 1 to the Simulator
The CoreForge simulator needs a press too. Its tags are in a separate file, so importing them doesn't touch the simulator tags your other machines are using.
The simulated press only shoots while a mold is mounted and an item is running. It takes its speed from the mounted mold's cycle rate, and counts its shots every 2 seconds, so you can watch the counts climb on the Operator Station. Kanoa does the rest: each shot makes one cap in every cavity of the mold that isn't blocked, and counts toward the mold's life.
- Download
coreforge-press-1-sim-tags.json. - In the Designer's Tag Browser, select the
[Kanoa]provider and click Import Tags from the three dots, as in Connect Tags. Import from the top-level Tags folder, and set Collision Policy to Overwrite. The file holds only Injection Press 1's simulator tags, so it doesn't touch the other machines' tags, and importing it again repairs them instead of failing with already exists. - Confirm
CoreForge Sim/Site/Molding/Injection Press 1now hassim,assetInputsandtoolingInputsfolders, and thatsim/stateandsim/shotsshow no error icon. - Edit Injection Press 1's
Linetag ([Kanoa]CoreForge/Philadelphia/Molding/Injection Press 1/Line) and set its MQTT path parameter to[Kanoa]CoreForge Sim/Site/Molding/Injection Press 1/assetInputs. - Edit Injection Press 1's
Toolingtag ([Kanoa]CoreForge/Philadelphia/Molding/Injection Press 1/Tooling) and set its MQTT path parameter to[Kanoa]CoreForge Sim/Site/Molding/Injection Press 1/toolingInputs.
The Line tag now reads Injection Press 1's state from the simulator, and the Tooling tag reads its shot count into
Tooling/Inputs/Cycle Count. Kanoa turns each shot into Injection Press 1's outfeed: the caps the mounted mold's
cavities make. So the simulator leaves the Line tag's own infeed and outfeed counts at 0, and on a real press you'd
leave them unbound too, pointing only the state and the shot counter at the PLC. Nothing counts the resin going in, so there's no infeed
count of its own: Run Review and the info panel show Injection Press 1's infeed equal to its outfeed.
In Tooling/Inputs, Cycle Count reads 0 until the press starts shooting. Blocked Positions, Tool Shot Counter and
Tooling show Bad_NotFound. That's expected: the simulator only provides a shot count, and you'll mount molds and
block cavities from the screens instead. Kanoa ignores an input while its quality is bad, so they can't unmount or block
anything.
Injection Press 1's mode card shows No mode selected for now. That's expected: it hasn't run yet, and there's no mold to mount. You'll put it into Changeover when you mount its first mold in Run and Change Over.
Copy this script into the Ignition Designer Script Console (Tools → Script Console) and run it. It checks that
Injection Press 1 is OEE-enabled in the Molding area and uses tooling, that it has rates for EC-25 and EC-32, that
the Injection Press 1 simulator tags were imported, and that its Line and Tooling tags have the right MQTT path.
Each check prints PASS or FAIL with what to fix. It doesn't change anything.
Show the check script
# Kanoa Ops Training - check "A New Press" (Tooling, lesson 1)
#
# Run in the Ignition Designer Script Console (Tools > Script Console). It only
# reads; it changes nothing. Every check prints PASS or FAIL with what to fix.
PRESS = 'CoreForge\\Philadelphia\\Molding\\Injection Press 1'
MOLDING = 'CoreForge\\Philadelphia\\Molding'
tl = system.kanoa.tooling
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 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')
def num(v):
try:
return float(v)
except (TypeError, ValueError):
return None
def near(v, target):
v = num(v)
return v is not None and abs(v - target) < 0.001
def rows(data):
return system.kanoa.utilities.convertDatasetToJSON(data) if data is not None else []
def findTool(name):
for t in rows(tl.getTools({})):
if key(t.get('assetName')) == key(name):
return t
return None
def positionsOf(tool):
byNumber = {}
if tool is not None:
for p in rows(tl.getPositions({'toolingAssetId': tool['toolingAssetId']})):
byNumber[int(num(p.get('positionNumber')) or 0)] = p
return byNumber
def itemId(name):
items = rows(system.kanoa.item.getItems({'itemName': name}))
return items[0].get('itemId') if items else None
def standardRate(assetId, itemName):
item = itemId(itemName)
if assetId is None or item is None:
return None
rate = rows(tl.getStandardRate({'assetId': assetId, 'itemId': item}))
return rate[0] if rate else None
def mountedNames(assetId):
return [key(m.get('toolingName')) for m in rows(tl.getMounted({'assetId': assetId}))] if assetId is not None else []
print '=' * 70
print 'Kanoa Ops Training - A New Press check'
print '=' * 70
assets = rows(system.kanoa.asset.getAssets({'assetPath': PRESS}))
pressId = assets[0].get('assetId') if assets else None
check(pressId is not None, 'Injection Press 1 exists', 'Import coreforge-press-1-asset-model.json, as in A New Press.')
def isGood(qv):
try:
return qv.quality.isGood()
except:
return False
def unwrap(v):
# getConfiguration parameter values can be wrapped in a dict or property object
for _ in range(3):
if v is None:
return None
if hasattr(v, 'get') and not isinstance(v, basestring):
try:
inner = v.get('value')
except:
inner = None
if inner is None:
return v
v = inner
elif hasattr(v, 'getValue'):
v = v.getValue()
else:
return v
return v
def mqttPath(udtPath):
qv = system.tag.readBlocking([udtPath + '/Parameters.MQTTPath'])[0]
if isGood(qv):
return text(qv.value)
try:
params = system.tag.getConfiguration(udtPath, False)[0].get('parameters') or {}
for k in params.keys():
if str(k).lower() == 'mqttpath':
return text(unwrap(params[k]))
except:
pass
return None
SIM = '[Kanoa]CoreForge Sim/Site/Molding/Injection Press 1'
# 1. Injection Press 1
print '\n-- Injection Press 1'
if pressId is not None:
press = assets[0]
check(truthy(press.get('oeeEnabled')), 'Injection Press 1 is OEE-enabled', 'Re-import coreforge-press-1-asset-model.json.')
if press.get('usesTooling') is not None:
check(truthy(press.get('usesTooling')), 'Injection Press 1 uses tooling',
'In Configuration > Ops > Assets, select Injection Press 1, tick Uses tooling and save.')
# 2. Its rates
print '\n-- Rates'
if pressId is not None:
rates = dict((key(r.get('itemName')), r) for r in rows(system.kanoa.item.getAssetItems({'assetId': pressId})))
for name, std in (('EC-25', 20), ('EC-32', 8)):
r = rates.get(key(name))
check(r is not None and near(r.get('standardRate'), std), 'Injection Press 1 has a rate for %s at %d a minute' % (name, std),
'Re-import coreforge-press-1-asset-model.json.')
# 3. Tags
print '\n-- Tags'
if pressId is not None:
base = system.kanoa.asset.getAssetTagPath({'assetId': pressId})
check(system.tag.exists(base + '/Tooling'), "Injection Press 1 has its Tooling tags (%s/Tooling)" % base,
'Tick Uses tooling on Injection Press 1 and save; that creates the Tooling folder.')
check(system.tag.exists(SIM + '/sim/shots'), 'The Injection Press 1 simulator tags are imported (%s)' % SIM,
'Import coreforge-press-1-sim-tags.json into the [Kanoa] provider from the top-level Tags folder.')
for udt, source in ((base + '/Line', SIM + '/assetInputs'), (base + '/Tooling', SIM + '/toolingInputs')):
if not system.tag.exists(udt):
continue
actual = mqttPath(udt)
check(key(actual) == key(source), '%s MQTT path is %s' % (udt, source),
"It's '%s'. Edit %s and set its MQTT path parameter to %s" % (text(actual), udt, source))
passed = results.count(True)
print '\n' + '=' * 70
print 'Result: %d of %d checks passed' % (passed, len(results))
if passed == len(results):
print "All good. Injection Press 1 is set up and connected to the simulator."
else:
print 'Fix the FAIL items above, then run this again.'
print '=' * 70