Overview
AMPI offers two main concepts for doing calculations: Scores and Blackboxes. Blackboxes are meant to evaluate one or several part Properties. That means a blackbox looks at the value of one property (can also be several properties if they are correlated) and decides whether that value is rather good (for AM) or rather bad (for AM).
Scores are meant to evaluate one or several Blackboxes, to produce an overall assessment of a part’s characteristics. Through reports and charts, the score results can then be shown to users.
The following example illustrates a typical setup:
...
Blackboxes and Scores are written in Javascript. It is helpful to have some prior exposure to any kind of scriptwriting or programming.
Defining blackboxes
Blackboxes are defined in the admin panel under
Home › B3_Ampi › Blackboxes
When defining blackboxes, the following fields are available.
Name
The name of the blackbox
Description
Additional description for the blackbox. Currently not displayed anywhere.
Script
The core of the blackbox is a script written in Javascript
Slug
Unique identifier of that blackbox. Used to reference this blackbox from a score.
Writing blackbox scripts
A blackbox can be considered a function that returns a value or an object.
Blackboxes can access a part’s property values through the property’s Variable namespace and Variable name:
variables.<Variable namespace>.<Variable name>
Variable namespace and Variable name are configured on the property itself.
...
An example blackbox using the value of Lead time (days) could look like this
...