Available Actions

This page gives an overview of the available actions. Plug-ins with the "control" capability (see Required Specifications) may create a new action using the API function MV_Action_Init(). Depending on the type of action, they may also set any number of its parameters using MV_Action_SetParameter() (for scalar-valued parameters) or MV_Action_Tuple_SetParameter() (for tuple-valued parameters), and enqueue the action to MERLIC using MV_QueueAction(). Upon enqueuing an action, MERLIC will assign an unsigned 32-bit integer number to the action as a unique action ID MV_PARAM_ACTION_ID. This action ID is subsequently associated to each event which is a direct result of the action. Plug-ins may retrieve this action ID by using the API function MV_Event_GetParameter() with the key MV_PARAM_ACTION_ID on incoming events.

For more detailed information about the actions and their respective parameters refer to the reference documentation of mv_action.h.

In addition to the action-specific parameters that are listed in the following subsections, each action carries the following parameter:

Parameter
MV_PARAM_ACTION_USER_ID: any scalar value type

This parameter can be set optionally to provide a plug-in-defined scalar MVValue_t of arbitrary type to an action. This action user ID will then be associated to each event that is caused by that particular action. Thus, it serves a similar purpose to the unique action ID which is given to each action upon enqueuing it. However, it is not assigned by MERLIC but can be chosen by the plug-in. Plug-ins may use the function MV_Event_GetParameter() with the key MV_PARAM_ACTION_USER_ID key to retrieve the action user ID on incoming events.

Use cases for action user IDs include the possibility of using it to convey plug-in-specific information such as an communication protocol handle, or to facilitate data exchange between compatible plug-ins.

SelectMode

This action triggers MERLIC to change from the "Pre-operational" state into the operational mode of the selected mode, e.g., "Operational". Currently, the automatic mode is the only mode which can be selected by plug-ins. The "OperationalFrontendAccessMode" may only be selected by MERLIC itself. Note that MERLIC triggers the selection of the automatic mode on startup.

Parameter
MV_PARAM_MODE_TYPE: UInt32

The parameter indicates which mode is to be selected in form of a numeric value of enum MVModeType_t, e.g., eMVMode_Automatic.

See also the reference documentation of mv_state_machine_def.h.

PrepareRecipe

This action triggers a recipe change. It loads the recipe with the specified ID and the MERLIC Vision App that is referenced in the recipe. PrepareRecipe is called automatically when MERLIC RTE is started and can be called in either the "Initialized" or "Ready" state. In the latter, it will trigger the unpreparation of the previously prepared recipe.

While the recipe is being prepared, the system will change into the "Initialized" state and return to "Ready" once it concluded at which point a RecipePrepared event is emitted.

Parameter
MV_PARAM_RECIPE_ID: String
The parameter represents the recipe ID of the recipe that is to be prepared. While the IDs of MERLIC recipes are numeric, this parameter references their string representations, e.g. "0", "1".

UnprepareRecipe

This action may only be called while MERLIC is in the "Ready" state. It causes MERLIC to unload the MERLIC Vision App that is referenced in the currently prepared recipe and to return to the "Initialized" state. A RecipeUnprepared event is emitted as soon as the unloading starts and the recipe becomes unavailable to execution.

Parameter
MV_PARAM_RECIPE_ID: String

The parameter represents the recipe ID of the recipe that is to be unprepared.

The parameter is optional: If no recipe ID is specified, the currently prepared recipe is unprepared. If a recipe ID is specified, it must match the ID of the latest prepared recipe.

While the IDs of MERLIC recipes are numeric, this parameter references their string representations, e.g. "0", "1".

StartSingleJob

This action is called to trigger a single execution of the MERLIC Vision App that is referenced in the currently prepared recipe. It may only be called in the "Ready" state. MERLIC will change to the state "SingleExecution" and emit a JobStarted event as the execution commences. Upon the execution's completion, the system returns to the "Ready" state and emits a Ready event unless preempted by way of Halt or Reset actions during the ongoing execution.

Parameter
MV_PARAM_RECIPE_ID: String

The parameter represents the recipe ID of the recipe that is to be executed.

The parameter is optional: If no recipe ID is specified, the currently prepared recipe is executed. If a recipe ID is specified, it must match the ID of the latest prepared recipe.

While the IDs of MERLIC recipes are numeric, this parameter references their string representations, e.g. "0", "1".

MV_PARAM_START_PARAMS: MVTuple_t

The parameter represents the tuple of parameter values that are used for the single execution instead of the parameter values defined in the recipe that is to be executed.

Thus, it can be used to override the parameter values defined in the currently prepared recipe. The single execution will be executed with the set of parameter values defined in MV_PARAM_START_PARAMS and the parameter values defined in the specified recipe will be ignored. However, the recipe values will be overwritten only for the current call of StartSingleJob. For subsequent calls of StartSingleJob, the default parameter values defined in the respective recipes will be used again if no values are provided in MV_PARAM_START_PARAMS.

When specifying the parameter values in the tuple, some requirements must be fulfilled.

Correct number of tuple elements:

The number of tuple elements must correspond to the number of parameter values defined in the specified recipe. For each recipe value, a tuple element must be defined. Otherwise, the action will result in a non-fatal Error event and the parameter values in the tuple are ignored. In this case, the parameter values defined in the recipe will be used for the single execution.

For example, if the specified recipe contains three parameter values, the tuple in MV_PARAM_START_PARAMS also needs to contain three values; one for each recipe value.

Correct order of tuple elements:

The order of the values defined in the tuple must correspond to the order of the parameter values in the recipe. The value of the first tuple element overwrites the first parameter value in the recipe and so on.

Suitable data type for a lossless conversion:

The data type of each tuple element must be suitable to enable a lossless conversion of the actual value in the tuple to the data type of the respective recipe value. Either the data type of the tuple element corresponds to the one of the recipe values or the data type has a value range in which the actual value of the tuple element can be represented. Otherwise, a non-fatal Error event is emitted and the parameter values in the tuple are ignored. In this case, the parameter values defined in the recipe will be used for the single execution.

For example, if the specified recipe file defines two parameters of data type DT_DINT and one parameter of data type DT_STRING_80, the tuple in MV_PARAM_START_PARAMS needs to contain three values. However, depending on the actual values, it is possible to use different data types. The tuple may contain three String values: ("42", "1", "OK"). In this case, the first two strings can be converted losslessly to DT_DINT values and the single execution can be performed with the values defined in the tuple. The data types of the tuple elements do not have to be identical to the data types of the recipe values but the conversion needs to be lossless. If the tuple contains the three String values ("Data", "1", "OK"), the conversion of the first String value to a DT_DINT value is lossy. In this case, a non-fatal Error event is emitted and the single execution is performed with the parameter values defined in the recipe instead.

MV_PARAM_MEAS_ID: String

This parameter can be used to define a measurement ID for the inspection that is performed in the execution.

This parameter is optional: If no measurement ID is specified, the respective value in the JobStarted and ResultReady events will not be set.

MV_PARAM_PART_ID: String

This parameter can be used to define the part ID for the part that is to be inspected. When multiple inspections are carried out for the same part, they share the same part ID but they have different associated measurement IDs.

This parameter is optional: If no part ID is specified, the respective value in the JobStarted and ResultReady events will not be set.

StartContinuous

This action is called to trigger the continuous execution of the MERLIC Vision App that is referenced in the currently prepared recipe. It may only be called in the "Ready" state. MERLIC will change to the "ContinuousExecutionState" state and emit a JobStarted event as the execution commences. The continuous execution is a series of single executions with the difference that the "Ready" signal is set to "0" permanently until the execution is stopped.

This action has the same parameter as StartSingleJob. Please see the documentation of StartSingleJob for a description of the parameters.

Halt

This action can be called in any of the sub-states of "Operational" or in the state "Preoperational" to facilitate the transition of MERLIC to the "Halted" state. It can also be called if MERLIC is already in the "Halted" state because self-transitions are allowed for the "Halted" state.

Note that the system may not change immediately to the "Halted" state but unprepare the currently prepared recipe during which time it will intermediately change to the "Initialized" state. If an execution is in progress while Halt is called, it will finish as usual but the system will change to "Initialized" without intermediately going to "Ready" and no Ready event will be emitted. However, the corresponding ResultReady event will be.

Reset

This action behaves similarly to Halt with the distinction that MERLIC will ultimately end up in the "Preoperational" state. It can be called in any of the sub-states of "Operational", in the "Halted" state, and even in "Preoperational" because self-transitions are allowed for the "Preoperational" state.

Stop

This action is called to stop the execution of the MERLIC Vision App and may thus only be called in the state "SingleExecution". Currently, calling Stop will not stop the execution any sooner than it would by simply waiting for the single execution to finish. However, once the execution concludes, the resulting Ready and StateChanged events will reference the ID of the Stop action as their cause.

Abort

This action is currently synonymous with Stop.