Parameterization of a module instance
Given is an instance of a TcCOM, in which tabs can parameters be found?
You can view and change parameters in Parameter (Init), Parameter (Online) and around Block Diagram. In Data Area you can see the created DataAreas and their contents (parameter name and data type), but you cannot manually change any values here via the XAE.
See also Best practice: access to TcCOM data for ways to access data on a TcCOM.
Default, Startup, Online and Prepared values
Parameters can have different states/properties. These are defined below:
- Default values are the parameter values during code generation (as they were set in Simulink®). They are stored unchangeably in the module description file (*.tmc), i.e. the description of the module class.
- Startup values are stored in the TwinCAT project file and written to the module instance. The startup values are located accordingly on the target system and define the values at the start of the module instance.
- Online values are only available if the TcCOM instance was started on the target system. They show the current parameter value in the running module. This value can also be changed during runtime.
- Prepared values can be specified whenever online values are available. With its help, several parameter values can be changed and written to the module at the same time.
Parameterization of a module instance
Example setting in TC TcCom Interface
To explain the parameterization of a module instance, a module with the following properties is assumed.
Properties of the TcCOM based on these settings:
- The structure of the model parameters <ModelName>_P is created as module parameters, because Parameters: Initial Values is enabled. As DataArea the model parameters are accessible if Code Interface packaging is not set to Reusable function.
NOTICE
- BlockIO is created as a standard DataArea and is therefore visible in the process image of the TcCOM and can be linked via DataPointer.
- Create ExecutionInfo output is enabled, accordingly there is another DataArea of type Output Source with the execution information of the instance.
- Create ADS Symbols is enabled on all DataAreas, so all parameters in the DataAreas are accessible by ADS symbol name.
- Module parameters are created for the inputs of the model, because Input: Initial Values is enabled.
For a description of the setting options, see Configuration of data access to data of a TcCOM object.
Possible parameter settings in Parameter (Init)
Module parameters can be found in Parameter (Init), which do not change cyclically but can be changed acyclically. No online values can be seen in Config mode, or when the TcCOM is not started.
Define Startup Values
Startup Values can be set in the Parameter (Init) representation or in the Block Diagram representation (see in the following chapter). To do this, select the entry in the Value column that you want to adjust on the module instance and enter a value. The value set in this way is only available in the project file in the XAE at this time. Activate Configuration loads the set value (with the overall project) to the target system.
Settings such as the ModuleCaller, StepSizeAdaption or ExecutionSequence cannot be changed at runtime of the module, but they can only be defined as startup values. Other module parameters such as Execute or the model parameters can also be changed online.
Change values online
If the TcCOM module is active, you can use Show Online Values to make the current values of the instance visible. You can enter a new value in the Value column, making it a Prepared Value. If the Prepared Value is not yet loaded on the target system, the field with deviation between Value and Online appears with red marking. Once all changes have been made, you can right-click at the structure level and use "Download" to set the prepared values in the target system. Note that this does not change the startup value of the instance on the target system. To do this, you must first activate the current configuration on the target system. Likewise, you can use "Upload" to set the current Online Values as Startup Values in the project. Again, the change is not active on the runtime system until the project is compiled and downloaded, see Best practice: access to TcCOM data.
Possible parameter settings in Block Diagram
All parameters in the parameter range (right side of the window) are only displayed in the TwinCAT 3 block diagram if you are in the top level of the block diagram ("<root>"). If you are in a subsystem or if you have selected a block, only the parameters of the active block are displayed.
In the block diagram you have the possibility to read and write online values as well as to change Startup Values.
Select a block with a yellow dot in the lower left corner. If you click directly on the yellow dot, a context menu opens in which you can see the online values of the block and also change them. If you change a value, it will be entered in the Prepared list. When you have made all the changes, you can write the prepared values to the target system. You can select in the Prepared list whether you want to set the prepared values as Online and/or Startup values.
You can also go over the parameter list in the right area of the block diagram and change values here. Find the parameter you want to change and click the down arrow on the right side of the list. Here you can make changes in the editable fields. If you move the mouse pointer over the parameter name (TempCtrl_P.Kp in the following diagram), the ADS address information is displayed. By right-clicking on the parameter name, you can copy the parameter's ADS address information to the clipboard.
You can also change entire structures. Select the <ModelName>_P structure, for example, i.e. the structure that contains all model parameters, and select the downward pointing arrow here. A context menu appears by right-clicking on Startup Values, for example. Here you can set all current online values of the structure as Startup Values, or you can reset the startup list to the default values.
Interaction with DataAreas
You cannot change DataAreas via the XAE. You can only see the DataArea type (see Type column) and deduce which interaction options are possible with the DataArea, see Configuration of data access to data of a TcCOM object.
Via the CS column you can see whether ADS symbol names are to be generated for this DataArea. CS is editable by the user. If CS is enabled, you can use the Target Browser, for example, to search for the ADS symbols and include them in a scope configuration. If CS is disabled, you can only access the DataArea data via Index Group and Index Offset. Index Group is the Object ID of the instance (see Object tab) and Index Offset is displayed in the CD / Elements column.
For more information on interacting with DataAreas, see Configuration of data access to data of a TcCOM object and Best practice: access to TcCOM data.