In connection with mappMotion the possibility to change settings related to configurations and parameterizations via functionblocks MC_BR_ProcessConfig and MC_BR_ProcessParam has been introduced.
This guide will address the usage of MC_BR_ProcessConfig with the focus on how to use the FB for configurations with unbounded arrays. There some additional points are required to be considered.
Unbounded arrays can be found widely spread in configurations like assembly features, axesgroup features but also in axis features. Unlike bounded arrays, unbounded arrays in the configuration settings have a variable number of elements within a configuration feature. This is the reason why general IEC data type “McCfgUnboundedArrayType” was added. With this data type, the number of array elements and the memory location of a user-defined array must be specified. This can be done via a task.
Useful AS help sections
-
Motion control → mappMotion → Programming → Application program → Libraries → Core → McBase → Function blocks → MC_BR_ProcessConfig
-
Motion control → mappMotion → Configuration → Changing settings at runtime
-
Motion control → mappMotion → Configuration → Basic components
-
Motion control → mappMotion → Configuration → Hardware
Step by step instruction for configurations using unbounded arrays
Create simple project
First, a simple AS project must be created. When doing so, make sure to define a mappMotion version inside the “Change runtime versions…” window. For using MC_BR_Processconfig for the axis feature “Alternative value source”, which is used for the below example, make sure to use mappMotion 5.16.0 or higher. Motion libraries McBase and McAxis are required.
Second, go to the PhysicalView of AS and add an ACOPOS drive (e.g. 8V1016.50-2), it is not required to insert any encoder interface or motor.
As a third step, e.g. the axis feature “Alternative value source” must be added.
There also the initial configuration of this axis feature can be made.
As a last step for a simple sample project, before inserting a task, the axis feature must be linked to the ACOPOS drive inside the PhysicalView.
Add task with MC_BR_ProcessConfig instance
Here it gets described, how a simple task with an MC_BR_ProcessConfig instance must look like in order to be able to execute the FB MC_BR_ProcessConfig (load / save config) in connection with an axis feature using an unbounded array.
At this point check also the AS help section:
- Motion control → mappMotion → Configuration → Basic components → Axis feature → Alternative value source → Change settings at runtime
PROGRAM _INIT
//MC_BR_ProcessConfig_0 Init
MC_BR_ProcessConfig_0.Name := ‘AlternativeValueSourceFeature’;
MC_BR_ProcessConfig_0.DataType := mcCFG_AX_FEAT_ALT_VAL_SRC;
MC_BR_ProcessConfig_0.DataAddress := ADR(DataVar);
//Init of address of the unbounded array and number of unbounded array elements
DataVar.ValueSource.DataAddress := ADR(Data);
DataVar.ValueSource.NumberOfArrayElements := 8;
END_PROGRAM
PROGRAM _CYCLIC
//Call FB
MC_BR_ProcessConfig_0();
END_PROGRAM
PROGRAM _EXIT
END_PROGRAM
VAR
MC_BR_ProcessConfig_0 : MC_BR_ProcessConfig;
Data : ARRAY[0…7] OF McAFAVSValSrcType;
DataVar : McCfgAxFeatAltValSrcType;
END_VAR
NOTE:
Most suitable in the upper example is to declare Data as an array of the necessary type (in the case above as McAFAVSValSrcType[0…7]), since then more elements of the unbounded array can be addressed for loading/saving.
For DataVar.ValueSource.NumberOfArrayElements the max. desired number of configured elements within the configuration feature (e.g. AlternativeValueSource) inside the ConfigurationView has to be set. DataVar.ValueSource.NumberOfElements will be of importance for executing the FB.
Quick check of the functionality via watch
Here it is described how the configuration in connection with unbounded arrays can be loaded from the configuration into the PV and vice versa. This is done via the watch window of AS and can be seen as a check of the functionality.
MC_BR_ProcessConfig.Execute with Mode mcPCM_LOAD:
Before setting MC_BR_ProcessConfig.Execute = TRUE it must be defined, how many elements of the unbounded array from the configuration are desired to be loaded. This is done by setting a value for DataVar.ValueSource.NumberOfElements. In the check below, the value 2 is assigned. This leads to the fact, that 2 array elements (e.g. from the axis feature “Alternative value source” Value source 1 and Value source 2) are loaded. The read values can be found in the PV Data and its child elements.
MC_BR_ProcessConfig.Execute with Mode mcPCM_SAVE:
Before setting MC_BR_ProcessConfig.Execute = TRUE it must be defined, how many elements of the array from the PV Data configuration are desired to be saved to the configuration. This is done by setting a value for DataVar.ValueSource.NumberOfElements. In the check below, the value 3 is assigned. This leads to the fact, that 3 array elements (e.g. from the axis feature “Alternative value source” Value source 1, Value source 2 and Value source 3) are saved.
Additionally, the desired configuration values can be defined via the PV Data and its child elements. In the shown check below, a third configuration element is added.