Example
Below is a portion of the injection molding machine selection module for aPriori’s plastic molding starting point cost model. The module finds the machine with the lowest overhead rate that satisfies these criteria:
Large enough for the part’s required mold.
Provides sufficient clamp force for the part and the number of mold cavities.
Can provide the required shot size.
The module assigns to the CSL output machine the result of applying the function selectMachine to the mold base dimensions.
 
machine = selectMachine(moldBaseXmm,moldBaseYmm)
 
selectMachine(moldBaseXmm,moldBaseYmm) = _
select first(m) from machines m _
where _
ClampForceCheck and _
tieBarHCheck and _
tieBarVCheck and _
moldHeightCheck and _
shotSizeCheck _
order by m.workCenterOverheadRate
 
The function selectMachine performs a query that does the following:
Selects the machines that satisfy the various checks (mold size, clamp force, and shot size), and
Orders the machines by overhead rate (as specified by order by m.workCenterOverheadRate in the order by clause), from lowest to highest.
The final query result is the first of the selected machines in the specified order (as specified by the first(m) in the select specification), since it is the least expensive one.
The query contains the following simple identifiers:
machines: CSL standard input
m: in effect, bound to each element of machines in turn. This variable remains in scope in the rules referred to by the query. The module uses the following fields of m, which are all machine attributes (found in aPriori’s Edit Machine Selection dialog):
o workCenterOverheadRate
o tieBarDistanceH
o name
o tieBarDistanceV
o maxMoldHeight
o shotSize
o clampForce
ClampForceCheck: rule (shown below) in the same module that compares the machine clamp force with the required clamp force. Required clamp force is calculated by a formula in the same module, shown below.
tieBarHCheck: rule (shown below) in the same module that compares the machine and mold dimensions, shown below.
tieBarVCheck: rule (shown below) in the same module that compares the machine and mold dimensions, shown below.
moldHeightCheck: rule (shown below) in the same module that compares the machine and mold dimensions, shown below.
shotSizeCheck: rule (shown below) in the same module that compares the maximum machine shot size with required shot size. Required shot size is calculated by a formula in the same module, shown below.
Some values are rounded off to less precise values for use in messages.
 
Rule tieBarHCheck: m.tieBarDistanceH >= moldBaseXmm
 
Message tieBarHCheck: m.name + _
' is not feasible. The mold base horizontal dimension ' + '(' + _
roundMoldBaseX + _
'mm ) is greater than the horizontal distance between the tie bars (' + _
maxTieBarDistanceH + 'mm)'
 
roundMoldBaseX = roundEps(moldBaseXmm, 1)
maxTieBarDistanceH = m.tieBarDistanceH
 
Rule tieBarVCheck: m.tieBarDistanceV >= moldBaseYmm
 
Message tieBarVCheck: m.name + _
' is not feasible. The mold base vertical dimension ' + '(' + _
roundMoldBaseY + _
'mm ) is greater than the vertical distance between the tie bars (' + _
maxTieBarDistanceV + 'mm)'
 
roundMoldBaseY = roundEps(moldBaseYmm, 1)
maxTieBarDistanceV = m.tieBarDistanceV
 
Rule moldHeightCheck: m.maxMoldHeight >= moldBaseHeight
 
Message moldHeightCheck: m.name + _
' is not feasible. The required mold base height ' + '(' + _
roundMoldBaseHeight + _
'mm ) is greater than the maximum mold height for this machine (' + _
maxMoldHeight + 'mm)'
 
roundMoldBaseHeight = roundEps(moldBaseHeight, 1)
maxMoldHeight = m.maxMoldHeight
moldBaseHeight = 2 * part.boxHeight
 
Rule shotSizeCheck: m.shotSize >= requiredShotSize
 
Message shotSizeCheck: m.name + _
' is not feasible. The required shot size ' + '(' + _
roundrequiredShotSize + _
'g ) is greater than the maximum shot size for this machine (' + _
maxShotSize + 'g of polystyrene)'
 
roundrequiredShotSize = roundEps(requiredShotSize , 1)
maxShotSize = m.shotSize //units are in grams of polystyrene
requiredShotSize = plant.shotSizeSafetyFactor * _
(part.volume * numCavities * plant.densityPolystyreneForShotSize)/1000000
 
Rule ClampForceCheck: m.clampForce >= requiredForce
 
Message ClampForceCheck: m.name + _
' is not feasible. The required clamp force ' + _
'(' + roundRequiredForce + _
'kN ) is greater than the max clamp force of this machine (' + _
maxClampForce + 'kN)'
 
roundRequiredForce = roundEps(requiredForce, 1)
maxClampForce = m.clampForce
 
requiredForce = _
((part.projectedArea * numCavities) + runnerArea) * _
material.clampingMNPerSqM * plant.clampForceSafetyFactor / 1000
 
runnerArea = numCavities * (partLength + partWidth) * nominalWallThickness
 
Portions of the module not shown above retrieve or calculate the following:
moldBaseXmm, moldBaseYmm: horizontal and vertical mold base dimensions.
numCavities: number of mold cavities (user-specified or based on required number to satisfy production requirements)
nominalWallThickness: Number to summarize part wall thicknesses for cool time and clamp force calculations.