Skip to main content
FW version: Stable

Variables

Variable class

The variables are maintained by the system in a specific manner:

Variable classSystem handlingCreation methodUse case
StateValue is lost at every device reset/shutdown.In compile timeTime dependent variable, describes internal state of process, cannot be changed by user.
ParameterValue is saved manually with the save command and loaded at every device boot.In compile timeTime independent constatnt, parametrizes internal process, can be set by user.
PermanentValue is autsaved/restored at every device shutdown/botup.In compile timeUsually a service reading, mileage counting, etc.
DynamicValue and variable is lost at every device reset.In run-time by command varScripting and custom functionality.

State variables

A process state variable represents either an input, internal state or output of a dynamic system. State variable typically changes with time, as the process propagates. User may not modify a state variable during standard operation. State variables are volatile and do not hold their values after reset. State variables are not automatically saved to storage or loaded from it. A state variable can be displayed, logged or plotted. State variable has a type, dimension and metadata. State variables are similar to the SDOs in the CANOpen protocol. Example of state variables: actual phase current / voltage, motor RPM, actual battery current / voltage, duty cycle ...

Parametric variables

A parametric variable represents a time invariant constant, which is typically adjusted by the user and not by the process itself. Such variables typically do not change with time, as the process propagates. A user may modify a parametric variable during standard operation. Parametric variables have a type, dimension, preset values (such as default, minimum, maximum and step) as their metadata. Parametric variables are similar to the PDOs in the CANOpen protocol. If the volatile flag is set for a parametric variable, it is not saved / loaded along the other variables. Parametric variables are volatile, unless saved to storage or loaded from it. Parametric variables saved in main storage are loaded automatically during boot-up sequence. Load from main storage and save to it is done by commands load and save (without parameters). Load from backup storage and save to it is done by same commands with parameter -b. Restore to release preset values is done by command restore. Operations with parametric variables are shown in the figure below. Examples: peak / reference phase current / voltage, peak motor RPM, motor odometer threshold, peak / reference battery current / voltage, maximum duty cycle ...

Permanent variables

Permanent variable is similar to a state variable, but is treated differently by the system. Permanent Variables are persistent, not volatile, they are automatically saved to storage during power-off and loaded during boot sequence. Permanent Variable has a type, dimension and metadata. Examples: total time since factory release, total motor-hours, total energy passed through the controller, maximum ever temperature, maximum ever current, maximum ever RPM ...

Dynamic variables

A symbolic variables that were created dynamically by the user during run-time. User may create variables in his own scripts for arbitrary usage. The dynamic variables exist only in run-time and they are volatile. After the device reset, they need to be created again, if needed. By default, dynamic variables are allocated in the /vars directory. Content of dynamic variables can be stored and loaded to/from a non-volatile memory, into the user storage in similar way as parametric variable.

Variable type

The YOS system supports the following variable types:

Variable typeRangeDescription
int8-128 to 1278-bit signed integer
uint80 to 2558-bit unsigned integer
int16-32768 to 3276716-bit signed integer
uint160 to 6553516-bit unsigned integer
int32-2147483648 to 214748364732-bit signed integer
uint320 to 429496729532-bit unsigned integer
float-3.4E+38 to 3.4E+3832-bit floating-point number

Built-in variables

Dynamic variables

The system creates several default variables that can be used e.g. for scripting:

  • retval return value of function. Generaly, 0 or positive number means that function ended without error, negative number means that function ended with error.
  • debuglevel value of this variable sets amount of debug messages printed to standard output. Value 0 means that all debug messages are printed, number 255 means that no debug messages are printed. Values 1 - 254 are reserved for application-dependent debug settings.
  • ticks this dynamic variable is used for time measurement. It is incremented by 1 each milisecond. It can be treaten as any other dynamic variable. Its value can be read or set to certain value.

Permanents

This is a list of permanents, registered by YOS in the device.

  • time [s] Number of seconds of current device run. (From power up)
  • totaltime [s] Summary time of all device runs. (From the first power-up)
  • ttl [s] Time To Live. (0 = No limitation) Life span of device can be limited. (For example, when the device is lend for evaluation)
  • run [cycles] Amount of power cycles of the device. Incremented on each device startup. (only if device is powered)