Skip to main content

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 Molding area, with Injection Press 1 in it. The press is OEE-enabled, with its modes and the 4 default states.
  • Two new items, the end caps EC-25 and EC-32, in a new CoreForge\WIP\Molded item class.
  • A production rate on Injection Press 1 for each cap.
Import the Injection Press 1 asset model
  1. Download coreforge-press-1-asset-model.json.
  2. Navigate to Configuration → Ops → Assets and import it with the import/export button.
  3. In the asset tree, expand CoreForge\Philadelphia. It now has a Molding area with Injection Press 1 in it.
  4. 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 to Machine 1; that's all this course needs.
  5. Navigate to Configuration → Ops → Materials. The Items tab has EC-25 and EC-32 in the Molded item class, and on Production Rates, Injection Press 1 has a rate for each cap.

Injection Press 1's rates for the two caps:

ItemStandard RateScheduled RateInfeed / Outfeed UnitsPackage Count
EC-2520 a minute18units1
EC-328 a minute7units1

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.

Machines measured in other units

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.

Turn on Uses tooling for Injection Press 1
  1. In Configuration → Ops → Assets, select Injection Press 1.
  2. On the info tab, next to OEE Enabled, tick Uses tooling and save.
  3. In the Designer's Tag Browser, expand the [Kanoa] provider's CoreForge/Philadelphia/Molding/Injection Press 1 folder. Next to the Line tags there's now a Tooling folder.

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.

Import and connect the Injection Press 1 simulator
  1. Download coreforge-press-1-sim-tags.json.
  2. 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.
  3. Confirm CoreForge Sim/Site/Molding/Injection Press 1 now has sim, assetInputs and toolingInputs folders, and that sim/state and sim/shots show no error icon.
  4. Edit Injection Press 1's Line tag ([Kanoa]CoreForge/Philadelphia/Molding/Injection Press 1/Line) and set its MQTT path parameter to [Kanoa]CoreForge Sim/Site/Molding/Injection Press 1/assetInputs.
  5. Edit Injection Press 1's Tooling tag ([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.

Check your work

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
checkLesson-aNewPress.py
# 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