Skip to content

Latest commit

 

History

History

README.md

AXOpen.Inspectors

AXOpen.Inspectors provides mechanism of inspection of different types of data. The input value is compared to required value. If input value is the same as required value for a stabilization time period, the inspection will succeed. If values are different, timeout will occur and inspection will fail.

Inspectors can integrate with coordination primitives like AxoSequencer. In consequence, inspectors offer extended capabilities in decision flow for failed checks.

Each inspector contains:

  1. Inspect method, which input is current parent and inspection variable

  2. OnFail method, which provides methods for making a decision after a failed inspection (see Handling failure section)

  3. UpdateComprehensiveResult method, which input is object of type AxoComprehesiveResult, which can be used to gather results of all inspections.

  4. Common data about inspection inputs and result. See below.

Simple example inspection

  1. Declare variables

[!code-smalltalk]

  1. Set initial inspection pass and fail timers

[!code-smalltalk]

  1. Run inspections

[!code-smalltalk]

  1. Check each inspector's data for results

Note

Inspectors use AxOpen.Timers for counting time during inspections. Make sure, that PLC cycle time value in configuration.st is set accordingly to Pass and Fail timers (it should be in tens or hundreds milliseconds, the value shouldn't higher than lowest difference between pass and fail timers). If there are small differences (in ms) between pass and fail times and PLC cycle time is higher number (e.g. 1000 ms), unexpected behavior may occur and inspections can fail (even if they should pass).

Example inspection with Coordinator

Example of inspection within a sequencer in PLC:

[!code-smalltalk]

  1. A _presenceInspector is created instance of AxoDigitalInspector
  2. A coordinator is passed to this inspector with WithCoordinator(THIS) method, in this case it is a sequencer, a parent object.
  3. Inspect methods takes parent and inspection variable, on which inspection is performing.
  4. If inspection fails, the result is updated to _comprehensiveResult object with UpdateComprehensiveResult method.
  5. If inspection fails, OnFail method provides CarryOn method, which tells the coordinator to continue in execution.

Common inspector data

Inspectors contain common data, which are used to store data about inspection. Each inspector contain following data:

[!code-smalltalk]

[!INCLUDE AxoDigitalInspector]

[!INCLUDE AxoAnalogueInspector]

[!INCLUDE AxoDataInspector]

Handling failure

When an inspector fails, OnFail() provides a series of methods for making decisions about the process. In order for this is feature to work the inspector needs to be aware of the coordinator of IAxoCoordinator. The coordinator must be passed to the inspector by WithCoordinator(coordinator) method.

Syntax Description
Dialog(inRetryStep, inTerminateStep) Opens dialog for the user to take a decision. Parameter inRetryStep represent state from which the inspection should start again. Parameter inTerminateStep represent terminate state of coordinator.
Retry(inRetryStep) Retries the inspector. Retry state parameter tells from which state the inspection should start again.
Override() Marks the inspection as failed but continues with the following states of the coordinator.
Terminate(inTerminateStep) Marks the inspection as failed and aborts the execution of the coordinator.

The following example specify, that when inspection fails, dialog is shown and is requesting user decision.

[!code-smalltalk]

Inspection failure

Over-inspection

When RetryAttemptsCount is same as NumberOfAllowedRetries, no more inspection are allowed, as data are overinspected.

Overinspected

Preserving overall result

Overall result of a series of inspections can be preserved in AxoComprehensiveResult. Each inspector has UpdateComprehensiveResult method that provides the update function. Once the UpdateComprehensiveResult marks the overall result as Failed, successive inspection will not overwrite the result.

[!code-smalltalk]