SETPB, SETPI, SETPR – Blocks for remote parameter setting
Block SymbolsLicensing group: STANDARD
Function Description
The SETPR, SETPI, SETPB blocks are used for setting the parameters of other blocks in the
model remotely. The only difference among the three blocks is the type of parameter which
they are setting. The SETPR block is used for setting real parameters, the SETPI block for
integer parameters and the SETPB block for Boolean parameters. To comply with the naming
convention for variables 1.3, the inputs and outputs of individual blocks are named according
to the type of the set parameter:
- p, y – real input and output of the SETPR block,
- ip, k – integer input and output of the SETPI block,
- P, Y – Boolean input and output for the SETPB block.
The blocks operate in two modes, which are switched by the SETF parameter. For the remote parameter sc is set to the value of the input signal p (or ip, P) at the start and every time when the input changes. If the SETF parameter is set to on, then the blocks work in one-shot write mode. In that case the remote parameter is set only when rising edge (offon) occurs at the SET input. Successful modification of the remote parameter is indicated by zero error output and the output y (or k, Y) is set to the value of the modified parameter. The error output is set to in case of write error.
The name of the remote parameter is determined by the string parameter sc (string connection), which has the form <block_path:parameter_name>. It is also possible to access individual items of array-type parameters (e.g. the tout parameter of the ATMT block). This can be achieved using the square brackets and item number, e.g. .ATMT:touts[2]. The items are numbered from zero, thus the string connection stated above refers to the third element of the array.
The path to the block whose parameter should be set can contain hierarchic levels separated by dots followed by the block name. The path can be either relative or absolute:
- Relative:
- Starts with a ’.’ character, indicating the level where the SETPR block (or SETPI, SETPB) is placed. Examples: ".GAIN:k", ".Motor1.Position:ycn".
- Starts with ’..’ characters, indicating a level above the SETPR block (or SETPI, SETPB). Examples: "..GAIN:k", "..Motor1.Position:ycn".
- Relative to Task: Starts at the root level of the task where the SETPR block (or SETPI, SETPB) is located. The string has to be prefixed with ’%’ in this case. Examples: "%GAIN:k", "%Motor1.Position:ycn".
- Absolute: A complete sequence of hierarchic levels down to the block. For referring to blocks located in the driver task (see the IOTASK block for details on configuration) the ’&’ followed by the driver’s name is used at the beginning of the absolute path. Examples: "task1.inputs.lin1:u2", "&EfaDrv.measurements.DER1:n".
The order and names of individual hierarchic levels are presented in a tree-like structure within the Diagnostics section of the REXYGEN Studio program.
Warning: If the remote parameter is in a task other than the SETPx block, block execution is delayed until the remote task is completed. It is necessary to avoid the so-called race conditions and guarantee the correct value setting. Therefore, it is recommended to include the SETPx block in a slower task (longer period/execution time) and set parameter in a faster task (shorter period/execution time). In the opposite situation (e.g. the SETPx block in a faster task), the GETPx block should be used in a slower task.
Note 1: When using multiple SETPx blocks, it is not guaranteed that all data will be written to the remote task in the same tick. It is only guaranteed that the previous block will set a value in the same or previous period as the next block. The execution order can be seen in the REXYGEN Studio program diagnostics. To send multiple values in the same period, it is needed to use the Inport and Outport blocks or the SETPA block.
Note 2: The SETPX and OUTCONN blocks can also be used for writing the value remotely.
This block propagates the signal quality. More information can be found in the 1.4 section.
Input
p | Desired parameter value | Double (F64) |
SET | Input for initiating one-shot parameter write | Bool |
Parameter
sc | String connection to the parameter | String |
SETF | Set parameter only when forced to | Bool |
|
|
|
Output
y | Parameter value | Double (F64) |
E | Error indicator | Bool |
|
|
|
[Previous] [Back to top] [Up] [Next]
2024 © REX Controls s.r.o., www.rexygen.com