Result Format

The results with a numerical data type are returned as a tuple. The number and type of the elements in the tuple correspond to the MVApp results output as produced by the execution of the MERLIC Vision App referenced in the recipe. The resulting tuple elements contain single (scalar) result values. The results themselves are sorted with respect to their data types.

The following table shows the order in which results are returned by the process integration mode of MERLIC, i.e., MERLIC RTE. Additionally, the corresponding Communicator data types are shown:

MERLIC RTE Communicator
BOOL Bool
BYTE UInt8
WORD UInt16
DWORD UInt32
LWORD UInt64
SINT Int8
USINT UInt8
INT Int16
UINT UInt16
DINT Int32
UDINT UInt32
LINT Int64
ULINT UInt64
REAL Float
LREAL Double
TIME UInt32
TIME_OF_DAY UInt32
LTIME UInt64
DATE UInt32
DATE_AND_TIME UInt32
STRING_80 String

MERLIC RTE also returns image results, i.e., images that have been specified as an "MVApp result" in the MERLIC Creator. However, they are returned separately from the results of other data types. See the topic Getting Image Results for more information.

Example

The MVApp returns the following MVApp results:

Result MERLIC RTE data type Communicator data type
true BOOL BOOL
11 LINT Int64
8 LINT Int64
2020 LINT Int64
3141 REAL Float

When using MERLIC RTE with your plug-ins, the results are sent to your plug-ins via the ResultReady event as a tuple.

Unpacking the Contents of the Results

The following code snippet demonstrates how to use the API functions in mv_value.h and mv_tuple.h to unpack the result contents such that the "assert`s" hold:

MVTuple_t result;
MVValue_t value;
bool a_bool;
int64_t an_int;
float a_float;
MV_Event_Tuple_GetParameter(event, MV_PARAM_RESULT_CONTENT, &result);
assert(MV_Tuple_GetSize(result) == 5);
MV_Tuple_Get(result, 0, &value);
assert(MV_Value_GetType(value) == eMVValueType_Scalar);
assert(MV_Value_GetDataType(value) == eMVDataType_Bool);
MV_Value_Scalar_GetBool(value, &a_bool);
MV_Value_Clear(&value);
assert(a_bool == true);
MV_Tuple_Get(result, 2, &value);
assert(MV_Value_GetType(value) == eMVValueType_Scalar);
assert(MV_Value_GetDataType(value) == eMVDataType_Int64);
MV_Value_Scalar_GetInt64(value, &an_int);
MV_Value_Clear(&value);
assert(an_int == 8);
MV_Tuple_Get(result, 4, &value);
assert(MV_Value_GetType(value) == eMVValueType_Scalar);
assert(MV_Value_GetDataType(value) == eMVDataType_Float);
MV_Value_Scalar_GetFloat(value, &a_float);
MV_Value_Clear(&value);
assert(abs(a_float - 3.141) < 1e-7);