SGSLP – Set, get, save and load parameters

Block SymbolLicensing group: ADVANCED
Qt SVG Document Exported by REXYGEN Studio u0 u1 u2 u3 u4 u5 u6 u7 u8 u9 u10 u11 u12 u13 u14 u15 ips SET GET SAVE LOAD y0 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 E iE SGSLP

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 ips = 0. 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 sci string means that no parameter is specified, otherwise one of the following syntaxes is used:

  1. <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.
  2. <block>:<param><sep><block>:<param> – This syntax allows the parameters to differ among the parameter sets. In general, each sci 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 ips = 2. There should be exactly nps items in each non-empty sci 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 sci 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 sci 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, broot = . and sc0 = CNR:ycn 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 (off on) 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 ui. In case the parameter is successfully set, the same value is also sent to the yi output.
GET – Gets the parameters of the corresponding parameter set ips. In case the parameter is successfully read, its value is sent to the yi 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 0 ips0 nps 1. 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 sci, i = 0,,m, where m < 16 defines the nonempty scm 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 sci 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 sci parameters syntax without modifying the file.

Consider using the SILO block if working with only a few values.

This block does not propagate the signal quality. More information can be found in the 1.4 section.

Input

u0..u15

Analog input of the block

Double (F64)

ips

Parameter set index

Long (I32)

SET

Set parameters

Bool

GET

Get parameters

Bool

SAVE

Save parameters

Bool

LOAD

Load parameters

Bool

Parameter

nps

Number of parameter sets   1  16 1

Long (I32)

ips0

Initial parameter set index   -1  15

Long (I32)

iprec

Precision of parameters (number of digits)   2  15 12

Long (I32)

icolw

Column width in status file   0  22

Long (I32)

fname

Name of persistent storage file  status

String

broot

Root block in hierarchy  .

String

sc0..sc15

List of connected parameters

String

Output

y0..y15

Analog output of the block

Double (F64)

E

Error indicator

Bool

off ..

No error

on ...

An error occurred

iE

Error or warning code

Long (I32)

0 ....

Operation successful

1 ....

Fatal error of the Matlab system

2 ....

LOAD operation error

3 ....

SAVE operation error

4 ....

Incorrect file format

5 ....

The ips parameter set not found

6 ....

Parameter not found, name mismatch

7 ....

Unexpected end of file

8 ....

Error writing to file (disk full?)

9 ....

Parameter syntax error

10 ...

Only whitespace in the parameter name

11 ...

Error creating the backup file

12 ...

GET operation error

13 ...

SET operation error

14 ...

Timeout

15 ...

The specified parameter is read-only

16 ...

The ips parameter is out of range

2024 © REX Controls s.r.o., www.rexygen.com