Preferring One Class of Machines Over Another
Suppose that, for Abrasive Cut, you want to modify the machine selection to prefer on-site machines (as opposed to machines located at a remote facility). And suppose that (in order to support this) machines have a string-valued attribute, isOnSite, which is true if the machine on site and false otherwise (see Modifying a Machine Type—Preferring One Class of Machines Over Another).
Follow these steps to modify machine selection for the AbrasiveJet Cut process so that it prefers customer-defined machines over predefined machines:
1 In the navigation pane, expand Processes, GCDs & Operations and double-click the AbrasiveJet Cut process.
2 In the editing pane, select the CSL tab.
3 Click on the folder icon, folder_icon.png, next to machineSelectionRule.
The module text appears in the editing pane.
In this example, the module is new, and so is editable without an explicit override. For inherited modules, you must select Override Object from the Edit menu, or click the override icon, green_dude.png, in the toolbar.
4 Modify the query that appears in the module. The unmodified query is as follows (see Removing unwanted machine checks):
machine = select first(m) from machines m _
where MaxPartWidthCheck and MaxPartLengthCheck _
order by isDefaultMachine(m) desc, overheadCost(m)
To prefer all on-site machines over all off-site machines, modify the query so that it appears as follows:
machine = select first(m) from machines m _
where MaxPartWidthCheck and MaxPartLengthCheck _
order by isOnSite(m) desc, overheadCost(m)
 
isOnSite(m) = (m.isOnSite == true)
 
This query orders the feasible machines by the result of isOnSite (a function defined below the query in this module). The result of isOnSite is either true or false. In the ascending order for boolean values, false precedes true, so the order is specified as descending. That way on-site machines (the ones for which true is returned) appear first, and the rest of the machines (the ones for which false is returned) follow them in the ordering.
Within that ordering, the query orders the machines by the result of overheadCost (another function defined below the query).
To prefer on-site machines to off-site machines with equal overhead, modify the query so that it appears as follows:
 
machine = select first(m) from machines m _
where MaxPartWidthCheck and MaxPartLengthCheck _
order by overheadCost(m), isOnSite(m) desc
 
isOnSite (m) = (m.isOnSite == true)
 
This query orders the feasible machines by overhead cost, and within that ordering, on-site machines appear first.
5 Select Save from the File menu, or click save_icon.png in the toolbar, to save your changes.
6 To incorporate your changes into the cost model, select Publish Cost Model and VPE from the File menu, or click publish_icon.png in the toolbar.
For more information on CSL, see CSL Language Overview in the chapter Working with Cost Model Logic.