The presence of a component can be controlled via the so-called Disabler. If the condition entered here is true, the component will be disabled. For the example project, this means that disablers are set up for the function groups Inspect and Discard, for the sensors Position_2, Position_3, and Position_4 of the Axis function unit, and for the actuator Valve_2.
- Open the Feeder component.
- Click the Inspect component.
- In the Disabled field, enter the formula =not(mc.$Option_Inspect_available).
- Repeat the steps 1 to 3 for the Discard component.
With not, you negate the return value of the subsequent method mc.$Option_Inspect_available.
Use this trick in order to apply positive logic with the Option_Inspect_available parameter (Option_Inspect_available = true: Inspect is enabled; Option_Inspect_available = false: Inspect is disabled).
In the formula, mc (mechatronic component) refers to the (superordinate) mechatronic component – in this case, Feeder. From this, $Option_Inspect_available takes the value of the parameter of the same name. The point is used as the path separator, similar to the file path whose folders and subfolders are separated by slashes.
The input of formulas is simplified by a Content Assistant. For example, if you have written =not(mc., followed by [Ctrl] + [Space bar], possible additions are shown in a dialog. In many cases, values can be adopted from this dialog by selecting them, which simplifies manual input.
For the axes, this has to be done for the position sensors Position_2, Position_3, and Position_4.
- Open the Axis Functionunit.
- In the editor, click the Position_2 component.
- In the Disabled field, enter the formula =not(mc.$Sensor_2_available).
- Repeat the previous steps for Position_3 with the formula =not(mc.$Sensor_3_available) and for Position_4 with =not(mc.$Sensor_4_available).
In the formula, mc (mechatronic component) references the superordinate component of the sensor, i.e., Axis. If after the point there were another mc, it would take you to a next higher level in the machine model for the Move Functiongroup, which uses Axis as the only component.
In the subformula $Sensor_2_available, the dollar sign represents the parameter, followed by the parameter name, that is, the axis parameter Sensor_2_available. This subformula must be negated with the not function not() in order to obtain the correct value. The formula language is described in the section Formulas.
A disabler is also set up for the installed component Valve_2 of the component Cylinder.
- Open the Cylinder function unit.
- In the editor, click the Valve_2 component.
- Enter the following formula in the Disabled field: