Step 1.2 Create the NPTs
We only need to worry about the NPT for the node “Residual defects”.
We are going to define the NPT by a deterministic function. To do this open
the Node Properties window for the node “Residual defects”. Click the Probabilities tab and select “Deterministic Function”:
Now close the Properties window, select the node “residual_defects” by clicking it once and then click the probabilities icon in the toolbar
This will bring up the node table window:
You are now going to enter an expression (rather then the default “0”). You can enter text directly into the box where the “0” is, but it is best to get help by calling up the Expression Editor. To do
this double-click on the test field where the 0 is and the Expression Editor
window appears:
The expression we want to enter is the one captures the function
inserted_defects discovered defects
If you double click on the available expression node “inserted defects” the label C3 appears in the expression (this is what you want since it refers
to the variable “inserted defects”). If you next enter a minus sign “” and then click on “discovered defects” you will get the expression
C3-C2
In principle this seems to be what you want, but there is a snag. If you tried
to compile this template you would get errors. This is because the tool does
not know that, in practice, C3 is always at least as big a number as C2. It
looks at the expression C3-C2 and computes all the possible values it can take.
Since both variables range from 0 to 49, the expression C3-C2 can in principle
take on values which are negative. But the node “residual defects” does not have negative values. It only has values 0 to 49. Thus we have to
somehow tell the tool that the value of the expression C3-C2 can never be less
than 0.
Fortunately, there is an easy way to do this because the expression editor has
standard function built in. One of these functions is the max function.
So, edit the expression as:
max(0, C3-C2)
(this defines a function which is the same as C3-C2 except when C2 is bigger
than C3 in which case it will return 0). The expression editor window should
look like:
Press OK.