SGSLP – Set, get, save and load parameters
Block SymbolLicensing group: ADVANCED
Function Description
The SGSLP block is a special function block for manipulation with parameters of other function
blocks in the REXYGEN system configuration. It works also in the Matlab-Simulink system
but its scope is limited to the .mdl file it is included in.
The block can manage up to 16 parameter sets, which are numbered from 0 to 15. The number of parameter sets is given by the nps parameter and the active set is defined by the ips input. If the ips input remains unconnected, the active parameter set is . Each set contains up to 16 different parameters defined by the string parameters sc0 to sc15. Thus the SGSLP block can work with a maximum of 256 parameters of the REXYGEN system. An empty sc string means that no parameter is specified, otherwise one of the following syntaxes is used:
- <block>:<param> – Specifies one function block named block and its parameter param. The same block and parameter are used for all nps parameter sets in this case.
- <block>:<param><sep>…<block>:<param> – This syntax allows the parameters to differ among the parameter sets. In general, each sc string can contain up to 16 items in the form <blok>:<param> separated by comma or semi-colon. E.g. the third item of these is active for . There should be exactly nps items in each non-empty sc string. If there is less items than nps none of the below described operations can be executed on the incomplete parameter set.
It is recommended not to use both syntaxes in one SGSLP block, all 16 sc strings should have the same form. The first syntax is for example used when producing nps types of goods, where many parameters must be changed for each type of production. The second syntax is usually used for saving user-defined parameters to disk (see the SAVE operation below). In that case it is desirable to arrange automated switching of the ips input (e.g. using the ATMT block from the LOGIC library).
The broot parameter is suitable when all blocks whose parameters are to be controlled by the SGSLP block reside in the same subsystem or deeper in the hierarchy. It is inserted in front of each <block> substring in the sc parameters. The ’.’ character stands for the subsystem where the SGSLP block is located. No quotation marks are used to define the parameter, they are used here solely to highlight a single character. If the broot parameter is an empty string, all <block> items must contain full path. For example, to create a connection to the CNR block and its parameter ycn located in the same subsystem as the SGSLP block, and must be set. Or it is possible to leave the broot parameter empty and put the ’.’ character to the sc0 string. See the GETPR or SETPR blocks description for more details about full paths in the REXYGEN system.
The SGSLP block executes one of the below described operations when a rising edge (offon) occurs at the input of the same name. The operations are:
- SET – Sets the parameters of the corresponding parameter set ips to the values of the input signals u. In case the parameter is successfully set, the same value is also sent to the y output.
- GET – Gets the parameters of the corresponding parameter set ips. In case the parameter is successfully read, its value is sent to the y output.
- SAVE – Saves the parameters of the corresponding parameter set ips to a file on the target platform. The parameters of the procedure and the format of the resulting file are described below.
- LOAD – Loads the parameters of the corresponding parameter set ips from a file on the target platform. This operation is executed also during the initialization of the block but only when . The parameters of the procedure and the format of the file are described below.
The LOAD and SAVE operations work with a file on the target platform. The name of the file is given by the fname parameter and the following rules:
- If no extension is specified in the fname parameter, the .rxs (ReX Status file) extension is added.
- A backup file is created when overwriting the file. The file name is preserved, only the extension is modified by adding the ’ ’ character right after the ’.’ (e.g. when no extension is specified, the backup file has a . rxs extension.
- The path is relative to the folder where the archives of the REXYGEN system are stored. The file should be located on a media which is not erased by system restart (flash drive or hard drive, not RAM).
The SAVE operation stores the data in a text file. Two lines are added for each parameter sc, , where defines the nonempty sc string with the highest number. The lines have the form:
- "<block>:<param>", …, "<block>:<param>"
- <value>, …, <value>
There are nps individual items "<block>:<param>" which are separated by commas. The second line contains the same number of <value> items which contain the value of the parameter at the same position in the line above. Note that the format of the file remains the same even for sc containing only one <block>:<param> item (see the syntax no. 1 above). The "<block>:<param>" item is always listed nps-times in the file, which allows seamless switching of the sc parameters syntax without modifying the file.
Consider using the SILO block if working with only a few values.
Inputs
u | -th analog input signal, | Double (F64) |
ips | Parameter set index (numbered from zero) | Long (I32) |
SET | Set the parameters of the ips parameter set according to the values of the u inputs. The values can be found at the y outputs after a successful operation. | Bool |
GET | Get the parameters of the ips parameter set. The values can be found at the y outputs after a successful operation. | Bool |
SAVE | Save the ips parameter set to a file on the target device | Bool |
LOAD | Load the ips parameter set from a file on the target device | Bool |
Outputs
y | -th analog output signal, | Double (F64) |
E | Error flag | Bool |
|
|
|
iE | Error or warning code of the last operation | Long (I32) |
|
|
|
Parameters
nps | Number of parameter sets 1 16 1 | Long (I32) |
ips0 | Index of parameter set to load and set during the block initialization. No set is read for or -1 15 | Long (I32) |
iprec | Precision (number of digits) for storing the values of double type in a file 2 15 12 | Long (I32) |
icolw | Requested column width in the status file. Spaces are appended to the parameter value when necessary. 0 22 | Long (I32) |
fname | Name of the file the SAVE and LOAD operations work with status | String |
broot | Root block in hierarchy, inserted at the beginning of all sc parameters, see the description above . | String |
sc | Strings defining the connection of u inputs and y outputs to the parameters, , see details above | String |
[Previous] [Back to top] [Up] [Next]
2020 © REX Controls s.r.o., www.rexygen.com