Parameterization of a module instance
Parameter representation in XAE
The block diagram in the Browser Parameters tab:
In general, TcCOM modules can be parameterized via the parameter list under the Parameter (Init) tab in the TwinCAT 3 development environment (XAE). Simulink modules can also be parameterized via the block diagram, if block diagram export is enabled in the Simulink coder settings under Tc Advanced.
Module- and model-specific parameters
The parameter list contains module- and model-specific parameters. Examples of module-specific parameters are "Call Parameter" or "External Mode Parameter". In the block diagram these parameters are only shown in the parameter section (on the right-hand side of the window) if the top level of the block diagram ("<root>“) is selected.
Model-specific parameters are defined as "tunable" parameters in the Simulink blocks. The parameter list displays them as a structure.
In the block diagram these model parameters are assigned to a block or indeed several blocks. The values can be adjusted when the corresponding block is selected. The parameter values (startup, prepared or online) can then be adjusted in the drop-down menu of the property table or in the parameter window directly in the block diagram:
Hover with the mouse over the name of the drop-down menu (in this case ModelParameters.Kp) to show its ADS information as a tooltip. Right-click on the name to copy the ADS symbol information to the clipboard.
Access to the model-specific parameters is only possible, if
- the Simulink optimization option Inline parameters is disabled, or workspace variables were selected as model parameters in the advanced options under Inline parameters
- ADS access to parameters is enabled under Tc interfaces (Data exchange (Tc Interfaces)).
"Default", "Startup", "Online" and "Prepared"
The following value types can be found in the drop-down menu of the Property table of the block diagram:
- Default values are the parameter values during code generation. They are invariably stored in the module description file and enable the manufacturing settings to be restored after parameter changes.
- Startup values are stored in the TwinCAT project file and downloaded to the module instance as soon as TwinCAT starts the module instance.
Startup values for the input process image can also be specified in Simulink® modules. This allows the module to be started with non-zero input values, without the need for linking the inputs with other process images. Internal signals and output signals have no starting values, since they would, in any case, be overwritten in the first cycle. - Online values are only available if the module was started on the target system. They show the current parameter value in the running module. This value can also be changed during runtime. Although in this case the corresponding input field has to be enabled via the context menu, in order to prevent accidental inputs.
- Prepared values can be specified whenever online values are available. They can be used to save various values, in order to write them consistently to the module. If prepared values have been specified, they are displayed in a table below the block diagram. The buttons to the right of the list can be used to download prepared values as online values and/or save them as starting value, or delete them.